github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directconnect/hostedTransitVirtualInterfaceAcceptor.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package directconnect
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a resource to manage the accepter's side of a Direct Connect hosted transit virtual interface.
    16  // This resource accepts ownership of a transit virtual interface created by another AWS account.
    17  //
    18  // > **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.**
    19  //
    20  // ## Example Usage
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directconnect"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			accepter, err := aws.GetCallerIdentity(ctx, nil, nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			// Accepter's side of the VIF.
    41  //			example, err := directconnect.NewGateway(ctx, "example", &directconnect.GatewayArgs{
    42  //				Name:          pulumi.String("tf-dxg-example"),
    43  //				AmazonSideAsn: pulumi.String("64512"),
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			// Creator's side of the VIF
    49  //			creator, err := directconnect.NewHostedTransitVirtualInterface(ctx, "creator", &directconnect.HostedTransitVirtualInterfaceArgs{
    50  //				ConnectionId:   pulumi.String("dxcon-zzzzzzzz"),
    51  //				OwnerAccountId: pulumi.String(accepter.AccountId),
    52  //				Name:           pulumi.String("tf-transit-vif-example"),
    53  //				Vlan:           pulumi.Int(4094),
    54  //				AddressFamily:  pulumi.String("ipv4"),
    55  //				BgpAsn:         pulumi.Int(65352),
    56  //			}, pulumi.DependsOn([]pulumi.Resource{
    57  //				example,
    58  //			}))
    59  //			if err != nil {
    60  //				return err
    61  //			}
    62  //			_, err = directconnect.NewHostedTransitVirtualInterfaceAcceptor(ctx, "accepter", &directconnect.HostedTransitVirtualInterfaceAcceptorArgs{
    63  //				VirtualInterfaceId: creator.ID(),
    64  //				DxGatewayId:        example.ID(),
    65  //				Tags: pulumi.StringMap{
    66  //					"Side": pulumi.String("Accepter"),
    67  //				},
    68  //			})
    69  //			if err != nil {
    70  //				return err
    71  //			}
    72  //			return nil
    73  //		})
    74  //	}
    75  //
    76  // ```
    77  // <!--End PulumiCodeChooser -->
    78  //
    79  // ## Import
    80  //
    81  // Using `pulumi import`, import Direct Connect hosted transit virtual interfaces using the VIF `id`. For example:
    82  //
    83  // ```sh
    84  // $ pulumi import aws:directconnect/hostedTransitVirtualInterfaceAcceptor:HostedTransitVirtualInterfaceAcceptor test dxvif-33cc44dd
    85  // ```
    86  type HostedTransitVirtualInterfaceAcceptor struct {
    87  	pulumi.CustomResourceState
    88  
    89  	// The ARN of the virtual interface.
    90  	Arn pulumi.StringOutput `pulumi:"arn"`
    91  	// The ID of the Direct Connect gateway to which to connect the virtual interface.
    92  	DxGatewayId pulumi.StringOutput `pulumi:"dxGatewayId"`
    93  	// 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.
    94  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    95  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    96  	//
    97  	// Deprecated: Please use `tags` instead.
    98  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    99  	// The ID of the Direct Connect virtual interface to accept.
   100  	VirtualInterfaceId pulumi.StringOutput `pulumi:"virtualInterfaceId"`
   101  }
   102  
   103  // NewHostedTransitVirtualInterfaceAcceptor registers a new resource with the given unique name, arguments, and options.
   104  func NewHostedTransitVirtualInterfaceAcceptor(ctx *pulumi.Context,
   105  	name string, args *HostedTransitVirtualInterfaceAcceptorArgs, opts ...pulumi.ResourceOption) (*HostedTransitVirtualInterfaceAcceptor, error) {
   106  	if args == nil {
   107  		return nil, errors.New("missing one or more required arguments")
   108  	}
   109  
   110  	if args.DxGatewayId == nil {
   111  		return nil, errors.New("invalid value for required argument 'DxGatewayId'")
   112  	}
   113  	if args.VirtualInterfaceId == nil {
   114  		return nil, errors.New("invalid value for required argument 'VirtualInterfaceId'")
   115  	}
   116  	opts = internal.PkgResourceDefaultOpts(opts)
   117  	var resource HostedTransitVirtualInterfaceAcceptor
   118  	err := ctx.RegisterResource("aws:directconnect/hostedTransitVirtualInterfaceAcceptor:HostedTransitVirtualInterfaceAcceptor", name, args, &resource, opts...)
   119  	if err != nil {
   120  		return nil, err
   121  	}
   122  	return &resource, nil
   123  }
   124  
   125  // GetHostedTransitVirtualInterfaceAcceptor gets an existing HostedTransitVirtualInterfaceAcceptor resource's state with the given name, ID, and optional
   126  // state properties that are used to uniquely qualify the lookup (nil if not required).
   127  func GetHostedTransitVirtualInterfaceAcceptor(ctx *pulumi.Context,
   128  	name string, id pulumi.IDInput, state *HostedTransitVirtualInterfaceAcceptorState, opts ...pulumi.ResourceOption) (*HostedTransitVirtualInterfaceAcceptor, error) {
   129  	var resource HostedTransitVirtualInterfaceAcceptor
   130  	err := ctx.ReadResource("aws:directconnect/hostedTransitVirtualInterfaceAcceptor:HostedTransitVirtualInterfaceAcceptor", name, id, state, &resource, opts...)
   131  	if err != nil {
   132  		return nil, err
   133  	}
   134  	return &resource, nil
   135  }
   136  
   137  // Input properties used for looking up and filtering HostedTransitVirtualInterfaceAcceptor resources.
   138  type hostedTransitVirtualInterfaceAcceptorState struct {
   139  	// The ARN of the virtual interface.
   140  	Arn *string `pulumi:"arn"`
   141  	// The ID of the Direct Connect gateway to which to connect the virtual interface.
   142  	DxGatewayId *string `pulumi:"dxGatewayId"`
   143  	// 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.
   144  	Tags map[string]string `pulumi:"tags"`
   145  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   146  	//
   147  	// Deprecated: Please use `tags` instead.
   148  	TagsAll map[string]string `pulumi:"tagsAll"`
   149  	// The ID of the Direct Connect virtual interface to accept.
   150  	VirtualInterfaceId *string `pulumi:"virtualInterfaceId"`
   151  }
   152  
   153  type HostedTransitVirtualInterfaceAcceptorState struct {
   154  	// The ARN of the virtual interface.
   155  	Arn pulumi.StringPtrInput
   156  	// The ID of the Direct Connect gateway to which to connect the virtual interface.
   157  	DxGatewayId pulumi.StringPtrInput
   158  	// 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.
   159  	Tags pulumi.StringMapInput
   160  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   161  	//
   162  	// Deprecated: Please use `tags` instead.
   163  	TagsAll pulumi.StringMapInput
   164  	// The ID of the Direct Connect virtual interface to accept.
   165  	VirtualInterfaceId pulumi.StringPtrInput
   166  }
   167  
   168  func (HostedTransitVirtualInterfaceAcceptorState) ElementType() reflect.Type {
   169  	return reflect.TypeOf((*hostedTransitVirtualInterfaceAcceptorState)(nil)).Elem()
   170  }
   171  
   172  type hostedTransitVirtualInterfaceAcceptorArgs struct {
   173  	// The ID of the Direct Connect gateway to which to connect the virtual interface.
   174  	DxGatewayId string `pulumi:"dxGatewayId"`
   175  	// 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.
   176  	Tags map[string]string `pulumi:"tags"`
   177  	// The ID of the Direct Connect virtual interface to accept.
   178  	VirtualInterfaceId string `pulumi:"virtualInterfaceId"`
   179  }
   180  
   181  // The set of arguments for constructing a HostedTransitVirtualInterfaceAcceptor resource.
   182  type HostedTransitVirtualInterfaceAcceptorArgs struct {
   183  	// The ID of the Direct Connect gateway to which to connect the virtual interface.
   184  	DxGatewayId pulumi.StringInput
   185  	// 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.
   186  	Tags pulumi.StringMapInput
   187  	// The ID of the Direct Connect virtual interface to accept.
   188  	VirtualInterfaceId pulumi.StringInput
   189  }
   190  
   191  func (HostedTransitVirtualInterfaceAcceptorArgs) ElementType() reflect.Type {
   192  	return reflect.TypeOf((*hostedTransitVirtualInterfaceAcceptorArgs)(nil)).Elem()
   193  }
   194  
   195  type HostedTransitVirtualInterfaceAcceptorInput interface {
   196  	pulumi.Input
   197  
   198  	ToHostedTransitVirtualInterfaceAcceptorOutput() HostedTransitVirtualInterfaceAcceptorOutput
   199  	ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorOutput
   200  }
   201  
   202  func (*HostedTransitVirtualInterfaceAcceptor) ElementType() reflect.Type {
   203  	return reflect.TypeOf((**HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
   204  }
   205  
   206  func (i *HostedTransitVirtualInterfaceAcceptor) ToHostedTransitVirtualInterfaceAcceptorOutput() HostedTransitVirtualInterfaceAcceptorOutput {
   207  	return i.ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(context.Background())
   208  }
   209  
   210  func (i *HostedTransitVirtualInterfaceAcceptor) ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(HostedTransitVirtualInterfaceAcceptorOutput)
   212  }
   213  
   214  // HostedTransitVirtualInterfaceAcceptorArrayInput is an input type that accepts HostedTransitVirtualInterfaceAcceptorArray and HostedTransitVirtualInterfaceAcceptorArrayOutput values.
   215  // You can construct a concrete instance of `HostedTransitVirtualInterfaceAcceptorArrayInput` via:
   216  //
   217  //	HostedTransitVirtualInterfaceAcceptorArray{ HostedTransitVirtualInterfaceAcceptorArgs{...} }
   218  type HostedTransitVirtualInterfaceAcceptorArrayInput interface {
   219  	pulumi.Input
   220  
   221  	ToHostedTransitVirtualInterfaceAcceptorArrayOutput() HostedTransitVirtualInterfaceAcceptorArrayOutput
   222  	ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(context.Context) HostedTransitVirtualInterfaceAcceptorArrayOutput
   223  }
   224  
   225  type HostedTransitVirtualInterfaceAcceptorArray []HostedTransitVirtualInterfaceAcceptorInput
   226  
   227  func (HostedTransitVirtualInterfaceAcceptorArray) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*[]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
   229  }
   230  
   231  func (i HostedTransitVirtualInterfaceAcceptorArray) ToHostedTransitVirtualInterfaceAcceptorArrayOutput() HostedTransitVirtualInterfaceAcceptorArrayOutput {
   232  	return i.ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(context.Background())
   233  }
   234  
   235  func (i HostedTransitVirtualInterfaceAcceptorArray) ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorArrayOutput {
   236  	return pulumi.ToOutputWithContext(ctx, i).(HostedTransitVirtualInterfaceAcceptorArrayOutput)
   237  }
   238  
   239  // HostedTransitVirtualInterfaceAcceptorMapInput is an input type that accepts HostedTransitVirtualInterfaceAcceptorMap and HostedTransitVirtualInterfaceAcceptorMapOutput values.
   240  // You can construct a concrete instance of `HostedTransitVirtualInterfaceAcceptorMapInput` via:
   241  //
   242  //	HostedTransitVirtualInterfaceAcceptorMap{ "key": HostedTransitVirtualInterfaceAcceptorArgs{...} }
   243  type HostedTransitVirtualInterfaceAcceptorMapInput interface {
   244  	pulumi.Input
   245  
   246  	ToHostedTransitVirtualInterfaceAcceptorMapOutput() HostedTransitVirtualInterfaceAcceptorMapOutput
   247  	ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(context.Context) HostedTransitVirtualInterfaceAcceptorMapOutput
   248  }
   249  
   250  type HostedTransitVirtualInterfaceAcceptorMap map[string]HostedTransitVirtualInterfaceAcceptorInput
   251  
   252  func (HostedTransitVirtualInterfaceAcceptorMap) ElementType() reflect.Type {
   253  	return reflect.TypeOf((*map[string]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
   254  }
   255  
   256  func (i HostedTransitVirtualInterfaceAcceptorMap) ToHostedTransitVirtualInterfaceAcceptorMapOutput() HostedTransitVirtualInterfaceAcceptorMapOutput {
   257  	return i.ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(context.Background())
   258  }
   259  
   260  func (i HostedTransitVirtualInterfaceAcceptorMap) ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorMapOutput {
   261  	return pulumi.ToOutputWithContext(ctx, i).(HostedTransitVirtualInterfaceAcceptorMapOutput)
   262  }
   263  
   264  type HostedTransitVirtualInterfaceAcceptorOutput struct{ *pulumi.OutputState }
   265  
   266  func (HostedTransitVirtualInterfaceAcceptorOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((**HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
   268  }
   269  
   270  func (o HostedTransitVirtualInterfaceAcceptorOutput) ToHostedTransitVirtualInterfaceAcceptorOutput() HostedTransitVirtualInterfaceAcceptorOutput {
   271  	return o
   272  }
   273  
   274  func (o HostedTransitVirtualInterfaceAcceptorOutput) ToHostedTransitVirtualInterfaceAcceptorOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorOutput {
   275  	return o
   276  }
   277  
   278  // The ARN of the virtual interface.
   279  func (o HostedTransitVirtualInterfaceAcceptorOutput) Arn() pulumi.StringOutput {
   280  	return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   281  }
   282  
   283  // The ID of the Direct Connect gateway to which to connect the virtual interface.
   284  func (o HostedTransitVirtualInterfaceAcceptorOutput) DxGatewayId() pulumi.StringOutput {
   285  	return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringOutput { return v.DxGatewayId }).(pulumi.StringOutput)
   286  }
   287  
   288  // 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.
   289  func (o HostedTransitVirtualInterfaceAcceptorOutput) Tags() pulumi.StringMapOutput {
   290  	return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   291  }
   292  
   293  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   294  //
   295  // Deprecated: Please use `tags` instead.
   296  func (o HostedTransitVirtualInterfaceAcceptorOutput) TagsAll() pulumi.StringMapOutput {
   297  	return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   298  }
   299  
   300  // The ID of the Direct Connect virtual interface to accept.
   301  func (o HostedTransitVirtualInterfaceAcceptorOutput) VirtualInterfaceId() pulumi.StringOutput {
   302  	return o.ApplyT(func(v *HostedTransitVirtualInterfaceAcceptor) pulumi.StringOutput { return v.VirtualInterfaceId }).(pulumi.StringOutput)
   303  }
   304  
   305  type HostedTransitVirtualInterfaceAcceptorArrayOutput struct{ *pulumi.OutputState }
   306  
   307  func (HostedTransitVirtualInterfaceAcceptorArrayOutput) ElementType() reflect.Type {
   308  	return reflect.TypeOf((*[]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
   309  }
   310  
   311  func (o HostedTransitVirtualInterfaceAcceptorArrayOutput) ToHostedTransitVirtualInterfaceAcceptorArrayOutput() HostedTransitVirtualInterfaceAcceptorArrayOutput {
   312  	return o
   313  }
   314  
   315  func (o HostedTransitVirtualInterfaceAcceptorArrayOutput) ToHostedTransitVirtualInterfaceAcceptorArrayOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorArrayOutput {
   316  	return o
   317  }
   318  
   319  func (o HostedTransitVirtualInterfaceAcceptorArrayOutput) Index(i pulumi.IntInput) HostedTransitVirtualInterfaceAcceptorOutput {
   320  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *HostedTransitVirtualInterfaceAcceptor {
   321  		return vs[0].([]*HostedTransitVirtualInterfaceAcceptor)[vs[1].(int)]
   322  	}).(HostedTransitVirtualInterfaceAcceptorOutput)
   323  }
   324  
   325  type HostedTransitVirtualInterfaceAcceptorMapOutput struct{ *pulumi.OutputState }
   326  
   327  func (HostedTransitVirtualInterfaceAcceptorMapOutput) ElementType() reflect.Type {
   328  	return reflect.TypeOf((*map[string]*HostedTransitVirtualInterfaceAcceptor)(nil)).Elem()
   329  }
   330  
   331  func (o HostedTransitVirtualInterfaceAcceptorMapOutput) ToHostedTransitVirtualInterfaceAcceptorMapOutput() HostedTransitVirtualInterfaceAcceptorMapOutput {
   332  	return o
   333  }
   334  
   335  func (o HostedTransitVirtualInterfaceAcceptorMapOutput) ToHostedTransitVirtualInterfaceAcceptorMapOutputWithContext(ctx context.Context) HostedTransitVirtualInterfaceAcceptorMapOutput {
   336  	return o
   337  }
   338  
   339  func (o HostedTransitVirtualInterfaceAcceptorMapOutput) MapIndex(k pulumi.StringInput) HostedTransitVirtualInterfaceAcceptorOutput {
   340  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *HostedTransitVirtualInterfaceAcceptor {
   341  		return vs[0].(map[string]*HostedTransitVirtualInterfaceAcceptor)[vs[1].(string)]
   342  	}).(HostedTransitVirtualInterfaceAcceptorOutput)
   343  }
   344  
   345  func init() {
   346  	pulumi.RegisterInputType(reflect.TypeOf((*HostedTransitVirtualInterfaceAcceptorInput)(nil)).Elem(), &HostedTransitVirtualInterfaceAcceptor{})
   347  	pulumi.RegisterInputType(reflect.TypeOf((*HostedTransitVirtualInterfaceAcceptorArrayInput)(nil)).Elem(), HostedTransitVirtualInterfaceAcceptorArray{})
   348  	pulumi.RegisterInputType(reflect.TypeOf((*HostedTransitVirtualInterfaceAcceptorMapInput)(nil)).Elem(), HostedTransitVirtualInterfaceAcceptorMap{})
   349  	pulumi.RegisterOutputType(HostedTransitVirtualInterfaceAcceptorOutput{})
   350  	pulumi.RegisterOutputType(HostedTransitVirtualInterfaceAcceptorArrayOutput{})
   351  	pulumi.RegisterOutputType(HostedTransitVirtualInterfaceAcceptorMapOutput{})
   352  }