Exemplo n.º 1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonImagebuilderConfig config = new AmazonImagebuilderConfig();

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

            ListImagesResponse resp = new ListImagesResponse();

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

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

                foreach (var obj in resp.ImageVersionList)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        protected IAmazonImagebuilder CreateClient(AWSCredentials credentials, RegionEndpoint region)
        {
            var config = new AmazonImagebuilderConfig {
                RegionEndpoint = region
            };

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

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