github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directconnect/gateway.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 Direct Connect Gateway.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directconnect"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := directconnect.NewGateway(ctx, "example", &directconnect.GatewayArgs{
    33  //				Name:          pulumi.String("tf-dxg-example"),
    34  //				AmazonSideAsn: pulumi.String("64512"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ## Import
    47  //
    48  // Using `pulumi import`, import Direct Connect Gateways using the gateway `id`. For example:
    49  //
    50  // ```sh
    51  // $ pulumi import aws:directconnect/gateway:Gateway test abcd1234-dcba-5678-be23-cdef9876ab45
    52  // ```
    53  type Gateway struct {
    54  	pulumi.CustomResourceState
    55  
    56  	// The ASN to be configured on the Amazon side of the connection. The ASN must be in the private range of 64,512 to 65,534 or 4,200,000,000 to 4,294,967,294.
    57  	AmazonSideAsn pulumi.StringOutput `pulumi:"amazonSideAsn"`
    58  	// The name of the connection.
    59  	Name pulumi.StringOutput `pulumi:"name"`
    60  	// AWS Account ID of the gateway.
    61  	OwnerAccountId pulumi.StringOutput `pulumi:"ownerAccountId"`
    62  }
    63  
    64  // NewGateway registers a new resource with the given unique name, arguments, and options.
    65  func NewGateway(ctx *pulumi.Context,
    66  	name string, args *GatewayArgs, opts ...pulumi.ResourceOption) (*Gateway, error) {
    67  	if args == nil {
    68  		return nil, errors.New("missing one or more required arguments")
    69  	}
    70  
    71  	if args.AmazonSideAsn == nil {
    72  		return nil, errors.New("invalid value for required argument 'AmazonSideAsn'")
    73  	}
    74  	opts = internal.PkgResourceDefaultOpts(opts)
    75  	var resource Gateway
    76  	err := ctx.RegisterResource("aws:directconnect/gateway:Gateway", name, args, &resource, opts...)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  	return &resource, nil
    81  }
    82  
    83  // GetGateway gets an existing Gateway resource's state with the given name, ID, and optional
    84  // state properties that are used to uniquely qualify the lookup (nil if not required).
    85  func GetGateway(ctx *pulumi.Context,
    86  	name string, id pulumi.IDInput, state *GatewayState, opts ...pulumi.ResourceOption) (*Gateway, error) {
    87  	var resource Gateway
    88  	err := ctx.ReadResource("aws:directconnect/gateway:Gateway", name, id, state, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // Input properties used for looking up and filtering Gateway resources.
    96  type gatewayState struct {
    97  	// The ASN to be configured on the Amazon side of the connection. The ASN must be in the private range of 64,512 to 65,534 or 4,200,000,000 to 4,294,967,294.
    98  	AmazonSideAsn *string `pulumi:"amazonSideAsn"`
    99  	// The name of the connection.
   100  	Name *string `pulumi:"name"`
   101  	// AWS Account ID of the gateway.
   102  	OwnerAccountId *string `pulumi:"ownerAccountId"`
   103  }
   104  
   105  type GatewayState struct {
   106  	// The ASN to be configured on the Amazon side of the connection. The ASN must be in the private range of 64,512 to 65,534 or 4,200,000,000 to 4,294,967,294.
   107  	AmazonSideAsn pulumi.StringPtrInput
   108  	// The name of the connection.
   109  	Name pulumi.StringPtrInput
   110  	// AWS Account ID of the gateway.
   111  	OwnerAccountId pulumi.StringPtrInput
   112  }
   113  
   114  func (GatewayState) ElementType() reflect.Type {
   115  	return reflect.TypeOf((*gatewayState)(nil)).Elem()
   116  }
   117  
   118  type gatewayArgs struct {
   119  	// The ASN to be configured on the Amazon side of the connection. The ASN must be in the private range of 64,512 to 65,534 or 4,200,000,000 to 4,294,967,294.
   120  	AmazonSideAsn string `pulumi:"amazonSideAsn"`
   121  	// The name of the connection.
   122  	Name *string `pulumi:"name"`
   123  }
   124  
   125  // The set of arguments for constructing a Gateway resource.
   126  type GatewayArgs struct {
   127  	// The ASN to be configured on the Amazon side of the connection. The ASN must be in the private range of 64,512 to 65,534 or 4,200,000,000 to 4,294,967,294.
   128  	AmazonSideAsn pulumi.StringInput
   129  	// The name of the connection.
   130  	Name pulumi.StringPtrInput
   131  }
   132  
   133  func (GatewayArgs) ElementType() reflect.Type {
   134  	return reflect.TypeOf((*gatewayArgs)(nil)).Elem()
   135  }
   136  
   137  type GatewayInput interface {
   138  	pulumi.Input
   139  
   140  	ToGatewayOutput() GatewayOutput
   141  	ToGatewayOutputWithContext(ctx context.Context) GatewayOutput
   142  }
   143  
   144  func (*Gateway) ElementType() reflect.Type {
   145  	return reflect.TypeOf((**Gateway)(nil)).Elem()
   146  }
   147  
   148  func (i *Gateway) ToGatewayOutput() GatewayOutput {
   149  	return i.ToGatewayOutputWithContext(context.Background())
   150  }
   151  
   152  func (i *Gateway) ToGatewayOutputWithContext(ctx context.Context) GatewayOutput {
   153  	return pulumi.ToOutputWithContext(ctx, i).(GatewayOutput)
   154  }
   155  
   156  // GatewayArrayInput is an input type that accepts GatewayArray and GatewayArrayOutput values.
   157  // You can construct a concrete instance of `GatewayArrayInput` via:
   158  //
   159  //	GatewayArray{ GatewayArgs{...} }
   160  type GatewayArrayInput interface {
   161  	pulumi.Input
   162  
   163  	ToGatewayArrayOutput() GatewayArrayOutput
   164  	ToGatewayArrayOutputWithContext(context.Context) GatewayArrayOutput
   165  }
   166  
   167  type GatewayArray []GatewayInput
   168  
   169  func (GatewayArray) ElementType() reflect.Type {
   170  	return reflect.TypeOf((*[]*Gateway)(nil)).Elem()
   171  }
   172  
   173  func (i GatewayArray) ToGatewayArrayOutput() GatewayArrayOutput {
   174  	return i.ToGatewayArrayOutputWithContext(context.Background())
   175  }
   176  
   177  func (i GatewayArray) ToGatewayArrayOutputWithContext(ctx context.Context) GatewayArrayOutput {
   178  	return pulumi.ToOutputWithContext(ctx, i).(GatewayArrayOutput)
   179  }
   180  
   181  // GatewayMapInput is an input type that accepts GatewayMap and GatewayMapOutput values.
   182  // You can construct a concrete instance of `GatewayMapInput` via:
   183  //
   184  //	GatewayMap{ "key": GatewayArgs{...} }
   185  type GatewayMapInput interface {
   186  	pulumi.Input
   187  
   188  	ToGatewayMapOutput() GatewayMapOutput
   189  	ToGatewayMapOutputWithContext(context.Context) GatewayMapOutput
   190  }
   191  
   192  type GatewayMap map[string]GatewayInput
   193  
   194  func (GatewayMap) ElementType() reflect.Type {
   195  	return reflect.TypeOf((*map[string]*Gateway)(nil)).Elem()
   196  }
   197  
   198  func (i GatewayMap) ToGatewayMapOutput() GatewayMapOutput {
   199  	return i.ToGatewayMapOutputWithContext(context.Background())
   200  }
   201  
   202  func (i GatewayMap) ToGatewayMapOutputWithContext(ctx context.Context) GatewayMapOutput {
   203  	return pulumi.ToOutputWithContext(ctx, i).(GatewayMapOutput)
   204  }
   205  
   206  type GatewayOutput struct{ *pulumi.OutputState }
   207  
   208  func (GatewayOutput) ElementType() reflect.Type {
   209  	return reflect.TypeOf((**Gateway)(nil)).Elem()
   210  }
   211  
   212  func (o GatewayOutput) ToGatewayOutput() GatewayOutput {
   213  	return o
   214  }
   215  
   216  func (o GatewayOutput) ToGatewayOutputWithContext(ctx context.Context) GatewayOutput {
   217  	return o
   218  }
   219  
   220  // The ASN to be configured on the Amazon side of the connection. The ASN must be in the private range of 64,512 to 65,534 or 4,200,000,000 to 4,294,967,294.
   221  func (o GatewayOutput) AmazonSideAsn() pulumi.StringOutput {
   222  	return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.AmazonSideAsn }).(pulumi.StringOutput)
   223  }
   224  
   225  // The name of the connection.
   226  func (o GatewayOutput) Name() pulumi.StringOutput {
   227  	return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   228  }
   229  
   230  // AWS Account ID of the gateway.
   231  func (o GatewayOutput) OwnerAccountId() pulumi.StringOutput {
   232  	return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.OwnerAccountId }).(pulumi.StringOutput)
   233  }
   234  
   235  type GatewayArrayOutput struct{ *pulumi.OutputState }
   236  
   237  func (GatewayArrayOutput) ElementType() reflect.Type {
   238  	return reflect.TypeOf((*[]*Gateway)(nil)).Elem()
   239  }
   240  
   241  func (o GatewayArrayOutput) ToGatewayArrayOutput() GatewayArrayOutput {
   242  	return o
   243  }
   244  
   245  func (o GatewayArrayOutput) ToGatewayArrayOutputWithContext(ctx context.Context) GatewayArrayOutput {
   246  	return o
   247  }
   248  
   249  func (o GatewayArrayOutput) Index(i pulumi.IntInput) GatewayOutput {
   250  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Gateway {
   251  		return vs[0].([]*Gateway)[vs[1].(int)]
   252  	}).(GatewayOutput)
   253  }
   254  
   255  type GatewayMapOutput struct{ *pulumi.OutputState }
   256  
   257  func (GatewayMapOutput) ElementType() reflect.Type {
   258  	return reflect.TypeOf((*map[string]*Gateway)(nil)).Elem()
   259  }
   260  
   261  func (o GatewayMapOutput) ToGatewayMapOutput() GatewayMapOutput {
   262  	return o
   263  }
   264  
   265  func (o GatewayMapOutput) ToGatewayMapOutputWithContext(ctx context.Context) GatewayMapOutput {
   266  	return o
   267  }
   268  
   269  func (o GatewayMapOutput) MapIndex(k pulumi.StringInput) GatewayOutput {
   270  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Gateway {
   271  		return vs[0].(map[string]*Gateway)[vs[1].(string)]
   272  	}).(GatewayOutput)
   273  }
   274  
   275  func init() {
   276  	pulumi.RegisterInputType(reflect.TypeOf((*GatewayInput)(nil)).Elem(), &Gateway{})
   277  	pulumi.RegisterInputType(reflect.TypeOf((*GatewayArrayInput)(nil)).Elem(), GatewayArray{})
   278  	pulumi.RegisterInputType(reflect.TypeOf((*GatewayMapInput)(nil)).Elem(), GatewayMap{})
   279  	pulumi.RegisterOutputType(GatewayOutput{})
   280  	pulumi.RegisterOutputType(GatewayArrayOutput{})
   281  	pulumi.RegisterOutputType(GatewayMapOutput{})
   282  }