/* * Copyright 2012-2017 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. */ package com.amazonaws.services.lightsail.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.lightsail.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * OperationMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class OperationMarshaller { private static final MarshallingInfo<String> ID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("id").build(); private static final MarshallingInfo<String> RESOURCENAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("resourceName").build(); private static final MarshallingInfo<String> RESOURCETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("resourceType").build(); private static final MarshallingInfo<java.util.Date> CREATEDAT_BINDING = MarshallingInfo.builder(MarshallingType.DATE) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("createdAt").build(); private static final MarshallingInfo<StructuredPojo> LOCATION_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("location").build(); private static final MarshallingInfo<Boolean> ISTERMINAL_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("isTerminal").build(); private static final MarshallingInfo<String> OPERATIONDETAILS_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("operationDetails").build(); private static final MarshallingInfo<String> OPERATIONTYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("operationType").build(); private static final MarshallingInfo<String> STATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("status").build(); private static final MarshallingInfo<java.util.Date> STATUSCHANGEDAT_BINDING = MarshallingInfo.builder(MarshallingType.DATE) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("statusChangedAt").build(); private static final MarshallingInfo<String> ERRORCODE_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("errorCode").build(); private static final MarshallingInfo<String> ERRORDETAILS_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("errorDetails").build(); private static final OperationMarshaller instance = new OperationMarshaller(); public static OperationMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(Operation operation, ProtocolMarshaller protocolMarshaller) { if (operation == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(operation.getId(), ID_BINDING); protocolMarshaller.marshall(operation.getResourceName(), RESOURCENAME_BINDING); protocolMarshaller.marshall(operation.getResourceType(), RESOURCETYPE_BINDING); protocolMarshaller.marshall(operation.getCreatedAt(), CREATEDAT_BINDING); protocolMarshaller.marshall(operation.getLocation(), LOCATION_BINDING); protocolMarshaller.marshall(operation.getIsTerminal(), ISTERMINAL_BINDING); protocolMarshaller.marshall(operation.getOperationDetails(), OPERATIONDETAILS_BINDING); protocolMarshaller.marshall(operation.getOperationType(), OPERATIONTYPE_BINDING); protocolMarshaller.marshall(operation.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(operation.getStatusChangedAt(), STATUSCHANGEDAT_BINDING); protocolMarshaller.marshall(operation.getErrorCode(), ERRORCODE_BINDING); protocolMarshaller.marshall(operation.getErrorDetails(), ERRORDETAILS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }