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

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

            DescribeProductsResponse resp = new DescribeProductsResponse();

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

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

                foreach (var obj in resp.Products)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Exemple #2
0
        /// <summary>
        /// 本接口(DescribeProducts)用于查询各个支持地域列表查询的产品信息。
        /// </summary>
        /// <param name="req"><see cref="DescribeProductsRequest"/></param>
        /// <returns><see cref="DescribeProductsResponse"/></returns>
        public DescribeProductsResponse DescribeProductsSync(DescribeProductsRequest req)
        {
            JsonResponseModel <DescribeProductsResponse> rsp = null;

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