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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("configurations", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Dictionary <string, string>, DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> >(new DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance));
                    response.Configurations = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Esempio n. 2
0
        public ListConfigurationsResponse ListConfigurations(string environmentId, string name = null)
        {
            if (string.IsNullOrEmpty(environmentId))
            {
                throw new ArgumentNullException(nameof(environmentId));
            }

            if (string.IsNullOrEmpty(VersionDate))
            {
                throw new ArgumentNullException("versionDate cannot be null. Use 'DISCOVERY_VERSION_DATE_2016_12_01'");
            }

            ListConfigurationsResponse result = null;

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

            return(result);
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonKafkaConfig config = new AmazonKafkaConfig();

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

            ListConfigurationsResponse resp = new ListConfigurationsResponse();

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

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

                foreach (var obj in resp.Configurations)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        public void TestListConfigurations()
        {
            IAmazonApplicationDiscoveryService client = new AmazonApplicationDiscoveryServiceClient(RegionEndpoint.USWest2);

            ListConfigurationsRequest request = new ListConfigurationsRequest {
                ConfigurationType = ConfigurationItemType.PROCESS
            };
            ListConfigurationsResponse response = client.ListConfigurations(request);

            Assert.IsNotNull(response.ResponseMetadata.RequestId);
        }
        public void TestListConfigurations()
        {
            IAmazonApplicationDiscoveryService client = new AmazonApplicationDiscoveryServiceClient(RegionEndpoint.USWest2);

            try
            {
                ListConfigurationsRequest request = new ListConfigurationsRequest {
                    ConfigurationType = ConfigurationItemType.PROCESS
                };
                ListConfigurationsResponse response = client.ListConfigurations(request);
                Assert.IsNotNull(response.ResponseMetadata.RequestId);
            }
            catch (AmazonApplicationDiscoveryServiceException e)
            {
                // We're really just making sure we can contact this service.
                // So an error from the service that the account isn't whitelisted is acceptable.
                if (!e.Message.Contains("is not whitelisted to access"))
                {
                    throw;
                }
            }
        }