-
Notifications
You must be signed in to change notification settings - Fork 51
/
sharedAccessPolicy.go
209 lines (196 loc) · 10.7 KB
/
sharedAccessPolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package iot
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages an IotHub Shared Access Policy
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/iot"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
// Location: pulumi.String("West US"),
// })
// if err != nil {
// return err
// }
// exampleIoTHub, err := iot.NewIoTHub(ctx, "exampleIoTHub", &iot.IoTHubArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// Sku: &iot.IoTHubSkuArgs{
// Name: pulumi.String("S1"),
// Capacity: pulumi.Int(1),
// },
// })
// if err != nil {
// return err
// }
// _, err = iot.NewSharedAccessPolicy(ctx, "exampleSharedAccessPolicy", &iot.SharedAccessPolicyArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// IothubName: exampleIoTHub.Name,
// RegistryRead: pulumi.Bool(true),
// RegistryWrite: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type SharedAccessPolicy struct {
pulumi.CustomResourceState
// Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
DeviceConnect pulumi.BoolPtrOutput `pulumi:"deviceConnect"`
// The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
IothubName pulumi.StringOutput `pulumi:"iothubName"`
// Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// The primary connection string of the Shared Access Policy.
PrimaryConnectionString pulumi.StringOutput `pulumi:"primaryConnectionString"`
// The primary key used to create the authentication token.
PrimaryKey pulumi.StringOutput `pulumi:"primaryKey"`
// Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
RegistryRead pulumi.BoolPtrOutput `pulumi:"registryRead"`
// Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
RegistryWrite pulumi.BoolPtrOutput `pulumi:"registryWrite"`
// The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// The secondary connection string of the Shared Access Policy.
SecondaryConnectionString pulumi.StringOutput `pulumi:"secondaryConnectionString"`
// The secondary key used to create the authentication token.
SecondaryKey pulumi.StringOutput `pulumi:"secondaryKey"`
// Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
ServiceConnect pulumi.BoolPtrOutput `pulumi:"serviceConnect"`
}
// NewSharedAccessPolicy registers a new resource with the given unique name, arguments, and options.
func NewSharedAccessPolicy(ctx *pulumi.Context,
name string, args *SharedAccessPolicyArgs, opts ...pulumi.ResourceOption) (*SharedAccessPolicy, error) {
if args == nil || args.IothubName == nil {
return nil, errors.New("missing required argument 'IothubName'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil {
args = &SharedAccessPolicyArgs{}
}
var resource SharedAccessPolicy
err := ctx.RegisterResource("azure:iot/sharedAccessPolicy:SharedAccessPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSharedAccessPolicy gets an existing SharedAccessPolicy resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetSharedAccessPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SharedAccessPolicyState, opts ...pulumi.ResourceOption) (*SharedAccessPolicy, error) {
var resource SharedAccessPolicy
err := ctx.ReadResource("azure:iot/sharedAccessPolicy:SharedAccessPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SharedAccessPolicy resources.
type sharedAccessPolicyState struct {
// Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
DeviceConnect *bool `pulumi:"deviceConnect"`
// The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
IothubName *string `pulumi:"iothubName"`
// Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The primary connection string of the Shared Access Policy.
PrimaryConnectionString *string `pulumi:"primaryConnectionString"`
// The primary key used to create the authentication token.
PrimaryKey *string `pulumi:"primaryKey"`
// Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
RegistryRead *bool `pulumi:"registryRead"`
// Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
RegistryWrite *bool `pulumi:"registryWrite"`
// The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// The secondary connection string of the Shared Access Policy.
SecondaryConnectionString *string `pulumi:"secondaryConnectionString"`
// The secondary key used to create the authentication token.
SecondaryKey *string `pulumi:"secondaryKey"`
// Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
ServiceConnect *bool `pulumi:"serviceConnect"`
}
type SharedAccessPolicyState struct {
// Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
DeviceConnect pulumi.BoolPtrInput
// The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
IothubName pulumi.StringPtrInput
// Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The primary connection string of the Shared Access Policy.
PrimaryConnectionString pulumi.StringPtrInput
// The primary key used to create the authentication token.
PrimaryKey pulumi.StringPtrInput
// Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
RegistryRead pulumi.BoolPtrInput
// Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
RegistryWrite pulumi.BoolPtrInput
// The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// The secondary connection string of the Shared Access Policy.
SecondaryConnectionString pulumi.StringPtrInput
// The secondary key used to create the authentication token.
SecondaryKey pulumi.StringPtrInput
// Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
ServiceConnect pulumi.BoolPtrInput
}
func (SharedAccessPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*sharedAccessPolicyState)(nil)).Elem()
}
type sharedAccessPolicyArgs struct {
// Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
DeviceConnect *bool `pulumi:"deviceConnect"`
// The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
IothubName string `pulumi:"iothubName"`
// Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
RegistryRead *bool `pulumi:"registryRead"`
// Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
RegistryWrite *bool `pulumi:"registryWrite"`
// The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
ServiceConnect *bool `pulumi:"serviceConnect"`
}
// The set of arguments for constructing a SharedAccessPolicy resource.
type SharedAccessPolicyArgs struct {
// Adds `DeviceConnect` permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.
DeviceConnect pulumi.BoolPtrInput
// The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
IothubName pulumi.StringInput
// Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Adds `RegistryRead` permission to this Shared Access Account. It allows read access to the identity registry.
RegistryRead pulumi.BoolPtrInput
// Adds `RegistryWrite` permission to this Shared Access Account. It allows write access to the identity registry.
RegistryWrite pulumi.BoolPtrInput
// The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// Adds `ServiceConnect` permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.
ServiceConnect pulumi.BoolPtrInput
}
func (SharedAccessPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*sharedAccessPolicyArgs)(nil)).Elem()
}