/
hostedTransitVirtualInterfaceAcceptor.go
352 lines (301 loc) · 17.3 KB
/
hostedTransitVirtualInterfaceAcceptor.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
// 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 directconnect
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a resource to manage the accepter's side of a Direct Connect hosted transit virtual interface.
// This resource accepts ownership of a transit virtual interface created by another AWS account.
//
// > **NOTE:** AWS allows a Direct Connect hosted transit virtual interface to be deleted from either the allocator's or accepter's side. However, this provider only allows the Direct Connect hosted transit virtual interface to be deleted from the allocator's side by removing the corresponding `directconnect.HostedTransitVirtualInterface` resource from your configuration. Removing a `directconnect.HostedTransitVirtualInterfaceAcceptor` resource from your configuration will remove it from your statefile and management, **but will not delete the Direct Connect virtual interface.**
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directconnect"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// accepter, err := aws.GetCallerIdentity(ctx, nil, nil)
// if err != nil {
// return err
// }
// // Accepter's side of the VIF.
// example, err := directconnect.NewGateway(ctx, "example", &directconnect.GatewayArgs{
// Name: pulumi.String("tf-dxg-example"),
// AmazonSideAsn: pulumi.String("64512"),
// })
// if err != nil {
// return err
// }
// // Creator's side of the VIF
// creator, err := directconnect.NewHostedTransitVirtualInterface(ctx, "creator", &directconnect.HostedTransitVirtualInterfaceArgs{
// ConnectionId: pulumi.String("dxcon-zzzzzzzz"),
// OwnerAccountId: pulumi.String(accepter.AccountId),
// Name: pulumi.String("tf-transit-vif-example"),
// Vlan: pulumi.Int(4094),
// AddressFamily: pulumi.String("ipv4"),
// BgpAsn: pulumi.Int(65352),
// }, pulumi.DependsOn([]pulumi.Resource{
// example,
// }))
// if err != nil {
// return err
// }
// _, err = directconnect.NewHostedTransitVirtualInterfaceAcceptor(ctx, "accepter", &directconnect.HostedTransitVirtualInterfaceAcceptorArgs{
// VirtualInterfaceId: creator.ID(),
// DxGatewayId: example.ID(),
// Tags: pulumi.StringMap{
// "Side": pulumi.String("Accepter"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import Direct Connect hosted transit virtual interfaces using the VIF `id`. For example:
//
// ```sh
// $ pulumi import aws:directconnect/hostedTransitVirtualInterfaceAcceptor:HostedTransitVirtualInterfaceAcceptor test dxvif-33cc44dd
// ```
type HostedTransitVirtualInterfaceAcceptor struct {
pulumi.CustomResourceState
// The ARN of the virtual interface.
Arn pulumi.StringOutput `pulumi:"arn"`
// The ID of the Direct Connect gateway to which to connect the virtual interface.
DxGatewayId pulumi.StringOutput `pulumi:"dxGatewayId"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
// The ID of the Direct Connect virtual interface to accept.
VirtualInterfaceId pulumi.StringOutput `pulumi:"virtualInterfaceId"`
}
// NewHostedTransitVirtualInterfaceAcceptor registers a new resource with the given unique name, arguments, and options.
func NewHostedTransitVirtualInterfaceAcceptor(ctx *pulumi.Context,
name string, args *HostedTransitVirtualInterfaceAcceptorArgs, opts ...pulumi.ResourceOption) (*HostedTransitVirtualInterfaceAcceptor, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DxGatewayId == nil {
return nil, errors.New("invalid value for required argument 'DxGatewayId'")
}
if args.VirtualInterfaceId == nil {
return nil, errors.New("invalid value for required argument 'VirtualInterfaceId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource HostedTransitVirtualInterfaceAcceptor
err := ctx.RegisterResource("aws:directconnect/hostedTransitVirtualInterfaceAcceptor:HostedTransitVirtualInterfaceAcceptor", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetHostedTransitVirtualInterfaceAcceptor gets an existing HostedTransitVirtualInterfaceAcceptor 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 GetHostedTransitVirtualInterfaceAcceptor(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *HostedTransitVirtualInterfaceAcceptorState, opts ...pulumi.ResourceOption) (*HostedTransitVirtualInterfaceAcceptor, error) {
var resource HostedTransitVirtualInterfaceAcceptor
err := ctx.ReadResource("aws:directconnect/hostedTransitVirtualInterfaceAcceptor:HostedTransitVirtualInterfaceAcceptor", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering HostedTransitVirtualInterfaceAcceptor resources.
type hostedTransitVirtualInterfaceAcceptorState struct {
// The ARN of the virtual interface.
Arn *string `pulumi:"arn"`
// The ID of the Direct Connect gateway to which to connect the virtual interface.
DxGatewayId *string `pulumi:"dxGatewayId"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll map[string]string `pulumi:"tagsAll"`
// The ID of the Direct Connect virtual interface to accept.
VirtualInterfaceId *string `pulumi:"virtualInterfaceId"`
}
type HostedTransitVirtualInterfaceAcceptorState struct {
// The ARN of the virtual interface.
Arn pulumi.StringPtrInput
// The ID of the Direct Connect gateway to which to connect the virtual interface.
DxGatewayId pulumi.StringPtrInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapInput
// The ID of the Direct Connect virtual interface to accept.
VirtualInterfaceId pulumi.StringPtrInput
}
func (HostedTransitVirtualInterfaceAcceptorState) ElementType() reflect.Type {
return reflect.TypeOf((*hostedTransitVirtualInterfaceAcceptorState)(nil)).Elem()
}
type hostedTransitVirtualInterfaceAcceptorArgs struct {
// The ID of the Direct Connect gateway to which to connect the virtual interface.
DxGatewayId string `pulumi:"dxGatewayId"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// The ID of the Direct Connect virtual interface to accept.
VirtualInterfaceId string `pulumi:"virtualInterfaceId"`
}
// The set of arguments for constructing a HostedTransitVirtualInterfaceAcceptor resource.
type HostedTransitVirtualInterfaceAcceptorArgs struct {
// The ID of the Direct Connect gateway to which to connect the virtual interface.
DxGatewayId pulumi.StringInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// The ID of the Direct Connect virtual interface to accept.
VirtualInterfaceId pulumi.StringInput
}
func (HostedTransitVirtualInterfaceAcceptorArgs) ElementType() reflect.Type {
return reflect.TypeOf((*hostedTransitVirtualInterfaceAcceptorArgs)(nil)).Elem()
}
type HostedTransitVirtualInterfaceAcceptorInput interface {
pulumi.Input
ToHostedTransitVirtualInterfaceAcceptorOutput() HostedTransitVirtualInterfaceAcceptorOutput
ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorOutput
}
func (*HostedTransitVirtualInterfaceAcceptor) ElementType() reflect.Type {
return reflect.TypeOf((**HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
}
func (i *HostedTransitVirtualInterfaceAcceptor) ToHostedTransitVirtualInterfaceAcceptorOutput() HostedTransitVirtualInterfaceAcceptorOutput {
return i.ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(context.Background())
}
func (i *HostedTransitVirtualInterfaceAcceptor) ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorOutput {
return pulumi.ToOutputWithContext(ctx, i).(HostedTransitVirtualInterfaceAcceptorOutput)
}
// HostedTransitVirtualInterfaceAcceptorArrayInput is an input type that accepts HostedTransitVirtualInterfaceAcceptorArray and HostedTransitVirtualInterfaceAcceptorArrayOutput values.
// You can construct a concrete instance of `HostedTransitVirtualInterfaceAcceptorArrayInput` via:
//
// HostedTransitVirtualInterfaceAcceptorArray{ HostedTransitVirtualInterfaceAcceptorArgs{...} }
type HostedTransitVirtualInterfaceAcceptorArrayInput interface {
pulumi.Input
ToHostedTransitVirtualInterfaceAcceptorArrayOutput() HostedTransitVirtualInterfaceAcceptorArrayOutput
ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(context.Context) HostedTransitVirtualInterfaceAcceptorArrayOutput
}
type HostedTransitVirtualInterfaceAcceptorArray []HostedTransitVirtualInterfaceAcceptorInput
func (HostedTransitVirtualInterfaceAcceptorArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
}
func (i HostedTransitVirtualInterfaceAcceptorArray) ToHostedTransitVirtualInterfaceAcceptorArrayOutput() HostedTransitVirtualInterfaceAcceptorArrayOutput {
return i.ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(context.Background())
}
func (i HostedTransitVirtualInterfaceAcceptorArray) ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(HostedTransitVirtualInterfaceAcceptorArrayOutput)
}
// HostedTransitVirtualInterfaceAcceptorMapInput is an input type that accepts HostedTransitVirtualInterfaceAcceptorMap and HostedTransitVirtualInterfaceAcceptorMapOutput values.
// You can construct a concrete instance of `HostedTransitVirtualInterfaceAcceptorMapInput` via:
//
// HostedTransitVirtualInterfaceAcceptorMap{ "key": HostedTransitVirtualInterfaceAcceptorArgs{...} }
type HostedTransitVirtualInterfaceAcceptorMapInput interface {
pulumi.Input
ToHostedTransitVirtualInterfaceAcceptorMapOutput() HostedTransitVirtualInterfaceAcceptorMapOutput
ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(context.Context) HostedTransitVirtualInterfaceAcceptorMapOutput
}
type HostedTransitVirtualInterfaceAcceptorMap map[string]HostedTransitVirtualInterfaceAcceptorInput
func (HostedTransitVirtualInterfaceAcceptorMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
}
func (i HostedTransitVirtualInterfaceAcceptorMap) ToHostedTransitVirtualInterfaceAcceptorMapOutput() HostedTransitVirtualInterfaceAcceptorMapOutput {
return i.ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(context.Background())
}
func (i HostedTransitVirtualInterfaceAcceptorMap) ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(HostedTransitVirtualInterfaceAcceptorMapOutput)
}
type HostedTransitVirtualInterfaceAcceptorOutput struct{ *pulumi.OutputState }
func (HostedTransitVirtualInterfaceAcceptorOutput) ElementType() reflect.Type {
return reflect.TypeOf((**HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
}
func (o HostedTransitVirtualInterfaceAcceptorOutput) ToHostedTransitVirtualInterfaceAcceptorOutput() HostedTransitVirtualInterfaceAcceptorOutput {
return o
}
func (o HostedTransitVirtualInterfaceAcceptorOutput) ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorOutput {
return o
}
// The ARN of the virtual interface.
func (o HostedTransitVirtualInterfaceAcceptorOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// The ID of the Direct Connect gateway to which to connect the virtual interface.
func (o HostedTransitVirtualInterfaceAcceptorOutput) DxGatewayId() pulumi.StringOutput {
return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringOutput { return v.DxGatewayId }).(pulumi.StringOutput)
}
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
func (o HostedTransitVirtualInterfaceAcceptorOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
func (o HostedTransitVirtualInterfaceAcceptorOutput) TagsAll() pulumi.StringMapOutput {
return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
}
// The ID of the Direct Connect virtual interface to accept.
func (o HostedTransitVirtualInterfaceAcceptorOutput) VirtualInterfaceId() pulumi.StringOutput {
return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringOutput { return v.VirtualInterfaceId }).(pulumi.StringOutput)
}
type HostedTransitVirtualInterfaceAcceptorArrayOutput struct{ *pulumi.OutputState }
func (HostedTransitVirtualInterfaceAcceptorArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
}
func (o HostedTransitVirtualInterfaceAcceptorArrayOutput) ToHostedTransitVirtualInterfaceAcceptorArrayOutput() HostedTransitVirtualInterfaceAcceptorArrayOutput {
return o
}
func (o HostedTransitVirtualInterfaceAcceptorArrayOutput) ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorArrayOutput {
return o
}
func (o HostedTransitVirtualInterfaceAcceptorArrayOutput) Index(i pulumi.IntInput) HostedTransitVirtualInterfaceAcceptorOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *HostedTransitVirtualInterfaceAcceptor {
return vs[0].([]*HostedTransitVirtualInterfaceAcceptor)[vs[1].(int)]
}).(HostedTransitVirtualInterfaceAcceptorOutput)
}
type HostedTransitVirtualInterfaceAcceptorMapOutput struct{ *pulumi.OutputState }
func (HostedTransitVirtualInterfaceAcceptorMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
}
func (o HostedTransitVirtualInterfaceAcceptorMapOutput) ToHostedTransitVirtualInterfaceAcceptorMapOutput() HostedTransitVirtualInterfaceAcceptorMapOutput {
return o
}
func (o HostedTransitVirtualInterfaceAcceptorMapOutput) ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorMapOutput {
return o
}
func (o HostedTransitVirtualInterfaceAcceptorMapOutput) MapIndex(k pulumi.StringInput) HostedTransitVirtualInterfaceAcceptorOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *HostedTransitVirtualInterfaceAcceptor {
return vs[0].(map[string]*HostedTransitVirtualInterfaceAcceptor)[vs[1].(string)]
}).(HostedTransitVirtualInterfaceAcceptorOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*HostedTransitVirtualInterfaceAcceptorInput)(nil)).Elem(), &HostedTransitVirtualInterfaceAcceptor{})
pulumi.RegisterInputType(reflect.TypeOf((*HostedTransitVirtualInterfaceAcceptorArrayInput)(nil)).Elem(), HostedTransitVirtualInterfaceAcceptorArray{})
pulumi.RegisterInputType(reflect.TypeOf((*HostedTransitVirtualInterfaceAcceptorMapInput)(nil)).Elem(), HostedTransitVirtualInterfaceAcceptorMap{})
pulumi.RegisterOutputType(HostedTransitVirtualInterfaceAcceptorOutput{})
pulumi.RegisterOutputType(HostedTransitVirtualInterfaceAcceptorArrayOutput{})
pulumi.RegisterOutputType(HostedTransitVirtualInterfaceAcceptorMapOutput{})
}