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