public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonElasticsearchConfig config = new AmazonElasticsearchConfig();

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

            DescribePackagesResponse resp = new DescribePackagesResponse();

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

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

                foreach (var obj in resp.PackageDetailsList)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Пример #2
0
        /// <summary>
        /// 获取已购曲库包列表接口
        /// </summary>
        /// <param name="req"><see cref="DescribePackagesRequest"/></param>
        /// <returns><see cref="DescribePackagesResponse"/></returns>
        public DescribePackagesResponse DescribePackagesSync(DescribePackagesRequest req)
        {
            JsonResponseModel <DescribePackagesResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "DescribePackages");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DescribePackagesResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }