/*
* 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 codebuild-2016-10-06.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.CodeBuild.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.CodeBuild.Model.Internal.MarshallTransformations
{
///
/// CreateProject Request Marshaller
///
public class CreateProjectRequestMarshaller : IMarshaller , IMarshaller
{
///
/// Marshaller the request object to the HTTP request.
///
///
///
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((CreateProjectRequest)input);
}
///
/// Marshaller the request object to the HTTP request.
///
///
///
public IRequest Marshall(CreateProjectRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.CodeBuild");
string target = "CodeBuild_20161006.CreateProject";
request.Headers["X-Amz-Target"] = target;
request.Headers["Content-Type"] = "application/x-amz-json-1.1";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2016-10-06";
request.HttpMethod = "POST";
request.ResourcePath = "/";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetArtifacts())
{
context.Writer.WritePropertyName("artifacts");
context.Writer.WriteObjectStart();
var marshaller = ProjectArtifactsMarshaller.Instance;
marshaller.Marshall(publicRequest.Artifacts, context);
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetBadgeEnabled())
{
context.Writer.WritePropertyName("badgeEnabled");
context.Writer.Write(publicRequest.BadgeEnabled);
}
if(publicRequest.IsSetBuildBatchConfig())
{
context.Writer.WritePropertyName("buildBatchConfig");
context.Writer.WriteObjectStart();
var marshaller = ProjectBuildBatchConfigMarshaller.Instance;
marshaller.Marshall(publicRequest.BuildBatchConfig, context);
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetCache())
{
context.Writer.WritePropertyName("cache");
context.Writer.WriteObjectStart();
var marshaller = ProjectCacheMarshaller.Instance;
marshaller.Marshall(publicRequest.Cache, context);
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetConcurrentBuildLimit())
{
context.Writer.WritePropertyName("concurrentBuildLimit");
context.Writer.Write(publicRequest.ConcurrentBuildLimit);
}
if(publicRequest.IsSetDescription())
{
context.Writer.WritePropertyName("description");
context.Writer.Write(publicRequest.Description);
}
if(publicRequest.IsSetEncryptionKey())
{
context.Writer.WritePropertyName("encryptionKey");
context.Writer.Write(publicRequest.EncryptionKey);
}
if(publicRequest.IsSetEnvironment())
{
context.Writer.WritePropertyName("environment");
context.Writer.WriteObjectStart();
var marshaller = ProjectEnvironmentMarshaller.Instance;
marshaller.Marshall(publicRequest.Environment, context);
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetFileSystemLocations())
{
context.Writer.WritePropertyName("fileSystemLocations");
context.Writer.WriteArrayStart();
foreach(var publicRequestFileSystemLocationsListValue in publicRequest.FileSystemLocations)
{
context.Writer.WriteObjectStart();
var marshaller = ProjectFileSystemLocationMarshaller.Instance;
marshaller.Marshall(publicRequestFileSystemLocationsListValue, context);
context.Writer.WriteObjectEnd();
}
context.Writer.WriteArrayEnd();
}
if(publicRequest.IsSetLogsConfig())
{
context.Writer.WritePropertyName("logsConfig");
context.Writer.WriteObjectStart();
var marshaller = LogsConfigMarshaller.Instance;
marshaller.Marshall(publicRequest.LogsConfig, context);
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetName())
{
context.Writer.WritePropertyName("name");
context.Writer.Write(publicRequest.Name);
}
if(publicRequest.IsSetQueuedTimeoutInMinutes())
{
context.Writer.WritePropertyName("queuedTimeoutInMinutes");
context.Writer.Write(publicRequest.QueuedTimeoutInMinutes);
}
if(publicRequest.IsSetSecondaryArtifacts())
{
context.Writer.WritePropertyName("secondaryArtifacts");
context.Writer.WriteArrayStart();
foreach(var publicRequestSecondaryArtifactsListValue in publicRequest.SecondaryArtifacts)
{
context.Writer.WriteObjectStart();
var marshaller = ProjectArtifactsMarshaller.Instance;
marshaller.Marshall(publicRequestSecondaryArtifactsListValue, context);
context.Writer.WriteObjectEnd();
}
context.Writer.WriteArrayEnd();
}
if(publicRequest.IsSetSecondarySources())
{
context.Writer.WritePropertyName("secondarySources");
context.Writer.WriteArrayStart();
foreach(var publicRequestSecondarySourcesListValue in publicRequest.SecondarySources)
{
context.Writer.WriteObjectStart();
var marshaller = ProjectSourceMarshaller.Instance;
marshaller.Marshall(publicRequestSecondarySourcesListValue, context);
context.Writer.WriteObjectEnd();
}
context.Writer.WriteArrayEnd();
}
if(publicRequest.IsSetSecondarySourceVersions())
{
context.Writer.WritePropertyName("secondarySourceVersions");
context.Writer.WriteArrayStart();
foreach(var publicRequestSecondarySourceVersionsListValue in publicRequest.SecondarySourceVersions)
{
context.Writer.WriteObjectStart();
var marshaller = ProjectSourceVersionMarshaller.Instance;
marshaller.Marshall(publicRequestSecondarySourceVersionsListValue, context);
context.Writer.WriteObjectEnd();
}
context.Writer.WriteArrayEnd();
}
if(publicRequest.IsSetServiceRole())
{
context.Writer.WritePropertyName("serviceRole");
context.Writer.Write(publicRequest.ServiceRole);
}
if(publicRequest.IsSetSource())
{
context.Writer.WritePropertyName("source");
context.Writer.WriteObjectStart();
var marshaller = ProjectSourceMarshaller.Instance;
marshaller.Marshall(publicRequest.Source, context);
context.Writer.WriteObjectEnd();
}
if(publicRequest.IsSetSourceVersion())
{
context.Writer.WritePropertyName("sourceVersion");
context.Writer.Write(publicRequest.SourceVersion);
}
if(publicRequest.IsSetTags())
{
context.Writer.WritePropertyName("tags");
context.Writer.WriteArrayStart();
foreach(var publicRequestTagsListValue in publicRequest.Tags)
{
context.Writer.WriteObjectStart();
var marshaller = TagMarshaller.Instance;
marshaller.Marshall(publicRequestTagsListValue, context);
context.Writer.WriteObjectEnd();
}
context.Writer.WriteArrayEnd();
}
if(publicRequest.IsSetTimeoutInMinutes())
{
context.Writer.WritePropertyName("timeoutInMinutes");
context.Writer.Write(publicRequest.TimeoutInMinutes);
}
if(publicRequest.IsSetVpcConfig())
{
context.Writer.WritePropertyName("vpcConfig");
context.Writer.WriteObjectStart();
var marshaller = VpcConfigMarshaller.Instance;
marshaller.Marshall(publicRequest.VpcConfig, context);
context.Writer.WriteObjectEnd();
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static CreateProjectRequestMarshaller _instance = new CreateProjectRequestMarshaller();
internal static CreateProjectRequestMarshaller GetInstance()
{
return _instance;
}
///
/// Gets the singleton.
///
public static CreateProjectRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
}