-
Notifications
You must be signed in to change notification settings - Fork 51
/
cacheBlobTarget.go
439 lines (387 loc) · 19.1 KB
/
cacheBlobTarget.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package hpc
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a Blob Target within a HPC Cache.
//
// > **NOTE:**: By request of the service team the provider no longer automatically registering the `Microsoft.StorageCache` Resource Provider for this resource. To register it you can run `az provider register --namespace 'Microsoft.StorageCache'`.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/hpc"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
// "github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("example-resources"),
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
// Name: pulumi.String("examplevn"),
// AddressSpaces: pulumi.StringArray{
// pulumi.String("10.0.0.0/16"),
// },
// Location: exampleResourceGroup.Location,
// ResourceGroupName: exampleResourceGroup.Name,
// })
// if err != nil {
// return err
// }
// exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
// Name: pulumi.String("examplesubnet"),
// ResourceGroupName: exampleResourceGroup.Name,
// VirtualNetworkName: exampleVirtualNetwork.Name,
// AddressPrefixes: pulumi.StringArray{
// pulumi.String("10.0.1.0/24"),
// },
// })
// if err != nil {
// return err
// }
// exampleCache, err := hpc.NewCache(ctx, "example", &hpc.CacheArgs{
// Name: pulumi.String("examplehpccache"),
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// CacheSizeInGb: pulumi.Int(3072),
// SubnetId: exampleSubnet.ID(),
// SkuName: pulumi.String("Standard_2G"),
// })
// if err != nil {
// return err
// }
// exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
// Name: pulumi.String("examplestorgaccount"),
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// AccountTier: pulumi.String("Standard"),
// AccountReplicationType: pulumi.String("LRS"),
// })
// if err != nil {
// return err
// }
// exampleContainer, err := storage.NewContainer(ctx, "example", &storage.ContainerArgs{
// Name: pulumi.String("examplestoragecontainer"),
// StorageAccountName: exampleAccount.Name,
// })
// if err != nil {
// return err
// }
// example, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
// DisplayName: pulumi.StringRef("HPC Cache Resource Provider"),
// }, nil)
// if err != nil {
// return err
// }
// _, err = authorization.NewAssignment(ctx, "example_storage_account_contrib", &authorization.AssignmentArgs{
// Scope: exampleAccount.ID(),
// RoleDefinitionName: pulumi.String("Storage Account Contributor"),
// PrincipalId: pulumi.String(example.ObjectId),
// })
// if err != nil {
// return err
// }
// _, err = authorization.NewAssignment(ctx, "example_storage_blob_data_contrib", &authorization.AssignmentArgs{
// Scope: exampleAccount.ID(),
// RoleDefinitionName: pulumi.String("Storage Blob Data Contributor"),
// PrincipalId: pulumi.String(example.ObjectId),
// })
// if err != nil {
// return err
// }
// _, err = hpc.NewCacheBlobTarget(ctx, "example", &hpc.CacheBlobTargetArgs{
// Name: pulumi.String("examplehpccblobtarget"),
// ResourceGroupName: exampleResourceGroup.Name,
// CacheName: exampleCache.Name,
// StorageContainerId: exampleContainer.ResourceManagerId,
// NamespacePath: pulumi.String("/blob_storage"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Blob Targets within an HPC Cache can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:hpc/cacheBlobTarget:CacheBlobTarget example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StorageCache/caches/cache1/storageTargets/target1
// ```
type CacheBlobTarget struct {
pulumi.CustomResourceState
// The name of the access policy applied to this target. Defaults to `default`.
AccessPolicyName pulumi.StringPtrOutput `pulumi:"accessPolicyName"`
// The name HPC Cache, which the HPC Cache Blob Target will be added to. Changing this forces a new resource to be created.
CacheName pulumi.StringOutput `pulumi:"cacheName"`
// The name of the HPC Cache Blob Target. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// The client-facing file path of the HPC Cache Blob Target.
NamespacePath pulumi.StringOutput `pulumi:"namespacePath"`
// The name of the Resource Group in which to create the HPC Cache Blob Target. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// The Resource Manager ID of the Storage Container used as the HPC Cache Blob Target. Changing this forces a new resource to be created.
//
// > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `storage.Container` Data Source/Resource as `resourceManagerId`.
StorageContainerId pulumi.StringOutput `pulumi:"storageContainerId"`
}
// NewCacheBlobTarget registers a new resource with the given unique name, arguments, and options.
func NewCacheBlobTarget(ctx *pulumi.Context,
name string, args *CacheBlobTargetArgs, opts ...pulumi.ResourceOption) (*CacheBlobTarget, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CacheName == nil {
return nil, errors.New("invalid value for required argument 'CacheName'")
}
if args.NamespacePath == nil {
return nil, errors.New("invalid value for required argument 'NamespacePath'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.StorageContainerId == nil {
return nil, errors.New("invalid value for required argument 'StorageContainerId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource CacheBlobTarget
err := ctx.RegisterResource("azure:hpc/cacheBlobTarget:CacheBlobTarget", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCacheBlobTarget gets an existing CacheBlobTarget 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 GetCacheBlobTarget(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CacheBlobTargetState, opts ...pulumi.ResourceOption) (*CacheBlobTarget, error) {
var resource CacheBlobTarget
err := ctx.ReadResource("azure:hpc/cacheBlobTarget:CacheBlobTarget", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering CacheBlobTarget resources.
type cacheBlobTargetState struct {
// The name of the access policy applied to this target. Defaults to `default`.
AccessPolicyName *string `pulumi:"accessPolicyName"`
// The name HPC Cache, which the HPC Cache Blob Target will be added to. Changing this forces a new resource to be created.
CacheName *string `pulumi:"cacheName"`
// The name of the HPC Cache Blob Target. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The client-facing file path of the HPC Cache Blob Target.
NamespacePath *string `pulumi:"namespacePath"`
// The name of the Resource Group in which to create the HPC Cache Blob Target. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// The Resource Manager ID of the Storage Container used as the HPC Cache Blob Target. Changing this forces a new resource to be created.
//
// > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `storage.Container` Data Source/Resource as `resourceManagerId`.
StorageContainerId *string `pulumi:"storageContainerId"`
}
type CacheBlobTargetState struct {
// The name of the access policy applied to this target. Defaults to `default`.
AccessPolicyName pulumi.StringPtrInput
// The name HPC Cache, which the HPC Cache Blob Target will be added to. Changing this forces a new resource to be created.
CacheName pulumi.StringPtrInput
// The name of the HPC Cache Blob Target. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The client-facing file path of the HPC Cache Blob Target.
NamespacePath pulumi.StringPtrInput
// The name of the Resource Group in which to create the HPC Cache Blob Target. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// The Resource Manager ID of the Storage Container used as the HPC Cache Blob Target. Changing this forces a new resource to be created.
//
// > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `storage.Container` Data Source/Resource as `resourceManagerId`.
StorageContainerId pulumi.StringPtrInput
}
func (CacheBlobTargetState) ElementType() reflect.Type {
return reflect.TypeOf((*cacheBlobTargetState)(nil)).Elem()
}
type cacheBlobTargetArgs struct {
// The name of the access policy applied to this target. Defaults to `default`.
AccessPolicyName *string `pulumi:"accessPolicyName"`
// The name HPC Cache, which the HPC Cache Blob Target will be added to. Changing this forces a new resource to be created.
CacheName string `pulumi:"cacheName"`
// The name of the HPC Cache Blob Target. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The client-facing file path of the HPC Cache Blob Target.
NamespacePath string `pulumi:"namespacePath"`
// The name of the Resource Group in which to create the HPC Cache Blob Target. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// The Resource Manager ID of the Storage Container used as the HPC Cache Blob Target. Changing this forces a new resource to be created.
//
// > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `storage.Container` Data Source/Resource as `resourceManagerId`.
StorageContainerId string `pulumi:"storageContainerId"`
}
// The set of arguments for constructing a CacheBlobTarget resource.
type CacheBlobTargetArgs struct {
// The name of the access policy applied to this target. Defaults to `default`.
AccessPolicyName pulumi.StringPtrInput
// The name HPC Cache, which the HPC Cache Blob Target will be added to. Changing this forces a new resource to be created.
CacheName pulumi.StringInput
// The name of the HPC Cache Blob Target. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The client-facing file path of the HPC Cache Blob Target.
NamespacePath pulumi.StringInput
// The name of the Resource Group in which to create the HPC Cache Blob Target. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// The Resource Manager ID of the Storage Container used as the HPC Cache Blob Target. Changing this forces a new resource to be created.
//
// > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `storage.Container` Data Source/Resource as `resourceManagerId`.
StorageContainerId pulumi.StringInput
}
func (CacheBlobTargetArgs) ElementType() reflect.Type {
return reflect.TypeOf((*cacheBlobTargetArgs)(nil)).Elem()
}
type CacheBlobTargetInput interface {
pulumi.Input
ToCacheBlobTargetOutput() CacheBlobTargetOutput
ToCacheBlobTargetOutputWithContext(ctx context.Context) CacheBlobTargetOutput
}
func (*CacheBlobTarget) ElementType() reflect.Type {
return reflect.TypeOf((**CacheBlobTarget)(nil)).Elem()
}
func (i *CacheBlobTarget) ToCacheBlobTargetOutput() CacheBlobTargetOutput {
return i.ToCacheBlobTargetOutputWithContext(context.Background())
}
func (i *CacheBlobTarget) ToCacheBlobTargetOutputWithContext(ctx context.Context) CacheBlobTargetOutput {
return pulumi.ToOutputWithContext(ctx, i).(CacheBlobTargetOutput)
}
// CacheBlobTargetArrayInput is an input type that accepts CacheBlobTargetArray and CacheBlobTargetArrayOutput values.
// You can construct a concrete instance of `CacheBlobTargetArrayInput` via:
//
// CacheBlobTargetArray{ CacheBlobTargetArgs{...} }
type CacheBlobTargetArrayInput interface {
pulumi.Input
ToCacheBlobTargetArrayOutput() CacheBlobTargetArrayOutput
ToCacheBlobTargetArrayOutputWithContext(context.Context) CacheBlobTargetArrayOutput
}
type CacheBlobTargetArray []CacheBlobTargetInput
func (CacheBlobTargetArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CacheBlobTarget)(nil)).Elem()
}
func (i CacheBlobTargetArray) ToCacheBlobTargetArrayOutput() CacheBlobTargetArrayOutput {
return i.ToCacheBlobTargetArrayOutputWithContext(context.Background())
}
func (i CacheBlobTargetArray) ToCacheBlobTargetArrayOutputWithContext(ctx context.Context) CacheBlobTargetArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CacheBlobTargetArrayOutput)
}
// CacheBlobTargetMapInput is an input type that accepts CacheBlobTargetMap and CacheBlobTargetMapOutput values.
// You can construct a concrete instance of `CacheBlobTargetMapInput` via:
//
// CacheBlobTargetMap{ "key": CacheBlobTargetArgs{...} }
type CacheBlobTargetMapInput interface {
pulumi.Input
ToCacheBlobTargetMapOutput() CacheBlobTargetMapOutput
ToCacheBlobTargetMapOutputWithContext(context.Context) CacheBlobTargetMapOutput
}
type CacheBlobTargetMap map[string]CacheBlobTargetInput
func (CacheBlobTargetMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CacheBlobTarget)(nil)).Elem()
}
func (i CacheBlobTargetMap) ToCacheBlobTargetMapOutput() CacheBlobTargetMapOutput {
return i.ToCacheBlobTargetMapOutputWithContext(context.Background())
}
func (i CacheBlobTargetMap) ToCacheBlobTargetMapOutputWithContext(ctx context.Context) CacheBlobTargetMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CacheBlobTargetMapOutput)
}
type CacheBlobTargetOutput struct{ *pulumi.OutputState }
func (CacheBlobTargetOutput) ElementType() reflect.Type {
return reflect.TypeOf((**CacheBlobTarget)(nil)).Elem()
}
func (o CacheBlobTargetOutput) ToCacheBlobTargetOutput() CacheBlobTargetOutput {
return o
}
func (o CacheBlobTargetOutput) ToCacheBlobTargetOutputWithContext(ctx context.Context) CacheBlobTargetOutput {
return o
}
// The name of the access policy applied to this target. Defaults to `default`.
func (o CacheBlobTargetOutput) AccessPolicyName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *CacheBlobTarget) pulumi.StringPtrOutput { return v.AccessPolicyName }).(pulumi.StringPtrOutput)
}
// The name HPC Cache, which the HPC Cache Blob Target will be added to. Changing this forces a new resource to be created.
func (o CacheBlobTargetOutput) CacheName() pulumi.StringOutput {
return o.ApplyT(func(v *CacheBlobTarget) pulumi.StringOutput { return v.CacheName }).(pulumi.StringOutput)
}
// The name of the HPC Cache Blob Target. Changing this forces a new resource to be created.
func (o CacheBlobTargetOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *CacheBlobTarget) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The client-facing file path of the HPC Cache Blob Target.
func (o CacheBlobTargetOutput) NamespacePath() pulumi.StringOutput {
return o.ApplyT(func(v *CacheBlobTarget) pulumi.StringOutput { return v.NamespacePath }).(pulumi.StringOutput)
}
// The name of the Resource Group in which to create the HPC Cache Blob Target. Changing this forces a new resource to be created.
func (o CacheBlobTargetOutput) ResourceGroupName() pulumi.StringOutput {
return o.ApplyT(func(v *CacheBlobTarget) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)
}
// The Resource Manager ID of the Storage Container used as the HPC Cache Blob Target. Changing this forces a new resource to be created.
//
// > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `storage.Container` Data Source/Resource as `resourceManagerId`.
func (o CacheBlobTargetOutput) StorageContainerId() pulumi.StringOutput {
return o.ApplyT(func(v *CacheBlobTarget) pulumi.StringOutput { return v.StorageContainerId }).(pulumi.StringOutput)
}
type CacheBlobTargetArrayOutput struct{ *pulumi.OutputState }
func (CacheBlobTargetArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CacheBlobTarget)(nil)).Elem()
}
func (o CacheBlobTargetArrayOutput) ToCacheBlobTargetArrayOutput() CacheBlobTargetArrayOutput {
return o
}
func (o CacheBlobTargetArrayOutput) ToCacheBlobTargetArrayOutputWithContext(ctx context.Context) CacheBlobTargetArrayOutput {
return o
}
func (o CacheBlobTargetArrayOutput) Index(i pulumi.IntInput) CacheBlobTargetOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CacheBlobTarget {
return vs[0].([]*CacheBlobTarget)[vs[1].(int)]
}).(CacheBlobTargetOutput)
}
type CacheBlobTargetMapOutput struct{ *pulumi.OutputState }
func (CacheBlobTargetMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CacheBlobTarget)(nil)).Elem()
}
func (o CacheBlobTargetMapOutput) ToCacheBlobTargetMapOutput() CacheBlobTargetMapOutput {
return o
}
func (o CacheBlobTargetMapOutput) ToCacheBlobTargetMapOutputWithContext(ctx context.Context) CacheBlobTargetMapOutput {
return o
}
func (o CacheBlobTargetMapOutput) MapIndex(k pulumi.StringInput) CacheBlobTargetOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CacheBlobTarget {
return vs[0].(map[string]*CacheBlobTarget)[vs[1].(string)]
}).(CacheBlobTargetOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CacheBlobTargetInput)(nil)).Elem(), &CacheBlobTarget{})
pulumi.RegisterInputType(reflect.TypeOf((*CacheBlobTargetArrayInput)(nil)).Elem(), CacheBlobTargetArray{})
pulumi.RegisterInputType(reflect.TypeOf((*CacheBlobTargetMapInput)(nil)).Elem(), CacheBlobTargetMap{})
pulumi.RegisterOutputType(CacheBlobTargetOutput{})
pulumi.RegisterOutputType(CacheBlobTargetArrayOutput{})
pulumi.RegisterOutputType(CacheBlobTargetMapOutput{})
}