/*
* 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 ec2-2016-11-15.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.EC2.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
namespace Amazon.EC2.Model.Internal.MarshallTransformations
{
///
/// Response Unmarshaller for SpotInstanceRequest Object
///
public class SpotInstanceRequestUnmarshaller : IUnmarshaller, IUnmarshaller
{
///
/// Unmarshaller the response from the service to the response class.
///
///
///
public SpotInstanceRequest Unmarshall(XmlUnmarshallerContext context)
{
SpotInstanceRequest unmarshalledObject = new SpotInstanceRequest();
int originalDepth = context.CurrentDepth;
int targetDepth = originalDepth + 1;
if (context.IsStartOfDocument)
targetDepth += 2;
while (context.ReadAtDepth(originalDepth))
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("actualBlockHourlyPrice", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ActualBlockHourlyPrice = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("availabilityZoneGroup", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.AvailabilityZoneGroup = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("blockDurationMinutes", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.BlockDurationMinutes = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("createTime", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.CreateTime = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("fault", targetDepth))
{
var unmarshaller = SpotInstanceStateFaultUnmarshaller.Instance;
unmarshalledObject.Fault = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("instanceId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.InstanceId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("instanceInterruptionBehavior", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.InstanceInterruptionBehavior = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("launchedAvailabilityZone", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.LaunchedAvailabilityZone = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("launchGroup", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.LaunchGroup = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("launchSpecification", targetDepth))
{
var unmarshaller = LaunchSpecificationUnmarshaller.Instance;
unmarshalledObject.LaunchSpecification = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("productDescription", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ProductDescription = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("spotInstanceRequestId", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.SpotInstanceRequestId = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("spotPrice", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.SpotPrice = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("state", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.State = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("status", targetDepth))
{
var unmarshaller = SpotInstanceStatusUnmarshaller.Instance;
unmarshalledObject.Status = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("tagSet/item", targetDepth))
{
var unmarshaller = TagUnmarshaller.Instance;
var item = unmarshaller.Unmarshall(context);
unmarshalledObject.Tags.Add(item);
continue;
}
if (context.TestExpression("type", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Type = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("validFrom", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.ValidFrom = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("validUntil", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.ValidUntil = unmarshaller.Unmarshall(context);
continue;
}
}
else if (context.IsEndElement && context.CurrentDepth < originalDepth)
{
return unmarshalledObject;
}
}
return unmarshalledObject;
}
///
/// Unmarshaller error response to exception.
///
///
///
public SpotInstanceRequest Unmarshall(JsonUnmarshallerContext context)
{
return null;
}
private static SpotInstanceRequestUnmarshaller _instance = new SpotInstanceRequestUnmarshaller();
///
/// Gets the singleton.
///
public static SpotInstanceRequestUnmarshaller Instance
{
get
{
return _instance;
}
}
}
}