github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/appmesh/getVirtualService.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // The App Mesh Virtual Service data source allows details of an App Mesh Virtual Service to be retrieved by its name, mesh_name, and optionally the mesh_owner.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appmesh"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := appmesh.LookupVirtualService(ctx, &appmesh.LookupVirtualServiceArgs{
    32  //				Name:     "example.mesh.local",
    33  //				MeshName: "example-mesh",
    34  //			}, nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			return nil
    39  //		})
    40  //	}
    41  //
    42  // ```
    43  // <!--End PulumiCodeChooser -->
    44  //
    45  // <!--Start PulumiCodeChooser -->
    46  // ```go
    47  // package main
    48  //
    49  // import (
    50  //
    51  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    52  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appmesh"
    53  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    54  //
    55  // )
    56  //
    57  //	func main() {
    58  //		pulumi.Run(func(ctx *pulumi.Context) error {
    59  //			current, err := aws.GetCallerIdentity(ctx, nil, nil)
    60  //			if err != nil {
    61  //				return err
    62  //			}
    63  //			_, err = appmesh.LookupVirtualService(ctx, &appmesh.LookupVirtualServiceArgs{
    64  //				Name:      "example.mesh.local",
    65  //				MeshName:  "example-mesh",
    66  //				MeshOwner: pulumi.StringRef(current.AccountId),
    67  //			}, nil)
    68  //			if err != nil {
    69  //				return err
    70  //			}
    71  //			return nil
    72  //		})
    73  //	}
    74  //
    75  // ```
    76  // <!--End PulumiCodeChooser -->
    77  func LookupVirtualService(ctx *pulumi.Context, args *LookupVirtualServiceArgs, opts ...pulumi.InvokeOption) (*LookupVirtualServiceResult, error) {
    78  	opts = internal.PkgInvokeDefaultOpts(opts)
    79  	var rv LookupVirtualServiceResult
    80  	err := ctx.Invoke("aws:appmesh/getVirtualService:getVirtualService", args, &rv, opts...)
    81  	if err != nil {
    82  		return nil, err
    83  	}
    84  	return &rv, nil
    85  }
    86  
    87  // A collection of arguments for invoking getVirtualService.
    88  type LookupVirtualServiceArgs struct {
    89  	// Name of the service mesh in which the virtual service exists.
    90  	MeshName string `pulumi:"meshName"`
    91  	// AWS account ID of the service mesh's owner.
    92  	MeshOwner *string `pulumi:"meshOwner"`
    93  	// Name of the virtual service.
    94  	Name string `pulumi:"name"`
    95  	// Map of tags.
    96  	Tags map[string]string `pulumi:"tags"`
    97  }
    98  
    99  // A collection of values returned by getVirtualService.
   100  type LookupVirtualServiceResult struct {
   101  	// ARN of the virtual service.
   102  	Arn string `pulumi:"arn"`
   103  	// Creation date of the virtual service.
   104  	CreatedDate string `pulumi:"createdDate"`
   105  	// The provider-assigned unique ID for this managed resource.
   106  	Id string `pulumi:"id"`
   107  	// Last update date of the virtual service.
   108  	LastUpdatedDate string `pulumi:"lastUpdatedDate"`
   109  	MeshName        string `pulumi:"meshName"`
   110  	MeshOwner       string `pulumi:"meshOwner"`
   111  	Name            string `pulumi:"name"`
   112  	// Resource owner's AWS account ID.
   113  	ResourceOwner string `pulumi:"resourceOwner"`
   114  	// Virtual service specification. See the `appmesh.VirtualService` resource for details.
   115  	Specs []GetVirtualServiceSpec `pulumi:"specs"`
   116  	// Map of tags.
   117  	Tags map[string]string `pulumi:"tags"`
   118  }
   119  
   120  func LookupVirtualServiceOutput(ctx *pulumi.Context, args LookupVirtualServiceOutputArgs, opts ...pulumi.InvokeOption) LookupVirtualServiceResultOutput {
   121  	return pulumi.ToOutputWithContext(context.Background(), args).
   122  		ApplyT(func(v interface{}) (LookupVirtualServiceResult, error) {
   123  			args := v.(LookupVirtualServiceArgs)
   124  			r, err := LookupVirtualService(ctx, &args, opts...)
   125  			var s LookupVirtualServiceResult
   126  			if r != nil {
   127  				s = *r
   128  			}
   129  			return s, err
   130  		}).(LookupVirtualServiceResultOutput)
   131  }
   132  
   133  // A collection of arguments for invoking getVirtualService.
   134  type LookupVirtualServiceOutputArgs struct {
   135  	// Name of the service mesh in which the virtual service exists.
   136  	MeshName pulumi.StringInput `pulumi:"meshName"`
   137  	// AWS account ID of the service mesh's owner.
   138  	MeshOwner pulumi.StringPtrInput `pulumi:"meshOwner"`
   139  	// Name of the virtual service.
   140  	Name pulumi.StringInput `pulumi:"name"`
   141  	// Map of tags.
   142  	Tags pulumi.StringMapInput `pulumi:"tags"`
   143  }
   144  
   145  func (LookupVirtualServiceOutputArgs) ElementType() reflect.Type {
   146  	return reflect.TypeOf((*LookupVirtualServiceArgs)(nil)).Elem()
   147  }
   148  
   149  // A collection of values returned by getVirtualService.
   150  type LookupVirtualServiceResultOutput struct{ *pulumi.OutputState }
   151  
   152  func (LookupVirtualServiceResultOutput) ElementType() reflect.Type {
   153  	return reflect.TypeOf((*LookupVirtualServiceResult)(nil)).Elem()
   154  }
   155  
   156  func (o LookupVirtualServiceResultOutput) ToLookupVirtualServiceResultOutput() LookupVirtualServiceResultOutput {
   157  	return o
   158  }
   159  
   160  func (o LookupVirtualServiceResultOutput) ToLookupVirtualServiceResultOutputWithContext(ctx context.Context) LookupVirtualServiceResultOutput {
   161  	return o
   162  }
   163  
   164  // ARN of the virtual service.
   165  func (o LookupVirtualServiceResultOutput) Arn() pulumi.StringOutput {
   166  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.Arn }).(pulumi.StringOutput)
   167  }
   168  
   169  // Creation date of the virtual service.
   170  func (o LookupVirtualServiceResultOutput) CreatedDate() pulumi.StringOutput {
   171  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.CreatedDate }).(pulumi.StringOutput)
   172  }
   173  
   174  // The provider-assigned unique ID for this managed resource.
   175  func (o LookupVirtualServiceResultOutput) Id() pulumi.StringOutput {
   176  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.Id }).(pulumi.StringOutput)
   177  }
   178  
   179  // Last update date of the virtual service.
   180  func (o LookupVirtualServiceResultOutput) LastUpdatedDate() pulumi.StringOutput {
   181  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.LastUpdatedDate }).(pulumi.StringOutput)
   182  }
   183  
   184  func (o LookupVirtualServiceResultOutput) MeshName() pulumi.StringOutput {
   185  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.MeshName }).(pulumi.StringOutput)
   186  }
   187  
   188  func (o LookupVirtualServiceResultOutput) MeshOwner() pulumi.StringOutput {
   189  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.MeshOwner }).(pulumi.StringOutput)
   190  }
   191  
   192  func (o LookupVirtualServiceResultOutput) Name() pulumi.StringOutput {
   193  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.Name }).(pulumi.StringOutput)
   194  }
   195  
   196  // Resource owner's AWS account ID.
   197  func (o LookupVirtualServiceResultOutput) ResourceOwner() pulumi.StringOutput {
   198  	return o.ApplyT(func(v LookupVirtualServiceResult) string { return v.ResourceOwner }).(pulumi.StringOutput)
   199  }
   200  
   201  // Virtual service specification. See the `appmesh.VirtualService` resource for details.
   202  func (o LookupVirtualServiceResultOutput) Specs() GetVirtualServiceSpecArrayOutput {
   203  	return o.ApplyT(func(v LookupVirtualServiceResult) []GetVirtualServiceSpec { return v.Specs }).(GetVirtualServiceSpecArrayOutput)
   204  }
   205  
   206  // Map of tags.
   207  func (o LookupVirtualServiceResultOutput) Tags() pulumi.StringMapOutput {
   208  	return o.ApplyT(func(v LookupVirtualServiceResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   209  }
   210  
   211  func init() {
   212  	pulumi.RegisterOutputType(LookupVirtualServiceResultOutput{})
   213  }