github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/appmesh/virtualService.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 virtual service resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Virtual Node Provider
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appmesh"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := appmesh.NewVirtualService(ctx, "servicea", &appmesh.VirtualServiceArgs{
    35  //				Name:     pulumi.String("servicea.simpleapp.local"),
    36  //				MeshName: pulumi.Any(simple.Id),
    37  //				Spec: &appmesh.VirtualServiceSpecArgs{
    38  //					Provider: &appmesh.VirtualServiceSpecProviderArgs{
    39  //						VirtualNode: &appmesh.VirtualServiceSpecProviderVirtualNodeArgs{
    40  //							VirtualNodeName: pulumi.Any(serviceb1.Name),
    41  //						},
    42  //					},
    43  //				},
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ### Virtual Router Provider
    56  //
    57  // <!--Start PulumiCodeChooser -->
    58  // ```go
    59  // package main
    60  //
    61  // import (
    62  //
    63  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appmesh"
    64  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    65  //
    66  // )
    67  //
    68  //	func main() {
    69  //		pulumi.Run(func(ctx *pulumi.Context) error {
    70  //			_, err := appmesh.NewVirtualService(ctx, "servicea", &appmesh.VirtualServiceArgs{
    71  //				Name:     pulumi.String("servicea.simpleapp.local"),
    72  //				MeshName: pulumi.Any(simple.Id),
    73  //				Spec: &appmesh.VirtualServiceSpecArgs{
    74  //					Provider: &appmesh.VirtualServiceSpecProviderArgs{
    75  //						VirtualRouter: &appmesh.VirtualServiceSpecProviderVirtualRouterArgs{
    76  //							VirtualRouterName: pulumi.Any(serviceb.Name),
    77  //						},
    78  //					},
    79  //				},
    80  //			})
    81  //			if err != nil {
    82  //				return err
    83  //			}
    84  //			return nil
    85  //		})
    86  //	}
    87  //
    88  // ```
    89  // <!--End PulumiCodeChooser -->
    90  //
    91  // ## Import
    92  //
    93  // Using `pulumi import`, import App Mesh virtual services using `mesh_name` together with the virtual service's `name`. For example:
    94  //
    95  // ```sh
    96  // $ pulumi import aws:appmesh/virtualService:VirtualService servicea simpleapp/servicea.simpleapp.local
    97  // ```
    98  type VirtualService struct {
    99  	pulumi.CustomResourceState
   100  
   101  	// ARN of the virtual service.
   102  	Arn pulumi.StringOutput `pulumi:"arn"`
   103  	// Creation date of the virtual service.
   104  	CreatedDate pulumi.StringOutput `pulumi:"createdDate"`
   105  	// Last update date of the virtual service.
   106  	LastUpdatedDate pulumi.StringOutput `pulumi:"lastUpdatedDate"`
   107  	// Name of the service mesh in which to create the virtual service. Must be between 1 and 255 characters in length.
   108  	MeshName pulumi.StringOutput `pulumi:"meshName"`
   109  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   110  	MeshOwner pulumi.StringOutput `pulumi:"meshOwner"`
   111  	// Name to use for the virtual service. Must be between 1 and 255 characters in length.
   112  	Name pulumi.StringOutput `pulumi:"name"`
   113  	// Resource owner's AWS account ID.
   114  	ResourceOwner pulumi.StringOutput `pulumi:"resourceOwner"`
   115  	// Virtual service specification to apply.
   116  	Spec VirtualServiceSpecOutput `pulumi:"spec"`
   117  	// 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.
   118  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   119  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   120  	//
   121  	// Deprecated: Please use `tags` instead.
   122  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   123  }
   124  
   125  // NewVirtualService registers a new resource with the given unique name, arguments, and options.
   126  func NewVirtualService(ctx *pulumi.Context,
   127  	name string, args *VirtualServiceArgs, opts ...pulumi.ResourceOption) (*VirtualService, error) {
   128  	if args == nil {
   129  		return nil, errors.New("missing one or more required arguments")
   130  	}
   131  
   132  	if args.MeshName == nil {
   133  		return nil, errors.New("invalid value for required argument 'MeshName'")
   134  	}
   135  	if args.Spec == nil {
   136  		return nil, errors.New("invalid value for required argument 'Spec'")
   137  	}
   138  	opts = internal.PkgResourceDefaultOpts(opts)
   139  	var resource VirtualService
   140  	err := ctx.RegisterResource("aws:appmesh/virtualService:VirtualService", name, args, &resource, opts...)
   141  	if err != nil {
   142  		return nil, err
   143  	}
   144  	return &resource, nil
   145  }
   146  
   147  // GetVirtualService gets an existing VirtualService resource's state with the given name, ID, and optional
   148  // state properties that are used to uniquely qualify the lookup (nil if not required).
   149  func GetVirtualService(ctx *pulumi.Context,
   150  	name string, id pulumi.IDInput, state *VirtualServiceState, opts ...pulumi.ResourceOption) (*VirtualService, error) {
   151  	var resource VirtualService
   152  	err := ctx.ReadResource("aws:appmesh/virtualService:VirtualService", name, id, state, &resource, opts...)
   153  	if err != nil {
   154  		return nil, err
   155  	}
   156  	return &resource, nil
   157  }
   158  
   159  // Input properties used for looking up and filtering VirtualService resources.
   160  type virtualServiceState struct {
   161  	// ARN of the virtual service.
   162  	Arn *string `pulumi:"arn"`
   163  	// Creation date of the virtual service.
   164  	CreatedDate *string `pulumi:"createdDate"`
   165  	// Last update date of the virtual service.
   166  	LastUpdatedDate *string `pulumi:"lastUpdatedDate"`
   167  	// Name of the service mesh in which to create the virtual service. Must be between 1 and 255 characters in length.
   168  	MeshName *string `pulumi:"meshName"`
   169  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   170  	MeshOwner *string `pulumi:"meshOwner"`
   171  	// Name to use for the virtual service. Must be between 1 and 255 characters in length.
   172  	Name *string `pulumi:"name"`
   173  	// Resource owner's AWS account ID.
   174  	ResourceOwner *string `pulumi:"resourceOwner"`
   175  	// Virtual service specification to apply.
   176  	Spec *VirtualServiceSpec `pulumi:"spec"`
   177  	// 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.
   178  	Tags map[string]string `pulumi:"tags"`
   179  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   180  	//
   181  	// Deprecated: Please use `tags` instead.
   182  	TagsAll map[string]string `pulumi:"tagsAll"`
   183  }
   184  
   185  type VirtualServiceState struct {
   186  	// ARN of the virtual service.
   187  	Arn pulumi.StringPtrInput
   188  	// Creation date of the virtual service.
   189  	CreatedDate pulumi.StringPtrInput
   190  	// Last update date of the virtual service.
   191  	LastUpdatedDate pulumi.StringPtrInput
   192  	// Name of the service mesh in which to create the virtual service. Must be between 1 and 255 characters in length.
   193  	MeshName pulumi.StringPtrInput
   194  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   195  	MeshOwner pulumi.StringPtrInput
   196  	// Name to use for the virtual service. Must be between 1 and 255 characters in length.
   197  	Name pulumi.StringPtrInput
   198  	// Resource owner's AWS account ID.
   199  	ResourceOwner pulumi.StringPtrInput
   200  	// Virtual service specification to apply.
   201  	Spec VirtualServiceSpecPtrInput
   202  	// 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.
   203  	Tags pulumi.StringMapInput
   204  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   205  	//
   206  	// Deprecated: Please use `tags` instead.
   207  	TagsAll pulumi.StringMapInput
   208  }
   209  
   210  func (VirtualServiceState) ElementType() reflect.Type {
   211  	return reflect.TypeOf((*virtualServiceState)(nil)).Elem()
   212  }
   213  
   214  type virtualServiceArgs struct {
   215  	// Name of the service mesh in which to create the virtual service. Must be between 1 and 255 characters in length.
   216  	MeshName string `pulumi:"meshName"`
   217  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   218  	MeshOwner *string `pulumi:"meshOwner"`
   219  	// Name to use for the virtual service. Must be between 1 and 255 characters in length.
   220  	Name *string `pulumi:"name"`
   221  	// Virtual service specification to apply.
   222  	Spec VirtualServiceSpec `pulumi:"spec"`
   223  	// 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.
   224  	Tags map[string]string `pulumi:"tags"`
   225  }
   226  
   227  // The set of arguments for constructing a VirtualService resource.
   228  type VirtualServiceArgs struct {
   229  	// Name of the service mesh in which to create the virtual service. Must be between 1 and 255 characters in length.
   230  	MeshName pulumi.StringInput
   231  	// AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   232  	MeshOwner pulumi.StringPtrInput
   233  	// Name to use for the virtual service. Must be between 1 and 255 characters in length.
   234  	Name pulumi.StringPtrInput
   235  	// Virtual service specification to apply.
   236  	Spec VirtualServiceSpecInput
   237  	// 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.
   238  	Tags pulumi.StringMapInput
   239  }
   240  
   241  func (VirtualServiceArgs) ElementType() reflect.Type {
   242  	return reflect.TypeOf((*virtualServiceArgs)(nil)).Elem()
   243  }
   244  
   245  type VirtualServiceInput interface {
   246  	pulumi.Input
   247  
   248  	ToVirtualServiceOutput() VirtualServiceOutput
   249  	ToVirtualServiceOutputWithContext(ctx context.Context) VirtualServiceOutput
   250  }
   251  
   252  func (*VirtualService) ElementType() reflect.Type {
   253  	return reflect.TypeOf((**VirtualService)(nil)).Elem()
   254  }
   255  
   256  func (i *VirtualService) ToVirtualServiceOutput() VirtualServiceOutput {
   257  	return i.ToVirtualServiceOutputWithContext(context.Background())
   258  }
   259  
   260  func (i *VirtualService) ToVirtualServiceOutputWithContext(ctx context.Context) VirtualServiceOutput {
   261  	return pulumi.ToOutputWithContext(ctx, i).(VirtualServiceOutput)
   262  }
   263  
   264  // VirtualServiceArrayInput is an input type that accepts VirtualServiceArray and VirtualServiceArrayOutput values.
   265  // You can construct a concrete instance of `VirtualServiceArrayInput` via:
   266  //
   267  //	VirtualServiceArray{ VirtualServiceArgs{...} }
   268  type VirtualServiceArrayInput interface {
   269  	pulumi.Input
   270  
   271  	ToVirtualServiceArrayOutput() VirtualServiceArrayOutput
   272  	ToVirtualServiceArrayOutputWithContext(context.Context) VirtualServiceArrayOutput
   273  }
   274  
   275  type VirtualServiceArray []VirtualServiceInput
   276  
   277  func (VirtualServiceArray) ElementType() reflect.Type {
   278  	return reflect.TypeOf((*[]*VirtualService)(nil)).Elem()
   279  }
   280  
   281  func (i VirtualServiceArray) ToVirtualServiceArrayOutput() VirtualServiceArrayOutput {
   282  	return i.ToVirtualServiceArrayOutputWithContext(context.Background())
   283  }
   284  
   285  func (i VirtualServiceArray) ToVirtualServiceArrayOutputWithContext(ctx context.Context) VirtualServiceArrayOutput {
   286  	return pulumi.ToOutputWithContext(ctx, i).(VirtualServiceArrayOutput)
   287  }
   288  
   289  // VirtualServiceMapInput is an input type that accepts VirtualServiceMap and VirtualServiceMapOutput values.
   290  // You can construct a concrete instance of `VirtualServiceMapInput` via:
   291  //
   292  //	VirtualServiceMap{ "key": VirtualServiceArgs{...} }
   293  type VirtualServiceMapInput interface {
   294  	pulumi.Input
   295  
   296  	ToVirtualServiceMapOutput() VirtualServiceMapOutput
   297  	ToVirtualServiceMapOutputWithContext(context.Context) VirtualServiceMapOutput
   298  }
   299  
   300  type VirtualServiceMap map[string]VirtualServiceInput
   301  
   302  func (VirtualServiceMap) ElementType() reflect.Type {
   303  	return reflect.TypeOf((*map[string]*VirtualService)(nil)).Elem()
   304  }
   305  
   306  func (i VirtualServiceMap) ToVirtualServiceMapOutput() VirtualServiceMapOutput {
   307  	return i.ToVirtualServiceMapOutputWithContext(context.Background())
   308  }
   309  
   310  func (i VirtualServiceMap) ToVirtualServiceMapOutputWithContext(ctx context.Context) VirtualServiceMapOutput {
   311  	return pulumi.ToOutputWithContext(ctx, i).(VirtualServiceMapOutput)
   312  }
   313  
   314  type VirtualServiceOutput struct{ *pulumi.OutputState }
   315  
   316  func (VirtualServiceOutput) ElementType() reflect.Type {
   317  	return reflect.TypeOf((**VirtualService)(nil)).Elem()
   318  }
   319  
   320  func (o VirtualServiceOutput) ToVirtualServiceOutput() VirtualServiceOutput {
   321  	return o
   322  }
   323  
   324  func (o VirtualServiceOutput) ToVirtualServiceOutputWithContext(ctx context.Context) VirtualServiceOutput {
   325  	return o
   326  }
   327  
   328  // ARN of the virtual service.
   329  func (o VirtualServiceOutput) Arn() pulumi.StringOutput {
   330  	return o.ApplyT(func(v *VirtualService) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   331  }
   332  
   333  // Creation date of the virtual service.
   334  func (o VirtualServiceOutput) CreatedDate() pulumi.StringOutput {
   335  	return o.ApplyT(func(v *VirtualService) pulumi.StringOutput { return v.CreatedDate }).(pulumi.StringOutput)
   336  }
   337  
   338  // Last update date of the virtual service.
   339  func (o VirtualServiceOutput) LastUpdatedDate() pulumi.StringOutput {
   340  	return o.ApplyT(func(v *VirtualService) pulumi.StringOutput { return v.LastUpdatedDate }).(pulumi.StringOutput)
   341  }
   342  
   343  // Name of the service mesh in which to create the virtual service. Must be between 1 and 255 characters in length.
   344  func (o VirtualServiceOutput) MeshName() pulumi.StringOutput {
   345  	return o.ApplyT(func(v *VirtualService) pulumi.StringOutput { return v.MeshName }).(pulumi.StringOutput)
   346  }
   347  
   348  // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
   349  func (o VirtualServiceOutput) MeshOwner() pulumi.StringOutput {
   350  	return o.ApplyT(func(v *VirtualService) pulumi.StringOutput { return v.MeshOwner }).(pulumi.StringOutput)
   351  }
   352  
   353  // Name to use for the virtual service. Must be between 1 and 255 characters in length.
   354  func (o VirtualServiceOutput) Name() pulumi.StringOutput {
   355  	return o.ApplyT(func(v *VirtualService) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   356  }
   357  
   358  // Resource owner's AWS account ID.
   359  func (o VirtualServiceOutput) ResourceOwner() pulumi.StringOutput {
   360  	return o.ApplyT(func(v *VirtualService) pulumi.StringOutput { return v.ResourceOwner }).(pulumi.StringOutput)
   361  }
   362  
   363  // Virtual service specification to apply.
   364  func (o VirtualServiceOutput) Spec() VirtualServiceSpecOutput {
   365  	return o.ApplyT(func(v *VirtualService) VirtualServiceSpecOutput { return v.Spec }).(VirtualServiceSpecOutput)
   366  }
   367  
   368  // 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.
   369  func (o VirtualServiceOutput) Tags() pulumi.StringMapOutput {
   370  	return o.ApplyT(func(v *VirtualService) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   371  }
   372  
   373  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   374  //
   375  // Deprecated: Please use `tags` instead.
   376  func (o VirtualServiceOutput) TagsAll() pulumi.StringMapOutput {
   377  	return o.ApplyT(func(v *VirtualService) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   378  }
   379  
   380  type VirtualServiceArrayOutput struct{ *pulumi.OutputState }
   381  
   382  func (VirtualServiceArrayOutput) ElementType() reflect.Type {
   383  	return reflect.TypeOf((*[]*VirtualService)(nil)).Elem()
   384  }
   385  
   386  func (o VirtualServiceArrayOutput) ToVirtualServiceArrayOutput() VirtualServiceArrayOutput {
   387  	return o
   388  }
   389  
   390  func (o VirtualServiceArrayOutput) ToVirtualServiceArrayOutputWithContext(ctx context.Context) VirtualServiceArrayOutput {
   391  	return o
   392  }
   393  
   394  func (o VirtualServiceArrayOutput) Index(i pulumi.IntInput) VirtualServiceOutput {
   395  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VirtualService {
   396  		return vs[0].([]*VirtualService)[vs[1].(int)]
   397  	}).(VirtualServiceOutput)
   398  }
   399  
   400  type VirtualServiceMapOutput struct{ *pulumi.OutputState }
   401  
   402  func (VirtualServiceMapOutput) ElementType() reflect.Type {
   403  	return reflect.TypeOf((*map[string]*VirtualService)(nil)).Elem()
   404  }
   405  
   406  func (o VirtualServiceMapOutput) ToVirtualServiceMapOutput() VirtualServiceMapOutput {
   407  	return o
   408  }
   409  
   410  func (o VirtualServiceMapOutput) ToVirtualServiceMapOutputWithContext(ctx context.Context) VirtualServiceMapOutput {
   411  	return o
   412  }
   413  
   414  func (o VirtualServiceMapOutput) MapIndex(k pulumi.StringInput) VirtualServiceOutput {
   415  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VirtualService {
   416  		return vs[0].(map[string]*VirtualService)[vs[1].(string)]
   417  	}).(VirtualServiceOutput)
   418  }
   419  
   420  func init() {
   421  	pulumi.RegisterInputType(reflect.TypeOf((*VirtualServiceInput)(nil)).Elem(), &VirtualService{})
   422  	pulumi.RegisterInputType(reflect.TypeOf((*VirtualServiceArrayInput)(nil)).Elem(), VirtualServiceArray{})
   423  	pulumi.RegisterInputType(reflect.TypeOf((*VirtualServiceMapInput)(nil)).Elem(), VirtualServiceMap{})
   424  	pulumi.RegisterOutputType(VirtualServiceOutput{})
   425  	pulumi.RegisterOutputType(VirtualServiceArrayOutput{})
   426  	pulumi.RegisterOutputType(VirtualServiceMapOutput{})
   427  }