github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/appmesh/gatewayRoute.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 appmesh
     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 AWS App Mesh gateway route resource.
    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/appmesh"
    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 := appmesh.NewGatewayRoute(ctx, "example", &appmesh.GatewayRouteArgs{
    33  //				Name:               pulumi.String("example-gateway-route"),
    34  //				MeshName:           pulumi.String("example-service-mesh"),
    35  //				VirtualGatewayName: pulumi.Any(exampleAwsAppmeshVirtualGateway.Name),
    36  //				Spec: &appmesh.GatewayRouteSpecArgs{
    37  //					HttpRoute: &appmesh.GatewayRouteSpecHttpRouteArgs{
    38  //						Action: &appmesh.GatewayRouteSpecHttpRouteActionArgs{
    39  //							Target: &appmesh.GatewayRouteSpecHttpRouteActionTargetArgs{
    40  //								VirtualService: &appmesh.GatewayRouteSpecHttpRouteActionTargetVirtualServiceArgs{
    41  //									VirtualServiceName: pulumi.Any(exampleAwsAppmeshVirtualService.Name),
    42  //								},
    43  //							},
    44  //						},
    45  //						Match: &appmesh.GatewayRouteSpecHttpRouteMatchArgs{
    46  //							Prefix: pulumi.String("/"),
    47  //						},
    48  //					},
    49  //				},
    50  //				Tags: pulumi.StringMap{
    51  //					"Environment": pulumi.String("test"),
    52  //				},
    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 App Mesh gateway routes using `mesh_name` and `virtual_gateway_name` together with the gateway route's `name`. For example:
    67  //
    68  // ```sh
    69  // $ pulumi import aws:appmesh/gatewayRoute:GatewayRoute example mesh/gw1/example-gateway-route
    70  // ```
    71  type GatewayRoute struct {
    72  	pulumi.CustomResourceState
    73  
    74  	// ARN of the gateway route.
    75  	Arn pulumi.StringOutput `pulumi:"arn"`
    76  	// Creation date of the gateway route.
    77  	CreatedDate pulumi.StringOutput `pulumi:"createdDate"`
    78  	// Last update date of the gateway route.
    79  	LastUpdatedDate pulumi.StringOutput `pulumi:"lastUpdatedDate"`
    80  	// Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.
    81  	MeshName pulumi.StringOutput `pulumi:"meshName"`
    82  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
    83  	MeshOwner pulumi.StringOutput `pulumi:"meshOwner"`
    84  	// Name to use for the gateway route. Must be between 1 and 255 characters in length.
    85  	Name pulumi.StringOutput `pulumi:"name"`
    86  	// Resource owner's AWS account ID.
    87  	ResourceOwner pulumi.StringOutput `pulumi:"resourceOwner"`
    88  	// Gateway route specification to apply.
    89  	Spec GatewayRouteSpecOutput `pulumi:"spec"`
    90  	// 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.
    91  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    92  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    93  	//
    94  	// Deprecated: Please use `tags` instead.
    95  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    96  	// Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.
    97  	VirtualGatewayName pulumi.StringOutput `pulumi:"virtualGatewayName"`
    98  }
    99  
   100  // NewGatewayRoute registers a new resource with the given unique name, arguments, and options.
   101  func NewGatewayRoute(ctx *pulumi.Context,
   102  	name string, args *GatewayRouteArgs, opts ...pulumi.ResourceOption) (*GatewayRoute, error) {
   103  	if args == nil {
   104  		return nil, errors.New("missing one or more required arguments")
   105  	}
   106  
   107  	if args.MeshName == nil {
   108  		return nil, errors.New("invalid value for required argument 'MeshName'")
   109  	}
   110  	if args.Spec == nil {
   111  		return nil, errors.New("invalid value for required argument 'Spec'")
   112  	}
   113  	if args.VirtualGatewayName == nil {
   114  		return nil, errors.New("invalid value for required argument 'VirtualGatewayName'")
   115  	}
   116  	opts = internal.PkgResourceDefaultOpts(opts)
   117  	var resource GatewayRoute
   118  	err := ctx.RegisterResource("aws:appmesh/gatewayRoute:GatewayRoute", name, args, &resource, opts...)
   119  	if err != nil {
   120  		return nil, err
   121  	}
   122  	return &resource, nil
   123  }
   124  
   125  // GetGatewayRoute gets an existing GatewayRoute 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 GetGatewayRoute(ctx *pulumi.Context,
   128  	name string, id pulumi.IDInput, state *GatewayRouteState, opts ...pulumi.ResourceOption) (*GatewayRoute, error) {
   129  	var resource GatewayRoute
   130  	err := ctx.ReadResource("aws:appmesh/gatewayRoute:GatewayRoute", 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 GatewayRoute resources.
   138  type gatewayRouteState struct {
   139  	// ARN of the gateway route.
   140  	Arn *string `pulumi:"arn"`
   141  	// Creation date of the gateway route.
   142  	CreatedDate *string `pulumi:"createdDate"`
   143  	// Last update date of the gateway route.
   144  	LastUpdatedDate *string `pulumi:"lastUpdatedDate"`
   145  	// Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.
   146  	MeshName *string `pulumi:"meshName"`
   147  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   148  	MeshOwner *string `pulumi:"meshOwner"`
   149  	// Name to use for the gateway route. Must be between 1 and 255 characters in length.
   150  	Name *string `pulumi:"name"`
   151  	// Resource owner's AWS account ID.
   152  	ResourceOwner *string `pulumi:"resourceOwner"`
   153  	// Gateway route specification to apply.
   154  	Spec *GatewayRouteSpec `pulumi:"spec"`
   155  	// 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.
   156  	Tags map[string]string `pulumi:"tags"`
   157  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   158  	//
   159  	// Deprecated: Please use `tags` instead.
   160  	TagsAll map[string]string `pulumi:"tagsAll"`
   161  	// Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.
   162  	VirtualGatewayName *string `pulumi:"virtualGatewayName"`
   163  }
   164  
   165  type GatewayRouteState struct {
   166  	// ARN of the gateway route.
   167  	Arn pulumi.StringPtrInput
   168  	// Creation date of the gateway route.
   169  	CreatedDate pulumi.StringPtrInput
   170  	// Last update date of the gateway route.
   171  	LastUpdatedDate pulumi.StringPtrInput
   172  	// Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.
   173  	MeshName pulumi.StringPtrInput
   174  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   175  	MeshOwner pulumi.StringPtrInput
   176  	// Name to use for the gateway route. Must be between 1 and 255 characters in length.
   177  	Name pulumi.StringPtrInput
   178  	// Resource owner's AWS account ID.
   179  	ResourceOwner pulumi.StringPtrInput
   180  	// Gateway route specification to apply.
   181  	Spec GatewayRouteSpecPtrInput
   182  	// 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.
   183  	Tags pulumi.StringMapInput
   184  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   185  	//
   186  	// Deprecated: Please use `tags` instead.
   187  	TagsAll pulumi.StringMapInput
   188  	// Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.
   189  	VirtualGatewayName pulumi.StringPtrInput
   190  }
   191  
   192  func (GatewayRouteState) ElementType() reflect.Type {
   193  	return reflect.TypeOf((*gatewayRouteState)(nil)).Elem()
   194  }
   195  
   196  type gatewayRouteArgs struct {
   197  	// Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.
   198  	MeshName string `pulumi:"meshName"`
   199  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   200  	MeshOwner *string `pulumi:"meshOwner"`
   201  	// Name to use for the gateway route. Must be between 1 and 255 characters in length.
   202  	Name *string `pulumi:"name"`
   203  	// Gateway route specification to apply.
   204  	Spec GatewayRouteSpec `pulumi:"spec"`
   205  	// 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.
   206  	Tags map[string]string `pulumi:"tags"`
   207  	// Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.
   208  	VirtualGatewayName string `pulumi:"virtualGatewayName"`
   209  }
   210  
   211  // The set of arguments for constructing a GatewayRoute resource.
   212  type GatewayRouteArgs struct {
   213  	// Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.
   214  	MeshName pulumi.StringInput
   215  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   216  	MeshOwner pulumi.StringPtrInput
   217  	// Name to use for the gateway route. Must be between 1 and 255 characters in length.
   218  	Name pulumi.StringPtrInput
   219  	// Gateway route specification to apply.
   220  	Spec GatewayRouteSpecInput
   221  	// 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.
   222  	Tags pulumi.StringMapInput
   223  	// Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.
   224  	VirtualGatewayName pulumi.StringInput
   225  }
   226  
   227  func (GatewayRouteArgs) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*gatewayRouteArgs)(nil)).Elem()
   229  }
   230  
   231  type GatewayRouteInput interface {
   232  	pulumi.Input
   233  
   234  	ToGatewayRouteOutput() GatewayRouteOutput
   235  	ToGatewayRouteOutputWithContext(ctx context.Context) GatewayRouteOutput
   236  }
   237  
   238  func (*GatewayRoute) ElementType() reflect.Type {
   239  	return reflect.TypeOf((**GatewayRoute)(nil)).Elem()
   240  }
   241  
   242  func (i *GatewayRoute) ToGatewayRouteOutput() GatewayRouteOutput {
   243  	return i.ToGatewayRouteOutputWithContext(context.Background())
   244  }
   245  
   246  func (i *GatewayRoute) ToGatewayRouteOutputWithContext(ctx context.Context) GatewayRouteOutput {
   247  	return pulumi.ToOutputWithContext(ctx, i).(GatewayRouteOutput)
   248  }
   249  
   250  // GatewayRouteArrayInput is an input type that accepts GatewayRouteArray and GatewayRouteArrayOutput values.
   251  // You can construct a concrete instance of `GatewayRouteArrayInput` via:
   252  //
   253  //	GatewayRouteArray{ GatewayRouteArgs{...} }
   254  type GatewayRouteArrayInput interface {
   255  	pulumi.Input
   256  
   257  	ToGatewayRouteArrayOutput() GatewayRouteArrayOutput
   258  	ToGatewayRouteArrayOutputWithContext(context.Context) GatewayRouteArrayOutput
   259  }
   260  
   261  type GatewayRouteArray []GatewayRouteInput
   262  
   263  func (GatewayRouteArray) ElementType() reflect.Type {
   264  	return reflect.TypeOf((*[]*GatewayRoute)(nil)).Elem()
   265  }
   266  
   267  func (i GatewayRouteArray) ToGatewayRouteArrayOutput() GatewayRouteArrayOutput {
   268  	return i.ToGatewayRouteArrayOutputWithContext(context.Background())
   269  }
   270  
   271  func (i GatewayRouteArray) ToGatewayRouteArrayOutputWithContext(ctx context.Context) GatewayRouteArrayOutput {
   272  	return pulumi.ToOutputWithContext(ctx, i).(GatewayRouteArrayOutput)
   273  }
   274  
   275  // GatewayRouteMapInput is an input type that accepts GatewayRouteMap and GatewayRouteMapOutput values.
   276  // You can construct a concrete instance of `GatewayRouteMapInput` via:
   277  //
   278  //	GatewayRouteMap{ "key": GatewayRouteArgs{...} }
   279  type GatewayRouteMapInput interface {
   280  	pulumi.Input
   281  
   282  	ToGatewayRouteMapOutput() GatewayRouteMapOutput
   283  	ToGatewayRouteMapOutputWithContext(context.Context) GatewayRouteMapOutput
   284  }
   285  
   286  type GatewayRouteMap map[string]GatewayRouteInput
   287  
   288  func (GatewayRouteMap) ElementType() reflect.Type {
   289  	return reflect.TypeOf((*map[string]*GatewayRoute)(nil)).Elem()
   290  }
   291  
   292  func (i GatewayRouteMap) ToGatewayRouteMapOutput() GatewayRouteMapOutput {
   293  	return i.ToGatewayRouteMapOutputWithContext(context.Background())
   294  }
   295  
   296  func (i GatewayRouteMap) ToGatewayRouteMapOutputWithContext(ctx context.Context) GatewayRouteMapOutput {
   297  	return pulumi.ToOutputWithContext(ctx, i).(GatewayRouteMapOutput)
   298  }
   299  
   300  type GatewayRouteOutput struct{ *pulumi.OutputState }
   301  
   302  func (GatewayRouteOutput) ElementType() reflect.Type {
   303  	return reflect.TypeOf((**GatewayRoute)(nil)).Elem()
   304  }
   305  
   306  func (o GatewayRouteOutput) ToGatewayRouteOutput() GatewayRouteOutput {
   307  	return o
   308  }
   309  
   310  func (o GatewayRouteOutput) ToGatewayRouteOutputWithContext(ctx context.Context) GatewayRouteOutput {
   311  	return o
   312  }
   313  
   314  // ARN of the gateway route.
   315  func (o GatewayRouteOutput) Arn() pulumi.StringOutput {
   316  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   317  }
   318  
   319  // Creation date of the gateway route.
   320  func (o GatewayRouteOutput) CreatedDate() pulumi.StringOutput {
   321  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.CreatedDate }).(pulumi.StringOutput)
   322  }
   323  
   324  // Last update date of the gateway route.
   325  func (o GatewayRouteOutput) LastUpdatedDate() pulumi.StringOutput {
   326  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.LastUpdatedDate }).(pulumi.StringOutput)
   327  }
   328  
   329  // Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.
   330  func (o GatewayRouteOutput) MeshName() pulumi.StringOutput {
   331  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.MeshName }).(pulumi.StringOutput)
   332  }
   333  
   334  // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   335  func (o GatewayRouteOutput) MeshOwner() pulumi.StringOutput {
   336  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.MeshOwner }).(pulumi.StringOutput)
   337  }
   338  
   339  // Name to use for the gateway route. Must be between 1 and 255 characters in length.
   340  func (o GatewayRouteOutput) Name() pulumi.StringOutput {
   341  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   342  }
   343  
   344  // Resource owner's AWS account ID.
   345  func (o GatewayRouteOutput) ResourceOwner() pulumi.StringOutput {
   346  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.ResourceOwner }).(pulumi.StringOutput)
   347  }
   348  
   349  // Gateway route specification to apply.
   350  func (o GatewayRouteOutput) Spec() GatewayRouteSpecOutput {
   351  	return o.ApplyT(func(v *GatewayRoute) GatewayRouteSpecOutput { return v.Spec }).(GatewayRouteSpecOutput)
   352  }
   353  
   354  // 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.
   355  func (o GatewayRouteOutput) Tags() pulumi.StringMapOutput {
   356  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   357  }
   358  
   359  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   360  //
   361  // Deprecated: Please use `tags` instead.
   362  func (o GatewayRouteOutput) TagsAll() pulumi.StringMapOutput {
   363  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   364  }
   365  
   366  // Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.
   367  func (o GatewayRouteOutput) VirtualGatewayName() pulumi.StringOutput {
   368  	return o.ApplyT(func(v *GatewayRoute) pulumi.StringOutput { return v.VirtualGatewayName }).(pulumi.StringOutput)
   369  }
   370  
   371  type GatewayRouteArrayOutput struct{ *pulumi.OutputState }
   372  
   373  func (GatewayRouteArrayOutput) ElementType() reflect.Type {
   374  	return reflect.TypeOf((*[]*GatewayRoute)(nil)).Elem()
   375  }
   376  
   377  func (o GatewayRouteArrayOutput) ToGatewayRouteArrayOutput() GatewayRouteArrayOutput {
   378  	return o
   379  }
   380  
   381  func (o GatewayRouteArrayOutput) ToGatewayRouteArrayOutputWithContext(ctx context.Context) GatewayRouteArrayOutput {
   382  	return o
   383  }
   384  
   385  func (o GatewayRouteArrayOutput) Index(i pulumi.IntInput) GatewayRouteOutput {
   386  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *GatewayRoute {
   387  		return vs[0].([]*GatewayRoute)[vs[1].(int)]
   388  	}).(GatewayRouteOutput)
   389  }
   390  
   391  type GatewayRouteMapOutput struct{ *pulumi.OutputState }
   392  
   393  func (GatewayRouteMapOutput) ElementType() reflect.Type {
   394  	return reflect.TypeOf((*map[string]*GatewayRoute)(nil)).Elem()
   395  }
   396  
   397  func (o GatewayRouteMapOutput) ToGatewayRouteMapOutput() GatewayRouteMapOutput {
   398  	return o
   399  }
   400  
   401  func (o GatewayRouteMapOutput) ToGatewayRouteMapOutputWithContext(ctx context.Context) GatewayRouteMapOutput {
   402  	return o
   403  }
   404  
   405  func (o GatewayRouteMapOutput) MapIndex(k pulumi.StringInput) GatewayRouteOutput {
   406  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *GatewayRoute {
   407  		return vs[0].(map[string]*GatewayRoute)[vs[1].(string)]
   408  	}).(GatewayRouteOutput)
   409  }
   410  
   411  func init() {
   412  	pulumi.RegisterInputType(reflect.TypeOf((*GatewayRouteInput)(nil)).Elem(), &GatewayRoute{})
   413  	pulumi.RegisterInputType(reflect.TypeOf((*GatewayRouteArrayInput)(nil)).Elem(), GatewayRouteArray{})
   414  	pulumi.RegisterInputType(reflect.TypeOf((*GatewayRouteMapInput)(nil)).Elem(), GatewayRouteMap{})
   415  	pulumi.RegisterOutputType(GatewayRouteOutput{})
   416  	pulumi.RegisterOutputType(GatewayRouteArrayOutput{})
   417  	pulumi.RegisterOutputType(GatewayRouteMapOutput{})
   418  }