/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListEnvironmentsResponse response = new ListEnvironmentsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Items", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Environment, EnvironmentUnmarshaller>(EnvironmentUnmarshaller.Instance);
                    response.Items = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

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

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

            ListEnvironmentsResponse resp = new ListEnvironmentsResponse();

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

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

                foreach (var obj in resp.Environments)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
示例#3
0
        public ListEnvironmentsResponse ListEnvironments(string name = null)
        {
            if (string.IsNullOrEmpty(VersionDate))
            {
                throw new ArgumentNullException("versionDate cannot be null. Use 'DISCOVERY_VERSION_DATE_2016_12_01'");
            }

            ListEnvironmentsResponse result = null;

            try
            {
                result = this.Client.WithAuthentication(this.UserName, this.Password)
                         .GetAsync($"{this.Endpoint}/v1/environments")
                         .WithArgument("version", VersionDate)
                         .WithArgument("name", name)
                         .As <ListEnvironmentsResponse>()
                         .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }
示例#4
0
    private IEnumerator ExampleListEnvironments()
    {
        Log.Debug("DiscoveryServiceV1", "ListEnvironments");
        ListEnvironmentsResponse listEnvironmentsResponse = null;

        service.ListEnvironments(
            callback: (DetailedResponse <ListEnvironmentsResponse> response, IBMError error) =>
        {
            Log.Debug("DiscoveryServiceV1", "ListEnvironments result: {0}", response.Response);
            listEnvironmentsResponse = response.Result;
        }
            );

        while (listEnvironmentsResponse == null)
        {
            yield return(null);
        }
    }
 public void ListEnvironmentsReciever(ListEnvironmentsResponse response)
 {
 }