github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigateway/vpcLink.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 apigateway
     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 an API Gateway VPC Link.
    16  //
    17  // > **Note:** Amazon API Gateway Version 1 VPC Links enable private integrations that connect REST APIs to private resources in a VPC.
    18  // To enable private integration for HTTP APIs, use the Amazon API Gateway Version 2 VPC Link resource.
    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/apigateway"
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lb"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			example, err := lb.NewLoadBalancer(ctx, "example", &lb.LoadBalancerArgs{
    37  //				Name:             pulumi.String("example"),
    38  //				Internal:         pulumi.Bool(true),
    39  //				LoadBalancerType: pulumi.String("network"),
    40  //				SubnetMappings: lb.LoadBalancerSubnetMappingArray{
    41  //					&lb.LoadBalancerSubnetMappingArgs{
    42  //						SubnetId: pulumi.String("12345"),
    43  //					},
    44  //				},
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			_, err = apigateway.NewVpcLink(ctx, "example", &apigateway.VpcLinkArgs{
    50  //				Name:        pulumi.String("example"),
    51  //				Description: pulumi.String("example description"),
    52  //				TargetArn:   example.Arn,
    53  //			})
    54  //			if err != nil {
    55  //				return err
    56  //			}
    57  //			return nil
    58  //		})
    59  //	}
    60  //
    61  // ```
    62  // <!--End PulumiCodeChooser -->
    63  //
    64  // ## Import
    65  //
    66  // Using `pulumi import`, import API Gateway VPC Link using the `id`. For example:
    67  //
    68  // ```sh
    69  // $ pulumi import aws:apigateway/vpcLink:VpcLink example 12345abcde
    70  // ```
    71  type VpcLink struct {
    72  	pulumi.CustomResourceState
    73  
    74  	Arn pulumi.StringOutput `pulumi:"arn"`
    75  	// Description of the VPC link.
    76  	Description pulumi.StringPtrOutput `pulumi:"description"`
    77  	// Name used to label and identify the VPC link.
    78  	Name pulumi.StringOutput `pulumi:"name"`
    79  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    80  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    81  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    82  	//
    83  	// Deprecated: Please use `tags` instead.
    84  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    85  	// List of network load balancer arns in the VPC targeted by the VPC link. Currently AWS only supports 1 target.
    86  	TargetArn pulumi.StringOutput `pulumi:"targetArn"`
    87  }
    88  
    89  // NewVpcLink registers a new resource with the given unique name, arguments, and options.
    90  func NewVpcLink(ctx *pulumi.Context,
    91  	name string, args *VpcLinkArgs, opts ...pulumi.ResourceOption) (*VpcLink, error) {
    92  	if args == nil {
    93  		return nil, errors.New("missing one or more required arguments")
    94  	}
    95  
    96  	if args.TargetArn == nil {
    97  		return nil, errors.New("invalid value for required argument 'TargetArn'")
    98  	}
    99  	opts = internal.PkgResourceDefaultOpts(opts)
   100  	var resource VpcLink
   101  	err := ctx.RegisterResource("aws:apigateway/vpcLink:VpcLink", name, args, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // GetVpcLink gets an existing VpcLink resource's state with the given name, ID, and optional
   109  // state properties that are used to uniquely qualify the lookup (nil if not required).
   110  func GetVpcLink(ctx *pulumi.Context,
   111  	name string, id pulumi.IDInput, state *VpcLinkState, opts ...pulumi.ResourceOption) (*VpcLink, error) {
   112  	var resource VpcLink
   113  	err := ctx.ReadResource("aws:apigateway/vpcLink:VpcLink", name, id, state, &resource, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return &resource, nil
   118  }
   119  
   120  // Input properties used for looking up and filtering VpcLink resources.
   121  type vpcLinkState struct {
   122  	Arn *string `pulumi:"arn"`
   123  	// Description of the VPC link.
   124  	Description *string `pulumi:"description"`
   125  	// Name used to label and identify the VPC link.
   126  	Name *string `pulumi:"name"`
   127  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   128  	Tags map[string]string `pulumi:"tags"`
   129  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   130  	//
   131  	// Deprecated: Please use `tags` instead.
   132  	TagsAll map[string]string `pulumi:"tagsAll"`
   133  	// List of network load balancer arns in the VPC targeted by the VPC link. Currently AWS only supports 1 target.
   134  	TargetArn *string `pulumi:"targetArn"`
   135  }
   136  
   137  type VpcLinkState struct {
   138  	Arn pulumi.StringPtrInput
   139  	// Description of the VPC link.
   140  	Description pulumi.StringPtrInput
   141  	// Name used to label and identify the VPC link.
   142  	Name pulumi.StringPtrInput
   143  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   144  	Tags pulumi.StringMapInput
   145  	// 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 pulumi.StringMapInput
   149  	// List of network load balancer arns in the VPC targeted by the VPC link. Currently AWS only supports 1 target.
   150  	TargetArn pulumi.StringPtrInput
   151  }
   152  
   153  func (VpcLinkState) ElementType() reflect.Type {
   154  	return reflect.TypeOf((*vpcLinkState)(nil)).Elem()
   155  }
   156  
   157  type vpcLinkArgs struct {
   158  	// Description of the VPC link.
   159  	Description *string `pulumi:"description"`
   160  	// Name used to label and identify the VPC link.
   161  	Name *string `pulumi:"name"`
   162  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   163  	Tags map[string]string `pulumi:"tags"`
   164  	// List of network load balancer arns in the VPC targeted by the VPC link. Currently AWS only supports 1 target.
   165  	TargetArn string `pulumi:"targetArn"`
   166  }
   167  
   168  // The set of arguments for constructing a VpcLink resource.
   169  type VpcLinkArgs struct {
   170  	// Description of the VPC link.
   171  	Description pulumi.StringPtrInput
   172  	// Name used to label and identify the VPC link.
   173  	Name pulumi.StringPtrInput
   174  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   175  	Tags pulumi.StringMapInput
   176  	// List of network load balancer arns in the VPC targeted by the VPC link. Currently AWS only supports 1 target.
   177  	TargetArn pulumi.StringInput
   178  }
   179  
   180  func (VpcLinkArgs) ElementType() reflect.Type {
   181  	return reflect.TypeOf((*vpcLinkArgs)(nil)).Elem()
   182  }
   183  
   184  type VpcLinkInput interface {
   185  	pulumi.Input
   186  
   187  	ToVpcLinkOutput() VpcLinkOutput
   188  	ToVpcLinkOutputWithContext(ctx context.Context) VpcLinkOutput
   189  }
   190  
   191  func (*VpcLink) ElementType() reflect.Type {
   192  	return reflect.TypeOf((**VpcLink)(nil)).Elem()
   193  }
   194  
   195  func (i *VpcLink) ToVpcLinkOutput() VpcLinkOutput {
   196  	return i.ToVpcLinkOutputWithContext(context.Background())
   197  }
   198  
   199  func (i *VpcLink) ToVpcLinkOutputWithContext(ctx context.Context) VpcLinkOutput {
   200  	return pulumi.ToOutputWithContext(ctx, i).(VpcLinkOutput)
   201  }
   202  
   203  // VpcLinkArrayInput is an input type that accepts VpcLinkArray and VpcLinkArrayOutput values.
   204  // You can construct a concrete instance of `VpcLinkArrayInput` via:
   205  //
   206  //	VpcLinkArray{ VpcLinkArgs{...} }
   207  type VpcLinkArrayInput interface {
   208  	pulumi.Input
   209  
   210  	ToVpcLinkArrayOutput() VpcLinkArrayOutput
   211  	ToVpcLinkArrayOutputWithContext(context.Context) VpcLinkArrayOutput
   212  }
   213  
   214  type VpcLinkArray []VpcLinkInput
   215  
   216  func (VpcLinkArray) ElementType() reflect.Type {
   217  	return reflect.TypeOf((*[]*VpcLink)(nil)).Elem()
   218  }
   219  
   220  func (i VpcLinkArray) ToVpcLinkArrayOutput() VpcLinkArrayOutput {
   221  	return i.ToVpcLinkArrayOutputWithContext(context.Background())
   222  }
   223  
   224  func (i VpcLinkArray) ToVpcLinkArrayOutputWithContext(ctx context.Context) VpcLinkArrayOutput {
   225  	return pulumi.ToOutputWithContext(ctx, i).(VpcLinkArrayOutput)
   226  }
   227  
   228  // VpcLinkMapInput is an input type that accepts VpcLinkMap and VpcLinkMapOutput values.
   229  // You can construct a concrete instance of `VpcLinkMapInput` via:
   230  //
   231  //	VpcLinkMap{ "key": VpcLinkArgs{...} }
   232  type VpcLinkMapInput interface {
   233  	pulumi.Input
   234  
   235  	ToVpcLinkMapOutput() VpcLinkMapOutput
   236  	ToVpcLinkMapOutputWithContext(context.Context) VpcLinkMapOutput
   237  }
   238  
   239  type VpcLinkMap map[string]VpcLinkInput
   240  
   241  func (VpcLinkMap) ElementType() reflect.Type {
   242  	return reflect.TypeOf((*map[string]*VpcLink)(nil)).Elem()
   243  }
   244  
   245  func (i VpcLinkMap) ToVpcLinkMapOutput() VpcLinkMapOutput {
   246  	return i.ToVpcLinkMapOutputWithContext(context.Background())
   247  }
   248  
   249  func (i VpcLinkMap) ToVpcLinkMapOutputWithContext(ctx context.Context) VpcLinkMapOutput {
   250  	return pulumi.ToOutputWithContext(ctx, i).(VpcLinkMapOutput)
   251  }
   252  
   253  type VpcLinkOutput struct{ *pulumi.OutputState }
   254  
   255  func (VpcLinkOutput) ElementType() reflect.Type {
   256  	return reflect.TypeOf((**VpcLink)(nil)).Elem()
   257  }
   258  
   259  func (o VpcLinkOutput) ToVpcLinkOutput() VpcLinkOutput {
   260  	return o
   261  }
   262  
   263  func (o VpcLinkOutput) ToVpcLinkOutputWithContext(ctx context.Context) VpcLinkOutput {
   264  	return o
   265  }
   266  
   267  func (o VpcLinkOutput) Arn() pulumi.StringOutput {
   268  	return o.ApplyT(func(v *VpcLink) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   269  }
   270  
   271  // Description of the VPC link.
   272  func (o VpcLinkOutput) Description() pulumi.StringPtrOutput {
   273  	return o.ApplyT(func(v *VpcLink) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   274  }
   275  
   276  // Name used to label and identify the VPC link.
   277  func (o VpcLinkOutput) Name() pulumi.StringOutput {
   278  	return o.ApplyT(func(v *VpcLink) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   279  }
   280  
   281  // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   282  func (o VpcLinkOutput) Tags() pulumi.StringMapOutput {
   283  	return o.ApplyT(func(v *VpcLink) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   284  }
   285  
   286  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   287  //
   288  // Deprecated: Please use `tags` instead.
   289  func (o VpcLinkOutput) TagsAll() pulumi.StringMapOutput {
   290  	return o.ApplyT(func(v *VpcLink) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   291  }
   292  
   293  // List of network load balancer arns in the VPC targeted by the VPC link. Currently AWS only supports 1 target.
   294  func (o VpcLinkOutput) TargetArn() pulumi.StringOutput {
   295  	return o.ApplyT(func(v *VpcLink) pulumi.StringOutput { return v.TargetArn }).(pulumi.StringOutput)
   296  }
   297  
   298  type VpcLinkArrayOutput struct{ *pulumi.OutputState }
   299  
   300  func (VpcLinkArrayOutput) ElementType() reflect.Type {
   301  	return reflect.TypeOf((*[]*VpcLink)(nil)).Elem()
   302  }
   303  
   304  func (o VpcLinkArrayOutput) ToVpcLinkArrayOutput() VpcLinkArrayOutput {
   305  	return o
   306  }
   307  
   308  func (o VpcLinkArrayOutput) ToVpcLinkArrayOutputWithContext(ctx context.Context) VpcLinkArrayOutput {
   309  	return o
   310  }
   311  
   312  func (o VpcLinkArrayOutput) Index(i pulumi.IntInput) VpcLinkOutput {
   313  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcLink {
   314  		return vs[0].([]*VpcLink)[vs[1].(int)]
   315  	}).(VpcLinkOutput)
   316  }
   317  
   318  type VpcLinkMapOutput struct{ *pulumi.OutputState }
   319  
   320  func (VpcLinkMapOutput) ElementType() reflect.Type {
   321  	return reflect.TypeOf((*map[string]*VpcLink)(nil)).Elem()
   322  }
   323  
   324  func (o VpcLinkMapOutput) ToVpcLinkMapOutput() VpcLinkMapOutput {
   325  	return o
   326  }
   327  
   328  func (o VpcLinkMapOutput) ToVpcLinkMapOutputWithContext(ctx context.Context) VpcLinkMapOutput {
   329  	return o
   330  }
   331  
   332  func (o VpcLinkMapOutput) MapIndex(k pulumi.StringInput) VpcLinkOutput {
   333  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcLink {
   334  		return vs[0].(map[string]*VpcLink)[vs[1].(string)]
   335  	}).(VpcLinkOutput)
   336  }
   337  
   338  func init() {
   339  	pulumi.RegisterInputType(reflect.TypeOf((*VpcLinkInput)(nil)).Elem(), &VpcLink{})
   340  	pulumi.RegisterInputType(reflect.TypeOf((*VpcLinkArrayInput)(nil)).Elem(), VpcLinkArray{})
   341  	pulumi.RegisterInputType(reflect.TypeOf((*VpcLinkMapInput)(nil)).Elem(), VpcLinkMap{})
   342  	pulumi.RegisterOutputType(VpcLinkOutput{})
   343  	pulumi.RegisterOutputType(VpcLinkArrayOutput{})
   344  	pulumi.RegisterOutputType(VpcLinkMapOutput{})
   345  }