Esempio n. 1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonCloud9Config config = new AmazonCloud9Config();

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

            DescribeEnvironmentMembershipsResponse resp = new DescribeEnvironmentMembershipsResponse();

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

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

                foreach (var obj in resp.Memberships)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Esempio n. 2
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)
        {
            DescribeEnvironmentMembershipsResponse response = new DescribeEnvironmentMembershipsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("memberships", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <EnvironmentMember, EnvironmentMemberUnmarshaller>(EnvironmentMemberUnmarshaller.Instance);
                    response.Memberships = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }