public void AutoScalingDescribeAutoScalingGroups()
        {
            #region autoscaling-describe-auto-scaling-groups-1

            var response = client.DescribeAutoScalingGroups(new DescribeAutoScalingGroupsRequest
            {
                AutoScalingGroupNames = new List <string> {
                    "my-auto-scaling-group"
                }
            });

            List <AutoScalingGroup> autoScalingGroups = response.AutoScalingGroups;

            #endregion
        }
Exemplo n.º 2
0
        IEnumerable <DescribeAutoScalingGroupsResponse> IPaginator <DescribeAutoScalingGroupsResponse> .Paginate()
        {
            if (Interlocked.Exchange(ref _isPaginatorInUse, 1) != 0)
            {
                throw new System.InvalidOperationException("Paginator has already been consumed and cannot be reused. Please create a new instance.");
            }
            var nextToken = _request.NextToken;
            DescribeAutoScalingGroupsResponse response;

            do
            {
                _request.NextToken = nextToken;
                response           = _client.DescribeAutoScalingGroups(_request);
                nextToken          = response.NextToken;
                yield return(response);
            }while (nextToken != null);
        }
Exemplo n.º 3
0
 private Amazon.AutoScaling.Model.DescribeAutoScalingGroupsResponse CallAWSServiceOperation(IAmazonAutoScaling client, Amazon.AutoScaling.Model.DescribeAutoScalingGroupsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Auto Scaling", "DescribeAutoScalingGroups");
     try
     {
         #if DESKTOP
         return(client.DescribeAutoScalingGroups(request));
         #elif CORECLR
         return(client.DescribeAutoScalingGroupsAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
Exemplo n.º 4
0
        public static void InvokeDescribeAutoScalingGroups()
        {
            NameValueCollection appConfig = ConfigurationManager.AppSettings;

            // Print the number of Auto Scaling triggers.
            IAmazonAutoScaling autoscaling = AWSClientFactory.CreateAmazonAutoScalingClient(RegionEndpoint.USWest2);

            try
            {
                DescribeAutoScalingGroupsResponse asResponse = autoscaling.DescribeAutoScalingGroups(new DescribeAutoScalingGroupsRequest());

                int numAutoScalingGroups = 0;
                if (asResponse.AutoScalingGroups != null)
                {
                    numAutoScalingGroups = asResponse.AutoScalingGroups.Count;
                }
                Console.WriteLine("You have " + numAutoScalingGroups + " Auto Scaling group(s).");
            }
            catch (AmazonAutoScalingException ex)
            {
                if (ex.ErrorCode.Equals("OptInRequired"))
                {
                    Console.WriteLine("You are not signed for Amazon EC2.");
                    Console.WriteLine("You can sign up at http://aws.amazon.com/ec2.");
                }
                else
                {
                    Console.WriteLine("Caught Exception: " + ex.Message);
                    Console.WriteLine("Response Status Code: " + ex.StatusCode);
                    Console.WriteLine("Error Code: " + ex.ErrorCode);
                    Console.WriteLine("Error Type: " + ex.ErrorType);
                    Console.WriteLine("Request ID: " + ex.RequestId);
                }
            }
            Console.WriteLine();
        }