コード例 #1
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, GetPolicyVersionResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("PolicyVersion", targetDepth))
                    {
                        var unmarshaller = PolicyVersionUnmarshaller.Instance;
                        response.PolicyVersion = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

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

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

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

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

            return(response);
        }
        public static GetPolicyVersionResponse Unmarshall(UnmarshallerContext context)
        {
            GetPolicyVersionResponse getPolicyVersionResponse = new GetPolicyVersionResponse();

            getPolicyVersionResponse.HttpResponse = context.HttpResponse;
            getPolicyVersionResponse.RequestId    = context.StringValue("GetPolicyVersion.RequestId");

            GetPolicyVersionResponse.GetPolicyVersion_PolicyVersion policyVersion = new GetPolicyVersionResponse.GetPolicyVersion_PolicyVersion();
            policyVersion.VersionId                = context.StringValue("GetPolicyVersion.PolicyVersion.VersionId");
            policyVersion.IsDefaultVersion         = context.BooleanValue("GetPolicyVersion.PolicyVersion.IsDefaultVersion");
            policyVersion.PolicyDocument           = context.StringValue("GetPolicyVersion.PolicyVersion.PolicyDocument");
            policyVersion.CreateDate               = context.StringValue("GetPolicyVersion.PolicyVersion.CreateDate");
            getPolicyVersionResponse.PolicyVersion = policyVersion;

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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("isDefaultVersion", targetDepth))
                {
                    var unmarshaller = BoolUnmarshaller.Instance;
                    response.IsDefaultVersion = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("policyArn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PolicyArn = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("policyDocument", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PolicyDocument = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("policyName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PolicyName = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("policyVersionId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PolicyVersionId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }