/
managedPrefixList.go
387 lines (326 loc) · 14.2 KB
/
managedPrefixList.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
// *** 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 ec2
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a managed prefix list resource.
//
// > **NOTE on `maxEntries`:** When you reference a Prefix List in a resource,
// the maximum number of entries for the prefix lists counts as the same number of rules
// or entries for the resource. For example, if you create a prefix list with a maximum
// of 20 entries and you reference that prefix list in a security group rule, this counts
// as 20 rules for the security group.
//
// ## Example Usage
//
// Basic usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ec2.NewManagedPrefixList(ctx, "example", &ec2.ManagedPrefixListArgs{
// AddressFamily: pulumi.String("IPv4"),
// MaxEntries: pulumi.Int(5),
// Entries: ec2.ManagedPrefixListEntryArray{
// &ec2.ManagedPrefixListEntryArgs{
// Cidr: pulumi.Any(aws_vpc.Example.Cidr_block),
// Description: pulumi.String("Primary"),
// },
// &ec2.ManagedPrefixListEntryArgs{
// Cidr: pulumi.Any(aws_vpc_ipv4_cidr_block_association.Example.Cidr_block),
// Description: pulumi.String("Secondary"),
// },
// },
// Tags: pulumi.StringMap{
// "Env": pulumi.String("live"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Prefix Lists can be imported using the `id`, e.g.
//
// ```sh
// $ pulumi import aws:ec2/managedPrefixList:ManagedPrefixList default pl-0570a1d2d725c16be
// ```
type ManagedPrefixList struct {
pulumi.CustomResourceState
// Address family (`IPv4` or `IPv6`) of this prefix list.
AddressFamily pulumi.StringOutput `pulumi:"addressFamily"`
// ARN of the prefix list.
Arn pulumi.StringOutput `pulumi:"arn"`
// Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated.
Entries ManagedPrefixListEntryArrayOutput `pulumi:"entries"`
// Maximum number of entries that this prefix list can contain.
MaxEntries pulumi.IntOutput `pulumi:"maxEntries"`
// Name of this resource. The name must not start with `com.amazonaws`.
Name pulumi.StringOutput `pulumi:"name"`
// ID of the AWS account that owns this prefix list.
OwnerId pulumi.StringOutput `pulumi:"ownerId"`
Tags pulumi.StringMapOutput `pulumi:"tags"`
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
// Latest version of this prefix list.
Version pulumi.IntOutput `pulumi:"version"`
}
// NewManagedPrefixList registers a new resource with the given unique name, arguments, and options.
func NewManagedPrefixList(ctx *pulumi.Context,
name string, args *ManagedPrefixListArgs, opts ...pulumi.ResourceOption) (*ManagedPrefixList, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AddressFamily == nil {
return nil, errors.New("invalid value for required argument 'AddressFamily'")
}
if args.MaxEntries == nil {
return nil, errors.New("invalid value for required argument 'MaxEntries'")
}
var resource ManagedPrefixList
err := ctx.RegisterResource("aws:ec2/managedPrefixList:ManagedPrefixList", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetManagedPrefixList gets an existing ManagedPrefixList 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 GetManagedPrefixList(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ManagedPrefixListState, opts ...pulumi.ResourceOption) (*ManagedPrefixList, error) {
var resource ManagedPrefixList
err := ctx.ReadResource("aws:ec2/managedPrefixList:ManagedPrefixList", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ManagedPrefixList resources.
type managedPrefixListState struct {
// Address family (`IPv4` or `IPv6`) of this prefix list.
AddressFamily *string `pulumi:"addressFamily"`
// ARN of the prefix list.
Arn *string `pulumi:"arn"`
// Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated.
Entries []ManagedPrefixListEntry `pulumi:"entries"`
// Maximum number of entries that this prefix list can contain.
MaxEntries *int `pulumi:"maxEntries"`
// Name of this resource. The name must not start with `com.amazonaws`.
Name *string `pulumi:"name"`
// ID of the AWS account that owns this prefix list.
OwnerId *string `pulumi:"ownerId"`
Tags map[string]string `pulumi:"tags"`
TagsAll map[string]string `pulumi:"tagsAll"`
// Latest version of this prefix list.
Version *int `pulumi:"version"`
}
type ManagedPrefixListState struct {
// Address family (`IPv4` or `IPv6`) of this prefix list.
AddressFamily pulumi.StringPtrInput
// ARN of the prefix list.
Arn pulumi.StringPtrInput
// Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated.
Entries ManagedPrefixListEntryArrayInput
// Maximum number of entries that this prefix list can contain.
MaxEntries pulumi.IntPtrInput
// Name of this resource. The name must not start with `com.amazonaws`.
Name pulumi.StringPtrInput
// ID of the AWS account that owns this prefix list.
OwnerId pulumi.StringPtrInput
Tags pulumi.StringMapInput
TagsAll pulumi.StringMapInput
// Latest version of this prefix list.
Version pulumi.IntPtrInput
}
func (ManagedPrefixListState) ElementType() reflect.Type {
return reflect.TypeOf((*managedPrefixListState)(nil)).Elem()
}
type managedPrefixListArgs struct {
// Address family (`IPv4` or `IPv6`) of this prefix list.
AddressFamily string `pulumi:"addressFamily"`
// Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated.
Entries []ManagedPrefixListEntry `pulumi:"entries"`
// Maximum number of entries that this prefix list can contain.
MaxEntries int `pulumi:"maxEntries"`
// Name of this resource. The name must not start with `com.amazonaws`.
Name *string `pulumi:"name"`
Tags map[string]string `pulumi:"tags"`
TagsAll map[string]string `pulumi:"tagsAll"`
}
// The set of arguments for constructing a ManagedPrefixList resource.
type ManagedPrefixListArgs struct {
// Address family (`IPv4` or `IPv6`) of this prefix list.
AddressFamily pulumi.StringInput
// Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated.
Entries ManagedPrefixListEntryArrayInput
// Maximum number of entries that this prefix list can contain.
MaxEntries pulumi.IntInput
// Name of this resource. The name must not start with `com.amazonaws`.
Name pulumi.StringPtrInput
Tags pulumi.StringMapInput
TagsAll pulumi.StringMapInput
}
func (ManagedPrefixListArgs) ElementType() reflect.Type {
return reflect.TypeOf((*managedPrefixListArgs)(nil)).Elem()
}
type ManagedPrefixListInput interface {
pulumi.Input
ToManagedPrefixListOutput() ManagedPrefixListOutput
ToManagedPrefixListOutputWithContext(ctx context.Context) ManagedPrefixListOutput
}
func (*ManagedPrefixList) ElementType() reflect.Type {
return reflect.TypeOf((*ManagedPrefixList)(nil))
}
func (i *ManagedPrefixList) ToManagedPrefixListOutput() ManagedPrefixListOutput {
return i.ToManagedPrefixListOutputWithContext(context.Background())
}
func (i *ManagedPrefixList) ToManagedPrefixListOutputWithContext(ctx context.Context) ManagedPrefixListOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListOutput)
}
func (i *ManagedPrefixList) ToManagedPrefixListPtrOutput() ManagedPrefixListPtrOutput {
return i.ToManagedPrefixListPtrOutputWithContext(context.Background())
}
func (i *ManagedPrefixList) ToManagedPrefixListPtrOutputWithContext(ctx context.Context) ManagedPrefixListPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListPtrOutput)
}
type ManagedPrefixListPtrInput interface {
pulumi.Input
ToManagedPrefixListPtrOutput() ManagedPrefixListPtrOutput
ToManagedPrefixListPtrOutputWithContext(ctx context.Context) ManagedPrefixListPtrOutput
}
type managedPrefixListPtrType ManagedPrefixListArgs
func (*managedPrefixListPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**ManagedPrefixList)(nil))
}
func (i *managedPrefixListPtrType) ToManagedPrefixListPtrOutput() ManagedPrefixListPtrOutput {
return i.ToManagedPrefixListPtrOutputWithContext(context.Background())
}
func (i *managedPrefixListPtrType) ToManagedPrefixListPtrOutputWithContext(ctx context.Context) ManagedPrefixListPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListPtrOutput)
}
// ManagedPrefixListArrayInput is an input type that accepts ManagedPrefixListArray and ManagedPrefixListArrayOutput values.
// You can construct a concrete instance of `ManagedPrefixListArrayInput` via:
//
// ManagedPrefixListArray{ ManagedPrefixListArgs{...} }
type ManagedPrefixListArrayInput interface {
pulumi.Input
ToManagedPrefixListArrayOutput() ManagedPrefixListArrayOutput
ToManagedPrefixListArrayOutputWithContext(context.Context) ManagedPrefixListArrayOutput
}
type ManagedPrefixListArray []ManagedPrefixListInput
func (ManagedPrefixListArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ManagedPrefixList)(nil)).Elem()
}
func (i ManagedPrefixListArray) ToManagedPrefixListArrayOutput() ManagedPrefixListArrayOutput {
return i.ToManagedPrefixListArrayOutputWithContext(context.Background())
}
func (i ManagedPrefixListArray) ToManagedPrefixListArrayOutputWithContext(ctx context.Context) ManagedPrefixListArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListArrayOutput)
}
// ManagedPrefixListMapInput is an input type that accepts ManagedPrefixListMap and ManagedPrefixListMapOutput values.
// You can construct a concrete instance of `ManagedPrefixListMapInput` via:
//
// ManagedPrefixListMap{ "key": ManagedPrefixListArgs{...} }
type ManagedPrefixListMapInput interface {
pulumi.Input
ToManagedPrefixListMapOutput() ManagedPrefixListMapOutput
ToManagedPrefixListMapOutputWithContext(context.Context) ManagedPrefixListMapOutput
}
type ManagedPrefixListMap map[string]ManagedPrefixListInput
func (ManagedPrefixListMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ManagedPrefixList)(nil)).Elem()
}
func (i ManagedPrefixListMap) ToManagedPrefixListMapOutput() ManagedPrefixListMapOutput {
return i.ToManagedPrefixListMapOutputWithContext(context.Background())
}
func (i ManagedPrefixListMap) ToManagedPrefixListMapOutputWithContext(ctx context.Context) ManagedPrefixListMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListMapOutput)
}
type ManagedPrefixListOutput struct{ *pulumi.OutputState }
func (ManagedPrefixListOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ManagedPrefixList)(nil))
}
func (o ManagedPrefixListOutput) ToManagedPrefixListOutput() ManagedPrefixListOutput {
return o
}
func (o ManagedPrefixListOutput) ToManagedPrefixListOutputWithContext(ctx context.Context) ManagedPrefixListOutput {
return o
}
func (o ManagedPrefixListOutput) ToManagedPrefixListPtrOutput() ManagedPrefixListPtrOutput {
return o.ToManagedPrefixListPtrOutputWithContext(context.Background())
}
func (o ManagedPrefixListOutput) ToManagedPrefixListPtrOutputWithContext(ctx context.Context) ManagedPrefixListPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v ManagedPrefixList) *ManagedPrefixList {
return &v
}).(ManagedPrefixListPtrOutput)
}
type ManagedPrefixListPtrOutput struct{ *pulumi.OutputState }
func (ManagedPrefixListPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ManagedPrefixList)(nil))
}
func (o ManagedPrefixListPtrOutput) ToManagedPrefixListPtrOutput() ManagedPrefixListPtrOutput {
return o
}
func (o ManagedPrefixListPtrOutput) ToManagedPrefixListPtrOutputWithContext(ctx context.Context) ManagedPrefixListPtrOutput {
return o
}
func (o ManagedPrefixListPtrOutput) Elem() ManagedPrefixListOutput {
return o.ApplyT(func(v *ManagedPrefixList) ManagedPrefixList {
if v != nil {
return *v
}
var ret ManagedPrefixList
return ret
}).(ManagedPrefixListOutput)
}
type ManagedPrefixListArrayOutput struct{ *pulumi.OutputState }
func (ManagedPrefixListArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]ManagedPrefixList)(nil))
}
func (o ManagedPrefixListArrayOutput) ToManagedPrefixListArrayOutput() ManagedPrefixListArrayOutput {
return o
}
func (o ManagedPrefixListArrayOutput) ToManagedPrefixListArrayOutputWithContext(ctx context.Context) ManagedPrefixListArrayOutput {
return o
}
func (o ManagedPrefixListArrayOutput) Index(i pulumi.IntInput) ManagedPrefixListOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) ManagedPrefixList {
return vs[0].([]ManagedPrefixList)[vs[1].(int)]
}).(ManagedPrefixListOutput)
}
type ManagedPrefixListMapOutput struct{ *pulumi.OutputState }
func (ManagedPrefixListMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]ManagedPrefixList)(nil))
}
func (o ManagedPrefixListMapOutput) ToManagedPrefixListMapOutput() ManagedPrefixListMapOutput {
return o
}
func (o ManagedPrefixListMapOutput) ToManagedPrefixListMapOutputWithContext(ctx context.Context) ManagedPrefixListMapOutput {
return o
}
func (o ManagedPrefixListMapOutput) MapIndex(k pulumi.StringInput) ManagedPrefixListOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) ManagedPrefixList {
return vs[0].(map[string]ManagedPrefixList)[vs[1].(string)]
}).(ManagedPrefixListOutput)
}
func init() {
pulumi.RegisterOutputType(ManagedPrefixListOutput{})
pulumi.RegisterOutputType(ManagedPrefixListPtrOutput{})
pulumi.RegisterOutputType(ManagedPrefixListArrayOutput{})
pulumi.RegisterOutputType(ManagedPrefixListMapOutput{})
}