Esempio n. 1
0
 internal static void WriteContainers(DateTime captureTime, string accountId, RegionEndpoint regionEndPoint)
 {
     try
     {
         var ecsClient           = new AmazonECSClient(regionEndPoint);
         var listClusterResponse = ecsClient.ListClusters(new ListClustersRequest {
             MaxResults = 100
         });
         foreach (var cluster in listClusterResponse.ClusterArns)
         {
             var ecsResponse = ecsClient.DescribeContainerInstances(new DescribeContainerInstancesRequest {
                 Cluster = cluster
             });
             foreach (var ecs in ecsResponse.ContainerInstances)
             {
                 string ecsJson = JsonConvert.SerializeObject(ecs);
                 Common.UpdateTopology(captureTime, accountId, regionEndPoint.SystemName, "ecs", ecs.Ec2InstanceId, ecsJson, "UPDATE");
             }
         }
     }
     catch (Exception ex)
     {
         //Log.Error("Exception occured while reading containers", ex);
         Log.InfoFormat("Error reading containers: {0}", ex.Message);
     }
 }
Esempio n. 2
0
        public void ECSDescribeContainerInstances()
        {
            #region c8f439de-eb27-4269-8ca7-2c0a7ba75ab0

            var client   = new AmazonECSClient();
            var response = client.DescribeContainerInstances(new DescribeContainerInstancesRequest
            {
                Cluster            = "default",
                ContainerInstances = new List <string> {
                    "f2756532-8f13-4d53-87c9-aed50dc94cd7"
                }
            });

            List <ContainerInstance> containerInstances = response.ContainerInstances;
            List <Failure>           failures           = response.Failures;

            #endregion
        }