Exemplo n.º 1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CreateClusterParameterGroupResponse response = new CreateClusterParameterGroupResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("CreateClusterParameterGroupResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
Exemplo n.º 2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, CreateClusterParameterGroupResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("ClusterParameterGroup", targetDepth))
                    {
                        response.ClusterParameterGroup = ClusterParameterGroupUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }
        }
Exemplo n.º 3
0
        public void CRUDParameterGroup()
        {
            string name          = "dotnetsdk" + DateTime.Now.Ticks;
            var    createRequest = new CreateClusterParameterGroupRequest()
            {
                ParameterGroupName = name, ParameterGroupFamily = "redshift-1.0", Description = "A Description"
            };
            CreateClusterParameterGroupResponse createResponse = Client.CreateClusterParameterGroupAsync(createRequest).Result;

            try
            {
                var descResponse = Client.DescribeClusterParameterGroupsAsync(new DescribeClusterParameterGroupsRequest()
                {
                    ParameterGroupName = name
                }).Result;
                Assert.AreEqual(1, descResponse.ParameterGroups.Count);
                Assert.AreEqual(name, descResponse.ParameterGroups[0].ParameterGroupName);

                ModifyClusterParameterGroupRequest modRequest = new ModifyClusterParameterGroupRequest()
                {
                    ParameterGroupName = name
                };
                modRequest.Parameters.Add(new Parameter()
                {
                    ParameterName = "require_ssl", ParameterValue = "true"
                });
                var modResponse = Client.ModifyClusterParameterGroupAsync(modRequest).Result;

                var descParameterResponse = Client.DescribeClusterParametersAsync(new DescribeClusterParametersRequest()
                {
                    ParameterGroupName = name
                }).Result;
                var parameter = descParameterResponse.Parameters.FirstOrDefault(x => x.ParameterName == "require_ssl");
                Assert.IsNotNull(parameter);
                Assert.AreEqual("true", parameter.ParameterValue);
            }
            finally
            {
                Client.DeleteClusterParameterGroupAsync(new DeleteClusterParameterGroupRequest()
                {
                    ParameterGroupName = name
                }).Wait();
                var descResponse = Client.DescribeClusterParameterGroupsAsync(new DescribeClusterParameterGroupsRequest()).Result;
                Assert.IsNull(descResponse.ParameterGroups.FirstOrDefault(x => x.ParameterGroupName == name));
            }
        }
Exemplo n.º 4
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CreateClusterParameterGroupResponse response = new CreateClusterParameterGroupResponse();

            while (context.Read())
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("CreateClusterParameterGroupResult", 2))
                    {
                        response.CreateClusterParameterGroupResult = CreateClusterParameterGroupResultUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
            }


            return(response);
        }