All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.codebuild.model.transform.ReportMarshaller Maven / Gradle / Ivy

/*
 * Copyright 2015-2020 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.codebuild.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.codebuild.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * ReportMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ReportMarshaller {

    private static final MarshallingInfo ARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("arn").build();
    private static final MarshallingInfo TYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("type").build();
    private static final MarshallingInfo NAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("name").build();
    private static final MarshallingInfo REPORTGROUPARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("reportGroupArn").build();
    private static final MarshallingInfo EXECUTIONID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("executionId").build();
    private static final MarshallingInfo STATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("status").build();
    private static final MarshallingInfo CREATED_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("created").timestampFormat("unixTimestamp").build();
    private static final MarshallingInfo EXPIRED_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("expired").timestampFormat("unixTimestamp").build();
    private static final MarshallingInfo EXPORTCONFIG_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("exportConfig").build();
    private static final MarshallingInfo TRUNCATED_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("truncated").build();
    private static final MarshallingInfo TESTSUMMARY_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("testSummary").build();
    private static final MarshallingInfo CODECOVERAGESUMMARY_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("codeCoverageSummary").build();

    private static final ReportMarshaller instance = new ReportMarshaller();

    public static ReportMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(Report report, ProtocolMarshaller protocolMarshaller) {

        if (report == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(report.getArn(), ARN_BINDING);
            protocolMarshaller.marshall(report.getType(), TYPE_BINDING);
            protocolMarshaller.marshall(report.getName(), NAME_BINDING);
            protocolMarshaller.marshall(report.getReportGroupArn(), REPORTGROUPARN_BINDING);
            protocolMarshaller.marshall(report.getExecutionId(), EXECUTIONID_BINDING);
            protocolMarshaller.marshall(report.getStatus(), STATUS_BINDING);
            protocolMarshaller.marshall(report.getCreated(), CREATED_BINDING);
            protocolMarshaller.marshall(report.getExpired(), EXPIRED_BINDING);
            protocolMarshaller.marshall(report.getExportConfig(), EXPORTCONFIG_BINDING);
            protocolMarshaller.marshall(report.getTruncated(), TRUNCATED_BINDING);
            protocolMarshaller.marshall(report.getTestSummary(), TESTSUMMARY_BINDING);
            protocolMarshaller.marshall(report.getCodeCoverageSummary(), CODECOVERAGESUMMARY_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy