public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonBatchConfig config = new AmazonBatchConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonBatchClient client = new AmazonBatchClient(creds, config);

            DescribeComputeEnvironmentsResponse resp = new DescribeComputeEnvironmentsResponse();

            do
            {
                DescribeComputeEnvironmentsRequest req = new DescribeComputeEnvironmentsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.DescribeComputeEnvironments(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.ComputeEnvironments)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Ejemplo n.º 2
0
        protected IAmazonBatch CreateClient(AWSCredentials credentials, RegionEndpoint region)
        {
            var config = new AmazonBatchConfig {
                RegionEndpoint = region
            };

            Amazon.PowerShell.Utils.Common.PopulateConfig(this, config);
            this.CustomizeClientConfig(config);
            var client = new AmazonBatchClient(credentials, config);

            client.BeforeRequestEvent += RequestEventHandler;
            client.AfterResponseEvent += ResponseEventHandler;
            return(client);
        }