generated from pulumi/pulumi-tf-provider-boilerplate
/
gatewayCacheDisk.go
373 lines (321 loc) · 15.6 KB
/
gatewayCacheDisk.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
// 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 cloudstoragegateway
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Cloud Storage Gateway Gateway Cache Disk resource.
//
// For information about Cloud Storage Gateway Gateway Cache Disk and how to use it, see [What is Gateway Cache Disk](https://www.alibabacloud.com/help/zh/doc-detail/170294.htm).
//
// > **NOTE:** Available in v1.144.0+.
//
// ## Example Usage
//
// # Basic Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-alicloud/sdk/go/alicloud/cloudstoragegateway"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/rhysmdnz/pulumi-alicloud/sdk/go/alicloud/cloudstoragegateway"
// "github.com/rhysmdnz/pulumi-alicloud/sdk/go/alicloud/vpc"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleStocks, err := cloudstoragegateway.GetStocks(ctx, &cloudstoragegateway.GetStocksArgs{
// GatewayClass: pulumi.StringRef("Standard"),
// }, nil)
// if err != nil {
// return err
// }
// vpc, err := vpc.NewNetwork(ctx, "vpc", &vpc.NetworkArgs{
// VpcName: pulumi.String("example_value"),
// CidrBlock: pulumi.String("172.16.0.0/12"),
// })
// if err != nil {
// return err
// }
// exampleSwitch, err := vpc.NewSwitch(ctx, "exampleSwitch", &vpc.SwitchArgs{
// VpcId: vpc.ID(),
// CidrBlock: pulumi.String("172.16.0.0/21"),
// ZoneId: pulumi.String(exampleStocks.Stocks[0].ZoneId),
// VswitchName: pulumi.String("example_value"),
// })
// if err != nil {
// return err
// }
// exampleStorageBundle, err := cloudstoragegateway.NewStorageBundle(ctx, "exampleStorageBundle", &cloudstoragegateway.StorageBundleArgs{
// StorageBundleName: pulumi.String("example_value"),
// })
// if err != nil {
// return err
// }
// _, err = cloudstoragegateway.NewGateway(ctx, "exampleGateway", &cloudstoragegateway.GatewayArgs{
// Description: pulumi.String("tf-acctestDesalone"),
// GatewayClass: pulumi.String("Standard"),
// Type: pulumi.String("File"),
// PaymentType: pulumi.String("PayAsYouGo"),
// VswitchId: exampleSwitch.ID(),
// ReleaseAfterExpiration: pulumi.Bool(true),
// PublicNetworkBandwidth: pulumi.Int(10),
// StorageBundleId: exampleStorageBundle.ID(),
// Location: pulumi.String("Cloud"),
// GatewayName: pulumi.String("example_value"),
// })
// if err != nil {
// return err
// }
// _, err = cloudstoragegateway.NewGatewayCacheDisk(ctx, "exampleGatewayCacheDisk", &cloudstoragegateway.GatewayCacheDiskArgs{
// CacheDiskCategory: pulumi.String("cloud_efficiency"),
// GatewayId: pulumi.Any(alicloud_cloud_storage_gateway_gateways.Example.Id),
// CacheDiskSizeInGb: pulumi.Int(50),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Cloud Storage Gateway Gateway Cache Disk can be imported using the id, e.g.
//
// ```sh
//
// $ pulumi import alicloud:cloudstoragegateway/gatewayCacheDisk:GatewayCacheDisk example <gateway_id>:<cache_id>:<local_file_path>
//
// ```
type GatewayCacheDisk struct {
pulumi.CustomResourceState
// The cache disk type. Valid values: `cloudEfficiency`, `cloudSsd`.
CacheDiskCategory pulumi.StringOutput `pulumi:"cacheDiskCategory"`
// size of the cache disk. Unit: `GB`. The upper limit of the basic gateway cache disk is `1` TB (`1024` GB), that of the standard gateway is `2` TB (`2048` GB), and that of other gateway cache disks is `32` TB (`32768` GB). The lower limit for the file gateway cache disk capacity is `40` GB, and the lower limit for the block gateway cache disk capacity is `20` GB.
CacheDiskSizeInGb pulumi.IntOutput `pulumi:"cacheDiskSizeInGb"`
// The ID of the cache.
CacheId pulumi.StringOutput `pulumi:"cacheId"`
// The ID of the gateway.
GatewayId pulumi.StringOutput `pulumi:"gatewayId"`
// The cache disk inside the device name.
LocalFilePath pulumi.StringOutput `pulumi:"localFilePath"`
// The status of the resource. Valid values: `0`, `1`, `2`. `0`: Normal. `1`: Is about to expire. `2`: Has expired.
Status pulumi.IntOutput `pulumi:"status"`
}
// NewGatewayCacheDisk registers a new resource with the given unique name, arguments, and options.
func NewGatewayCacheDisk(ctx *pulumi.Context,
name string, args *GatewayCacheDiskArgs, opts ...pulumi.ResourceOption) (*GatewayCacheDisk, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CacheDiskSizeInGb == nil {
return nil, errors.New("invalid value for required argument 'CacheDiskSizeInGb'")
}
if args.GatewayId == nil {
return nil, errors.New("invalid value for required argument 'GatewayId'")
}
opts = pkgResourceDefaultOpts(opts)
var resource GatewayCacheDisk
err := ctx.RegisterResource("alicloud:cloudstoragegateway/gatewayCacheDisk:GatewayCacheDisk", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetGatewayCacheDisk gets an existing GatewayCacheDisk 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 GetGatewayCacheDisk(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *GatewayCacheDiskState, opts ...pulumi.ResourceOption) (*GatewayCacheDisk, error) {
var resource GatewayCacheDisk
err := ctx.ReadResource("alicloud:cloudstoragegateway/gatewayCacheDisk:GatewayCacheDisk", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering GatewayCacheDisk resources.
type gatewayCacheDiskState struct {
// The cache disk type. Valid values: `cloudEfficiency`, `cloudSsd`.
CacheDiskCategory *string `pulumi:"cacheDiskCategory"`
// size of the cache disk. Unit: `GB`. The upper limit of the basic gateway cache disk is `1` TB (`1024` GB), that of the standard gateway is `2` TB (`2048` GB), and that of other gateway cache disks is `32` TB (`32768` GB). The lower limit for the file gateway cache disk capacity is `40` GB, and the lower limit for the block gateway cache disk capacity is `20` GB.
CacheDiskSizeInGb *int `pulumi:"cacheDiskSizeInGb"`
// The ID of the cache.
CacheId *string `pulumi:"cacheId"`
// The ID of the gateway.
GatewayId *string `pulumi:"gatewayId"`
// The cache disk inside the device name.
LocalFilePath *string `pulumi:"localFilePath"`
// The status of the resource. Valid values: `0`, `1`, `2`. `0`: Normal. `1`: Is about to expire. `2`: Has expired.
Status *int `pulumi:"status"`
}
type GatewayCacheDiskState struct {
// The cache disk type. Valid values: `cloudEfficiency`, `cloudSsd`.
CacheDiskCategory pulumi.StringPtrInput
// size of the cache disk. Unit: `GB`. The upper limit of the basic gateway cache disk is `1` TB (`1024` GB), that of the standard gateway is `2` TB (`2048` GB), and that of other gateway cache disks is `32` TB (`32768` GB). The lower limit for the file gateway cache disk capacity is `40` GB, and the lower limit for the block gateway cache disk capacity is `20` GB.
CacheDiskSizeInGb pulumi.IntPtrInput
// The ID of the cache.
CacheId pulumi.StringPtrInput
// The ID of the gateway.
GatewayId pulumi.StringPtrInput
// The cache disk inside the device name.
LocalFilePath pulumi.StringPtrInput
// The status of the resource. Valid values: `0`, `1`, `2`. `0`: Normal. `1`: Is about to expire. `2`: Has expired.
Status pulumi.IntPtrInput
}
func (GatewayCacheDiskState) ElementType() reflect.Type {
return reflect.TypeOf((*gatewayCacheDiskState)(nil)).Elem()
}
type gatewayCacheDiskArgs struct {
// The cache disk type. Valid values: `cloudEfficiency`, `cloudSsd`.
CacheDiskCategory *string `pulumi:"cacheDiskCategory"`
// size of the cache disk. Unit: `GB`. The upper limit of the basic gateway cache disk is `1` TB (`1024` GB), that of the standard gateway is `2` TB (`2048` GB), and that of other gateway cache disks is `32` TB (`32768` GB). The lower limit for the file gateway cache disk capacity is `40` GB, and the lower limit for the block gateway cache disk capacity is `20` GB.
CacheDiskSizeInGb int `pulumi:"cacheDiskSizeInGb"`
// The ID of the gateway.
GatewayId string `pulumi:"gatewayId"`
}
// The set of arguments for constructing a GatewayCacheDisk resource.
type GatewayCacheDiskArgs struct {
// The cache disk type. Valid values: `cloudEfficiency`, `cloudSsd`.
CacheDiskCategory pulumi.StringPtrInput
// size of the cache disk. Unit: `GB`. The upper limit of the basic gateway cache disk is `1` TB (`1024` GB), that of the standard gateway is `2` TB (`2048` GB), and that of other gateway cache disks is `32` TB (`32768` GB). The lower limit for the file gateway cache disk capacity is `40` GB, and the lower limit for the block gateway cache disk capacity is `20` GB.
CacheDiskSizeInGb pulumi.IntInput
// The ID of the gateway.
GatewayId pulumi.StringInput
}
func (GatewayCacheDiskArgs) ElementType() reflect.Type {
return reflect.TypeOf((*gatewayCacheDiskArgs)(nil)).Elem()
}
type GatewayCacheDiskInput interface {
pulumi.Input
ToGatewayCacheDiskOutput() GatewayCacheDiskOutput
ToGatewayCacheDiskOutputWithContext(ctx context.Context) GatewayCacheDiskOutput
}
func (*GatewayCacheDisk) ElementType() reflect.Type {
return reflect.TypeOf((**GatewayCacheDisk)(nil)).Elem()
}
func (i *GatewayCacheDisk) ToGatewayCacheDiskOutput() GatewayCacheDiskOutput {
return i.ToGatewayCacheDiskOutputWithContext(context.Background())
}
func (i *GatewayCacheDisk) ToGatewayCacheDiskOutputWithContext(ctx context.Context) GatewayCacheDiskOutput {
return pulumi.ToOutputWithContext(ctx, i).(GatewayCacheDiskOutput)
}
// GatewayCacheDiskArrayInput is an input type that accepts GatewayCacheDiskArray and GatewayCacheDiskArrayOutput values.
// You can construct a concrete instance of `GatewayCacheDiskArrayInput` via:
//
// GatewayCacheDiskArray{ GatewayCacheDiskArgs{...} }
type GatewayCacheDiskArrayInput interface {
pulumi.Input
ToGatewayCacheDiskArrayOutput() GatewayCacheDiskArrayOutput
ToGatewayCacheDiskArrayOutputWithContext(context.Context) GatewayCacheDiskArrayOutput
}
type GatewayCacheDiskArray []GatewayCacheDiskInput
func (GatewayCacheDiskArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*GatewayCacheDisk)(nil)).Elem()
}
func (i GatewayCacheDiskArray) ToGatewayCacheDiskArrayOutput() GatewayCacheDiskArrayOutput {
return i.ToGatewayCacheDiskArrayOutputWithContext(context.Background())
}
func (i GatewayCacheDiskArray) ToGatewayCacheDiskArrayOutputWithContext(ctx context.Context) GatewayCacheDiskArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(GatewayCacheDiskArrayOutput)
}
// GatewayCacheDiskMapInput is an input type that accepts GatewayCacheDiskMap and GatewayCacheDiskMapOutput values.
// You can construct a concrete instance of `GatewayCacheDiskMapInput` via:
//
// GatewayCacheDiskMap{ "key": GatewayCacheDiskArgs{...} }
type GatewayCacheDiskMapInput interface {
pulumi.Input
ToGatewayCacheDiskMapOutput() GatewayCacheDiskMapOutput
ToGatewayCacheDiskMapOutputWithContext(context.Context) GatewayCacheDiskMapOutput
}
type GatewayCacheDiskMap map[string]GatewayCacheDiskInput
func (GatewayCacheDiskMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*GatewayCacheDisk)(nil)).Elem()
}
func (i GatewayCacheDiskMap) ToGatewayCacheDiskMapOutput() GatewayCacheDiskMapOutput {
return i.ToGatewayCacheDiskMapOutputWithContext(context.Background())
}
func (i GatewayCacheDiskMap) ToGatewayCacheDiskMapOutputWithContext(ctx context.Context) GatewayCacheDiskMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(GatewayCacheDiskMapOutput)
}
type GatewayCacheDiskOutput struct{ *pulumi.OutputState }
func (GatewayCacheDiskOutput) ElementType() reflect.Type {
return reflect.TypeOf((**GatewayCacheDisk)(nil)).Elem()
}
func (o GatewayCacheDiskOutput) ToGatewayCacheDiskOutput() GatewayCacheDiskOutput {
return o
}
func (o GatewayCacheDiskOutput) ToGatewayCacheDiskOutputWithContext(ctx context.Context) GatewayCacheDiskOutput {
return o
}
// The cache disk type. Valid values: `cloudEfficiency`, `cloudSsd`.
func (o GatewayCacheDiskOutput) CacheDiskCategory() pulumi.StringOutput {
return o.ApplyT(func(v *GatewayCacheDisk) pulumi.StringOutput { return v.CacheDiskCategory }).(pulumi.StringOutput)
}
// size of the cache disk. Unit: `GB`. The upper limit of the basic gateway cache disk is `1` TB (`1024` GB), that of the standard gateway is `2` TB (`2048` GB), and that of other gateway cache disks is `32` TB (`32768` GB). The lower limit for the file gateway cache disk capacity is `40` GB, and the lower limit for the block gateway cache disk capacity is `20` GB.
func (o GatewayCacheDiskOutput) CacheDiskSizeInGb() pulumi.IntOutput {
return o.ApplyT(func(v *GatewayCacheDisk) pulumi.IntOutput { return v.CacheDiskSizeInGb }).(pulumi.IntOutput)
}
// The ID of the cache.
func (o GatewayCacheDiskOutput) CacheId() pulumi.StringOutput {
return o.ApplyT(func(v *GatewayCacheDisk) pulumi.StringOutput { return v.CacheId }).(pulumi.StringOutput)
}
// The ID of the gateway.
func (o GatewayCacheDiskOutput) GatewayId() pulumi.StringOutput {
return o.ApplyT(func(v *GatewayCacheDisk) pulumi.StringOutput { return v.GatewayId }).(pulumi.StringOutput)
}
// The cache disk inside the device name.
func (o GatewayCacheDiskOutput) LocalFilePath() pulumi.StringOutput {
return o.ApplyT(func(v *GatewayCacheDisk) pulumi.StringOutput { return v.LocalFilePath }).(pulumi.StringOutput)
}
// The status of the resource. Valid values: `0`, `1`, `2`. `0`: Normal. `1`: Is about to expire. `2`: Has expired.
func (o GatewayCacheDiskOutput) Status() pulumi.IntOutput {
return o.ApplyT(func(v *GatewayCacheDisk) pulumi.IntOutput { return v.Status }).(pulumi.IntOutput)
}
type GatewayCacheDiskArrayOutput struct{ *pulumi.OutputState }
func (GatewayCacheDiskArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*GatewayCacheDisk)(nil)).Elem()
}
func (o GatewayCacheDiskArrayOutput) ToGatewayCacheDiskArrayOutput() GatewayCacheDiskArrayOutput {
return o
}
func (o GatewayCacheDiskArrayOutput) ToGatewayCacheDiskArrayOutputWithContext(ctx context.Context) GatewayCacheDiskArrayOutput {
return o
}
func (o GatewayCacheDiskArrayOutput) Index(i pulumi.IntInput) GatewayCacheDiskOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *GatewayCacheDisk {
return vs[0].([]*GatewayCacheDisk)[vs[1].(int)]
}).(GatewayCacheDiskOutput)
}
type GatewayCacheDiskMapOutput struct{ *pulumi.OutputState }
func (GatewayCacheDiskMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*GatewayCacheDisk)(nil)).Elem()
}
func (o GatewayCacheDiskMapOutput) ToGatewayCacheDiskMapOutput() GatewayCacheDiskMapOutput {
return o
}
func (o GatewayCacheDiskMapOutput) ToGatewayCacheDiskMapOutputWithContext(ctx context.Context) GatewayCacheDiskMapOutput {
return o
}
func (o GatewayCacheDiskMapOutput) MapIndex(k pulumi.StringInput) GatewayCacheDiskOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *GatewayCacheDisk {
return vs[0].(map[string]*GatewayCacheDisk)[vs[1].(string)]
}).(GatewayCacheDiskOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*GatewayCacheDiskInput)(nil)).Elem(), &GatewayCacheDisk{})
pulumi.RegisterInputType(reflect.TypeOf((*GatewayCacheDiskArrayInput)(nil)).Elem(), GatewayCacheDiskArray{})
pulumi.RegisterInputType(reflect.TypeOf((*GatewayCacheDiskMapInput)(nil)).Elem(), GatewayCacheDiskMap{})
pulumi.RegisterOutputType(GatewayCacheDiskOutput{})
pulumi.RegisterOutputType(GatewayCacheDiskArrayOutput{})
pulumi.RegisterOutputType(GatewayCacheDiskMapOutput{})
}