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

com.amazonaws.services.ec2.model.transform.ModifyVpcEndpointRequestMarshaller Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

The newest version!
/*
 * Copyright 2019-2024 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.ec2.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.ec2.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * ModifyVpcEndpointRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ModifyVpcEndpointRequestMarshaller implements Marshaller, ModifyVpcEndpointRequest> {

    public Request marshall(ModifyVpcEndpointRequest modifyVpcEndpointRequest) {

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

        Request request = new DefaultRequest(modifyVpcEndpointRequest, "AmazonEC2");
        request.addParameter("Action", "ModifyVpcEndpoint");
        request.addParameter("Version", "2016-11-15");
        request.setHttpMethod(HttpMethodName.POST);

        if (modifyVpcEndpointRequest.getVpcEndpointId() != null) {
            request.addParameter("VpcEndpointId", StringUtils.fromString(modifyVpcEndpointRequest.getVpcEndpointId()));
        }

        if (modifyVpcEndpointRequest.getResetPolicy() != null) {
            request.addParameter("ResetPolicy", StringUtils.fromBoolean(modifyVpcEndpointRequest.getResetPolicy()));
        }

        if (modifyVpcEndpointRequest.getPolicyDocument() != null) {
            request.addParameter("PolicyDocument", StringUtils.fromString(modifyVpcEndpointRequest.getPolicyDocument()));
        }

        com.amazonaws.internal.SdkInternalList modifyVpcEndpointRequestAddRouteTableIdsList = (com.amazonaws.internal.SdkInternalList) modifyVpcEndpointRequest
                .getAddRouteTableIds();
        if (!modifyVpcEndpointRequestAddRouteTableIdsList.isEmpty() || !modifyVpcEndpointRequestAddRouteTableIdsList.isAutoConstruct()) {
            int addRouteTableIdsListIndex = 1;

            for (String modifyVpcEndpointRequestAddRouteTableIdsListValue : modifyVpcEndpointRequestAddRouteTableIdsList) {
                if (modifyVpcEndpointRequestAddRouteTableIdsListValue != null) {
                    request.addParameter("AddRouteTableId." + addRouteTableIdsListIndex,
                            StringUtils.fromString(modifyVpcEndpointRequestAddRouteTableIdsListValue));
                }
                addRouteTableIdsListIndex++;
            }
        }

        com.amazonaws.internal.SdkInternalList modifyVpcEndpointRequestRemoveRouteTableIdsList = (com.amazonaws.internal.SdkInternalList) modifyVpcEndpointRequest
                .getRemoveRouteTableIds();
        if (!modifyVpcEndpointRequestRemoveRouteTableIdsList.isEmpty() || !modifyVpcEndpointRequestRemoveRouteTableIdsList.isAutoConstruct()) {
            int removeRouteTableIdsListIndex = 1;

            for (String modifyVpcEndpointRequestRemoveRouteTableIdsListValue : modifyVpcEndpointRequestRemoveRouteTableIdsList) {
                if (modifyVpcEndpointRequestRemoveRouteTableIdsListValue != null) {
                    request.addParameter("RemoveRouteTableId." + removeRouteTableIdsListIndex,
                            StringUtils.fromString(modifyVpcEndpointRequestRemoveRouteTableIdsListValue));
                }
                removeRouteTableIdsListIndex++;
            }
        }

        com.amazonaws.internal.SdkInternalList modifyVpcEndpointRequestAddSubnetIdsList = (com.amazonaws.internal.SdkInternalList) modifyVpcEndpointRequest
                .getAddSubnetIds();
        if (!modifyVpcEndpointRequestAddSubnetIdsList.isEmpty() || !modifyVpcEndpointRequestAddSubnetIdsList.isAutoConstruct()) {
            int addSubnetIdsListIndex = 1;

            for (String modifyVpcEndpointRequestAddSubnetIdsListValue : modifyVpcEndpointRequestAddSubnetIdsList) {
                if (modifyVpcEndpointRequestAddSubnetIdsListValue != null) {
                    request.addParameter("AddSubnetId." + addSubnetIdsListIndex, StringUtils.fromString(modifyVpcEndpointRequestAddSubnetIdsListValue));
                }
                addSubnetIdsListIndex++;
            }
        }

        com.amazonaws.internal.SdkInternalList modifyVpcEndpointRequestRemoveSubnetIdsList = (com.amazonaws.internal.SdkInternalList) modifyVpcEndpointRequest
                .getRemoveSubnetIds();
        if (!modifyVpcEndpointRequestRemoveSubnetIdsList.isEmpty() || !modifyVpcEndpointRequestRemoveSubnetIdsList.isAutoConstruct()) {
            int removeSubnetIdsListIndex = 1;

            for (String modifyVpcEndpointRequestRemoveSubnetIdsListValue : modifyVpcEndpointRequestRemoveSubnetIdsList) {
                if (modifyVpcEndpointRequestRemoveSubnetIdsListValue != null) {
                    request.addParameter("RemoveSubnetId." + removeSubnetIdsListIndex, StringUtils.fromString(modifyVpcEndpointRequestRemoveSubnetIdsListValue));
                }
                removeSubnetIdsListIndex++;
            }
        }

        com.amazonaws.internal.SdkInternalList modifyVpcEndpointRequestAddSecurityGroupIdsList = (com.amazonaws.internal.SdkInternalList) modifyVpcEndpointRequest
                .getAddSecurityGroupIds();
        if (!modifyVpcEndpointRequestAddSecurityGroupIdsList.isEmpty() || !modifyVpcEndpointRequestAddSecurityGroupIdsList.isAutoConstruct()) {
            int addSecurityGroupIdsListIndex = 1;

            for (String modifyVpcEndpointRequestAddSecurityGroupIdsListValue : modifyVpcEndpointRequestAddSecurityGroupIdsList) {
                if (modifyVpcEndpointRequestAddSecurityGroupIdsListValue != null) {
                    request.addParameter("AddSecurityGroupId." + addSecurityGroupIdsListIndex,
                            StringUtils.fromString(modifyVpcEndpointRequestAddSecurityGroupIdsListValue));
                }
                addSecurityGroupIdsListIndex++;
            }
        }

        com.amazonaws.internal.SdkInternalList modifyVpcEndpointRequestRemoveSecurityGroupIdsList = (com.amazonaws.internal.SdkInternalList) modifyVpcEndpointRequest
                .getRemoveSecurityGroupIds();
        if (!modifyVpcEndpointRequestRemoveSecurityGroupIdsList.isEmpty() || !modifyVpcEndpointRequestRemoveSecurityGroupIdsList.isAutoConstruct()) {
            int removeSecurityGroupIdsListIndex = 1;

            for (String modifyVpcEndpointRequestRemoveSecurityGroupIdsListValue : modifyVpcEndpointRequestRemoveSecurityGroupIdsList) {
                if (modifyVpcEndpointRequestRemoveSecurityGroupIdsListValue != null) {
                    request.addParameter("RemoveSecurityGroupId." + removeSecurityGroupIdsListIndex,
                            StringUtils.fromString(modifyVpcEndpointRequestRemoveSecurityGroupIdsListValue));
                }
                removeSecurityGroupIdsListIndex++;
            }
        }

        if (modifyVpcEndpointRequest.getIpAddressType() != null) {
            request.addParameter("IpAddressType", StringUtils.fromString(modifyVpcEndpointRequest.getIpAddressType()));
        }

        DnsOptionsSpecification dnsOptions = modifyVpcEndpointRequest.getDnsOptions();
        if (dnsOptions != null) {

            if (dnsOptions.getDnsRecordIpType() != null) {
                request.addParameter("DnsOptions.DnsRecordIpType", StringUtils.fromString(dnsOptions.getDnsRecordIpType()));
            }

            if (dnsOptions.getPrivateDnsOnlyForInboundResolverEndpoint() != null) {
                request.addParameter("DnsOptions.PrivateDnsOnlyForInboundResolverEndpoint",
                        StringUtils.fromBoolean(dnsOptions.getPrivateDnsOnlyForInboundResolverEndpoint()));
            }
        }

        if (modifyVpcEndpointRequest.getPrivateDnsEnabled() != null) {
            request.addParameter("PrivateDnsEnabled", StringUtils.fromBoolean(modifyVpcEndpointRequest.getPrivateDnsEnabled()));
        }

        com.amazonaws.internal.SdkInternalList modifyVpcEndpointRequestSubnetConfigurationsList = (com.amazonaws.internal.SdkInternalList) modifyVpcEndpointRequest
                .getSubnetConfigurations();
        if (!modifyVpcEndpointRequestSubnetConfigurationsList.isEmpty() || !modifyVpcEndpointRequestSubnetConfigurationsList.isAutoConstruct()) {
            int subnetConfigurationsListIndex = 1;

            for (SubnetConfiguration modifyVpcEndpointRequestSubnetConfigurationsListValue : modifyVpcEndpointRequestSubnetConfigurationsList) {

                if (modifyVpcEndpointRequestSubnetConfigurationsListValue.getSubnetId() != null) {
                    request.addParameter("SubnetConfiguration." + subnetConfigurationsListIndex + ".SubnetId",
                            StringUtils.fromString(modifyVpcEndpointRequestSubnetConfigurationsListValue.getSubnetId()));
                }

                if (modifyVpcEndpointRequestSubnetConfigurationsListValue.getIpv4() != null) {
                    request.addParameter("SubnetConfiguration." + subnetConfigurationsListIndex + ".Ipv4",
                            StringUtils.fromString(modifyVpcEndpointRequestSubnetConfigurationsListValue.getIpv4()));
                }

                if (modifyVpcEndpointRequestSubnetConfigurationsListValue.getIpv6() != null) {
                    request.addParameter("SubnetConfiguration." + subnetConfigurationsListIndex + ".Ipv6",
                            StringUtils.fromString(modifyVpcEndpointRequestSubnetConfigurationsListValue.getIpv6()));
                }
                subnetConfigurationsListIndex++;
            }
        }

        return request;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy