コード例 #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetTagValuesResponse response = new GetTagValuesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("PaginationToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PaginationToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("TagValues", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    response.TagValues = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonResourceGroupsTaggingAPIConfig config = new AmazonResourceGroupsTaggingAPIConfig();

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

            GetTagValuesResponse resp = new GetTagValuesResponse();

            do
            {
                GetTagValuesRequest req = new GetTagValuesRequest
                {
                    PaginationToken = resp.PaginationToken
                };

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

                foreach (var obj in resp.TagValues)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.PaginationToken));
        }