コード例 #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)
        {
            ListOfferingsResponse response = new ListOfferingsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("offerings", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Offering, OfferingUnmarshaller>(OfferingUnmarshaller.Instance);
                    response.Offerings = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

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

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

            ListOfferingsResponse resp = new ListOfferingsResponse();

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

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

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