/*
* 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 sagemaker-2017-07-24.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.SageMaker.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.SageMaker.Model.Internal.MarshallTransformations
{
///
/// Response Unmarshaller for DescribeTrainingJob operation
///
public class DescribeTrainingJobResponseUnmarshaller : JsonResponseUnmarshaller
{
///
/// Unmarshaller the response from the service to the response class.
///
///
///
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
{
DescribeTrainingJobResponse response = new DescribeTrainingJobResponse();
context.Read();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("AlgorithmSpecification", targetDepth))
{
var unmarshaller = AlgorithmSpecificationUnmarshaller.Instance;
response.AlgorithmSpecification = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("AutoMLJobArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.AutoMLJobArn = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("BillableTimeInSeconds", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.BillableTimeInSeconds = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("CheckpointConfig", targetDepth))
{
var unmarshaller = CheckpointConfigUnmarshaller.Instance;
response.CheckpointConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("CreationTime", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.CreationTime = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("DebugHookConfig", targetDepth))
{
var unmarshaller = DebugHookConfigUnmarshaller.Instance;
response.DebugHookConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("DebugRuleConfigurations", targetDepth))
{
var unmarshaller = new ListUnmarshaller(DebugRuleConfigurationUnmarshaller.Instance);
response.DebugRuleConfigurations = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("DebugRuleEvaluationStatuses", targetDepth))
{
var unmarshaller = new ListUnmarshaller(DebugRuleEvaluationStatusUnmarshaller.Instance);
response.DebugRuleEvaluationStatuses = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("EnableInterContainerTrafficEncryption", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.EnableInterContainerTrafficEncryption = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("EnableManagedSpotTraining", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.EnableManagedSpotTraining = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("EnableNetworkIsolation", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
response.EnableNetworkIsolation = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("Environment", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.Environment = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("ExperimentConfig", targetDepth))
{
var unmarshaller = ExperimentConfigUnmarshaller.Instance;
response.ExperimentConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("FailureReason", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.FailureReason = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("FinalMetricDataList", targetDepth))
{
var unmarshaller = new ListUnmarshaller(MetricDataUnmarshaller.Instance);
response.FinalMetricDataList = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("HyperParameters", targetDepth))
{
var unmarshaller = new DictionaryUnmarshaller(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
response.HyperParameters = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("InputDataConfig", targetDepth))
{
var unmarshaller = new ListUnmarshaller(ChannelUnmarshaller.Instance);
response.InputDataConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("LabelingJobArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.LabelingJobArn = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("LastModifiedTime", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.LastModifiedTime = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("ModelArtifacts", targetDepth))
{
var unmarshaller = ModelArtifactsUnmarshaller.Instance;
response.ModelArtifacts = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("OutputDataConfig", targetDepth))
{
var unmarshaller = OutputDataConfigUnmarshaller.Instance;
response.OutputDataConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("ProfilerConfig", targetDepth))
{
var unmarshaller = ProfilerConfigUnmarshaller.Instance;
response.ProfilerConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("ProfilerRuleConfigurations", targetDepth))
{
var unmarshaller = new ListUnmarshaller(ProfilerRuleConfigurationUnmarshaller.Instance);
response.ProfilerRuleConfigurations = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("ProfilerRuleEvaluationStatuses", targetDepth))
{
var unmarshaller = new ListUnmarshaller(ProfilerRuleEvaluationStatusUnmarshaller.Instance);
response.ProfilerRuleEvaluationStatuses = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("ProfilingStatus", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.ProfilingStatus = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("ResourceConfig", targetDepth))
{
var unmarshaller = ResourceConfigUnmarshaller.Instance;
response.ResourceConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("RetryStrategy", targetDepth))
{
var unmarshaller = RetryStrategyUnmarshaller.Instance;
response.RetryStrategy = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("RoleArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.RoleArn = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("SecondaryStatus", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.SecondaryStatus = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("SecondaryStatusTransitions", targetDepth))
{
var unmarshaller = new ListUnmarshaller(SecondaryStatusTransitionUnmarshaller.Instance);
response.SecondaryStatusTransitions = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("StoppingCondition", targetDepth))
{
var unmarshaller = StoppingConditionUnmarshaller.Instance;
response.StoppingCondition = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TensorBoardOutputConfig", targetDepth))
{
var unmarshaller = TensorBoardOutputConfigUnmarshaller.Instance;
response.TensorBoardOutputConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TrainingEndTime", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.TrainingEndTime = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TrainingJobArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.TrainingJobArn = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TrainingJobName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.TrainingJobName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TrainingJobStatus", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.TrainingJobStatus = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TrainingStartTime", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
response.TrainingStartTime = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TrainingTimeInSeconds", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
response.TrainingTimeInSeconds = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("TuningJobArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
response.TuningJobArn = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("VpcConfig", targetDepth))
{
var unmarshaller = VpcConfigUnmarshaller.Instance;
response.VpcConfig = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("WarmPoolStatus", targetDepth))
{
var unmarshaller = WarmPoolStatusUnmarshaller.Instance;
response.WarmPoolStatus = unmarshaller.Unmarshall(context);
continue;
}
}
return response;
}
///
/// Unmarshaller error response to exception.
///
///
///
///
///
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("ResourceNotFound"))
{
return ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
}
}
return new AmazonSageMakerException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
}
private static DescribeTrainingJobResponseUnmarshaller _instance = new DescribeTrainingJobResponseUnmarshaller();
internal static DescribeTrainingJobResponseUnmarshaller GetInstance()
{
return _instance;
}
///
/// Gets the singleton.
///
public static DescribeTrainingJobResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
}