github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/internetGatewayAttachment.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 ec2
     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 create a VPC Internet Gateway Attachment.
    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/ec2"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			exampleVpc, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
    33  //				CidrBlock: pulumi.String("10.1.0.0/16"),
    34  //			})
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			exampleInternetGateway, err := ec2.NewInternetGateway(ctx, "example", nil)
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			_, err = ec2.NewInternetGatewayAttachment(ctx, "example", &ec2.InternetGatewayAttachmentArgs{
    43  //				InternetGatewayId: exampleInternetGateway.ID(),
    44  //				VpcId:             exampleVpc.ID(),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import Internet Gateway Attachments using the `id`. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:ec2/internetGatewayAttachment:InternetGatewayAttachment example igw-c0a643a9:vpc-123456
    62  // ```
    63  type InternetGatewayAttachment struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// The ID of the internet gateway.
    67  	InternetGatewayId pulumi.StringOutput `pulumi:"internetGatewayId"`
    68  	// The ID of the VPC.
    69  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    70  }
    71  
    72  // NewInternetGatewayAttachment registers a new resource with the given unique name, arguments, and options.
    73  func NewInternetGatewayAttachment(ctx *pulumi.Context,
    74  	name string, args *InternetGatewayAttachmentArgs, opts ...pulumi.ResourceOption) (*InternetGatewayAttachment, error) {
    75  	if args == nil {
    76  		return nil, errors.New("missing one or more required arguments")
    77  	}
    78  
    79  	if args.InternetGatewayId == nil {
    80  		return nil, errors.New("invalid value for required argument 'InternetGatewayId'")
    81  	}
    82  	if args.VpcId == nil {
    83  		return nil, errors.New("invalid value for required argument 'VpcId'")
    84  	}
    85  	opts = internal.PkgResourceDefaultOpts(opts)
    86  	var resource InternetGatewayAttachment
    87  	err := ctx.RegisterResource("aws:ec2/internetGatewayAttachment:InternetGatewayAttachment", name, args, &resource, opts...)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	return &resource, nil
    92  }
    93  
    94  // GetInternetGatewayAttachment gets an existing InternetGatewayAttachment resource's state with the given name, ID, and optional
    95  // state properties that are used to uniquely qualify the lookup (nil if not required).
    96  func GetInternetGatewayAttachment(ctx *pulumi.Context,
    97  	name string, id pulumi.IDInput, state *InternetGatewayAttachmentState, opts ...pulumi.ResourceOption) (*InternetGatewayAttachment, error) {
    98  	var resource InternetGatewayAttachment
    99  	err := ctx.ReadResource("aws:ec2/internetGatewayAttachment:InternetGatewayAttachment", name, id, state, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // Input properties used for looking up and filtering InternetGatewayAttachment resources.
   107  type internetGatewayAttachmentState struct {
   108  	// The ID of the internet gateway.
   109  	InternetGatewayId *string `pulumi:"internetGatewayId"`
   110  	// The ID of the VPC.
   111  	VpcId *string `pulumi:"vpcId"`
   112  }
   113  
   114  type InternetGatewayAttachmentState struct {
   115  	// The ID of the internet gateway.
   116  	InternetGatewayId pulumi.StringPtrInput
   117  	// The ID of the VPC.
   118  	VpcId pulumi.StringPtrInput
   119  }
   120  
   121  func (InternetGatewayAttachmentState) ElementType() reflect.Type {
   122  	return reflect.TypeOf((*internetGatewayAttachmentState)(nil)).Elem()
   123  }
   124  
   125  type internetGatewayAttachmentArgs struct {
   126  	// The ID of the internet gateway.
   127  	InternetGatewayId string `pulumi:"internetGatewayId"`
   128  	// The ID of the VPC.
   129  	VpcId string `pulumi:"vpcId"`
   130  }
   131  
   132  // The set of arguments for constructing a InternetGatewayAttachment resource.
   133  type InternetGatewayAttachmentArgs struct {
   134  	// The ID of the internet gateway.
   135  	InternetGatewayId pulumi.StringInput
   136  	// The ID of the VPC.
   137  	VpcId pulumi.StringInput
   138  }
   139  
   140  func (InternetGatewayAttachmentArgs) ElementType() reflect.Type {
   141  	return reflect.TypeOf((*internetGatewayAttachmentArgs)(nil)).Elem()
   142  }
   143  
   144  type InternetGatewayAttachmentInput interface {
   145  	pulumi.Input
   146  
   147  	ToInternetGatewayAttachmentOutput() InternetGatewayAttachmentOutput
   148  	ToInternetGatewayAttachmentOutputWithContext(ctx context.Context) InternetGatewayAttachmentOutput
   149  }
   150  
   151  func (*InternetGatewayAttachment) ElementType() reflect.Type {
   152  	return reflect.TypeOf((**InternetGatewayAttachment)(nil)).Elem()
   153  }
   154  
   155  func (i *InternetGatewayAttachment) ToInternetGatewayAttachmentOutput() InternetGatewayAttachmentOutput {
   156  	return i.ToInternetGatewayAttachmentOutputWithContext(context.Background())
   157  }
   158  
   159  func (i *InternetGatewayAttachment) ToInternetGatewayAttachmentOutputWithContext(ctx context.Context) InternetGatewayAttachmentOutput {
   160  	return pulumi.ToOutputWithContext(ctx, i).(InternetGatewayAttachmentOutput)
   161  }
   162  
   163  // InternetGatewayAttachmentArrayInput is an input type that accepts InternetGatewayAttachmentArray and InternetGatewayAttachmentArrayOutput values.
   164  // You can construct a concrete instance of `InternetGatewayAttachmentArrayInput` via:
   165  //
   166  //	InternetGatewayAttachmentArray{ InternetGatewayAttachmentArgs{...} }
   167  type InternetGatewayAttachmentArrayInput interface {
   168  	pulumi.Input
   169  
   170  	ToInternetGatewayAttachmentArrayOutput() InternetGatewayAttachmentArrayOutput
   171  	ToInternetGatewayAttachmentArrayOutputWithContext(context.Context) InternetGatewayAttachmentArrayOutput
   172  }
   173  
   174  type InternetGatewayAttachmentArray []InternetGatewayAttachmentInput
   175  
   176  func (InternetGatewayAttachmentArray) ElementType() reflect.Type {
   177  	return reflect.TypeOf((*[]*InternetGatewayAttachment)(nil)).Elem()
   178  }
   179  
   180  func (i InternetGatewayAttachmentArray) ToInternetGatewayAttachmentArrayOutput() InternetGatewayAttachmentArrayOutput {
   181  	return i.ToInternetGatewayAttachmentArrayOutputWithContext(context.Background())
   182  }
   183  
   184  func (i InternetGatewayAttachmentArray) ToInternetGatewayAttachmentArrayOutputWithContext(ctx context.Context) InternetGatewayAttachmentArrayOutput {
   185  	return pulumi.ToOutputWithContext(ctx, i).(InternetGatewayAttachmentArrayOutput)
   186  }
   187  
   188  // InternetGatewayAttachmentMapInput is an input type that accepts InternetGatewayAttachmentMap and InternetGatewayAttachmentMapOutput values.
   189  // You can construct a concrete instance of `InternetGatewayAttachmentMapInput` via:
   190  //
   191  //	InternetGatewayAttachmentMap{ "key": InternetGatewayAttachmentArgs{...} }
   192  type InternetGatewayAttachmentMapInput interface {
   193  	pulumi.Input
   194  
   195  	ToInternetGatewayAttachmentMapOutput() InternetGatewayAttachmentMapOutput
   196  	ToInternetGatewayAttachmentMapOutputWithContext(context.Context) InternetGatewayAttachmentMapOutput
   197  }
   198  
   199  type InternetGatewayAttachmentMap map[string]InternetGatewayAttachmentInput
   200  
   201  func (InternetGatewayAttachmentMap) ElementType() reflect.Type {
   202  	return reflect.TypeOf((*map[string]*InternetGatewayAttachment)(nil)).Elem()
   203  }
   204  
   205  func (i InternetGatewayAttachmentMap) ToInternetGatewayAttachmentMapOutput() InternetGatewayAttachmentMapOutput {
   206  	return i.ToInternetGatewayAttachmentMapOutputWithContext(context.Background())
   207  }
   208  
   209  func (i InternetGatewayAttachmentMap) ToInternetGatewayAttachmentMapOutputWithContext(ctx context.Context) InternetGatewayAttachmentMapOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(InternetGatewayAttachmentMapOutput)
   211  }
   212  
   213  type InternetGatewayAttachmentOutput struct{ *pulumi.OutputState }
   214  
   215  func (InternetGatewayAttachmentOutput) ElementType() reflect.Type {
   216  	return reflect.TypeOf((**InternetGatewayAttachment)(nil)).Elem()
   217  }
   218  
   219  func (o InternetGatewayAttachmentOutput) ToInternetGatewayAttachmentOutput() InternetGatewayAttachmentOutput {
   220  	return o
   221  }
   222  
   223  func (o InternetGatewayAttachmentOutput) ToInternetGatewayAttachmentOutputWithContext(ctx context.Context) InternetGatewayAttachmentOutput {
   224  	return o
   225  }
   226  
   227  // The ID of the internet gateway.
   228  func (o InternetGatewayAttachmentOutput) InternetGatewayId() pulumi.StringOutput {
   229  	return o.ApplyT(func(v *InternetGatewayAttachment) pulumi.StringOutput { return v.InternetGatewayId }).(pulumi.StringOutput)
   230  }
   231  
   232  // The ID of the VPC.
   233  func (o InternetGatewayAttachmentOutput) VpcId() pulumi.StringOutput {
   234  	return o.ApplyT(func(v *InternetGatewayAttachment) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   235  }
   236  
   237  type InternetGatewayAttachmentArrayOutput struct{ *pulumi.OutputState }
   238  
   239  func (InternetGatewayAttachmentArrayOutput) ElementType() reflect.Type {
   240  	return reflect.TypeOf((*[]*InternetGatewayAttachment)(nil)).Elem()
   241  }
   242  
   243  func (o InternetGatewayAttachmentArrayOutput) ToInternetGatewayAttachmentArrayOutput() InternetGatewayAttachmentArrayOutput {
   244  	return o
   245  }
   246  
   247  func (o InternetGatewayAttachmentArrayOutput) ToInternetGatewayAttachmentArrayOutputWithContext(ctx context.Context) InternetGatewayAttachmentArrayOutput {
   248  	return o
   249  }
   250  
   251  func (o InternetGatewayAttachmentArrayOutput) Index(i pulumi.IntInput) InternetGatewayAttachmentOutput {
   252  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InternetGatewayAttachment {
   253  		return vs[0].([]*InternetGatewayAttachment)[vs[1].(int)]
   254  	}).(InternetGatewayAttachmentOutput)
   255  }
   256  
   257  type InternetGatewayAttachmentMapOutput struct{ *pulumi.OutputState }
   258  
   259  func (InternetGatewayAttachmentMapOutput) ElementType() reflect.Type {
   260  	return reflect.TypeOf((*map[string]*InternetGatewayAttachment)(nil)).Elem()
   261  }
   262  
   263  func (o InternetGatewayAttachmentMapOutput) ToInternetGatewayAttachmentMapOutput() InternetGatewayAttachmentMapOutput {
   264  	return o
   265  }
   266  
   267  func (o InternetGatewayAttachmentMapOutput) ToInternetGatewayAttachmentMapOutputWithContext(ctx context.Context) InternetGatewayAttachmentMapOutput {
   268  	return o
   269  }
   270  
   271  func (o InternetGatewayAttachmentMapOutput) MapIndex(k pulumi.StringInput) InternetGatewayAttachmentOutput {
   272  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InternetGatewayAttachment {
   273  		return vs[0].(map[string]*InternetGatewayAttachment)[vs[1].(string)]
   274  	}).(InternetGatewayAttachmentOutput)
   275  }
   276  
   277  func init() {
   278  	pulumi.RegisterInputType(reflect.TypeOf((*InternetGatewayAttachmentInput)(nil)).Elem(), &InternetGatewayAttachment{})
   279  	pulumi.RegisterInputType(reflect.TypeOf((*InternetGatewayAttachmentArrayInput)(nil)).Elem(), InternetGatewayAttachmentArray{})
   280  	pulumi.RegisterInputType(reflect.TypeOf((*InternetGatewayAttachmentMapInput)(nil)).Elem(), InternetGatewayAttachmentMap{})
   281  	pulumi.RegisterOutputType(InternetGatewayAttachmentOutput{})
   282  	pulumi.RegisterOutputType(InternetGatewayAttachmentArrayOutput{})
   283  	pulumi.RegisterOutputType(InternetGatewayAttachmentMapOutput{})
   284  }