/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DeleteFunctionResponse response = new DeleteFunctionResponse(); return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, CreateEnvironmentResponse 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("AbortableOperationInProgress", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.AbortableOperationInProgress = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ApplicationName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ApplicationName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("CNAME", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.CNAME = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DateCreated", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.DateCreated = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DateUpdated", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.DateUpdated = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Description", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Description = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("EndpointURL", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.EndpointURL = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("EnvironmentId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.EnvironmentId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("EnvironmentLinks/member", targetDepth)) { var unmarshaller = EnvironmentLinkUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.EnvironmentLinks.Add(item); continue; } if (context.TestExpression("EnvironmentName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.EnvironmentName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Health", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Health = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("HealthStatus", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.HealthStatus = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("PlatformArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.PlatformArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Resources", targetDepth)) { var unmarshaller = EnvironmentResourcesDescriptionUnmarshaller.Instance; response.Resources = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SolutionStackName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.SolutionStackName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Status = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TemplateName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.TemplateName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Tier", targetDepth)) { var unmarshaller = EnvironmentTierUnmarshaller.Instance; response.Tier = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("VersionLabel", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.VersionLabel = unmarshaller.Unmarshall(context); continue; } } } return; }
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); return(new AmazonEC2Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
private static void UnmarshallResult(XmlUnmarshallerContext context, CopyObjectResponse 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("ETag", targetDepth)) { response.ETag = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("LastModified", targetDepth)) { response.LastModified = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumCRC32", targetDepth)) { response.ChecksumCRC32 = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumCRC32C", targetDepth)) { response.ChecksumCRC32C = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumSHA1", targetDepth)) { response.ChecksumSHA1 = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ChecksumSHA256", targetDepth)) { response.ChecksumSHA256 = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } IWebResponseData responseData = context.ResponseData; if (responseData.IsHeaderPresent("x-amz-expiration")) { response.Expiration = new Expiration(responseData.GetHeaderValue("x-amz-expiration")); } if (responseData.IsHeaderPresent("x-amz-copy-source-version-id")) { response.SourceVersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-copy-source-version-id")); } if (responseData.IsHeaderPresent("x-amz-version-id")) { response.VersionId = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-version-id")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption")) { response.ServerSideEncryptionMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-customer-algorithm")) { response.ServerSideEncryptionCustomerMethod = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-customer-algorithm")); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-customer-key-MD5")) { response.ServerSideEncryptionCustomerProvidedKeyMD5 = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-customer-key-MD5")); } if (responseData.IsHeaderPresent(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)) { response.ServerSideEncryptionKeyManagementServiceKeyId = S3Transforms.ToString(responseData.GetHeaderValue(HeaderKeys.XAmzServerSideEncryptionAwsKmsKeyIdHeader)); } if (responseData.IsHeaderPresent("x-amz-server-side-encryption-context")) { response.ServerSideEncryptionKeyManagementServiceEncryptionContext = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-server-side-encryption-context")); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged)) { response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged)); } if (responseData.IsHeaderPresent(S3Constants.AmzHeaderBucketKeyEnabled)) { response.BucketKeyEnabled = S3Transforms.ToBool(responseData.GetHeaderValue(S3Constants.AmzHeaderBucketKeyEnabled)); } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, CreateUsageLimitResponse 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("Amount", targetDepth)) { var unmarshaller = LongUnmarshaller.Instance; response.Amount = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("BreachAction", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.BreachAction = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ClusterIdentifier", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ClusterIdentifier = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("FeatureType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.FeatureType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("LimitType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.LimitType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Period", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Period = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Tags/Tag", targetDepth)) { var unmarshaller = TagUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Tags.Add(item); continue; } if (context.TestExpression("UsageLimitId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.UsageLimitId = unmarshaller.Unmarshall(context); continue; } } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, CreateDBClusterEndpointResponse 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("CustomEndpointType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.CustomEndpointType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DBClusterEndpointArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DBClusterEndpointArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DBClusterEndpointIdentifier", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DBClusterEndpointIdentifier = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DBClusterEndpointResourceIdentifier", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DBClusterEndpointResourceIdentifier = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DBClusterIdentifier", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DBClusterIdentifier = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Endpoint", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Endpoint = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("EndpointType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.EndpointType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ExcludedMembers/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ExcludedMembers.Add(item); continue; } if (context.TestExpression("StaticMembers/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.StaticMembers.Add(item); continue; } if (context.TestExpression("Status", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Status = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { TagResourceResponse response = new TagResourceResponse(); return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, CreateScheduledActionResponse 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("EndTime", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.EndTime = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("IamRole", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.IamRole = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextInvocations/ScheduledActionTime", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.NextInvocations.Add(item); continue; } if (context.TestExpression("Schedule", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Schedule = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ScheduledActionDescription", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ScheduledActionDescription = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ScheduledActionName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ScheduledActionName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("StartTime", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.StartTime = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("State", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.State = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TargetAction", targetDepth)) { var unmarshaller = ScheduledActionTypeUnmarshaller.Instance; response.TargetAction = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { PutBucketLifecycleConfigurationResponse response = new PutBucketLifecycleConfigurationResponse(); return(response); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CacheClusterNotFound")) { return(CacheClusterNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheParameterGroupNotFound")) { return(CacheParameterGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheSecurityGroupNotFound")) { return(CacheSecurityGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientCacheClusterCapacity")) { return(InsufficientCacheClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCacheClusterState")) { return(InvalidCacheClusterStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCacheSecurityGroupState")) { return(InvalidCacheSecurityGroupStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidKMSKeyFault")) { return(InvalidKMSKeyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombination")) { return(InvalidParameterCombinationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValue")) { return(InvalidParameterValueExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReplicationGroupState")) { return(InvalidReplicationGroupStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(InvalidVPCNetworkStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForClusterExceeded")) { return(NodeQuotaForClusterExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForCustomerExceeded")) { return(NodeQuotaForCustomerExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplicationGroupNotFoundFault")) { return(ReplicationGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonElastiCacheException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
private static void UnmarshallResult(XmlUnmarshallerContext context, PutBucketResponseECS response) { return; }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AllocationIdNotFound")) { return(AllocationIdNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("AvailabilityZoneNotSupported")) { return(AvailabilityZoneNotSupportedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DuplicateLoadBalancerName")) { return(DuplicateLoadBalancerNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DuplicateTagKeys")) { return(DuplicateTagKeysExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConfigurationRequest")) { return(InvalidConfigurationRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidScheme")) { return(InvalidSchemeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSecurityGroup")) { return(InvalidSecurityGroupExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(InvalidSubnetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermitted")) { return(OperationNotPermittedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceInUse")) { return(ResourceInUseExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SubnetNotFound")) { return(SubnetNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyLoadBalancers")) { return(TooManyLoadBalancersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTags")) { return(TooManyTagsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonElasticLoadBalancingV2Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AuthorizationError")) { return(AuthorizationErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EndpointDisabled")) { return(EndpointDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalError")) { return(InternalErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameter")) { return(InvalidParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ParameterValueInvalid")) { return(InvalidParameterValueExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSecurity")) { return(InvalidSecurityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSAccessDenied")) { return(KMSAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSDisabled")) { return(KMSDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSInvalidState")) { return(KMSInvalidStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSNotFound")) { return(KMSNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSOptInRequired")) { return(KMSOptInRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSThrottling")) { return(KMSThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotFound")) { return(NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PlatformApplicationDisabled")) { return(PlatformApplicationDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonSimpleNotificationServiceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeChangeSetResponse 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("Capabilities/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Capabilities.Add(item); continue; } if (context.TestExpression("Changes/member", targetDepth)) { var unmarshaller = ChangeUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Changes.Add(item); continue; } if (context.TestExpression("ChangeSetId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ChangeSetId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ChangeSetName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ChangeSetName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("CreationTime", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.CreationTime = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Description", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Description = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ExecutionStatus", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ExecutionStatus = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("IncludeNestedStacks", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.IncludeNestedStacks = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NotificationARNs/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.NotificationARNs.Add(item); continue; } if (context.TestExpression("Parameters/member", targetDepth)) { var unmarshaller = ParameterUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Parameters.Add(item); continue; } if (context.TestExpression("ParentChangeSetId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ParentChangeSetId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("RollbackConfiguration", targetDepth)) { var unmarshaller = RollbackConfigurationUnmarshaller.Instance; response.RollbackConfiguration = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("RootChangeSetId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.RootChangeSetId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("StackId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.StackId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("StackName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.StackName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Status = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("StatusReason", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.StatusReason = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Tags/member", targetDepth)) { var unmarshaller = TagUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Tags.Add(item); continue; } } } return; }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterAlreadyExistsFault")) { return(DBClusterAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterParameterGroupNotFound")) { return(DBClusterParameterGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterQuotaExceededFault")) { return(DBClusterQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterSnapshotNotFoundFault")) { return(DBClusterSnapshotNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSnapshotNotFound")) { return(DBSnapshotNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupNotFoundFault")) { return(DBSubnetGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBClusterCapacityFault")) { return(InsufficientDBClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientStorageClusterCapacity")) { return(InsufficientStorageClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBClusterSnapshotStateFault")) { return(InvalidDBClusterSnapshotStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBSnapshotState")) { return(InvalidDBSnapshotStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRestoreFault")) { return(InvalidRestoreExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(InvalidSubnetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(InvalidVPCNetworkStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSKeyNotAccessibleFault")) { return(KMSKeyNotAccessibleExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OptionGroupNotFoundFault")) { return(OptionGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(StorageQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonNeptuneException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
private static void UnmarshallResult(XmlUnmarshallerContext context, GetTemplateSummaryResponse 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("Capabilities/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Capabilities.Add(item); continue; } if (context.TestExpression("CapabilitiesReason", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.CapabilitiesReason = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DeclaredTransforms/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.DeclaredTransforms.Add(item); continue; } if (context.TestExpression("Description", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Description = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Metadata", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Metadata = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Parameters/member", targetDepth)) { var unmarshaller = ParameterDeclarationUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Parameters.Add(item); continue; } if (context.TestExpression("ResourceTypes/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ResourceTypes.Add(item); continue; } if (context.TestExpression("Version", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Version = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied")) { return(new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CNAMEAlreadyExists")) { return(new CNAMEAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IllegalUpdate")) { return(new IllegalUpdateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities")) { return(new InconsistentQuantitiesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument")) { return(new InvalidArgumentException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDefaultRootObject")) { return(new InvalidDefaultRootObjectException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidErrorCode")) { return(new InvalidErrorCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidForwardCookies")) { return(new InvalidForwardCookiesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidGeoRestrictionParameter")) { return(new InvalidGeoRestrictionParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidHeadersForS3Origin")) { return(new InvalidHeadersForS3OriginException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidIfMatchVersion")) { return(new InvalidIfMatchVersionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLocationCode")) { return(new InvalidLocationCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMinimumProtocolVersion")) { return(new InvalidMinimumProtocolVersionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginAccessIdentity")) { return(new InvalidOriginAccessIdentityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRelativePath")) { return(new InvalidRelativePathException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequiredProtocol")) { return(new InvalidRequiredProtocolException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidResponseCode")) { return(new InvalidResponseCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTTLOrder")) { return(new InvalidTTLOrderException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidViewerCertificate")) { return(new InvalidViewerCertificateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidWebACLId")) { return(new InvalidWebACLIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingBody")) { return(new MissingBodyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchDistribution")) { return(new NoSuchDistributionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchOrigin")) { return(new NoSuchOriginException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PreconditionFailed")) { return(new PreconditionFailedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCacheBehaviors")) { return(new TooManyCacheBehaviorsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCertificates")) { return(new TooManyCertificatesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCookieNamesInWhiteList")) { return(new TooManyCookieNamesInWhiteListException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionCNAMEs")) { return(new TooManyDistributionCNAMEsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyHeadersInForwardedValues")) { return(new TooManyHeadersInForwardedValuesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOriginCustomHeaders")) { return(new TooManyOriginCustomHeadersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOrigins")) { return(new TooManyOriginsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTrustedSigners")) { return(new TooManyTrustedSignersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrustedSignerDoesNotExist")) { return(new TrustedSignerDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("CacheClusterNotFound")) { return(new CacheClusterNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheParameterGroupNotFound")) { return(new CacheParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheSecurityGroupNotFound")) { return(new CacheSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheSubnetGroupNotFoundFault")) { return(new CacheSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterQuotaForCustomerExceeded")) { return(new ClusterQuotaForCustomerExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientCacheClusterCapacity")) { return(new InsufficientCacheClusterCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCacheClusterState")) { return(new InvalidCacheClusterStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombination")) { return(new InvalidParameterCombinationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValue")) { return(new InvalidParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForClusterExceeded")) { return(new NodeQuotaForClusterExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForCustomerExceeded")) { return(new NodeQuotaForCustomerExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplicationGroupAlreadyExists")) { return(new ReplicationGroupAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TagQuotaPerResourceExceeded")) { return(new TagQuotaPerResourceExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonElastiCacheException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
private static void UnmarshallResult(XmlUnmarshallerContext context, GetServiceLastAccessedDetailsResponse 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("Error", targetDepth)) { var unmarshaller = ErrorDetailsUnmarshaller.Instance; response.Error = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("IsTruncated", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.IsTruncated = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("JobCompletionDate", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.JobCompletionDate = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("JobCreationDate", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.JobCreationDate = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("JobStatus", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.JobStatus = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("JobType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.JobType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ServicesLastAccessed/member", targetDepth)) { var unmarshaller = ServiceLastAccessedUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ServicesLastAccessed.Add(item); continue; } } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, CancelExportTaskResponse 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("ExportOnly/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ExportOnly.Add(item); continue; } if (context.TestExpression("ExportTaskIdentifier", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ExportTaskIdentifier = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("FailureCause", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.FailureCause = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("IamRoleArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.IamRoleArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("KmsKeyId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.KmsKeyId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("PercentProgress", targetDepth)) { var unmarshaller = IntUnmarshaller.Instance; response.PercentProgress = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("S3Bucket", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.S3Bucket = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("S3Prefix", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.S3Prefix = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SnapshotTime", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.SnapshotTime = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SourceArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.SourceArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Status = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TaskEndTime", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.TaskEndTime = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TaskStartTime", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.TaskStartTime = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TotalExtractedDataInGB", targetDepth)) { var unmarshaller = IntUnmarshaller.Instance; response.TotalExtractedDataInGB = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("WarningMessage", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.WarningMessage = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { CreateAccessPointResponse response = new CreateAccessPointResponse(); return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DomainMetadataResponse 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("ItemCount", targetDepth)) { response.ItemCount = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ItemNamesSizeBytes", targetDepth)) { response.ItemNamesSizeBytes = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AttributeNameCount", targetDepth)) { response.AttributeNameCount = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AttributeNamesSizeBytes", targetDepth)) { response.AttributeNamesSizeBytes = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AttributeValueCount", targetDepth)) { response.AttributeValueCount = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AttributeValuesSizeBytes", targetDepth)) { response.AttributeValuesSizeBytes = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Timestamp", targetDepth)) { response.Timestamp = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AuthorizationNotFound")) { return(new AuthorizationNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterNotFoundFault")) { return(new DBClusterNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceAlreadyExists")) { return(new DBInstanceAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBParameterGroupNotFound")) { return(new DBParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSecurityGroupNotFound")) { return(new DBSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupDoesNotCoverEnoughAZs")) { return(new DBSubnetGroupDoesNotCoverEnoughAZsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupNotFoundFault")) { return(new DBSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InstanceQuotaExceeded")) { return(new InstanceQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBInstanceCapacity")) { return(new InsufficientDBInstanceCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBClusterStateFault")) { return(new InvalidDBClusterStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(new InvalidSubnetException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSKeyNotAccessibleFault")) { return(new KMSKeyNotAccessibleException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OptionGroupNotFoundFault")) { return(new OptionGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ProvisionedIopsNotAvailableInAZFault")) { return(new ProvisionedIopsNotAvailableInAZException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(new StorageQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageTypeNotSupported")) { return(new StorageTypeNotSupportedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonRDSException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied")) { return(AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CNAMEAlreadyExists")) { return(CNAMEAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DistributionAlreadyExists")) { return(DistributionAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IllegalFieldLevelEncryptionConfigAssociationWithCacheBehavior")) { return(IllegalFieldLevelEncryptionConfigAssociationWithCacheBehaviorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities")) { return(InconsistentQuantitiesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument")) { return(InvalidArgumentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDefaultRootObject")) { return(InvalidDefaultRootObjectExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidErrorCode")) { return(InvalidErrorCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidForwardCookies")) { return(InvalidForwardCookiesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidFunctionAssociation")) { return(InvalidFunctionAssociationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidGeoRestrictionParameter")) { return(InvalidGeoRestrictionParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidHeadersForS3Origin")) { return(InvalidHeadersForS3OriginExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLambdaFunctionAssociation")) { return(InvalidLambdaFunctionAssociationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLocationCode")) { return(InvalidLocationCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMinimumProtocolVersion")) { return(InvalidMinimumProtocolVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginAccessIdentity")) { return(InvalidOriginAccessIdentityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOrigin")) { return(InvalidOriginExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginKeepaliveTimeout")) { return(InvalidOriginKeepaliveTimeoutExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginReadTimeout")) { return(InvalidOriginReadTimeoutExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidProtocolSettings")) { return(InvalidProtocolSettingsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidQueryStringParameters")) { return(InvalidQueryStringParametersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRelativePath")) { return(InvalidRelativePathExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequiredProtocol")) { return(InvalidRequiredProtocolExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidResponseCode")) { return(InvalidResponseCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagging")) { return(InvalidTaggingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTTLOrder")) { return(InvalidTTLOrderExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidViewerCertificate")) { return(InvalidViewerCertificateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidWebACLId")) { return(InvalidWebACLIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingBody")) { return(MissingBodyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchCachePolicy")) { return(NoSuchCachePolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchFieldLevelEncryptionConfig")) { return(NoSuchFieldLevelEncryptionConfigExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchOrigin")) { return(NoSuchOriginExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchOriginRequestPolicy")) { return(NoSuchOriginRequestPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchRealtimeLogConfig")) { return(NoSuchRealtimeLogConfigExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchResponseHeadersPolicy")) { return(NoSuchResponseHeadersPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RealtimeLogConfigOwnerMismatch")) { return(RealtimeLogConfigOwnerMismatchExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCacheBehaviors")) { return(TooManyCacheBehaviorsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCertificates")) { return(TooManyCertificatesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCookieNamesInWhiteList")) { return(TooManyCookieNamesInWhiteListExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionCNAMEs")) { return(TooManyDistributionCNAMEsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToCachePolicy")) { return(TooManyDistributionsAssociatedToCachePolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToFieldLevelEncryptionConfig")) { return(TooManyDistributionsAssociatedToFieldLevelEncryptionConfigExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToKeyGroup")) { return(TooManyDistributionsAssociatedToKeyGroupExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToOriginRequestPolicy")) { return(TooManyDistributionsAssociatedToOriginRequestPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToResponseHeadersPolicy")) { return(TooManyDistributionsAssociatedToResponseHeadersPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributions")) { return(TooManyDistributionsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsWithFunctionAssociations")) { return(TooManyDistributionsWithFunctionAssociationsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsWithLambdaAssociations")) { return(TooManyDistributionsWithLambdaAssociationsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsWithSingleFunctionARN")) { return(TooManyDistributionsWithSingleFunctionARNExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyFunctionAssociations")) { return(TooManyFunctionAssociationsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyHeadersInForwardedValues")) { return(TooManyHeadersInForwardedValuesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyKeyGroupsAssociatedToDistribution")) { return(TooManyKeyGroupsAssociatedToDistributionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyLambdaFunctionAssociations")) { return(TooManyLambdaFunctionAssociationsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOriginCustomHeaders")) { return(TooManyOriginCustomHeadersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOriginGroupsPerDistribution")) { return(TooManyOriginGroupsPerDistributionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOrigins")) { return(TooManyOriginsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyQueryStringParameters")) { return(TooManyQueryStringParametersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTrustedSigners")) { return(TooManyTrustedSignersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrustedKeyGroupDoesNotExist")) { return(TrustedKeyGroupDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrustedSignerDoesNotExist")) { return(TrustedSignerDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied")) { return(AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FieldLevelEncryptionProfileAlreadyExists")) { return(FieldLevelEncryptionProfileAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FieldLevelEncryptionProfileSizeExceeded")) { return(FieldLevelEncryptionProfileSizeExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IllegalUpdate")) { return(IllegalUpdateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities")) { return(InconsistentQuantitiesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument")) { return(InvalidArgumentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidIfMatchVersion")) { return(InvalidIfMatchVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchFieldLevelEncryptionProfile")) { return(NoSuchFieldLevelEncryptionProfileExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchPublicKey")) { return(NoSuchPublicKeyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PreconditionFailed")) { return(PreconditionFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyFieldLevelEncryptionEncryptionEntities")) { return(TooManyFieldLevelEncryptionEncryptionEntitiesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyFieldLevelEncryptionFieldPatterns")) { return(TooManyFieldLevelEncryptionFieldPatternsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
private static void UnmarshallResult(XmlUnmarshallerContext context, AssumeRoleWithSAMLResponse 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("AssumedRoleUser", targetDepth)) { var unmarshaller = AssumedRoleUserUnmarshaller.Instance; response.AssumedRoleUser = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Audience", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Audience = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Credentials", targetDepth)) { var unmarshaller = CredentialsUnmarshaller.Instance; response.Credentials = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Issuer", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Issuer = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NameQualifier", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NameQualifier = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("PackedPolicySize", targetDepth)) { var unmarshaller = IntUnmarshaller.Instance; response.PackedPolicySize = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Subject", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Subject = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SubjectType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.SubjectType = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DeleteFieldLevelEncryptionConfigResponse response = new DeleteFieldLevelEncryptionConfigResponse(); return(response); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessToSnapshotDenied")) { return(AccessToSnapshotDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterAlreadyExists")) { return(ClusterAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterParameterGroupNotFound")) { return(ClusterParameterGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterQuotaExceeded")) { return(ClusterQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSecurityGroupNotFound")) { return(ClusterSecurityGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSnapshotNotFound")) { return(ClusterSnapshotNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSubnetGroupNotFoundFault")) { return(ClusterSubnetGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DependentServiceRequestThrottlingFault")) { return(DependentServiceRequestThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmClientCertificateNotFoundFault")) { return(HsmClientCertificateNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmConfigurationNotFoundFault")) { return(HsmConfigurationNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientClusterCapacity")) { return(InsufficientClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterSnapshotState")) { return(InvalidClusterSnapshotStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterSubnetGroupStateFault")) { return(InvalidClusterSubnetGroupStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterTrack")) { return(InvalidClusterTrackExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidElasticIpFault")) { return(InvalidElasticIpExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRestore")) { return(InvalidRestoreExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(InvalidSubnetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagFault")) { return(InvalidTagExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(InvalidVPCNetworkStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededFault")) { return(LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesPerClusterLimitExceeded")) { return(NumberOfNodesPerClusterLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesQuotaExceeded")) { return(NumberOfNodesQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SnapshotScheduleNotFound")) { return(SnapshotScheduleNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TagLimitExceededFault")) { return(TagLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedOperation")) { return(UnauthorizedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonRedshiftException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DeleteCloudFrontOriginAccessIdentityResponse response = new DeleteCloudFrontOriginAccessIdentityResponse(); return(response); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); SubscriptionAttributes attributes = new SubscriptionAttributes(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_TOPIC_NAME: reader.Read(); attributes.TopicName = reader.Value; break; case MNSConstants.XML_ELEMENT_CREATE_TIME: reader.Read(); attributes.CreateTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(long.Parse(reader.Value) * 1000); break; case MNSConstants.XML_ELEMENT_LAST_MODIFY_TIME: reader.Read(); attributes.LastModifyTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(long.Parse(reader.Value) * 1000); break; case MNSConstants.XML_ELEMENT_TOPIC_OWNER: reader.Read(); attributes.TopicOwner = reader.Value; break; case MNSConstants.XML_ELEMENT_SUBSCRIPTION_NAME: reader.Read(); attributes.SubscriptionName = reader.Value; break; case MNSConstants.XML_ELEMENT_ENDPOINT: reader.Read(); attributes.EndPoint = reader.Value; break; case MNSConstants.XML_ELEMENT_FILTER_TAG: reader.Read(); attributes.FilterTag = reader.Value; break; case MNSConstants.XML_ELEMENT_NOTIFY_STRATEGY: reader.Read(); string strategyStr = reader.Value; attributes.Strategy = (SubscriptionAttributes.NotifyStrategy) Enum.Parse(typeof(SubscriptionAttributes.NotifyStrategy), strategyStr.ToUpper()); break; case MNSConstants.XML_ELEMENT_NOTIFY_CONTENT_FORMAT: reader.Read(); string contentFormatStr = reader.Value; attributes.ContentFormat = (SubscriptionAttributes.NotifyContentFormat) Enum.Parse(typeof(SubscriptionAttributes.NotifyContentFormat), contentFormatStr.ToUpper()); break; } break; } } reader.Close(); return(new GetSubscriptionAttributeResponse() { Attributes = attributes }); }