示例#1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonMigrationHubConfigConfig config = new AmazonMigrationHubConfigConfig();

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

            DescribeHomeRegionControlsResponse resp = new DescribeHomeRegionControlsResponse();

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

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

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

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

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