/
byoIpPrefix.go
305 lines (255 loc) · 11.3 KB
/
byoIpPrefix.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
// 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 cloudflare
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides the ability to manage Bring-Your-Own-IP prefixes (BYOIP)
// which are used with or without Magic Transit.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cloudflare.NewByoIpPrefix(ctx, "example", &cloudflare.ByoIpPrefixArgs{
// AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
// Advertisement: pulumi.String("on"),
// Description: pulumi.String("Example IP Prefix"),
// PrefixId: pulumi.String("d41d8cd98f00b204e9800998ecf8427e"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// ```sh
// $ pulumi import cloudflare:index/byoIpPrefix:ByoIpPrefix example <account_id>/<prefix_id>
// ```
type ByoIpPrefix struct {
pulumi.CustomResourceState
// The account identifier to target for the resource.
AccountId pulumi.StringOutput `pulumi:"accountId"`
// Whether or not the prefix shall be announced. A prefix can be activated or deactivated once every 15 minutes (attempting more regular updates will trigger rate limiting). Available values: `on`, `off`.
Advertisement pulumi.StringOutput `pulumi:"advertisement"`
// Description of the BYO IP prefix.
Description pulumi.StringOutput `pulumi:"description"`
// The assigned Bring-Your-Own-IP prefix ID. **Modifying this attribute will force creation of a new resource.**
PrefixId pulumi.StringOutput `pulumi:"prefixId"`
}
// NewByoIpPrefix registers a new resource with the given unique name, arguments, and options.
func NewByoIpPrefix(ctx *pulumi.Context,
name string, args *ByoIpPrefixArgs, opts ...pulumi.ResourceOption) (*ByoIpPrefix, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AccountId == nil {
return nil, errors.New("invalid value for required argument 'AccountId'")
}
if args.PrefixId == nil {
return nil, errors.New("invalid value for required argument 'PrefixId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ByoIpPrefix
err := ctx.RegisterResource("cloudflare:index/byoIpPrefix:ByoIpPrefix", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetByoIpPrefix gets an existing ByoIpPrefix 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 GetByoIpPrefix(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ByoIpPrefixState, opts ...pulumi.ResourceOption) (*ByoIpPrefix, error) {
var resource ByoIpPrefix
err := ctx.ReadResource("cloudflare:index/byoIpPrefix:ByoIpPrefix", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ByoIpPrefix resources.
type byoIpPrefixState struct {
// The account identifier to target for the resource.
AccountId *string `pulumi:"accountId"`
// Whether or not the prefix shall be announced. A prefix can be activated or deactivated once every 15 minutes (attempting more regular updates will trigger rate limiting). Available values: `on`, `off`.
Advertisement *string `pulumi:"advertisement"`
// Description of the BYO IP prefix.
Description *string `pulumi:"description"`
// The assigned Bring-Your-Own-IP prefix ID. **Modifying this attribute will force creation of a new resource.**
PrefixId *string `pulumi:"prefixId"`
}
type ByoIpPrefixState struct {
// The account identifier to target for the resource.
AccountId pulumi.StringPtrInput
// Whether or not the prefix shall be announced. A prefix can be activated or deactivated once every 15 minutes (attempting more regular updates will trigger rate limiting). Available values: `on`, `off`.
Advertisement pulumi.StringPtrInput
// Description of the BYO IP prefix.
Description pulumi.StringPtrInput
// The assigned Bring-Your-Own-IP prefix ID. **Modifying this attribute will force creation of a new resource.**
PrefixId pulumi.StringPtrInput
}
func (ByoIpPrefixState) ElementType() reflect.Type {
return reflect.TypeOf((*byoIpPrefixState)(nil)).Elem()
}
type byoIpPrefixArgs struct {
// The account identifier to target for the resource.
AccountId string `pulumi:"accountId"`
// Whether or not the prefix shall be announced. A prefix can be activated or deactivated once every 15 minutes (attempting more regular updates will trigger rate limiting). Available values: `on`, `off`.
Advertisement *string `pulumi:"advertisement"`
// Description of the BYO IP prefix.
Description *string `pulumi:"description"`
// The assigned Bring-Your-Own-IP prefix ID. **Modifying this attribute will force creation of a new resource.**
PrefixId string `pulumi:"prefixId"`
}
// The set of arguments for constructing a ByoIpPrefix resource.
type ByoIpPrefixArgs struct {
// The account identifier to target for the resource.
AccountId pulumi.StringInput
// Whether or not the prefix shall be announced. A prefix can be activated or deactivated once every 15 minutes (attempting more regular updates will trigger rate limiting). Available values: `on`, `off`.
Advertisement pulumi.StringPtrInput
// Description of the BYO IP prefix.
Description pulumi.StringPtrInput
// The assigned Bring-Your-Own-IP prefix ID. **Modifying this attribute will force creation of a new resource.**
PrefixId pulumi.StringInput
}
func (ByoIpPrefixArgs) ElementType() reflect.Type {
return reflect.TypeOf((*byoIpPrefixArgs)(nil)).Elem()
}
type ByoIpPrefixInput interface {
pulumi.Input
ToByoIpPrefixOutput() ByoIpPrefixOutput
ToByoIpPrefixOutputWithContext(ctx context.Context) ByoIpPrefixOutput
}
func (*ByoIpPrefix) ElementType() reflect.Type {
return reflect.TypeOf((**ByoIpPrefix)(nil)).Elem()
}
func (i *ByoIpPrefix) ToByoIpPrefixOutput() ByoIpPrefixOutput {
return i.ToByoIpPrefixOutputWithContext(context.Background())
}
func (i *ByoIpPrefix) ToByoIpPrefixOutputWithContext(ctx context.Context) ByoIpPrefixOutput {
return pulumi.ToOutputWithContext(ctx, i).(ByoIpPrefixOutput)
}
// ByoIpPrefixArrayInput is an input type that accepts ByoIpPrefixArray and ByoIpPrefixArrayOutput values.
// You can construct a concrete instance of `ByoIpPrefixArrayInput` via:
//
// ByoIpPrefixArray{ ByoIpPrefixArgs{...} }
type ByoIpPrefixArrayInput interface {
pulumi.Input
ToByoIpPrefixArrayOutput() ByoIpPrefixArrayOutput
ToByoIpPrefixArrayOutputWithContext(context.Context) ByoIpPrefixArrayOutput
}
type ByoIpPrefixArray []ByoIpPrefixInput
func (ByoIpPrefixArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ByoIpPrefix)(nil)).Elem()
}
func (i ByoIpPrefixArray) ToByoIpPrefixArrayOutput() ByoIpPrefixArrayOutput {
return i.ToByoIpPrefixArrayOutputWithContext(context.Background())
}
func (i ByoIpPrefixArray) ToByoIpPrefixArrayOutputWithContext(ctx context.Context) ByoIpPrefixArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ByoIpPrefixArrayOutput)
}
// ByoIpPrefixMapInput is an input type that accepts ByoIpPrefixMap and ByoIpPrefixMapOutput values.
// You can construct a concrete instance of `ByoIpPrefixMapInput` via:
//
// ByoIpPrefixMap{ "key": ByoIpPrefixArgs{...} }
type ByoIpPrefixMapInput interface {
pulumi.Input
ToByoIpPrefixMapOutput() ByoIpPrefixMapOutput
ToByoIpPrefixMapOutputWithContext(context.Context) ByoIpPrefixMapOutput
}
type ByoIpPrefixMap map[string]ByoIpPrefixInput
func (ByoIpPrefixMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ByoIpPrefix)(nil)).Elem()
}
func (i ByoIpPrefixMap) ToByoIpPrefixMapOutput() ByoIpPrefixMapOutput {
return i.ToByoIpPrefixMapOutputWithContext(context.Background())
}
func (i ByoIpPrefixMap) ToByoIpPrefixMapOutputWithContext(ctx context.Context) ByoIpPrefixMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ByoIpPrefixMapOutput)
}
type ByoIpPrefixOutput struct{ *pulumi.OutputState }
func (ByoIpPrefixOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ByoIpPrefix)(nil)).Elem()
}
func (o ByoIpPrefixOutput) ToByoIpPrefixOutput() ByoIpPrefixOutput {
return o
}
func (o ByoIpPrefixOutput) ToByoIpPrefixOutputWithContext(ctx context.Context) ByoIpPrefixOutput {
return o
}
// The account identifier to target for the resource.
func (o ByoIpPrefixOutput) AccountId() pulumi.StringOutput {
return o.ApplyT(func(v *ByoIpPrefix) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput)
}
// Whether or not the prefix shall be announced. A prefix can be activated or deactivated once every 15 minutes (attempting more regular updates will trigger rate limiting). Available values: `on`, `off`.
func (o ByoIpPrefixOutput) Advertisement() pulumi.StringOutput {
return o.ApplyT(func(v *ByoIpPrefix) pulumi.StringOutput { return v.Advertisement }).(pulumi.StringOutput)
}
// Description of the BYO IP prefix.
func (o ByoIpPrefixOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *ByoIpPrefix) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// The assigned Bring-Your-Own-IP prefix ID. **Modifying this attribute will force creation of a new resource.**
func (o ByoIpPrefixOutput) PrefixId() pulumi.StringOutput {
return o.ApplyT(func(v *ByoIpPrefix) pulumi.StringOutput { return v.PrefixId }).(pulumi.StringOutput)
}
type ByoIpPrefixArrayOutput struct{ *pulumi.OutputState }
func (ByoIpPrefixArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ByoIpPrefix)(nil)).Elem()
}
func (o ByoIpPrefixArrayOutput) ToByoIpPrefixArrayOutput() ByoIpPrefixArrayOutput {
return o
}
func (o ByoIpPrefixArrayOutput) ToByoIpPrefixArrayOutputWithContext(ctx context.Context) ByoIpPrefixArrayOutput {
return o
}
func (o ByoIpPrefixArrayOutput) Index(i pulumi.IntInput) ByoIpPrefixOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ByoIpPrefix {
return vs[0].([]*ByoIpPrefix)[vs[1].(int)]
}).(ByoIpPrefixOutput)
}
type ByoIpPrefixMapOutput struct{ *pulumi.OutputState }
func (ByoIpPrefixMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ByoIpPrefix)(nil)).Elem()
}
func (o ByoIpPrefixMapOutput) ToByoIpPrefixMapOutput() ByoIpPrefixMapOutput {
return o
}
func (o ByoIpPrefixMapOutput) ToByoIpPrefixMapOutputWithContext(ctx context.Context) ByoIpPrefixMapOutput {
return o
}
func (o ByoIpPrefixMapOutput) MapIndex(k pulumi.StringInput) ByoIpPrefixOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ByoIpPrefix {
return vs[0].(map[string]*ByoIpPrefix)[vs[1].(string)]
}).(ByoIpPrefixOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ByoIpPrefixInput)(nil)).Elem(), &ByoIpPrefix{})
pulumi.RegisterInputType(reflect.TypeOf((*ByoIpPrefixArrayInput)(nil)).Elem(), ByoIpPrefixArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ByoIpPrefixMapInput)(nil)).Elem(), ByoIpPrefixMap{})
pulumi.RegisterOutputType(ByoIpPrefixOutput{})
pulumi.RegisterOutputType(ByoIpPrefixArrayOutput{})
pulumi.RegisterOutputType(ByoIpPrefixMapOutput{})
}