github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecs/getService.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 ecs
     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 ECS Service data source allows access to details of a specific
    15  // Service within a AWS ECS Cluster.
    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/ecs"
    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 := ecs.LookupService(ctx, &ecs.LookupServiceArgs{
    33  //				ServiceName: "example",
    34  //				ClusterArn:  exampleAwsEcsCluster.Arn,
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func LookupService(ctx *pulumi.Context, args *LookupServiceArgs, opts ...pulumi.InvokeOption) (*LookupServiceResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv LookupServiceResult
    48  	err := ctx.Invoke("aws:ecs/getService:getService", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getService.
    56  type LookupServiceArgs struct {
    57  	// ARN of the ECS Cluster
    58  	ClusterArn string `pulumi:"clusterArn"`
    59  	// Name of the ECS Service
    60  	ServiceName string `pulumi:"serviceName"`
    61  	// Resource tags.
    62  	Tags map[string]string `pulumi:"tags"`
    63  }
    64  
    65  // A collection of values returned by getService.
    66  type LookupServiceResult struct {
    67  	// ARN of the ECS Service
    68  	Arn        string `pulumi:"arn"`
    69  	ClusterArn string `pulumi:"clusterArn"`
    70  	// Number of tasks for the ECS Service
    71  	DesiredCount int `pulumi:"desiredCount"`
    72  	// The provider-assigned unique ID for this managed resource.
    73  	Id string `pulumi:"id"`
    74  	// Launch type for the ECS Service
    75  	LaunchType string `pulumi:"launchType"`
    76  	// Scheduling strategy for the ECS Service
    77  	SchedulingStrategy string `pulumi:"schedulingStrategy"`
    78  	ServiceName        string `pulumi:"serviceName"`
    79  	// Resource tags.
    80  	Tags map[string]string `pulumi:"tags"`
    81  	// Family for the latest ACTIVE revision or full ARN of the task definition.
    82  	TaskDefinition string `pulumi:"taskDefinition"`
    83  }
    84  
    85  func LookupServiceOutput(ctx *pulumi.Context, args LookupServiceOutputArgs, opts ...pulumi.InvokeOption) LookupServiceResultOutput {
    86  	return pulumi.ToOutputWithContext(context.Background(), args).
    87  		ApplyT(func(v interface{}) (LookupServiceResult, error) {
    88  			args := v.(LookupServiceArgs)
    89  			r, err := LookupService(ctx, &args, opts...)
    90  			var s LookupServiceResult
    91  			if r != nil {
    92  				s = *r
    93  			}
    94  			return s, err
    95  		}).(LookupServiceResultOutput)
    96  }
    97  
    98  // A collection of arguments for invoking getService.
    99  type LookupServiceOutputArgs struct {
   100  	// ARN of the ECS Cluster
   101  	ClusterArn pulumi.StringInput `pulumi:"clusterArn"`
   102  	// Name of the ECS Service
   103  	ServiceName pulumi.StringInput `pulumi:"serviceName"`
   104  	// Resource tags.
   105  	Tags pulumi.StringMapInput `pulumi:"tags"`
   106  }
   107  
   108  func (LookupServiceOutputArgs) ElementType() reflect.Type {
   109  	return reflect.TypeOf((*LookupServiceArgs)(nil)).Elem()
   110  }
   111  
   112  // A collection of values returned by getService.
   113  type LookupServiceResultOutput struct{ *pulumi.OutputState }
   114  
   115  func (LookupServiceResultOutput) ElementType() reflect.Type {
   116  	return reflect.TypeOf((*LookupServiceResult)(nil)).Elem()
   117  }
   118  
   119  func (o LookupServiceResultOutput) ToLookupServiceResultOutput() LookupServiceResultOutput {
   120  	return o
   121  }
   122  
   123  func (o LookupServiceResultOutput) ToLookupServiceResultOutputWithContext(ctx context.Context) LookupServiceResultOutput {
   124  	return o
   125  }
   126  
   127  // ARN of the ECS Service
   128  func (o LookupServiceResultOutput) Arn() pulumi.StringOutput {
   129  	return o.ApplyT(func(v LookupServiceResult) string { return v.Arn }).(pulumi.StringOutput)
   130  }
   131  
   132  func (o LookupServiceResultOutput) ClusterArn() pulumi.StringOutput {
   133  	return o.ApplyT(func(v LookupServiceResult) string { return v.ClusterArn }).(pulumi.StringOutput)
   134  }
   135  
   136  // Number of tasks for the ECS Service
   137  func (o LookupServiceResultOutput) DesiredCount() pulumi.IntOutput {
   138  	return o.ApplyT(func(v LookupServiceResult) int { return v.DesiredCount }).(pulumi.IntOutput)
   139  }
   140  
   141  // The provider-assigned unique ID for this managed resource.
   142  func (o LookupServiceResultOutput) Id() pulumi.StringOutput {
   143  	return o.ApplyT(func(v LookupServiceResult) string { return v.Id }).(pulumi.StringOutput)
   144  }
   145  
   146  // Launch type for the ECS Service
   147  func (o LookupServiceResultOutput) LaunchType() pulumi.StringOutput {
   148  	return o.ApplyT(func(v LookupServiceResult) string { return v.LaunchType }).(pulumi.StringOutput)
   149  }
   150  
   151  // Scheduling strategy for the ECS Service
   152  func (o LookupServiceResultOutput) SchedulingStrategy() pulumi.StringOutput {
   153  	return o.ApplyT(func(v LookupServiceResult) string { return v.SchedulingStrategy }).(pulumi.StringOutput)
   154  }
   155  
   156  func (o LookupServiceResultOutput) ServiceName() pulumi.StringOutput {
   157  	return o.ApplyT(func(v LookupServiceResult) string { return v.ServiceName }).(pulumi.StringOutput)
   158  }
   159  
   160  // Resource tags.
   161  func (o LookupServiceResultOutput) Tags() pulumi.StringMapOutput {
   162  	return o.ApplyT(func(v LookupServiceResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   163  }
   164  
   165  // Family for the latest ACTIVE revision or full ARN of the task definition.
   166  func (o LookupServiceResultOutput) TaskDefinition() pulumi.StringOutput {
   167  	return o.ApplyT(func(v LookupServiceResult) string { return v.TaskDefinition }).(pulumi.StringOutput)
   168  }
   169  
   170  func init() {
   171  	pulumi.RegisterOutputType(LookupServiceResultOutput{})
   172  }