/
instanceAllowedIpAttachment.go
400 lines (350 loc) · 18.5 KB
/
instanceAllowedIpAttachment.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
// 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 alikafka
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a AliKafka Instance Allowed Ip Attachment resource.
//
// For information about AliKafka Instance Allowed Ip Attachment and how to use it, see [What is Instance Allowed Ip Attachment](https://www.alibabacloud.com/help/en/message-queue-for-apache-kafka/latest/api-alikafka-2019-09-16-updateallowedip).
//
// > **NOTE:** Available since v1.163.0.
//
// ## Example Usage
//
// # Basic Usage
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alikafka"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
// "github.com/pulumi/pulumi-random/sdk/v4/go/random"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// name := "tf-example"
// if param := cfg.Get("name"); param != "" {
// name = param
// }
// defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
// Min: 10000,
// Max: 99999,
// })
// if err != nil {
// return err
// }
// _default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
// AvailableResourceCreation: pulumi.StringRef("VSwitch"),
// }, nil)
// if err != nil {
// return err
// }
// defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
// VpcName: pulumi.String(name),
// CidrBlock: pulumi.String("10.4.0.0/16"),
// })
// if err != nil {
// return err
// }
// defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
// VswitchName: pulumi.String(name),
// CidrBlock: pulumi.String("10.4.0.0/24"),
// VpcId: defaultNetwork.ID(),
// ZoneId: pulumi.String(_default.Zones[0].Id),
// })
// if err != nil {
// return err
// }
// defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
// VpcId: defaultNetwork.ID(),
// })
// if err != nil {
// return err
// }
// defaultInstance, err := alikafka.NewInstance(ctx, "default", &alikafka.InstanceArgs{
// Name: pulumi.String(fmt.Sprintf("%v-%v", name, defaultInteger.Result)),
// PartitionNum: pulumi.Int(50),
// DiskType: pulumi.Int(1),
// DiskSize: pulumi.Int(500),
// DeployType: pulumi.Int(5),
// IoMax: pulumi.Int(20),
// VswitchId: defaultSwitch.ID(),
// SecurityGroup: defaultSecurityGroup.ID(),
// })
// if err != nil {
// return err
// }
// _, err = alikafka.NewInstanceAllowedIpAttachment(ctx, "default", &alikafka.InstanceAllowedIpAttachmentArgs{
// InstanceId: defaultInstance.ID(),
// AllowedType: pulumi.String("vpc"),
// PortRange: pulumi.String("9092/9092"),
// AllowedIp: pulumi.String("114.237.9.78/32"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// AliKafka Instance Allowed Ip Attachment can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:alikafka/instanceAllowedIpAttachment:InstanceAllowedIpAttachment example <instance_id>:<allowed_type>:<port_range>:<allowed_ip>
// ```
type InstanceAllowedIpAttachment struct {
pulumi.CustomResourceState
// The IP address whitelist. It can be a CIDR block.
AllowedIp pulumi.StringOutput `pulumi:"allowedIp"`
// The type of the whitelist. Valid Value: `vpc`, `internet`. **NOTE:** From version 1.179.0, `allowedType` can be set to `internet`.
AllowedType pulumi.StringOutput `pulumi:"allowedType"`
// The ID of the instance.
InstanceId pulumi.StringOutput `pulumi:"instanceId"`
// The Port range. Valid Value: `9092/9092`, `9093/9093`, `9094/9094`, `9095/9095`. **NOTE:** From version 1.179.0, `portRange` can be set to `9093/9093`. From version 1.219.0, `portRange` can be set to `9094/9094`, `9095/9095`.
// - `9092/9092`: The port range for access from virtual private clouds (VPCs) by using the default endpoint.
// - `9093/9093`: The port range for access from the Internet.
// - `9094/9094`: The port range for access from VPCs by using the Simple Authentication and Security Layer (SASL) endpoint.
// - `9095/9095`: The port range for access from VPCs by using the Secure Sockets Layer (SSL) endpoint.
PortRange pulumi.StringOutput `pulumi:"portRange"`
}
// NewInstanceAllowedIpAttachment registers a new resource with the given unique name, arguments, and options.
func NewInstanceAllowedIpAttachment(ctx *pulumi.Context,
name string, args *InstanceAllowedIpAttachmentArgs, opts ...pulumi.ResourceOption) (*InstanceAllowedIpAttachment, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AllowedIp == nil {
return nil, errors.New("invalid value for required argument 'AllowedIp'")
}
if args.AllowedType == nil {
return nil, errors.New("invalid value for required argument 'AllowedType'")
}
if args.InstanceId == nil {
return nil, errors.New("invalid value for required argument 'InstanceId'")
}
if args.PortRange == nil {
return nil, errors.New("invalid value for required argument 'PortRange'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource InstanceAllowedIpAttachment
err := ctx.RegisterResource("alicloud:alikafka/instanceAllowedIpAttachment:InstanceAllowedIpAttachment", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetInstanceAllowedIpAttachment gets an existing InstanceAllowedIpAttachment 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 GetInstanceAllowedIpAttachment(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *InstanceAllowedIpAttachmentState, opts ...pulumi.ResourceOption) (*InstanceAllowedIpAttachment, error) {
var resource InstanceAllowedIpAttachment
err := ctx.ReadResource("alicloud:alikafka/instanceAllowedIpAttachment:InstanceAllowedIpAttachment", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering InstanceAllowedIpAttachment resources.
type instanceAllowedIpAttachmentState struct {
// The IP address whitelist. It can be a CIDR block.
AllowedIp *string `pulumi:"allowedIp"`
// The type of the whitelist. Valid Value: `vpc`, `internet`. **NOTE:** From version 1.179.0, `allowedType` can be set to `internet`.
AllowedType *string `pulumi:"allowedType"`
// The ID of the instance.
InstanceId *string `pulumi:"instanceId"`
// The Port range. Valid Value: `9092/9092`, `9093/9093`, `9094/9094`, `9095/9095`. **NOTE:** From version 1.179.0, `portRange` can be set to `9093/9093`. From version 1.219.0, `portRange` can be set to `9094/9094`, `9095/9095`.
// - `9092/9092`: The port range for access from virtual private clouds (VPCs) by using the default endpoint.
// - `9093/9093`: The port range for access from the Internet.
// - `9094/9094`: The port range for access from VPCs by using the Simple Authentication and Security Layer (SASL) endpoint.
// - `9095/9095`: The port range for access from VPCs by using the Secure Sockets Layer (SSL) endpoint.
PortRange *string `pulumi:"portRange"`
}
type InstanceAllowedIpAttachmentState struct {
// The IP address whitelist. It can be a CIDR block.
AllowedIp pulumi.StringPtrInput
// The type of the whitelist. Valid Value: `vpc`, `internet`. **NOTE:** From version 1.179.0, `allowedType` can be set to `internet`.
AllowedType pulumi.StringPtrInput
// The ID of the instance.
InstanceId pulumi.StringPtrInput
// The Port range. Valid Value: `9092/9092`, `9093/9093`, `9094/9094`, `9095/9095`. **NOTE:** From version 1.179.0, `portRange` can be set to `9093/9093`. From version 1.219.0, `portRange` can be set to `9094/9094`, `9095/9095`.
// - `9092/9092`: The port range for access from virtual private clouds (VPCs) by using the default endpoint.
// - `9093/9093`: The port range for access from the Internet.
// - `9094/9094`: The port range for access from VPCs by using the Simple Authentication and Security Layer (SASL) endpoint.
// - `9095/9095`: The port range for access from VPCs by using the Secure Sockets Layer (SSL) endpoint.
PortRange pulumi.StringPtrInput
}
func (InstanceAllowedIpAttachmentState) ElementType() reflect.Type {
return reflect.TypeOf((*instanceAllowedIpAttachmentState)(nil)).Elem()
}
type instanceAllowedIpAttachmentArgs struct {
// The IP address whitelist. It can be a CIDR block.
AllowedIp string `pulumi:"allowedIp"`
// The type of the whitelist. Valid Value: `vpc`, `internet`. **NOTE:** From version 1.179.0, `allowedType` can be set to `internet`.
AllowedType string `pulumi:"allowedType"`
// The ID of the instance.
InstanceId string `pulumi:"instanceId"`
// The Port range. Valid Value: `9092/9092`, `9093/9093`, `9094/9094`, `9095/9095`. **NOTE:** From version 1.179.0, `portRange` can be set to `9093/9093`. From version 1.219.0, `portRange` can be set to `9094/9094`, `9095/9095`.
// - `9092/9092`: The port range for access from virtual private clouds (VPCs) by using the default endpoint.
// - `9093/9093`: The port range for access from the Internet.
// - `9094/9094`: The port range for access from VPCs by using the Simple Authentication and Security Layer (SASL) endpoint.
// - `9095/9095`: The port range for access from VPCs by using the Secure Sockets Layer (SSL) endpoint.
PortRange string `pulumi:"portRange"`
}
// The set of arguments for constructing a InstanceAllowedIpAttachment resource.
type InstanceAllowedIpAttachmentArgs struct {
// The IP address whitelist. It can be a CIDR block.
AllowedIp pulumi.StringInput
// The type of the whitelist. Valid Value: `vpc`, `internet`. **NOTE:** From version 1.179.0, `allowedType` can be set to `internet`.
AllowedType pulumi.StringInput
// The ID of the instance.
InstanceId pulumi.StringInput
// The Port range. Valid Value: `9092/9092`, `9093/9093`, `9094/9094`, `9095/9095`. **NOTE:** From version 1.179.0, `portRange` can be set to `9093/9093`. From version 1.219.0, `portRange` can be set to `9094/9094`, `9095/9095`.
// - `9092/9092`: The port range for access from virtual private clouds (VPCs) by using the default endpoint.
// - `9093/9093`: The port range for access from the Internet.
// - `9094/9094`: The port range for access from VPCs by using the Simple Authentication and Security Layer (SASL) endpoint.
// - `9095/9095`: The port range for access from VPCs by using the Secure Sockets Layer (SSL) endpoint.
PortRange pulumi.StringInput
}
func (InstanceAllowedIpAttachmentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*instanceAllowedIpAttachmentArgs)(nil)).Elem()
}
type InstanceAllowedIpAttachmentInput interface {
pulumi.Input
ToInstanceAllowedIpAttachmentOutput() InstanceAllowedIpAttachmentOutput
ToInstanceAllowedIpAttachmentOutputWithContext(ctx context.Context) InstanceAllowedIpAttachmentOutput
}
func (*InstanceAllowedIpAttachment) ElementType() reflect.Type {
return reflect.TypeOf((**InstanceAllowedIpAttachment)(nil)).Elem()
}
func (i *InstanceAllowedIpAttachment) ToInstanceAllowedIpAttachmentOutput() InstanceAllowedIpAttachmentOutput {
return i.ToInstanceAllowedIpAttachmentOutputWithContext(context.Background())
}
func (i *InstanceAllowedIpAttachment) ToInstanceAllowedIpAttachmentOutputWithContext(ctx context.Context) InstanceAllowedIpAttachmentOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceAllowedIpAttachmentOutput)
}
// InstanceAllowedIpAttachmentArrayInput is an input type that accepts InstanceAllowedIpAttachmentArray and InstanceAllowedIpAttachmentArrayOutput values.
// You can construct a concrete instance of `InstanceAllowedIpAttachmentArrayInput` via:
//
// InstanceAllowedIpAttachmentArray{ InstanceAllowedIpAttachmentArgs{...} }
type InstanceAllowedIpAttachmentArrayInput interface {
pulumi.Input
ToInstanceAllowedIpAttachmentArrayOutput() InstanceAllowedIpAttachmentArrayOutput
ToInstanceAllowedIpAttachmentArrayOutputWithContext(context.Context) InstanceAllowedIpAttachmentArrayOutput
}
type InstanceAllowedIpAttachmentArray []InstanceAllowedIpAttachmentInput
func (InstanceAllowedIpAttachmentArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*InstanceAllowedIpAttachment)(nil)).Elem()
}
func (i InstanceAllowedIpAttachmentArray) ToInstanceAllowedIpAttachmentArrayOutput() InstanceAllowedIpAttachmentArrayOutput {
return i.ToInstanceAllowedIpAttachmentArrayOutputWithContext(context.Background())
}
func (i InstanceAllowedIpAttachmentArray) ToInstanceAllowedIpAttachmentArrayOutputWithContext(ctx context.Context) InstanceAllowedIpAttachmentArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceAllowedIpAttachmentArrayOutput)
}
// InstanceAllowedIpAttachmentMapInput is an input type that accepts InstanceAllowedIpAttachmentMap and InstanceAllowedIpAttachmentMapOutput values.
// You can construct a concrete instance of `InstanceAllowedIpAttachmentMapInput` via:
//
// InstanceAllowedIpAttachmentMap{ "key": InstanceAllowedIpAttachmentArgs{...} }
type InstanceAllowedIpAttachmentMapInput interface {
pulumi.Input
ToInstanceAllowedIpAttachmentMapOutput() InstanceAllowedIpAttachmentMapOutput
ToInstanceAllowedIpAttachmentMapOutputWithContext(context.Context) InstanceAllowedIpAttachmentMapOutput
}
type InstanceAllowedIpAttachmentMap map[string]InstanceAllowedIpAttachmentInput
func (InstanceAllowedIpAttachmentMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*InstanceAllowedIpAttachment)(nil)).Elem()
}
func (i InstanceAllowedIpAttachmentMap) ToInstanceAllowedIpAttachmentMapOutput() InstanceAllowedIpAttachmentMapOutput {
return i.ToInstanceAllowedIpAttachmentMapOutputWithContext(context.Background())
}
func (i InstanceAllowedIpAttachmentMap) ToInstanceAllowedIpAttachmentMapOutputWithContext(ctx context.Context) InstanceAllowedIpAttachmentMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceAllowedIpAttachmentMapOutput)
}
type InstanceAllowedIpAttachmentOutput struct{ *pulumi.OutputState }
func (InstanceAllowedIpAttachmentOutput) ElementType() reflect.Type {
return reflect.TypeOf((**InstanceAllowedIpAttachment)(nil)).Elem()
}
func (o InstanceAllowedIpAttachmentOutput) ToInstanceAllowedIpAttachmentOutput() InstanceAllowedIpAttachmentOutput {
return o
}
func (o InstanceAllowedIpAttachmentOutput) ToInstanceAllowedIpAttachmentOutputWithContext(ctx context.Context) InstanceAllowedIpAttachmentOutput {
return o
}
// The IP address whitelist. It can be a CIDR block.
func (o InstanceAllowedIpAttachmentOutput) AllowedIp() pulumi.StringOutput {
return o.ApplyT(func(v *InstanceAllowedIpAttachment) pulumi.StringOutput { return v.AllowedIp }).(pulumi.StringOutput)
}
// The type of the whitelist. Valid Value: `vpc`, `internet`. **NOTE:** From version 1.179.0, `allowedType` can be set to `internet`.
func (o InstanceAllowedIpAttachmentOutput) AllowedType() pulumi.StringOutput {
return o.ApplyT(func(v *InstanceAllowedIpAttachment) pulumi.StringOutput { return v.AllowedType }).(pulumi.StringOutput)
}
// The ID of the instance.
func (o InstanceAllowedIpAttachmentOutput) InstanceId() pulumi.StringOutput {
return o.ApplyT(func(v *InstanceAllowedIpAttachment) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)
}
// The Port range. Valid Value: `9092/9092`, `9093/9093`, `9094/9094`, `9095/9095`. **NOTE:** From version 1.179.0, `portRange` can be set to `9093/9093`. From version 1.219.0, `portRange` can be set to `9094/9094`, `9095/9095`.
// - `9092/9092`: The port range for access from virtual private clouds (VPCs) by using the default endpoint.
// - `9093/9093`: The port range for access from the Internet.
// - `9094/9094`: The port range for access from VPCs by using the Simple Authentication and Security Layer (SASL) endpoint.
// - `9095/9095`: The port range for access from VPCs by using the Secure Sockets Layer (SSL) endpoint.
func (o InstanceAllowedIpAttachmentOutput) PortRange() pulumi.StringOutput {
return o.ApplyT(func(v *InstanceAllowedIpAttachment) pulumi.StringOutput { return v.PortRange }).(pulumi.StringOutput)
}
type InstanceAllowedIpAttachmentArrayOutput struct{ *pulumi.OutputState }
func (InstanceAllowedIpAttachmentArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*InstanceAllowedIpAttachment)(nil)).Elem()
}
func (o InstanceAllowedIpAttachmentArrayOutput) ToInstanceAllowedIpAttachmentArrayOutput() InstanceAllowedIpAttachmentArrayOutput {
return o
}
func (o InstanceAllowedIpAttachmentArrayOutput) ToInstanceAllowedIpAttachmentArrayOutputWithContext(ctx context.Context) InstanceAllowedIpAttachmentArrayOutput {
return o
}
func (o InstanceAllowedIpAttachmentArrayOutput) Index(i pulumi.IntInput) InstanceAllowedIpAttachmentOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InstanceAllowedIpAttachment {
return vs[0].([]*InstanceAllowedIpAttachment)[vs[1].(int)]
}).(InstanceAllowedIpAttachmentOutput)
}
type InstanceAllowedIpAttachmentMapOutput struct{ *pulumi.OutputState }
func (InstanceAllowedIpAttachmentMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*InstanceAllowedIpAttachment)(nil)).Elem()
}
func (o InstanceAllowedIpAttachmentMapOutput) ToInstanceAllowedIpAttachmentMapOutput() InstanceAllowedIpAttachmentMapOutput {
return o
}
func (o InstanceAllowedIpAttachmentMapOutput) ToInstanceAllowedIpAttachmentMapOutputWithContext(ctx context.Context) InstanceAllowedIpAttachmentMapOutput {
return o
}
func (o InstanceAllowedIpAttachmentMapOutput) MapIndex(k pulumi.StringInput) InstanceAllowedIpAttachmentOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InstanceAllowedIpAttachment {
return vs[0].(map[string]*InstanceAllowedIpAttachment)[vs[1].(string)]
}).(InstanceAllowedIpAttachmentOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*InstanceAllowedIpAttachmentInput)(nil)).Elem(), &InstanceAllowedIpAttachment{})
pulumi.RegisterInputType(reflect.TypeOf((*InstanceAllowedIpAttachmentArrayInput)(nil)).Elem(), InstanceAllowedIpAttachmentArray{})
pulumi.RegisterInputType(reflect.TypeOf((*InstanceAllowedIpAttachmentMapInput)(nil)).Elem(), InstanceAllowedIpAttachmentMap{})
pulumi.RegisterOutputType(InstanceAllowedIpAttachmentOutput{})
pulumi.RegisterOutputType(InstanceAllowedIpAttachmentArrayOutput{})
pulumi.RegisterOutputType(InstanceAllowedIpAttachmentMapOutput{})
}