github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecs/getCluster.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 Cluster data source allows access to details of a specific
    15  // cluster within an AWS ECS service.
    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.LookupCluster(ctx, &ecs.LookupClusterArgs{
    33  //				ClusterName: "ecs-mongo-production",
    34  //			}, nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			return nil
    39  //		})
    40  //	}
    41  //
    42  // ```
    43  // <!--End PulumiCodeChooser -->
    44  func LookupCluster(ctx *pulumi.Context, args *LookupClusterArgs, opts ...pulumi.InvokeOption) (*LookupClusterResult, error) {
    45  	opts = internal.PkgInvokeDefaultOpts(opts)
    46  	var rv LookupClusterResult
    47  	err := ctx.Invoke("aws:ecs/getCluster:getCluster", args, &rv, opts...)
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	return &rv, nil
    52  }
    53  
    54  // A collection of arguments for invoking getCluster.
    55  type LookupClusterArgs struct {
    56  	// Name of the ECS Cluster
    57  	ClusterName string `pulumi:"clusterName"`
    58  	// Key-value map of resource tags
    59  	Tags map[string]string `pulumi:"tags"`
    60  }
    61  
    62  // A collection of values returned by getCluster.
    63  type LookupClusterResult struct {
    64  	// ARN of the ECS Cluster
    65  	Arn         string `pulumi:"arn"`
    66  	ClusterName string `pulumi:"clusterName"`
    67  	// The provider-assigned unique ID for this managed resource.
    68  	Id string `pulumi:"id"`
    69  	// Number of pending tasks for the ECS Cluster
    70  	PendingTasksCount int `pulumi:"pendingTasksCount"`
    71  	// The number of registered container instances for the ECS Cluster
    72  	RegisteredContainerInstancesCount int `pulumi:"registeredContainerInstancesCount"`
    73  	// Number of running tasks for the ECS Cluster
    74  	RunningTasksCount int `pulumi:"runningTasksCount"`
    75  	// The default Service Connect namespace
    76  	ServiceConnectDefaults []GetClusterServiceConnectDefault `pulumi:"serviceConnectDefaults"`
    77  	// Settings associated with the ECS Cluster
    78  	Settings []GetClusterSetting `pulumi:"settings"`
    79  	// Status of the ECS Cluster
    80  	Status string `pulumi:"status"`
    81  	// Key-value map of resource tags
    82  	Tags map[string]string `pulumi:"tags"`
    83  }
    84  
    85  func LookupClusterOutput(ctx *pulumi.Context, args LookupClusterOutputArgs, opts ...pulumi.InvokeOption) LookupClusterResultOutput {
    86  	return pulumi.ToOutputWithContext(context.Background(), args).
    87  		ApplyT(func(v interface{}) (LookupClusterResult, error) {
    88  			args := v.(LookupClusterArgs)
    89  			r, err := LookupCluster(ctx, &args, opts...)
    90  			var s LookupClusterResult
    91  			if r != nil {
    92  				s = *r
    93  			}
    94  			return s, err
    95  		}).(LookupClusterResultOutput)
    96  }
    97  
    98  // A collection of arguments for invoking getCluster.
    99  type LookupClusterOutputArgs struct {
   100  	// Name of the ECS Cluster
   101  	ClusterName pulumi.StringInput `pulumi:"clusterName"`
   102  	// Key-value map of resource tags
   103  	Tags pulumi.StringMapInput `pulumi:"tags"`
   104  }
   105  
   106  func (LookupClusterOutputArgs) ElementType() reflect.Type {
   107  	return reflect.TypeOf((*LookupClusterArgs)(nil)).Elem()
   108  }
   109  
   110  // A collection of values returned by getCluster.
   111  type LookupClusterResultOutput struct{ *pulumi.OutputState }
   112  
   113  func (LookupClusterResultOutput) ElementType() reflect.Type {
   114  	return reflect.TypeOf((*LookupClusterResult)(nil)).Elem()
   115  }
   116  
   117  func (o LookupClusterResultOutput) ToLookupClusterResultOutput() LookupClusterResultOutput {
   118  	return o
   119  }
   120  
   121  func (o LookupClusterResultOutput) ToLookupClusterResultOutputWithContext(ctx context.Context) LookupClusterResultOutput {
   122  	return o
   123  }
   124  
   125  // ARN of the ECS Cluster
   126  func (o LookupClusterResultOutput) Arn() pulumi.StringOutput {
   127  	return o.ApplyT(func(v LookupClusterResult) string { return v.Arn }).(pulumi.StringOutput)
   128  }
   129  
   130  func (o LookupClusterResultOutput) ClusterName() pulumi.StringOutput {
   131  	return o.ApplyT(func(v LookupClusterResult) string { return v.ClusterName }).(pulumi.StringOutput)
   132  }
   133  
   134  // The provider-assigned unique ID for this managed resource.
   135  func (o LookupClusterResultOutput) Id() pulumi.StringOutput {
   136  	return o.ApplyT(func(v LookupClusterResult) string { return v.Id }).(pulumi.StringOutput)
   137  }
   138  
   139  // Number of pending tasks for the ECS Cluster
   140  func (o LookupClusterResultOutput) PendingTasksCount() pulumi.IntOutput {
   141  	return o.ApplyT(func(v LookupClusterResult) int { return v.PendingTasksCount }).(pulumi.IntOutput)
   142  }
   143  
   144  // The number of registered container instances for the ECS Cluster
   145  func (o LookupClusterResultOutput) RegisteredContainerInstancesCount() pulumi.IntOutput {
   146  	return o.ApplyT(func(v LookupClusterResult) int { return v.RegisteredContainerInstancesCount }).(pulumi.IntOutput)
   147  }
   148  
   149  // Number of running tasks for the ECS Cluster
   150  func (o LookupClusterResultOutput) RunningTasksCount() pulumi.IntOutput {
   151  	return o.ApplyT(func(v LookupClusterResult) int { return v.RunningTasksCount }).(pulumi.IntOutput)
   152  }
   153  
   154  // The default Service Connect namespace
   155  func (o LookupClusterResultOutput) ServiceConnectDefaults() GetClusterServiceConnectDefaultArrayOutput {
   156  	return o.ApplyT(func(v LookupClusterResult) []GetClusterServiceConnectDefault { return v.ServiceConnectDefaults }).(GetClusterServiceConnectDefaultArrayOutput)
   157  }
   158  
   159  // Settings associated with the ECS Cluster
   160  func (o LookupClusterResultOutput) Settings() GetClusterSettingArrayOutput {
   161  	return o.ApplyT(func(v LookupClusterResult) []GetClusterSetting { return v.Settings }).(GetClusterSettingArrayOutput)
   162  }
   163  
   164  // Status of the ECS Cluster
   165  func (o LookupClusterResultOutput) Status() pulumi.StringOutput {
   166  	return o.ApplyT(func(v LookupClusterResult) string { return v.Status }).(pulumi.StringOutput)
   167  }
   168  
   169  // Key-value map of resource tags
   170  func (o LookupClusterResultOutput) Tags() pulumi.StringMapOutput {
   171  	return o.ApplyT(func(v LookupClusterResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   172  }
   173  
   174  func init() {
   175  	pulumi.RegisterOutputType(LookupClusterResultOutput{})
   176  }