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

com.amazonaws.services.ec2.model.transform.UpdateSecurityGroupRuleDescriptionsEgressRequestMarshaller 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

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2018-2023 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;

/**
 * UpdateSecurityGroupRuleDescriptionsEgressRequest Marshaller
 */

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

    public Request marshall(
            UpdateSecurityGroupRuleDescriptionsEgressRequest updateSecurityGroupRuleDescriptionsEgressRequest) {

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

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

        if (updateSecurityGroupRuleDescriptionsEgressRequest.getGroupId() != null) {
            request.addParameter("GroupId", StringUtils.fromString(updateSecurityGroupRuleDescriptionsEgressRequest.getGroupId()));
        }

        if (updateSecurityGroupRuleDescriptionsEgressRequest.getGroupName() != null) {
            request.addParameter("GroupName", StringUtils.fromString(updateSecurityGroupRuleDescriptionsEgressRequest.getGroupName()));
        }

        com.amazonaws.internal.SdkInternalList updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsList = (com.amazonaws.internal.SdkInternalList) updateSecurityGroupRuleDescriptionsEgressRequest
                .getIpPermissions();
        if (!updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsList.isEmpty()
                || !updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsList.isAutoConstruct()) {
            int ipPermissionsListIndex = 1;

            for (IpPermission updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue : updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsList) {

                if (updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getFromPort() != null) {
                    request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort",
                            StringUtils.fromInteger(updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getFromPort()));
                }

                if (updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getIpProtocol() != null) {
                    request.addParameter("IpPermissions." + ipPermissionsListIndex + ".IpProtocol",
                            StringUtils.fromString(updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getIpProtocol()));
                }

                com.amazonaws.internal.SdkInternalList ipPermissionIpv6RangesList = (com.amazonaws.internal.SdkInternalList) updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue
                        .getIpv6Ranges();
                if (!ipPermissionIpv6RangesList.isEmpty() || !ipPermissionIpv6RangesList.isAutoConstruct()) {
                    int ipv6RangesListIndex = 1;

                    for (Ipv6Range ipPermissionIpv6RangesListValue : ipPermissionIpv6RangesList) {

                        if (ipPermissionIpv6RangesListValue.getCidrIpv6() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Ipv6Ranges." + ipv6RangesListIndex + ".CidrIpv6",
                                    StringUtils.fromString(ipPermissionIpv6RangesListValue.getCidrIpv6()));
                        }

                        if (ipPermissionIpv6RangesListValue.getDescription() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Ipv6Ranges." + ipv6RangesListIndex + ".Description",
                                    StringUtils.fromString(ipPermissionIpv6RangesListValue.getDescription()));
                        }
                        ipv6RangesListIndex++;
                    }
                }

                com.amazonaws.internal.SdkInternalList ipPermissionPrefixListIdsList = (com.amazonaws.internal.SdkInternalList) updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue
                        .getPrefixListIds();
                if (!ipPermissionPrefixListIdsList.isEmpty() || !ipPermissionPrefixListIdsList.isAutoConstruct()) {
                    int prefixListIdsListIndex = 1;

                    for (PrefixListId ipPermissionPrefixListIdsListValue : ipPermissionPrefixListIdsList) {

                        if (ipPermissionPrefixListIdsListValue.getDescription() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".PrefixListIds." + prefixListIdsListIndex + ".Description",
                                    StringUtils.fromString(ipPermissionPrefixListIdsListValue.getDescription()));
                        }

                        if (ipPermissionPrefixListIdsListValue.getPrefixListId() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".PrefixListIds." + prefixListIdsListIndex + ".PrefixListId",
                                    StringUtils.fromString(ipPermissionPrefixListIdsListValue.getPrefixListId()));
                        }
                        prefixListIdsListIndex++;
                    }
                }

                if (updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getToPort() != null) {
                    request.addParameter("IpPermissions." + ipPermissionsListIndex + ".ToPort",
                            StringUtils.fromInteger(updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getToPort()));
                }

                com.amazonaws.internal.SdkInternalList ipPermissionUserIdGroupPairsList = (com.amazonaws.internal.SdkInternalList) updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue
                        .getUserIdGroupPairs();
                if (!ipPermissionUserIdGroupPairsList.isEmpty() || !ipPermissionUserIdGroupPairsList.isAutoConstruct()) {
                    int userIdGroupPairsListIndex = 1;

                    for (UserIdGroupPair ipPermissionUserIdGroupPairsListValue : ipPermissionUserIdGroupPairsList) {

                        if (ipPermissionUserIdGroupPairsListValue.getDescription() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Groups." + userIdGroupPairsListIndex + ".Description",
                                    StringUtils.fromString(ipPermissionUserIdGroupPairsListValue.getDescription()));
                        }

                        if (ipPermissionUserIdGroupPairsListValue.getGroupId() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Groups." + userIdGroupPairsListIndex + ".GroupId",
                                    StringUtils.fromString(ipPermissionUserIdGroupPairsListValue.getGroupId()));
                        }

                        if (ipPermissionUserIdGroupPairsListValue.getGroupName() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Groups." + userIdGroupPairsListIndex + ".GroupName",
                                    StringUtils.fromString(ipPermissionUserIdGroupPairsListValue.getGroupName()));
                        }

                        if (ipPermissionUserIdGroupPairsListValue.getPeeringStatus() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Groups." + userIdGroupPairsListIndex + ".PeeringStatus",
                                    StringUtils.fromString(ipPermissionUserIdGroupPairsListValue.getPeeringStatus()));
                        }

                        if (ipPermissionUserIdGroupPairsListValue.getUserId() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Groups." + userIdGroupPairsListIndex + ".UserId",
                                    StringUtils.fromString(ipPermissionUserIdGroupPairsListValue.getUserId()));
                        }

                        if (ipPermissionUserIdGroupPairsListValue.getVpcId() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".Groups." + userIdGroupPairsListIndex + ".VpcId",
                                    StringUtils.fromString(ipPermissionUserIdGroupPairsListValue.getVpcId()));
                        }

                        if (ipPermissionUserIdGroupPairsListValue.getVpcPeeringConnectionId() != null) {
                            request.addParameter(
                                    "IpPermissions." + ipPermissionsListIndex + ".Groups." + userIdGroupPairsListIndex + ".VpcPeeringConnectionId",
                                    StringUtils.fromString(ipPermissionUserIdGroupPairsListValue.getVpcPeeringConnectionId()));
                        }
                        userIdGroupPairsListIndex++;
                    }
                }

                com.amazonaws.internal.SdkInternalList ipPermissionIpv4RangesList = (com.amazonaws.internal.SdkInternalList) updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue
                        .getIpv4Ranges();
                if (!ipPermissionIpv4RangesList.isEmpty() || !ipPermissionIpv4RangesList.isAutoConstruct()) {
                    int ipv4RangesListIndex = 1;

                    for (IpRange ipPermissionIpv4RangesListValue : ipPermissionIpv4RangesList) {

                        if (ipPermissionIpv4RangesListValue.getCidrIp() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".IpRanges." + ipv4RangesListIndex + ".CidrIp",
                                    StringUtils.fromString(ipPermissionIpv4RangesListValue.getCidrIp()));
                        }

                        if (ipPermissionIpv4RangesListValue.getDescription() != null) {
                            request.addParameter("IpPermissions." + ipPermissionsListIndex + ".IpRanges." + ipv4RangesListIndex + ".Description",
                                    StringUtils.fromString(ipPermissionIpv4RangesListValue.getDescription()));
                        }
                        ipv4RangesListIndex++;
                    }
                }
                ipPermissionsListIndex++;
            }
        }

        com.amazonaws.internal.SdkInternalList updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsList = (com.amazonaws.internal.SdkInternalList) updateSecurityGroupRuleDescriptionsEgressRequest
                .getSecurityGroupRuleDescriptions();
        if (!updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsList.isEmpty()
                || !updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsList.isAutoConstruct()) {
            int securityGroupRuleDescriptionsListIndex = 1;

            for (SecurityGroupRuleDescription updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsListValue : updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsList) {

                if (updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsListValue.getSecurityGroupRuleId() != null) {
                    request.addParameter("SecurityGroupRuleDescription." + securityGroupRuleDescriptionsListIndex + ".SecurityGroupRuleId", StringUtils
                            .fromString(updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsListValue.getSecurityGroupRuleId()));
                }

                if (updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsListValue.getDescription() != null) {
                    request.addParameter("SecurityGroupRuleDescription." + securityGroupRuleDescriptionsListIndex + ".Description",
                            StringUtils.fromString(updateSecurityGroupRuleDescriptionsEgressRequestSecurityGroupRuleDescriptionsListValue.getDescription()));
                }
                securityGroupRuleDescriptionsListIndex++;
            }
        }

        return request;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy