Exemplo n.º 1
0
        private async threadingTask.Task <bool> DoesServiceExist()
        {
            var request = new DescribeServicesRequest
            {
                Cluster  = DefaultSettings.General.ClusterName,
                Services = new List <string> {
                    DefaultSettings.General.ServiceName
                }
            };

            var response = await ECSClient.DescribeServicesAsync(request);

            return(response.Services.Any());
        }
        static async Task Main(string[] args)
        {
            var basicCredentials = new BasicAWSCredentials("XXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXX");
            var client           = new AmazonECSClient(basicCredentials, RegionEndpoint.USWest2);

            // list available clusters in region
            var regionClusterArn = client.ListClusters(new Amazon.ECS.Model.ListClustersRequest {
            }).ClusterArns;

            foreach (var regionClusterName in regionClusterArn)
            {
                var clusterServiceArn      = (await client.ListServicesAsync(new Amazon.ECS.Model.ListServicesRequest {
                    Cluster = regionClusterName
                }).ConfigureAwait(false)).ServiceArns;
                var describeServiceRequest = new Amazon.ECS.Model.DescribeServicesRequest {
                    Cluster = regionClusterName, Services = clusterServiceArn
                };

                // list all available services in cluster
                var regionClusterService = (await client.DescribeServicesAsync(describeServiceRequest).ConfigureAwait(false)).Services;
            }
        }