repo_name
stringlengths 1
52
| repo_creator
stringclasses 6
values | programming_language
stringclasses 4
values | code
stringlengths 0
9.68M
| num_lines
int64 1
234k
|
---|---|---|---|---|
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetModel Request Marshaller
/// </summary>
public class GetModelRequestMarshaller : IMarshaller<IRequest, GetModelRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetModelRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetModelRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetModelName())
throw new AmazonAPIGatewayException("Request object does not have required field ModelName set");
request.AddPathResource("{model_name}", StringUtils.FromString(publicRequest.ModelName));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetFlatten())
request.Parameters.Add("flatten", StringUtils.FromBool(publicRequest.Flatten));
request.ResourcePath = "/restapis/{restapi_id}/models/{model_name}";
request.UseQueryString = true;
return request;
}
private static GetModelRequestMarshaller _instance = new GetModelRequestMarshaller();
internal static GetModelRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetModelRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 94 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetModel operation
/// </summary>
public class GetModelResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetModelResponse response = new GetModelResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("contentType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ContentType = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("schema", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Schema = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetModelResponseUnmarshaller _instance = new GetModelResponseUnmarshaller();
internal static GetModelResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetModelResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 146 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetModels Request Marshaller
/// </summary>
public class GetModelsRequestMarshaller : IMarshaller<IRequest, GetModelsRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetModelsRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetModelsRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/restapis/{restapi_id}/models";
request.UseQueryString = true;
return request;
}
private static GetModelsRequestMarshaller _instance = new GetModelsRequestMarshaller();
internal static GetModelsRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetModelsRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 94 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetModels operation
/// </summary>
public class GetModelsResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetModelsResponse response = new GetModelsResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<Model, ModelUnmarshaller>(ModelUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetModelsResponseUnmarshaller _instance = new GetModelsResponseUnmarshaller();
internal static GetModelsResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetModelsResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetModelTemplate Request Marshaller
/// </summary>
public class GetModelTemplateRequestMarshaller : IMarshaller<IRequest, GetModelTemplateRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetModelTemplateRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetModelTemplateRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetModelName())
throw new AmazonAPIGatewayException("Request object does not have required field ModelName set");
request.AddPathResource("{model_name}", StringUtils.FromString(publicRequest.ModelName));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}/models/{model_name}/default_template";
return request;
}
private static GetModelTemplateRequestMarshaller _instance = new GetModelTemplateRequestMarshaller();
internal static GetModelTemplateRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetModelTemplateRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 90 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetModelTemplate operation
/// </summary>
public class GetModelTemplateResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetModelTemplateResponse response = new GetModelTemplateResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("value", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Value = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetModelTemplateResponseUnmarshaller _instance = new GetModelTemplateResponseUnmarshaller();
internal static GetModelTemplateResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetModelTemplateResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 122 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetRequestValidator Request Marshaller
/// </summary>
public class GetRequestValidatorRequestMarshaller : IMarshaller<IRequest, GetRequestValidatorRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetRequestValidatorRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetRequestValidatorRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRequestValidatorId())
throw new AmazonAPIGatewayException("Request object does not have required field RequestValidatorId set");
request.AddPathResource("{requestvalidator_id}", StringUtils.FromString(publicRequest.RequestValidatorId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}";
return request;
}
private static GetRequestValidatorRequestMarshaller _instance = new GetRequestValidatorRequestMarshaller();
internal static GetRequestValidatorRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRequestValidatorRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 90 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetRequestValidator operation
/// </summary>
public class GetRequestValidatorResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetRequestValidatorResponse response = new GetRequestValidatorResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("validateRequestBody", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.ValidateRequestBody = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("validateRequestParameters", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.ValidateRequestParameters = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetRequestValidatorResponseUnmarshaller _instance = new GetRequestValidatorResponseUnmarshaller();
internal static GetRequestValidatorResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRequestValidatorResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 140 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetRequestValidators Request Marshaller
/// </summary>
public class GetRequestValidatorsRequestMarshaller : IMarshaller<IRequest, GetRequestValidatorsRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetRequestValidatorsRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetRequestValidatorsRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/restapis/{restapi_id}/requestvalidators";
request.UseQueryString = true;
return request;
}
private static GetRequestValidatorsRequestMarshaller _instance = new GetRequestValidatorsRequestMarshaller();
internal static GetRequestValidatorsRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRequestValidatorsRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 94 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetRequestValidators operation
/// </summary>
public class GetRequestValidatorsResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetRequestValidatorsResponse response = new GetRequestValidatorsResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<RequestValidator, RequestValidatorUnmarshaller>(RequestValidatorUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetRequestValidatorsResponseUnmarshaller _instance = new GetRequestValidatorsResponseUnmarshaller();
internal static GetRequestValidatorsResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRequestValidatorsResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetResource Request Marshaller
/// </summary>
public class GetResourceRequestMarshaller : IMarshaller<IRequest, GetResourceRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetResourceRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetResourceRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetResourceId())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceId set");
request.AddPathResource("{resource_id}", StringUtils.FromString(publicRequest.ResourceId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetEmbed())
request.ParameterCollection.Add("embed", publicRequest.Embed);
request.ResourcePath = "/restapis/{restapi_id}/resources/{resource_id}";
request.UseQueryString = true;
return request;
}
private static GetResourceRequestMarshaller _instance = new GetResourceRequestMarshaller();
internal static GetResourceRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetResourceRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 94 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetResource operation
/// </summary>
public class GetResourceResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetResourceResponse response = new GetResourceResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("parentId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ParentId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("path", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Path = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("pathPart", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.PathPart = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("resourceMethods", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, Method, StringUnmarshaller, MethodUnmarshaller>(StringUnmarshaller.Instance, MethodUnmarshaller.Instance);
response.ResourceMethods = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetResourceResponseUnmarshaller _instance = new GetResourceResponseUnmarshaller();
internal static GetResourceResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetResourceResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 142 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetResources Request Marshaller
/// </summary>
public class GetResourcesRequestMarshaller : IMarshaller<IRequest, GetResourcesRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetResourcesRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetResourcesRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetEmbed())
request.ParameterCollection.Add("embed", publicRequest.Embed);
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/restapis/{restapi_id}/resources";
request.UseQueryString = true;
return request;
}
private static GetResourcesRequestMarshaller _instance = new GetResourcesRequestMarshaller();
internal static GetResourcesRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetResourcesRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 97 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetResources operation
/// </summary>
public class GetResourcesResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetResourcesResponse response = new GetResourcesResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<Resource, ResourceUnmarshaller>(ResourceUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetResourcesResponseUnmarshaller _instance = new GetResourcesResponseUnmarshaller();
internal static GetResourcesResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetResourcesResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetRestApi Request Marshaller
/// </summary>
public class GetRestApiRequestMarshaller : IMarshaller<IRequest, GetRestApiRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetRestApiRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetRestApiRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}";
return request;
}
private static GetRestApiRequestMarshaller _instance = new GetRestApiRequestMarshaller();
internal static GetRestApiRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRestApiRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 87 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetRestApi operation
/// </summary>
public class GetRestApiResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetRestApiResponse response = new GetRestApiResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeySource", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ApiKeySource = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("binaryMediaTypes", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.BinaryMediaTypes = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("createdDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.CreatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("disableExecuteApiEndpoint", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.DisableExecuteApiEndpoint = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("endpointConfiguration", targetDepth))
{
var unmarshaller = EndpointConfigurationUnmarshaller.Instance;
response.EndpointConfiguration = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("minimumCompressionSize", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.MinimumCompressionSize = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("policy", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Policy = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("version", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Version = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("warnings", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Warnings = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetRestApiResponseUnmarshaller _instance = new GetRestApiResponseUnmarshaller();
internal static GetRestApiResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRestApiResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 194 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetRestApis Request Marshaller
/// </summary>
public class GetRestApisRequestMarshaller : IMarshaller<IRequest, GetRestApisRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetRestApisRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetRestApisRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/restapis";
request.UseQueryString = true;
return request;
}
private static GetRestApisRequestMarshaller _instance = new GetRestApisRequestMarshaller();
internal static GetRestApisRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRestApisRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetRestApis operation
/// </summary>
public class GetRestApisResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetRestApisResponse response = new GetRestApisResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<RestApi, RestApiUnmarshaller>(RestApiUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetRestApisResponseUnmarshaller _instance = new GetRestApisResponseUnmarshaller();
internal static GetRestApisResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetRestApisResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetSdk Request Marshaller
/// </summary>
public class GetSdkRequestMarshaller : IMarshaller<IRequest, GetSdkRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetSdkRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetSdkRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (!publicRequest.IsSetSdkType())
throw new AmazonAPIGatewayException("Request object does not have required field SdkType set");
request.AddPathResource("{sdk_type}", StringUtils.FromString(publicRequest.SdkType));
if (!publicRequest.IsSetStageName())
throw new AmazonAPIGatewayException("Request object does not have required field StageName set");
request.AddPathResource("{stage_name}", StringUtils.FromString(publicRequest.StageName));
if (publicRequest.IsSetParameters())
{
foreach(var kvp in publicRequest.Parameters)
{
request.Parameters.Add(kvp.Key, kvp.Value);
}
}
request.ResourcePath = "/restapis/{restapi_id}/stages/{stage_name}/sdks/{sdk_type}";
request.UseQueryString = true;
return request;
}
private static GetSdkRequestMarshaller _instance = new GetSdkRequestMarshaller();
internal static GetSdkRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetSdkRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 102 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetSdk operation
/// </summary>
public class GetSdkResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetSdkResponse response = new GetSdkResponse();
var ms = new MemoryStream();
Amazon.Util.AWSSDKUtils.CopyStream(context.Stream, ms);
ms.Seek(0, SeekOrigin.Begin);
response.Body = ms;
if (context.ResponseData.IsHeaderPresent("Content-Disposition"))
response.ContentDisposition = context.ResponseData.GetHeaderValue("Content-Disposition");
if (context.ResponseData.IsHeaderPresent("Content-Type"))
response.ContentType = context.ResponseData.GetHeaderValue("Content-Type");
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetSdkResponseUnmarshaller _instance = new GetSdkResponseUnmarshaller();
internal static GetSdkResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetSdkResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 127 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetSdkType Request Marshaller
/// </summary>
public class GetSdkTypeRequestMarshaller : IMarshaller<IRequest, GetSdkTypeRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetSdkTypeRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetSdkTypeRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetId())
throw new AmazonAPIGatewayException("Request object does not have required field Id set");
request.AddPathResource("{sdktype_id}", StringUtils.FromString(publicRequest.Id));
request.ResourcePath = "/sdktypes/{sdktype_id}";
return request;
}
private static GetSdkTypeRequestMarshaller _instance = new GetSdkTypeRequestMarshaller();
internal static GetSdkTypeRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetSdkTypeRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 87 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetSdkType operation
/// </summary>
public class GetSdkTypeResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetSdkTypeResponse response = new GetSdkTypeResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("configurationProperties", targetDepth))
{
var unmarshaller = new ListUnmarshaller<SdkConfigurationProperty, SdkConfigurationPropertyUnmarshaller>(SdkConfigurationPropertyUnmarshaller.Instance);
response.ConfigurationProperties = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("friendlyName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.FriendlyName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetSdkTypeResponseUnmarshaller _instance = new GetSdkTypeResponseUnmarshaller();
internal static GetSdkTypeResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetSdkTypeResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 140 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetSdkTypes Request Marshaller
/// </summary>
public class GetSdkTypesRequestMarshaller : IMarshaller<IRequest, GetSdkTypesRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetSdkTypesRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetSdkTypesRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/sdktypes";
request.UseQueryString = true;
return request;
}
private static GetSdkTypesRequestMarshaller _instance = new GetSdkTypesRequestMarshaller();
internal static GetSdkTypesRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetSdkTypesRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetSdkTypes operation
/// </summary>
public class GetSdkTypesResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetSdkTypesResponse response = new GetSdkTypesResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<SdkType, SdkTypeUnmarshaller>(SdkTypeUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetSdkTypesResponseUnmarshaller _instance = new GetSdkTypesResponseUnmarshaller();
internal static GetSdkTypesResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetSdkTypesResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetStage Request Marshaller
/// </summary>
public class GetStageRequestMarshaller : IMarshaller<IRequest, GetStageRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetStageRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetStageRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (!publicRequest.IsSetStageName())
throw new AmazonAPIGatewayException("Request object does not have required field StageName set");
request.AddPathResource("{stage_name}", StringUtils.FromString(publicRequest.StageName));
request.ResourcePath = "/restapis/{restapi_id}/stages/{stage_name}";
return request;
}
private static GetStageRequestMarshaller _instance = new GetStageRequestMarshaller();
internal static GetStageRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetStageRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 90 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetStage operation
/// </summary>
public class GetStageResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetStageResponse response = new GetStageResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("accessLogSettings", targetDepth))
{
var unmarshaller = AccessLogSettingsUnmarshaller.Instance;
response.AccessLogSettings = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheClusterEnabled", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.CacheClusterEnabled = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheClusterSize", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.CacheClusterSize = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheClusterStatus", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.CacheClusterStatus = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("canarySettings", targetDepth))
{
var unmarshaller = CanarySettingsUnmarshaller.Instance;
response.CanarySettings = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("clientCertificateId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ClientCertificateId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("createdDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.CreatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("deploymentId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.DeploymentId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("documentationVersion", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.DocumentationVersion = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("lastUpdatedDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.LastUpdatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("methodSettings", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, MethodSetting, StringUnmarshaller, MethodSettingUnmarshaller>(StringUnmarshaller.Instance, MethodSettingUnmarshaller.Instance);
response.MethodSettings = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("stageName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.StageName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tracingEnabled", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.TracingEnabled = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("variables", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Variables = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("webAclArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.WebAclArn = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetStageResponseUnmarshaller _instance = new GetStageResponseUnmarshaller();
internal static GetStageResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetStageResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 226 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetStages Request Marshaller
/// </summary>
public class GetStagesRequestMarshaller : IMarshaller<IRequest, GetStagesRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetStagesRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetStagesRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetDeploymentId())
request.Parameters.Add("deploymentId", StringUtils.FromString(publicRequest.DeploymentId));
request.ResourcePath = "/restapis/{restapi_id}/stages";
request.UseQueryString = true;
return request;
}
private static GetStagesRequestMarshaller _instance = new GetStagesRequestMarshaller();
internal static GetStagesRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetStagesRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetStages operation
/// </summary>
public class GetStagesResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetStagesResponse response = new GetStagesResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<Stage, StageUnmarshaller>(StageUnmarshaller.Instance);
response.Item = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetStagesResponseUnmarshaller _instance = new GetStagesResponseUnmarshaller();
internal static GetStagesResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetStagesResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 130 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetTags Request Marshaller
/// </summary>
public class GetTagsRequestMarshaller : IMarshaller<IRequest, GetTagsRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetTagsRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetTagsRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetResourceArn())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceArn set");
request.AddPathResource("{resource_arn}", StringUtils.FromString(publicRequest.ResourceArn));
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/tags/{resource_arn}";
request.UseQueryString = true;
return request;
}
private static GetTagsRequestMarshaller _instance = new GetTagsRequestMarshaller();
internal static GetTagsRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetTagsRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 94 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetTags operation
/// </summary>
public class GetTagsResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetTagsResponse response = new GetTagsResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Tags = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetTagsResponseUnmarshaller _instance = new GetTagsResponseUnmarshaller();
internal static GetTagsResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetTagsResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 122 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetUsagePlanKey Request Marshaller
/// </summary>
public class GetUsagePlanKeyRequestMarshaller : IMarshaller<IRequest, GetUsagePlanKeyRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetUsagePlanKeyRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetUsagePlanKeyRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetKeyId())
throw new AmazonAPIGatewayException("Request object does not have required field KeyId set");
request.AddPathResource("{keyId}", StringUtils.FromString(publicRequest.KeyId));
if (!publicRequest.IsSetUsagePlanId())
throw new AmazonAPIGatewayException("Request object does not have required field UsagePlanId set");
request.AddPathResource("{usageplanId}", StringUtils.FromString(publicRequest.UsagePlanId));
request.ResourcePath = "/usageplans/{usageplanId}/keys/{keyId}";
return request;
}
private static GetUsagePlanKeyRequestMarshaller _instance = new GetUsagePlanKeyRequestMarshaller();
internal static GetUsagePlanKeyRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlanKeyRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 90 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetUsagePlanKey operation
/// </summary>
public class GetUsagePlanKeyResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetUsagePlanKeyResponse response = new GetUsagePlanKeyResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("type", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Type = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("value", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Value = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetUsagePlanKeyResponseUnmarshaller _instance = new GetUsagePlanKeyResponseUnmarshaller();
internal static GetUsagePlanKeyResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlanKeyResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 140 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetUsagePlanKeys Request Marshaller
/// </summary>
public class GetUsagePlanKeysRequestMarshaller : IMarshaller<IRequest, GetUsagePlanKeysRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetUsagePlanKeysRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetUsagePlanKeysRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetUsagePlanId())
throw new AmazonAPIGatewayException("Request object does not have required field UsagePlanId set");
request.AddPathResource("{usageplanId}", StringUtils.FromString(publicRequest.UsagePlanId));
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetNameQuery())
request.Parameters.Add("name", StringUtils.FromString(publicRequest.NameQuery));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/usageplans/{usageplanId}/keys";
request.UseQueryString = true;
return request;
}
private static GetUsagePlanKeysRequestMarshaller _instance = new GetUsagePlanKeysRequestMarshaller();
internal static GetUsagePlanKeysRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlanKeysRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 97 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetUsagePlanKeys operation
/// </summary>
public class GetUsagePlanKeysResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetUsagePlanKeysResponse response = new GetUsagePlanKeysResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<UsagePlanKey, UsagePlanKeyUnmarshaller>(UsagePlanKeyUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetUsagePlanKeysResponseUnmarshaller _instance = new GetUsagePlanKeysResponseUnmarshaller();
internal static GetUsagePlanKeysResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlanKeysResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetUsagePlan Request Marshaller
/// </summary>
public class GetUsagePlanRequestMarshaller : IMarshaller<IRequest, GetUsagePlanRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetUsagePlanRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetUsagePlanRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetUsagePlanId())
throw new AmazonAPIGatewayException("Request object does not have required field UsagePlanId set");
request.AddPathResource("{usageplanId}", StringUtils.FromString(publicRequest.UsagePlanId));
request.ResourcePath = "/usageplans/{usageplanId}";
return request;
}
private static GetUsagePlanRequestMarshaller _instance = new GetUsagePlanRequestMarshaller();
internal static GetUsagePlanRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlanRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 87 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetUsagePlan operation
/// </summary>
public class GetUsagePlanResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetUsagePlanResponse response = new GetUsagePlanResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiStages", targetDepth))
{
var unmarshaller = new ListUnmarshaller<ApiStage, ApiStageUnmarshaller>(ApiStageUnmarshaller.Instance);
response.ApiStages = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("productCode", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ProductCode = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("quota", targetDepth))
{
var unmarshaller = QuotaSettingsUnmarshaller.Instance;
response.Quota = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("throttle", targetDepth))
{
var unmarshaller = ThrottleSettingsUnmarshaller.Instance;
response.Throttle = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetUsagePlanResponseUnmarshaller _instance = new GetUsagePlanResponseUnmarshaller();
internal static GetUsagePlanResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlanResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 164 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetUsagePlans Request Marshaller
/// </summary>
public class GetUsagePlansRequestMarshaller : IMarshaller<IRequest, GetUsagePlansRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetUsagePlansRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetUsagePlansRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (publicRequest.IsSetKeyId())
request.Parameters.Add("keyId", StringUtils.FromString(publicRequest.KeyId));
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/usageplans";
request.UseQueryString = true;
return request;
}
private static GetUsagePlansRequestMarshaller _instance = new GetUsagePlansRequestMarshaller();
internal static GetUsagePlansRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlansRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 94 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetUsagePlans operation
/// </summary>
public class GetUsagePlansResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetUsagePlansResponse response = new GetUsagePlansResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<UsagePlan, UsagePlanUnmarshaller>(UsagePlanUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetUsagePlansResponseUnmarshaller _instance = new GetUsagePlansResponseUnmarshaller();
internal static GetUsagePlansResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsagePlansResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetUsage Request Marshaller
/// </summary>
public class GetUsageRequestMarshaller : IMarshaller<IRequest, GetUsageRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetUsageRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetUsageRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetUsagePlanId())
throw new AmazonAPIGatewayException("Request object does not have required field UsagePlanId set");
request.AddPathResource("{usageplanId}", StringUtils.FromString(publicRequest.UsagePlanId));
if (publicRequest.IsSetEndDate())
request.Parameters.Add("endDate", StringUtils.FromString(publicRequest.EndDate));
if (publicRequest.IsSetKeyId())
request.Parameters.Add("keyId", StringUtils.FromString(publicRequest.KeyId));
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
if (publicRequest.IsSetStartDate())
request.Parameters.Add("startDate", StringUtils.FromString(publicRequest.StartDate));
request.ResourcePath = "/usageplans/{usageplanId}/usage";
request.UseQueryString = true;
return request;
}
private static GetUsageRequestMarshaller _instance = new GetUsageRequestMarshaller();
internal static GetUsageRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsageRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 103 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetUsage operation
/// </summary>
public class GetUsageResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetUsageResponse response = new GetUsageResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("endDate", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.EndDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("values", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, List<List<long>>, StringUnmarshaller, ListUnmarshaller<List<long>, ListUnmarshaller<long, LongUnmarshaller>>>(StringUnmarshaller.Instance, new ListUnmarshaller<List<long>, ListUnmarshaller<long, LongUnmarshaller>>(new ListUnmarshaller<long, LongUnmarshaller>(LongUnmarshaller.Instance)));
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("startDate", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.StartDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("usagePlanId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.UsagePlanId = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetUsageResponseUnmarshaller _instance = new GetUsageResponseUnmarshaller();
internal static GetUsageResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetUsageResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 146 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetVpcLink Request Marshaller
/// </summary>
public class GetVpcLinkRequestMarshaller : IMarshaller<IRequest, GetVpcLinkRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetVpcLinkRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetVpcLinkRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (!publicRequest.IsSetVpcLinkId())
throw new AmazonAPIGatewayException("Request object does not have required field VpcLinkId set");
request.AddPathResource("{vpclink_id}", StringUtils.FromString(publicRequest.VpcLinkId));
request.ResourcePath = "/vpclinks/{vpclink_id}";
return request;
}
private static GetVpcLinkRequestMarshaller _instance = new GetVpcLinkRequestMarshaller();
internal static GetVpcLinkRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetVpcLinkRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 87 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetVpcLink operation
/// </summary>
public class GetVpcLinkResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetVpcLinkResponse response = new GetVpcLinkResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("status", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Status = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("statusMessage", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.StatusMessage = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("targetArns", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.TargetArns = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetVpcLinkResponseUnmarshaller _instance = new GetVpcLinkResponseUnmarshaller();
internal static GetVpcLinkResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetVpcLinkResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 158 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// GetVpcLinks Request Marshaller
/// </summary>
public class GetVpcLinksRequestMarshaller : IMarshaller<IRequest, GetVpcLinksRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((GetVpcLinksRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(GetVpcLinksRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "GET";
if (publicRequest.IsSetLimit())
request.Parameters.Add("limit", StringUtils.FromInt(publicRequest.Limit));
if (publicRequest.IsSetPosition())
request.Parameters.Add("position", StringUtils.FromString(publicRequest.Position));
request.ResourcePath = "/vpclinks";
request.UseQueryString = true;
return request;
}
private static GetVpcLinksRequestMarshaller _instance = new GetVpcLinksRequestMarshaller();
internal static GetVpcLinksRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetVpcLinksRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for GetVpcLinks operation
/// </summary>
public class GetVpcLinksResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
GetVpcLinksResponse response = new GetVpcLinksResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("item", targetDepth))
{
var unmarshaller = new ListUnmarshaller<VpcLink, VpcLinkUnmarshaller>(VpcLinkUnmarshaller.Instance);
response.Items = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("position", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Position = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static GetVpcLinksResponseUnmarshaller _instance = new GetVpcLinksResponseUnmarshaller();
internal static GetVpcLinksResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static GetVpcLinksResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 128 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// ImportApiKeys Request Marshaller
/// </summary>
public class ImportApiKeysRequestMarshaller : IMarshaller<IRequest, ImportApiKeysRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((ImportApiKeysRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(ImportApiKeysRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "POST";
request.AddSubResource("mode", "import");
if (publicRequest.IsSetFailOnWarnings())
request.Parameters.Add("failonwarnings", StringUtils.FromBool(publicRequest.FailOnWarnings));
if (publicRequest.IsSetFormat())
request.Parameters.Add("format", StringUtils.FromString(publicRequest.Format));
request.ResourcePath = "/apikeys";
request.ContentStream = publicRequest.Body ?? new MemoryStream();
request.Headers[Amazon.Util.HeaderKeys.ContentLengthHeader] =
request.ContentStream.Length.ToString(CultureInfo.InvariantCulture);
request.Headers[Amazon.Util.HeaderKeys.ContentTypeHeader] = "binary/octet-stream";
if (request.ContentStream != null && request.ContentStream.Length == 0)
{
request.Headers.Remove(Amazon.Util.HeaderKeys.ContentTypeHeader);
}
request.UseQueryString = true;
return request;
}
private static ImportApiKeysRequestMarshaller _instance = new ImportApiKeysRequestMarshaller();
internal static ImportApiKeysRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static ImportApiKeysRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 101 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for ImportApiKeys operation
/// </summary>
public class ImportApiKeysResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
ImportApiKeysResponse response = new ImportApiKeysResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("ids", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Ids = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("warnings", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Warnings = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static ImportApiKeysResponseUnmarshaller _instance = new ImportApiKeysResponseUnmarshaller();
internal static ImportApiKeysResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static ImportApiKeysResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 136 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// ImportDocumentationParts Request Marshaller
/// </summary>
public class ImportDocumentationPartsRequestMarshaller : IMarshaller<IRequest, ImportDocumentationPartsRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((ImportDocumentationPartsRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(ImportDocumentationPartsRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetFailOnWarnings())
request.Parameters.Add("failonwarnings", StringUtils.FromBool(publicRequest.FailOnWarnings));
if (publicRequest.IsSetMode())
request.Parameters.Add("mode", StringUtils.FromString(publicRequest.Mode));
request.ResourcePath = "/restapis/{restapi_id}/documentation/parts";
request.ContentStream = publicRequest.Body ?? new MemoryStream();
request.Headers[Amazon.Util.HeaderKeys.ContentLengthHeader] =
request.ContentStream.Length.ToString(CultureInfo.InvariantCulture);
request.Headers[Amazon.Util.HeaderKeys.ContentTypeHeader] = "binary/octet-stream";
if (request.ContentStream != null && request.ContentStream.Length == 0)
{
request.Headers.Remove(Amazon.Util.HeaderKeys.ContentTypeHeader);
}
request.UseQueryString = true;
return request;
}
private static ImportDocumentationPartsRequestMarshaller _instance = new ImportDocumentationPartsRequestMarshaller();
internal static ImportDocumentationPartsRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static ImportDocumentationPartsRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 103 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for ImportDocumentationParts operation
/// </summary>
public class ImportDocumentationPartsResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
ImportDocumentationPartsResponse response = new ImportDocumentationPartsResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("ids", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Ids = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("warnings", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Warnings = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static ImportDocumentationPartsResponseUnmarshaller _instance = new ImportDocumentationPartsResponseUnmarshaller();
internal static ImportDocumentationPartsResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static ImportDocumentationPartsResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 136 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// ImportRestApi Request Marshaller
/// </summary>
public class ImportRestApiRequestMarshaller : IMarshaller<IRequest, ImportRestApiRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((ImportRestApiRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(ImportRestApiRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "POST";
request.AddSubResource("mode", "import");
if (publicRequest.IsSetFailOnWarnings())
request.Parameters.Add("failonwarnings", StringUtils.FromBool(publicRequest.FailOnWarnings));
if (publicRequest.IsSetParameters())
{
foreach(var kvp in publicRequest.Parameters)
{
request.Parameters.Add(kvp.Key, kvp.Value);
}
}
request.ResourcePath = "/restapis";
request.ContentStream = publicRequest.Body ?? new MemoryStream();
request.Headers[Amazon.Util.HeaderKeys.ContentLengthHeader] =
request.ContentStream.Length.ToString(CultureInfo.InvariantCulture);
request.Headers[Amazon.Util.HeaderKeys.ContentTypeHeader] = "binary/octet-stream";
if (request.ContentStream != null && request.ContentStream.Length == 0)
{
request.Headers.Remove(Amazon.Util.HeaderKeys.ContentTypeHeader);
}
request.UseQueryString = true;
return request;
}
private static ImportRestApiRequestMarshaller _instance = new ImportRestApiRequestMarshaller();
internal static ImportRestApiRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static ImportRestApiRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 106 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for ImportRestApi operation
/// </summary>
public class ImportRestApiResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
ImportRestApiResponse response = new ImportRestApiResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeySource", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ApiKeySource = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("binaryMediaTypes", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.BinaryMediaTypes = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("createdDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.CreatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("disableExecuteApiEndpoint", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.DisableExecuteApiEndpoint = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("endpointConfiguration", targetDepth))
{
var unmarshaller = EndpointConfigurationUnmarshaller.Instance;
response.EndpointConfiguration = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("minimumCompressionSize", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.MinimumCompressionSize = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("policy", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Policy = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("version", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Version = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("warnings", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Warnings = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static ImportRestApiResponseUnmarshaller _instance = new ImportRestApiResponseUnmarshaller();
internal static ImportRestApiResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static ImportRestApiResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 202 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for IntegrationResponse Object
/// </summary>
public class IntegrationResponseUnmarshaller : IUnmarshaller<IntegrationResponse, XmlUnmarshallerContext>, IUnmarshaller<IntegrationResponse, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
IntegrationResponse IUnmarshaller<IntegrationResponse, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public IntegrationResponse Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
IntegrationResponse unmarshalledObject = new IntegrationResponse();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("contentHandling", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ContentHandling = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.ResponseParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseTemplates", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.ResponseTemplates = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("selectionPattern", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.SelectionPattern = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("statusCode", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.StatusCode = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static IntegrationResponseUnmarshaller _instance = new IntegrationResponseUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static IntegrationResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 116 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for Integration Object
/// </summary>
public class IntegrationUnmarshaller : IUnmarshaller<Integration, XmlUnmarshallerContext>, IUnmarshaller<Integration, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
Integration IUnmarshaller<Integration, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public Integration Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
Integration unmarshalledObject = new Integration();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("cacheKeyParameters", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
unmarshalledObject.CacheKeyParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheNamespace", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.CacheNamespace = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("connectionId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ConnectionId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("connectionType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ConnectionType = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("contentHandling", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ContentHandling = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("credentials", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Credentials = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("httpMethod", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.HttpMethod = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("integrationResponses", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, IntegrationResponse, StringUnmarshaller, IntegrationResponseUnmarshaller>(StringUnmarshaller.Instance, IntegrationResponseUnmarshaller.Instance);
unmarshalledObject.IntegrationResponses = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("passthroughBehavior", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.PassthroughBehavior = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.RequestParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestTemplates", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.RequestTemplates = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("timeoutInMillis", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.TimeoutInMillis = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tlsConfig", targetDepth))
{
var unmarshaller = TlsConfigUnmarshaller.Instance;
unmarshalledObject.TlsConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("type", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Type = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("uri", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Uri = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static IntegrationUnmarshaller _instance = new IntegrationUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static IntegrationUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 176 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for LimitExceededException Object
/// </summary>
public class LimitExceededExceptionUnmarshaller : IErrorResponseUnmarshaller<LimitExceededException, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public LimitExceededException Unmarshall(JsonUnmarshallerContext context)
{
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse());
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <param name="errorResponse"></param>
/// <returns></returns>
public LimitExceededException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
{
context.Read();
LimitExceededException unmarshalledObject = new LimitExceededException(errorResponse.Message, errorResponse.InnerException,
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("Retry-After", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.RetryAfterSeconds = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static LimitExceededExceptionUnmarshaller _instance = new LimitExceededExceptionUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static LimitExceededExceptionUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for MethodResponse Object
/// </summary>
public class MethodResponseUnmarshaller : IUnmarshaller<MethodResponse, XmlUnmarshallerContext>, IUnmarshaller<MethodResponse, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
MethodResponse IUnmarshaller<MethodResponse, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public MethodResponse Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
MethodResponse unmarshalledObject = new MethodResponse();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("responseModels", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.ResponseModels = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, bool, StringUnmarshaller, BoolUnmarshaller>(StringUnmarshaller.Instance, BoolUnmarshaller.Instance);
unmarshalledObject.ResponseParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("statusCode", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.StatusCode = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static MethodResponseUnmarshaller _instance = new MethodResponseUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static MethodResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 104 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for MethodSetting Object
/// </summary>
public class MethodSettingUnmarshaller : IUnmarshaller<MethodSetting, XmlUnmarshallerContext>, IUnmarshaller<MethodSetting, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
MethodSetting IUnmarshaller<MethodSetting, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public MethodSetting Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
MethodSetting unmarshalledObject = new MethodSetting();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("cacheDataEncrypted", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.CacheDataEncrypted = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheTtlInSeconds", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.CacheTtlInSeconds = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cachingEnabled", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.CachingEnabled = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("dataTraceEnabled", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.DataTraceEnabled = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("loggingLevel", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.LoggingLevel = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("metricsEnabled", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.MetricsEnabled = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requireAuthorizationForCacheControl", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.RequireAuthorizationForCacheControl = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("throttlingBurstLimit", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.ThrottlingBurstLimit = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("throttlingRateLimit", targetDepth))
{
var unmarshaller = DoubleUnmarshaller.Instance;
unmarshalledObject.ThrottlingRateLimit = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("unauthorizedCacheControlHeaderStrategy", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.UnauthorizedCacheControlHeaderStrategy = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static MethodSettingUnmarshaller _instance = new MethodSettingUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static MethodSettingUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 146 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for MethodSnapshot Object
/// </summary>
public class MethodSnapshotUnmarshaller : IUnmarshaller<MethodSnapshot, XmlUnmarshallerContext>, IUnmarshaller<MethodSnapshot, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
MethodSnapshot IUnmarshaller<MethodSnapshot, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public MethodSnapshot Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
MethodSnapshot unmarshalledObject = new MethodSnapshot();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeyRequired", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.ApiKeyRequired = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("authorizationType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.AuthorizationType = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static MethodSnapshotUnmarshaller _instance = new MethodSnapshotUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static MethodSnapshotUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 98 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for Method Object
/// </summary>
public class MethodUnmarshaller : IUnmarshaller<Method, XmlUnmarshallerContext>, IUnmarshaller<Method, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
Method IUnmarshaller<Method, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public Method Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
Method unmarshalledObject = new Method();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeyRequired", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.ApiKeyRequired = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("authorizationScopes", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
unmarshalledObject.AuthorizationScopes = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("authorizationType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.AuthorizationType = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("authorizerId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.AuthorizerId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("httpMethod", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.HttpMethod = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("methodIntegration", targetDepth))
{
var unmarshaller = IntegrationUnmarshaller.Instance;
unmarshalledObject.MethodIntegration = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("methodResponses", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, MethodResponse, StringUnmarshaller, MethodResponseUnmarshaller>(StringUnmarshaller.Instance, MethodResponseUnmarshaller.Instance);
unmarshalledObject.MethodResponses = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("operationName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.OperationName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestModels", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.RequestModels = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, bool, StringUnmarshaller, BoolUnmarshaller>(StringUnmarshaller.Instance, BoolUnmarshaller.Instance);
unmarshalledObject.RequestParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestValidatorId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.RequestValidatorId = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static MethodUnmarshaller _instance = new MethodUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static MethodUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 152 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for Model Object
/// </summary>
public class ModelUnmarshaller : IUnmarshaller<Model, XmlUnmarshallerContext>, IUnmarshaller<Model, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
Model IUnmarshaller<Model, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public Model Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
Model unmarshalledObject = new Model();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("contentType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ContentType = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("schema", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Schema = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static ModelUnmarshaller _instance = new ModelUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static ModelUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 116 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// MutualTlsAuthenticationInput Marshaller
/// </summary>
public class MutualTlsAuthenticationInputMarshaller : IRequestMarshaller<MutualTlsAuthenticationInput, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(MutualTlsAuthenticationInput requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetTruststoreUri())
{
context.Writer.WritePropertyName("truststoreUri");
context.Writer.Write(requestObject.TruststoreUri);
}
if(requestObject.IsSetTruststoreVersion())
{
context.Writer.WritePropertyName("truststoreVersion");
context.Writer.Write(requestObject.TruststoreVersion);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static MutualTlsAuthenticationInputMarshaller Instance = new MutualTlsAuthenticationInputMarshaller();
}
} | 68 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for MutualTlsAuthentication Object
/// </summary>
public class MutualTlsAuthenticationUnmarshaller : IUnmarshaller<MutualTlsAuthentication, XmlUnmarshallerContext>, IUnmarshaller<MutualTlsAuthentication, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
MutualTlsAuthentication IUnmarshaller<MutualTlsAuthentication, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public MutualTlsAuthentication Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
MutualTlsAuthentication unmarshalledObject = new MutualTlsAuthentication();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("truststoreUri", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.TruststoreUri = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("truststoreVersion", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.TruststoreVersion = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("truststoreWarnings", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
unmarshalledObject.TruststoreWarnings = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static MutualTlsAuthenticationUnmarshaller _instance = new MutualTlsAuthenticationUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static MutualTlsAuthenticationUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 104 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for NotFoundException Object
/// </summary>
public class NotFoundExceptionUnmarshaller : IErrorResponseUnmarshaller<NotFoundException, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public NotFoundException Unmarshall(JsonUnmarshallerContext context)
{
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse());
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <param name="errorResponse"></param>
/// <returns></returns>
public NotFoundException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
{
context.Read();
NotFoundException unmarshalledObject = new NotFoundException(errorResponse.Message, errorResponse.InnerException,
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
}
return unmarshalledObject;
}
private static NotFoundExceptionUnmarshaller _instance = new NotFoundExceptionUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static NotFoundExceptionUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 85 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// PatchOperation Marshaller
/// </summary>
public class PatchOperationMarshaller : IRequestMarshaller<PatchOperation, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(PatchOperation requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetFrom())
{
context.Writer.WritePropertyName("from");
context.Writer.Write(requestObject.From);
}
if(requestObject.IsSetOp())
{
context.Writer.WritePropertyName("op");
context.Writer.Write(requestObject.Op);
}
if(requestObject.IsSetPath())
{
context.Writer.WritePropertyName("path");
context.Writer.Write(requestObject.Path);
}
if(requestObject.IsSetValue())
{
context.Writer.WritePropertyName("value");
context.Writer.Write(requestObject.Value);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static PatchOperationMarshaller Instance = new PatchOperationMarshaller();
}
} | 80 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// PutGatewayResponse Request Marshaller
/// </summary>
public class PutGatewayResponseRequestMarshaller : IMarshaller<IRequest, PutGatewayResponseRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((PutGatewayResponseRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(PutGatewayResponseRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetResponseType())
throw new AmazonAPIGatewayException("Request object does not have required field ResponseType set");
request.AddPathResource("{response_type}", StringUtils.FromString(publicRequest.ResponseType));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}/gatewayresponses/{response_type}";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetResponseParameters())
{
context.Writer.WritePropertyName("responseParameters");
context.Writer.WriteObjectStart();
foreach (var publicRequestResponseParametersKvp in publicRequest.ResponseParameters)
{
context.Writer.WritePropertyName(publicRequestResponseParametersKvp.Key);
var publicRequestResponseParametersValue = publicRequestResponseParametersKvp.Value;
context.Writer.Write(publicRequestResponseParametersValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetResponseTemplates())
{
context.Writer.WritePropertyName("responseTemplates");
context.Writer.WriteObjectStart();
foreach (var publicRequestResponseTemplatesKvp in publicRequest.ResponseTemplates)
{
context.Writer.WritePropertyName(publicRequestResponseTemplatesKvp.Key);
var publicRequestResponseTemplatesValue = publicRequestResponseTemplatesKvp.Value;
context.Writer.Write(publicRequestResponseTemplatesValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetStatusCode())
{
context.Writer.WritePropertyName("statusCode");
context.Writer.Write(publicRequest.StatusCode);
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static PutGatewayResponseRequestMarshaller _instance = new PutGatewayResponseRequestMarshaller();
internal static PutGatewayResponseRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutGatewayResponseRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 135 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for PutGatewayResponse operation
/// </summary>
public class PutGatewayResponseResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
PutGatewayResponseResponse response = new PutGatewayResponseResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("defaultResponse", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.DefaultResponse = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.ResponseParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseTemplates", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.ResponseTemplates = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ResponseType = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("statusCode", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.StatusCode = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static PutGatewayResponseResponseUnmarshaller _instance = new PutGatewayResponseResponseUnmarshaller();
internal static PutGatewayResponseResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutGatewayResponseResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 154 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// PutIntegration Request Marshaller
/// </summary>
public class PutIntegrationRequestMarshaller : IMarshaller<IRequest, PutIntegrationRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((PutIntegrationRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(PutIntegrationRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetHttpMethod())
throw new AmazonAPIGatewayException("Request object does not have required field HttpMethod set");
request.AddPathResource("{http_method}", StringUtils.FromString(publicRequest.HttpMethod));
if (!publicRequest.IsSetResourceId())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceId set");
request.AddPathResource("{resource_id}", StringUtils.FromString(publicRequest.ResourceId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetCacheKeyParameters())
{
context.Writer.WritePropertyName("cacheKeyParameters");
context.Writer.WriteArrayStart();
foreach(var publicRequestCacheKeyParametersListValue in publicRequest.CacheKeyParameters)
{
context.Writer.Write(publicRequestCacheKeyParametersListValue);
}
context.Writer.WriteArrayEnd();
}
if(publicRequest.IsSetCacheNamespace())
{
context.Writer.WritePropertyName("cacheNamespace");
context.Writer.Write(publicRequest.CacheNamespace);
}
if(publicRequest.IsSetConnectionId())
{
context.Writer.WritePropertyName("connectionId");
context.Writer.Write(publicRequest.ConnectionId);
}
if(publicRequest.IsSetConnectionType())
{
context.Writer.WritePropertyName("connectionType");
context.Writer.Write(publicRequest.ConnectionType);
}
if(publicRequest.IsSetContentHandling())
{
context.Writer.WritePropertyName("contentHandling");
context.Writer.Write(publicRequest.ContentHandling);
}
if(publicRequest.IsSetCredentials())
{
context.Writer.WritePropertyName("credentials");
context.Writer.Write(publicRequest.Credentials);
}
if(publicRequest.IsSetIntegrationHttpMethod())
{
context.Writer.WritePropertyName("httpMethod");
context.Writer.Write(publicRequest.IntegrationHttpMethod);
}
if(publicRequest.IsSetPassthroughBehavior())
{
context.Writer.WritePropertyName("passthroughBehavior");
context.Writer.Write(publicRequest.PassthroughBehavior);
}
if(publicRequest.IsSetRequestParameters())
{
context.Writer.WritePropertyName("requestParameters");
context.Writer.WriteObjectStart();
foreach (var publicRequestRequestParametersKvp in publicRequest.RequestParameters)
{
context.Writer.WritePropertyName(publicRequestRequestParametersKvp.Key);
var publicRequestRequestParametersValue = publicRequestRequestParametersKvp.Value;
context.Writer.Write(publicRequestRequestParametersValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetRequestTemplates())
{
context.Writer.WritePropertyName("requestTemplates");
context.Writer.WriteObjectStart();
foreach (var publicRequestRequestTemplatesKvp in publicRequest.RequestTemplates)
{
context.Writer.WritePropertyName(publicRequestRequestTemplatesKvp.Key);
var publicRequestRequestTemplatesValue = publicRequestRequestTemplatesKvp.Value;
context.Writer.Write(publicRequestRequestTemplatesValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetTimeoutInMillis())
{
context.Writer.WritePropertyName("timeoutInMillis");
context.Writer.Write(publicRequest.TimeoutInMillis);
}
if(publicRequest.IsSetTlsConfig())
{
context.Writer.WritePropertyName("tlsConfig");
context.Writer.WriteObjectStart();
var marshaller = TlsConfigMarshaller.Instance;
marshaller.Marshall(publicRequest.TlsConfig, context);
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetType())
{
context.Writer.WritePropertyName("type");
context.Writer.Write(publicRequest.Type);
}
if(publicRequest.IsSetUri())
{
context.Writer.WritePropertyName("uri");
context.Writer.Write(publicRequest.Uri);
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static PutIntegrationRequestMarshaller _instance = new PutIntegrationRequestMarshaller();
internal static PutIntegrationRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutIntegrationRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 214 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// PutIntegrationResponse Request Marshaller
/// </summary>
public class PutIntegrationResponseRequestMarshaller : IMarshaller<IRequest, PutIntegrationResponseRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((PutIntegrationResponseRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(PutIntegrationResponseRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetHttpMethod())
throw new AmazonAPIGatewayException("Request object does not have required field HttpMethod set");
request.AddPathResource("{http_method}", StringUtils.FromString(publicRequest.HttpMethod));
if (!publicRequest.IsSetResourceId())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceId set");
request.AddPathResource("{resource_id}", StringUtils.FromString(publicRequest.ResourceId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (!publicRequest.IsSetStatusCode())
throw new AmazonAPIGatewayException("Request object does not have required field StatusCode set");
request.AddPathResource("{status_code}", StringUtils.FromString(publicRequest.StatusCode));
request.ResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/integration/responses/{status_code}";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetContentHandling())
{
context.Writer.WritePropertyName("contentHandling");
context.Writer.Write(publicRequest.ContentHandling);
}
if(publicRequest.IsSetResponseParameters())
{
context.Writer.WritePropertyName("responseParameters");
context.Writer.WriteObjectStart();
foreach (var publicRequestResponseParametersKvp in publicRequest.ResponseParameters)
{
context.Writer.WritePropertyName(publicRequestResponseParametersKvp.Key);
var publicRequestResponseParametersValue = publicRequestResponseParametersKvp.Value;
context.Writer.Write(publicRequestResponseParametersValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetResponseTemplates())
{
context.Writer.WritePropertyName("responseTemplates");
context.Writer.WriteObjectStart();
foreach (var publicRequestResponseTemplatesKvp in publicRequest.ResponseTemplates)
{
context.Writer.WritePropertyName(publicRequestResponseTemplatesKvp.Key);
var publicRequestResponseTemplatesValue = publicRequestResponseTemplatesKvp.Value;
context.Writer.Write(publicRequestResponseTemplatesValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetSelectionPattern())
{
context.Writer.WritePropertyName("selectionPattern");
context.Writer.Write(publicRequest.SelectionPattern);
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static PutIntegrationResponseRequestMarshaller _instance = new PutIntegrationResponseRequestMarshaller();
internal static PutIntegrationResponseRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutIntegrationResponseRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 147 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for PutIntegrationResponse operation
/// </summary>
public class PutIntegrationResponseResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
PutIntegrationResponseResponse response = new PutIntegrationResponseResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("contentHandling", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ContentHandling = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.ResponseParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseTemplates", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.ResponseTemplates = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("selectionPattern", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.SelectionPattern = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("statusCode", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.StatusCode = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static PutIntegrationResponseResponseUnmarshaller _instance = new PutIntegrationResponseResponseUnmarshaller();
internal static PutIntegrationResponseResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutIntegrationResponseResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 154 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for PutIntegration operation
/// </summary>
public class PutIntegrationResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
PutIntegrationResponse response = new PutIntegrationResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("cacheKeyParameters", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.CacheKeyParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheNamespace", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.CacheNamespace = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("connectionId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ConnectionId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("connectionType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ConnectionType = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("contentHandling", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ContentHandling = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("credentials", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Credentials = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("httpMethod", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.HttpMethod = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("integrationResponses", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, IntegrationResponse, StringUnmarshaller, IntegrationResponseUnmarshaller>(StringUnmarshaller.Instance, IntegrationResponseUnmarshaller.Instance);
response.IntegrationResponses = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("passthroughBehavior", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.PassthroughBehavior = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.RequestParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestTemplates", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.RequestTemplates = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("timeoutInMillis", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.TimeoutInMillis = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tlsConfig", targetDepth))
{
var unmarshaller = TlsConfigUnmarshaller.Instance;
response.TlsConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("type", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Type = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("uri", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Uri = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static PutIntegrationResponseUnmarshaller _instance = new PutIntegrationResponseUnmarshaller();
internal static PutIntegrationResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutIntegrationResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 214 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// PutMethod Request Marshaller
/// </summary>
public class PutMethodRequestMarshaller : IMarshaller<IRequest, PutMethodRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((PutMethodRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(PutMethodRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetHttpMethod())
throw new AmazonAPIGatewayException("Request object does not have required field HttpMethod set");
request.AddPathResource("{http_method}", StringUtils.FromString(publicRequest.HttpMethod));
if (!publicRequest.IsSetResourceId())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceId set");
request.AddPathResource("{resource_id}", StringUtils.FromString(publicRequest.ResourceId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetApiKeyRequired())
{
context.Writer.WritePropertyName("apiKeyRequired");
context.Writer.Write(publicRequest.ApiKeyRequired);
}
if(publicRequest.IsSetAuthorizationScopes())
{
context.Writer.WritePropertyName("authorizationScopes");
context.Writer.WriteArrayStart();
foreach(var publicRequestAuthorizationScopesListValue in publicRequest.AuthorizationScopes)
{
context.Writer.Write(publicRequestAuthorizationScopesListValue);
}
context.Writer.WriteArrayEnd();
}
if(publicRequest.IsSetAuthorizationType())
{
context.Writer.WritePropertyName("authorizationType");
context.Writer.Write(publicRequest.AuthorizationType);
}
if(publicRequest.IsSetAuthorizerId())
{
context.Writer.WritePropertyName("authorizerId");
context.Writer.Write(publicRequest.AuthorizerId);
}
if(publicRequest.IsSetOperationName())
{
context.Writer.WritePropertyName("operationName");
context.Writer.Write(publicRequest.OperationName);
}
if(publicRequest.IsSetRequestModels())
{
context.Writer.WritePropertyName("requestModels");
context.Writer.WriteObjectStart();
foreach (var publicRequestRequestModelsKvp in publicRequest.RequestModels)
{
context.Writer.WritePropertyName(publicRequestRequestModelsKvp.Key);
var publicRequestRequestModelsValue = publicRequestRequestModelsKvp.Value;
context.Writer.Write(publicRequestRequestModelsValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetRequestParameters())
{
context.Writer.WritePropertyName("requestParameters");
context.Writer.WriteObjectStart();
foreach (var publicRequestRequestParametersKvp in publicRequest.RequestParameters)
{
context.Writer.WritePropertyName(publicRequestRequestParametersKvp.Key);
var publicRequestRequestParametersValue = publicRequestRequestParametersKvp.Value;
context.Writer.Write(publicRequestRequestParametersValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetRequestValidatorId())
{
context.Writer.WritePropertyName("requestValidatorId");
context.Writer.Write(publicRequest.RequestValidatorId);
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static PutMethodRequestMarshaller _instance = new PutMethodRequestMarshaller();
internal static PutMethodRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutMethodRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 173 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// PutMethodResponse Request Marshaller
/// </summary>
public class PutMethodResponseRequestMarshaller : IMarshaller<IRequest, PutMethodResponseRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((PutMethodResponseRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(PutMethodResponseRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetHttpMethod())
throw new AmazonAPIGatewayException("Request object does not have required field HttpMethod set");
request.AddPathResource("{http_method}", StringUtils.FromString(publicRequest.HttpMethod));
if (!publicRequest.IsSetResourceId())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceId set");
request.AddPathResource("{resource_id}", StringUtils.FromString(publicRequest.ResourceId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (!publicRequest.IsSetStatusCode())
throw new AmazonAPIGatewayException("Request object does not have required field StatusCode set");
request.AddPathResource("{status_code}", StringUtils.FromString(publicRequest.StatusCode));
request.ResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}/responses/{status_code}";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetResponseModels())
{
context.Writer.WritePropertyName("responseModels");
context.Writer.WriteObjectStart();
foreach (var publicRequestResponseModelsKvp in publicRequest.ResponseModels)
{
context.Writer.WritePropertyName(publicRequestResponseModelsKvp.Key);
var publicRequestResponseModelsValue = publicRequestResponseModelsKvp.Value;
context.Writer.Write(publicRequestResponseModelsValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetResponseParameters())
{
context.Writer.WritePropertyName("responseParameters");
context.Writer.WriteObjectStart();
foreach (var publicRequestResponseParametersKvp in publicRequest.ResponseParameters)
{
context.Writer.WritePropertyName(publicRequestResponseParametersKvp.Key);
var publicRequestResponseParametersValue = publicRequestResponseParametersKvp.Value;
context.Writer.Write(publicRequestResponseParametersValue);
}
context.Writer.WriteObjectEnd();
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static PutMethodResponseRequestMarshaller _instance = new PutMethodResponseRequestMarshaller();
internal static PutMethodResponseRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutMethodResponseRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 135 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for PutMethodResponse operation
/// </summary>
public class PutMethodResponseResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
PutMethodResponseResponse response = new PutMethodResponseResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("responseModels", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.ResponseModels = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("responseParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, bool, StringUnmarshaller, BoolUnmarshaller>(StringUnmarshaller.Instance, BoolUnmarshaller.Instance);
response.ResponseParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("statusCode", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.StatusCode = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static PutMethodResponseResponseUnmarshaller _instance = new PutMethodResponseResponseUnmarshaller();
internal static PutMethodResponseResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutMethodResponseResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 142 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for PutMethod operation
/// </summary>
public class PutMethodResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
PutMethodResponse response = new PutMethodResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeyRequired", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.ApiKeyRequired = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("authorizationScopes", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.AuthorizationScopes = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("authorizationType", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.AuthorizationType = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("authorizerId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.AuthorizerId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("httpMethod", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.HttpMethod = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("methodIntegration", targetDepth))
{
var unmarshaller = IntegrationUnmarshaller.Instance;
response.MethodIntegration = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("methodResponses", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, MethodResponse, StringUnmarshaller, MethodResponseUnmarshaller>(StringUnmarshaller.Instance, MethodResponseUnmarshaller.Instance);
response.MethodResponses = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("operationName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.OperationName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestModels", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.RequestModels = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, bool, StringUnmarshaller, BoolUnmarshaller>(StringUnmarshaller.Instance, BoolUnmarshaller.Instance);
response.RequestParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("requestValidatorId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.RequestValidatorId = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static PutMethodResponseUnmarshaller _instance = new PutMethodResponseUnmarshaller();
internal static PutMethodResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutMethodResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 190 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// PutRestApi Request Marshaller
/// </summary>
public class PutRestApiRequestMarshaller : IMarshaller<IRequest, PutRestApiRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((PutRestApiRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(PutRestApiRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
if (publicRequest.IsSetFailOnWarnings())
request.Parameters.Add("failonwarnings", StringUtils.FromBool(publicRequest.FailOnWarnings));
if (publicRequest.IsSetMode())
request.Parameters.Add("mode", StringUtils.FromString(publicRequest.Mode));
if (publicRequest.IsSetParameters())
{
foreach(var kvp in publicRequest.Parameters)
{
request.Parameters.Add(kvp.Key, kvp.Value);
}
}
request.ResourcePath = "/restapis/{restapi_id}";
request.ContentStream = publicRequest.Body ?? new MemoryStream();
request.Headers[Amazon.Util.HeaderKeys.ContentLengthHeader] =
request.ContentStream.Length.ToString(CultureInfo.InvariantCulture);
request.Headers[Amazon.Util.HeaderKeys.ContentTypeHeader] = "binary/octet-stream";
if (request.ContentStream != null && request.ContentStream.Length == 0)
{
request.Headers.Remove(Amazon.Util.HeaderKeys.ContentTypeHeader);
}
request.UseQueryString = true;
return request;
}
private static PutRestApiRequestMarshaller _instance = new PutRestApiRequestMarshaller();
internal static PutRestApiRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutRestApiRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 111 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for PutRestApi operation
/// </summary>
public class PutRestApiResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
PutRestApiResponse response = new PutRestApiResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeySource", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ApiKeySource = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("binaryMediaTypes", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.BinaryMediaTypes = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("createdDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.CreatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("disableExecuteApiEndpoint", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.DisableExecuteApiEndpoint = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("endpointConfiguration", targetDepth))
{
var unmarshaller = EndpointConfigurationUnmarshaller.Instance;
response.EndpointConfiguration = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("minimumCompressionSize", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.MinimumCompressionSize = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("policy", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Policy = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("version", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Version = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("warnings", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Warnings = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static PutRestApiResponseUnmarshaller _instance = new PutRestApiResponseUnmarshaller();
internal static PutRestApiResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static PutRestApiResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 202 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// QuotaSettings Marshaller
/// </summary>
public class QuotaSettingsMarshaller : IRequestMarshaller<QuotaSettings, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(QuotaSettings requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetLimit())
{
context.Writer.WritePropertyName("limit");
context.Writer.Write(requestObject.Limit);
}
if(requestObject.IsSetOffset())
{
context.Writer.WritePropertyName("offset");
context.Writer.Write(requestObject.Offset);
}
if(requestObject.IsSetPeriod())
{
context.Writer.WritePropertyName("period");
context.Writer.Write(requestObject.Period);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static QuotaSettingsMarshaller Instance = new QuotaSettingsMarshaller();
}
} | 74 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for QuotaSettings Object
/// </summary>
public class QuotaSettingsUnmarshaller : IUnmarshaller<QuotaSettings, XmlUnmarshallerContext>, IUnmarshaller<QuotaSettings, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
QuotaSettings IUnmarshaller<QuotaSettings, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public QuotaSettings Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
QuotaSettings unmarshalledObject = new QuotaSettings();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("limit", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.Limit = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("offset", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.Offset = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("period", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Period = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static QuotaSettingsUnmarshaller _instance = new QuotaSettingsUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static QuotaSettingsUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 104 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for RequestValidator Object
/// </summary>
public class RequestValidatorUnmarshaller : IUnmarshaller<RequestValidator, XmlUnmarshallerContext>, IUnmarshaller<RequestValidator, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
RequestValidator IUnmarshaller<RequestValidator, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public RequestValidator Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
RequestValidator unmarshalledObject = new RequestValidator();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("validateRequestBody", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.ValidateRequestBody = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("validateRequestParameters", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.ValidateRequestParameters = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static RequestValidatorUnmarshaller _instance = new RequestValidatorUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static RequestValidatorUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 110 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for Resource Object
/// </summary>
public class ResourceUnmarshaller : IUnmarshaller<Resource, XmlUnmarshallerContext>, IUnmarshaller<Resource, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
Resource IUnmarshaller<Resource, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public Resource Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
Resource unmarshalledObject = new Resource();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("parentId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ParentId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("path", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Path = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("pathPart", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.PathPart = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("resourceMethods", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, Method, StringUnmarshaller, MethodUnmarshaller>(StringUnmarshaller.Instance, MethodUnmarshaller.Instance);
unmarshalledObject.ResourceMethods = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static ResourceUnmarshaller _instance = new ResourceUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static ResourceUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 116 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for RestApi Object
/// </summary>
public class RestApiUnmarshaller : IUnmarshaller<RestApi, XmlUnmarshallerContext>, IUnmarshaller<RestApi, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
RestApi IUnmarshaller<RestApi, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public RestApi Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
RestApi unmarshalledObject = new RestApi();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeySource", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ApiKeySource = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("binaryMediaTypes", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
unmarshalledObject.BinaryMediaTypes = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("createdDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.CreatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("disableExecuteApiEndpoint", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.DisableExecuteApiEndpoint = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("endpointConfiguration", targetDepth))
{
var unmarshaller = EndpointConfigurationUnmarshaller.Instance;
unmarshalledObject.EndpointConfiguration = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("minimumCompressionSize", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.MinimumCompressionSize = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("policy", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Policy = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("version", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Version = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("warnings", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
unmarshalledObject.Warnings = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static RestApiUnmarshaller _instance = new RestApiUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static RestApiUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 164 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for SdkConfigurationProperty Object
/// </summary>
public class SdkConfigurationPropertyUnmarshaller : IUnmarshaller<SdkConfigurationProperty, XmlUnmarshallerContext>, IUnmarshaller<SdkConfigurationProperty, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
SdkConfigurationProperty IUnmarshaller<SdkConfigurationProperty, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public SdkConfigurationProperty Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
SdkConfigurationProperty unmarshalledObject = new SdkConfigurationProperty();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("defaultValue", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.DefaultValue = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("friendlyName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.FriendlyName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("name", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Name = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("required", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.Required = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static SdkConfigurationPropertyUnmarshaller _instance = new SdkConfigurationPropertyUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static SdkConfigurationPropertyUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 116 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for SdkType Object
/// </summary>
public class SdkTypeUnmarshaller : IUnmarshaller<SdkType, XmlUnmarshallerContext>, IUnmarshaller<SdkType, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
SdkType IUnmarshaller<SdkType, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public SdkType Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
SdkType unmarshalledObject = new SdkType();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("configurationProperties", targetDepth))
{
var unmarshaller = new ListUnmarshaller<SdkConfigurationProperty, SdkConfigurationPropertyUnmarshaller>(SdkConfigurationPropertyUnmarshaller.Instance);
unmarshalledObject.ConfigurationProperties = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("friendlyName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.FriendlyName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Id = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static SdkTypeUnmarshaller _instance = new SdkTypeUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static SdkTypeUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 110 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for ServiceUnavailableException Object
/// </summary>
public class ServiceUnavailableExceptionUnmarshaller : IErrorResponseUnmarshaller<ServiceUnavailableException, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public ServiceUnavailableException Unmarshall(JsonUnmarshallerContext context)
{
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse());
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <param name="errorResponse"></param>
/// <returns></returns>
public ServiceUnavailableException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
{
context.Read();
ServiceUnavailableException unmarshalledObject = new ServiceUnavailableException(errorResponse.Message, errorResponse.InnerException,
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("Retry-After", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.RetryAfterSeconds = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static ServiceUnavailableExceptionUnmarshaller _instance = new ServiceUnavailableExceptionUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static ServiceUnavailableExceptionUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// StageKey Marshaller
/// </summary>
public class StageKeyMarshaller : IRequestMarshaller<StageKey, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(StageKey requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetRestApiId())
{
context.Writer.WritePropertyName("restApiId");
context.Writer.Write(requestObject.RestApiId);
}
if(requestObject.IsSetStageName())
{
context.Writer.WritePropertyName("stageName");
context.Writer.Write(requestObject.StageName);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static StageKeyMarshaller Instance = new StageKeyMarshaller();
}
} | 68 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for Stage Object
/// </summary>
public class StageUnmarshaller : IUnmarshaller<Stage, XmlUnmarshallerContext>, IUnmarshaller<Stage, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
Stage IUnmarshaller<Stage, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public Stage Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
Stage unmarshalledObject = new Stage();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("accessLogSettings", targetDepth))
{
var unmarshaller = AccessLogSettingsUnmarshaller.Instance;
unmarshalledObject.AccessLogSettings = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheClusterEnabled", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.CacheClusterEnabled = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheClusterSize", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.CacheClusterSize = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cacheClusterStatus", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.CacheClusterStatus = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("canarySettings", targetDepth))
{
var unmarshaller = CanarySettingsUnmarshaller.Instance;
unmarshalledObject.CanarySettings = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("clientCertificateId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ClientCertificateId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("createdDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.CreatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("deploymentId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.DeploymentId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("description", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Description = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("documentationVersion", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.DocumentationVersion = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("lastUpdatedDate", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.LastUpdatedDate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("methodSettings", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, MethodSetting, StringUnmarshaller, MethodSettingUnmarshaller>(StringUnmarshaller.Instance, MethodSettingUnmarshaller.Instance);
unmarshalledObject.MethodSettings = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("stageName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.StageName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tags", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.Tags = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tracingEnabled", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.TracingEnabled = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("variables", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
unmarshalledObject.Variables = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("webAclArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.WebAclArn = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static StageUnmarshaller _instance = new StageUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static StageUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 188 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// TagResource Request Marshaller
/// </summary>
public class TagResourceRequestMarshaller : IMarshaller<IRequest, TagResourceRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((TagResourceRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(TagResourceRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PUT";
if (!publicRequest.IsSetResourceArn())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceArn set");
request.AddPathResource("{resource_arn}", StringUtils.FromString(publicRequest.ResourceArn));
request.ResourcePath = "/tags/{resource_arn}";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetTags())
{
context.Writer.WritePropertyName("tags");
context.Writer.WriteObjectStart();
foreach (var publicRequestTagsKvp in publicRequest.Tags)
{
context.Writer.WritePropertyName(publicRequestTagsKvp.Key);
var publicRequestTagsValue = publicRequestTagsKvp.Value;
context.Writer.Write(publicRequestTagsValue);
}
context.Writer.WriteObjectEnd();
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static TagResourceRequestMarshaller _instance = new TagResourceRequestMarshaller();
internal static TagResourceRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static TagResourceRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 112 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for TagResource operation
/// </summary>
public class TagResourceResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
TagResourceResponse response = new TagResourceResponse();
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static TagResourceResponseUnmarshaller _instance = new TagResourceResponseUnmarshaller();
internal static TagResourceResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static TagResourceResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 119 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// TestInvokeAuthorizer Request Marshaller
/// </summary>
public class TestInvokeAuthorizerRequestMarshaller : IMarshaller<IRequest, TestInvokeAuthorizerRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((TestInvokeAuthorizerRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(TestInvokeAuthorizerRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "POST";
if (!publicRequest.IsSetAuthorizerId())
throw new AmazonAPIGatewayException("Request object does not have required field AuthorizerId set");
request.AddPathResource("{authorizer_id}", StringUtils.FromString(publicRequest.AuthorizerId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}/authorizers/{authorizer_id}";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetAdditionalContext())
{
context.Writer.WritePropertyName("additionalContext");
context.Writer.WriteObjectStart();
foreach (var publicRequestAdditionalContextKvp in publicRequest.AdditionalContext)
{
context.Writer.WritePropertyName(publicRequestAdditionalContextKvp.Key);
var publicRequestAdditionalContextValue = publicRequestAdditionalContextKvp.Value;
context.Writer.Write(publicRequestAdditionalContextValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetBody())
{
context.Writer.WritePropertyName("body");
context.Writer.Write(publicRequest.Body);
}
if(publicRequest.IsSetHeaders())
{
context.Writer.WritePropertyName("headers");
context.Writer.WriteObjectStart();
foreach (var publicRequestHeadersKvp in publicRequest.Headers)
{
context.Writer.WritePropertyName(publicRequestHeadersKvp.Key);
var publicRequestHeadersValue = publicRequestHeadersKvp.Value;
context.Writer.Write(publicRequestHeadersValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetMultiValueHeaders())
{
context.Writer.WritePropertyName("multiValueHeaders");
context.Writer.WriteObjectStart();
foreach (var publicRequestMultiValueHeadersKvp in publicRequest.MultiValueHeaders)
{
context.Writer.WritePropertyName(publicRequestMultiValueHeadersKvp.Key);
var publicRequestMultiValueHeadersValue = publicRequestMultiValueHeadersKvp.Value;
context.Writer.WriteArrayStart();
foreach(var publicRequestMultiValueHeadersValueListValue in publicRequestMultiValueHeadersValue)
{
context.Writer.Write(publicRequestMultiValueHeadersValueListValue);
}
context.Writer.WriteArrayEnd();
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetPathWithQueryString())
{
context.Writer.WritePropertyName("pathWithQueryString");
context.Writer.Write(publicRequest.PathWithQueryString);
}
if(publicRequest.IsSetStageVariables())
{
context.Writer.WritePropertyName("stageVariables");
context.Writer.WriteObjectStart();
foreach (var publicRequestStageVariablesKvp in publicRequest.StageVariables)
{
context.Writer.WritePropertyName(publicRequestStageVariablesKvp.Key);
var publicRequestStageVariablesValue = publicRequestStageVariablesKvp.Value;
context.Writer.Write(publicRequestStageVariablesValue);
}
context.Writer.WriteObjectEnd();
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static TestInvokeAuthorizerRequestMarshaller _instance = new TestInvokeAuthorizerRequestMarshaller();
internal static TestInvokeAuthorizerRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static TestInvokeAuthorizerRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 174 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for TestInvokeAuthorizer operation
/// </summary>
public class TestInvokeAuthorizerResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
TestInvokeAuthorizerResponse response = new TestInvokeAuthorizerResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("authorization", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, List<string>, StringUnmarshaller, ListUnmarshaller<string, StringUnmarshaller>>(StringUnmarshaller.Instance, new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance));
response.Authorization = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("claims", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Claims = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("clientStatus", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.ClientStatus = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("latency", targetDepth))
{
var unmarshaller = LongUnmarshaller.Instance;
response.Latency = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("log", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Log = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("policy", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Policy = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("principalId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.PrincipalId = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static TestInvokeAuthorizerResponseUnmarshaller _instance = new TestInvokeAuthorizerResponseUnmarshaller();
internal static TestInvokeAuthorizerResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static TestInvokeAuthorizerResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 158 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// TestInvokeMethod Request Marshaller
/// </summary>
public class TestInvokeMethodRequestMarshaller : IMarshaller<IRequest, TestInvokeMethodRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((TestInvokeMethodRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(TestInvokeMethodRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "POST";
if (!publicRequest.IsSetHttpMethod())
throw new AmazonAPIGatewayException("Request object does not have required field HttpMethod set");
request.AddPathResource("{http_method}", StringUtils.FromString(publicRequest.HttpMethod));
if (!publicRequest.IsSetResourceId())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceId set");
request.AddPathResource("{resource_id}", StringUtils.FromString(publicRequest.ResourceId));
if (!publicRequest.IsSetRestApiId())
throw new AmazonAPIGatewayException("Request object does not have required field RestApiId set");
request.AddPathResource("{restapi_id}", StringUtils.FromString(publicRequest.RestApiId));
request.ResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetBody())
{
context.Writer.WritePropertyName("body");
context.Writer.Write(publicRequest.Body);
}
if(publicRequest.IsSetClientCertificateId())
{
context.Writer.WritePropertyName("clientCertificateId");
context.Writer.Write(publicRequest.ClientCertificateId);
}
if(publicRequest.IsSetHeaders())
{
context.Writer.WritePropertyName("headers");
context.Writer.WriteObjectStart();
foreach (var publicRequestHeadersKvp in publicRequest.Headers)
{
context.Writer.WritePropertyName(publicRequestHeadersKvp.Key);
var publicRequestHeadersValue = publicRequestHeadersKvp.Value;
context.Writer.Write(publicRequestHeadersValue);
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetMultiValueHeaders())
{
context.Writer.WritePropertyName("multiValueHeaders");
context.Writer.WriteObjectStart();
foreach (var publicRequestMultiValueHeadersKvp in publicRequest.MultiValueHeaders)
{
context.Writer.WritePropertyName(publicRequestMultiValueHeadersKvp.Key);
var publicRequestMultiValueHeadersValue = publicRequestMultiValueHeadersKvp.Value;
context.Writer.WriteArrayStart();
foreach(var publicRequestMultiValueHeadersValueListValue in publicRequestMultiValueHeadersValue)
{
context.Writer.Write(publicRequestMultiValueHeadersValueListValue);
}
context.Writer.WriteArrayEnd();
}
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetPathWithQueryString())
{
context.Writer.WritePropertyName("pathWithQueryString");
context.Writer.Write(publicRequest.PathWithQueryString);
}
if(publicRequest.IsSetStageVariables())
{
context.Writer.WritePropertyName("stageVariables");
context.Writer.WriteObjectStart();
foreach (var publicRequestStageVariablesKvp in publicRequest.StageVariables)
{
context.Writer.WritePropertyName(publicRequestStageVariablesKvp.Key);
var publicRequestStageVariablesValue = publicRequestStageVariablesKvp.Value;
context.Writer.Write(publicRequestStageVariablesValue);
}
context.Writer.WriteObjectEnd();
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static TestInvokeMethodRequestMarshaller _instance = new TestInvokeMethodRequestMarshaller();
internal static TestInvokeMethodRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static TestInvokeMethodRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 169 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for TestInvokeMethod operation
/// </summary>
public class TestInvokeMethodResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
TestInvokeMethodResponse response = new TestInvokeMethodResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("body", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Body = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("headers", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Headers = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("latency", targetDepth))
{
var unmarshaller = LongUnmarshaller.Instance;
response.Latency = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("log", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.Log = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("multiValueHeaders", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller<string, List<string>, StringUnmarshaller, ListUnmarshaller<string, StringUnmarshaller>>(StringUnmarshaller.Instance, new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance));
response.MultiValueHeaders = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("status", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.Status = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static TestInvokeMethodResponseUnmarshaller _instance = new TestInvokeMethodResponseUnmarshaller();
internal static TestInvokeMethodResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static TestInvokeMethodResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 152 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// ThrottleSettings Marshaller
/// </summary>
public class ThrottleSettingsMarshaller : IRequestMarshaller<ThrottleSettings, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(ThrottleSettings requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetBurstLimit())
{
context.Writer.WritePropertyName("burstLimit");
context.Writer.Write(requestObject.BurstLimit);
}
if(requestObject.IsSetRateLimit())
{
context.Writer.WritePropertyName("rateLimit");
context.Writer.Write(requestObject.RateLimit);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static ThrottleSettingsMarshaller Instance = new ThrottleSettingsMarshaller();
}
} | 68 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for ThrottleSettings Object
/// </summary>
public class ThrottleSettingsUnmarshaller : IUnmarshaller<ThrottleSettings, XmlUnmarshallerContext>, IUnmarshaller<ThrottleSettings, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
ThrottleSettings IUnmarshaller<ThrottleSettings, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public ThrottleSettings Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
ThrottleSettings unmarshalledObject = new ThrottleSettings();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("burstLimit", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.BurstLimit = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("rateLimit", targetDepth))
{
var unmarshaller = DoubleUnmarshaller.Instance;
unmarshalledObject.RateLimit = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static ThrottleSettingsUnmarshaller _instance = new ThrottleSettingsUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static ThrottleSettingsUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 98 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// TlsConfig Marshaller
/// </summary>
public class TlsConfigMarshaller : IRequestMarshaller<TlsConfig, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(TlsConfig requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetInsecureSkipVerification())
{
context.Writer.WritePropertyName("insecureSkipVerification");
context.Writer.Write(requestObject.InsecureSkipVerification);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static TlsConfigMarshaller Instance = new TlsConfigMarshaller();
}
} | 62 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for TlsConfig Object
/// </summary>
public class TlsConfigUnmarshaller : IUnmarshaller<TlsConfig, XmlUnmarshallerContext>, IUnmarshaller<TlsConfig, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
TlsConfig IUnmarshaller<TlsConfig, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public TlsConfig Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
TlsConfig unmarshalledObject = new TlsConfig();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("insecureSkipVerification", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.InsecureSkipVerification = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static TlsConfigUnmarshaller _instance = new TlsConfigUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static TlsConfigUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 92 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for TooManyRequestsException Object
/// </summary>
public class TooManyRequestsExceptionUnmarshaller : IErrorResponseUnmarshaller<TooManyRequestsException, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public TooManyRequestsException Unmarshall(JsonUnmarshallerContext context)
{
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse());
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <param name="errorResponse"></param>
/// <returns></returns>
public TooManyRequestsException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
{
context.Read();
TooManyRequestsException unmarshalledObject = new TooManyRequestsException(errorResponse.Message, errorResponse.InnerException,
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("Retry-After", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.RetryAfterSeconds = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static TooManyRequestsExceptionUnmarshaller _instance = new TooManyRequestsExceptionUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static TooManyRequestsExceptionUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for UnauthorizedException Object
/// </summary>
public class UnauthorizedExceptionUnmarshaller : IErrorResponseUnmarshaller<UnauthorizedException, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public UnauthorizedException Unmarshall(JsonUnmarshallerContext context)
{
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse());
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <param name="errorResponse"></param>
/// <returns></returns>
public UnauthorizedException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
{
context.Read();
UnauthorizedException unmarshalledObject = new UnauthorizedException(errorResponse.Message, errorResponse.InnerException,
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
}
return unmarshalledObject;
}
private static UnauthorizedExceptionUnmarshaller _instance = new UnauthorizedExceptionUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static UnauthorizedExceptionUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 85 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// UntagResource Request Marshaller
/// </summary>
public class UntagResourceRequestMarshaller : IMarshaller<IRequest, UntagResourceRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((UntagResourceRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(UntagResourceRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "DELETE";
if (!publicRequest.IsSetResourceArn())
throw new AmazonAPIGatewayException("Request object does not have required field ResourceArn set");
request.AddPathResource("{resource_arn}", StringUtils.FromString(publicRequest.ResourceArn));
if (publicRequest.IsSetTagKeys())
request.ParameterCollection.Add("tagKeys", publicRequest.TagKeys);
request.ResourcePath = "/tags/{resource_arn}";
request.UseQueryString = true;
return request;
}
private static UntagResourceRequestMarshaller _instance = new UntagResourceRequestMarshaller();
internal static UntagResourceRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static UntagResourceRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 91 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for UntagResource operation
/// </summary>
public class UntagResourceResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
UntagResourceResponse response = new UntagResourceResponse();
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static UntagResourceResponseUnmarshaller _instance = new UntagResourceResponseUnmarshaller();
internal static UntagResourceResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static UntagResourceResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 119 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// UpdateAccount Request Marshaller
/// </summary>
public class UpdateAccountRequestMarshaller : IMarshaller<IRequest, UpdateAccountRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((UpdateAccountRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(UpdateAccountRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.APIGateway");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-07-09";
request.HttpMethod = "PATCH";
request.ResourcePath = "/account";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetPatchOperations())
{
context.Writer.WritePropertyName("patchOperations");
context.Writer.WriteArrayStart();
foreach(var publicRequestPatchOperationsListValue in publicRequest.PatchOperations)
{
context.Writer.WriteObjectStart();
var marshaller = PatchOperationMarshaller.Instance;
marshaller.Marshall(publicRequestPatchOperationsListValue, context);
context.Writer.WriteObjectEnd();
}
context.Writer.WriteArrayEnd();
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static UpdateAccountRequestMarshaller _instance = new UpdateAccountRequestMarshaller();
internal static UpdateAccountRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static UpdateAccountRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 111 |
aws-sdk-net | aws | C# | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the apigateway-2015-07-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.APIGateway.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.APIGateway.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for UpdateAccount operation
/// </summary>
public class UpdateAccountResponseUnmarshaller : JsonResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
UpdateAccountResponse response = new UpdateAccountResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("apiKeyVersion", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ApiKeyVersion = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("cloudwatchRoleArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.CloudwatchRoleArn = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("features", targetDepth))
{
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
response.Features = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("throttleSettings", targetDepth))
{
var unmarshaller = ThrottleSettingsUnmarshaller.Instance;
response.ThrottleSettings = unmarshaller.Unmarshall(context);
continue;
}
}
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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
errorResponse.InnerException = innerException;
errorResponse.StatusCode = statusCode;
var responseBodyBytes = context.GetResponseBodyBytes();
using (var streamCopy = new MemoryStream(responseBodyBytes))
using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null))
{
if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException"))
{
return BadRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException"))
{
return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
{
return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
{
return NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
{
return TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
{
return UnauthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonAPIGatewayException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static UpdateAccountResponseUnmarshaller _instance = new UpdateAccountResponseUnmarshaller();
internal static UpdateAccountResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static UpdateAccountResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.