public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonServiceDiscoveryConfig config = new AmazonServiceDiscoveryConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonServiceDiscoveryClient client = new AmazonServiceDiscoveryClient(creds, config); ListNamespacesResponse resp = new ListNamespacesResponse(); do { ListNamespacesRequest req = new ListNamespacesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListNamespaces(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Namespaces) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
protected IAmazonServiceDiscovery CreateClient(AWSCredentials credentials, RegionEndpoint region) { var config = new AmazonServiceDiscoveryConfig { RegionEndpoint = region }; Amazon.PowerShell.Utils.Common.PopulateConfig(this, config); this.CustomizeClientConfig(config); var client = new AmazonServiceDiscoveryClient(credentials, config); client.BeforeRequestEvent += RequestEventHandler; client.AfterResponseEvent += ResponseEventHandler; return(client); }