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

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

            ListWorkspacesResponse resp = new ListWorkspacesResponse();

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

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

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

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

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