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

software.amazon.awssdk.services.elasticache.transform.CreateCacheClusterRequestMarshaller Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
Show newest version
/*
 * 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 software.amazon.awssdk.services.elasticache.transform;

import java.util.List;

import javax.annotation.Generated;

import software.amazon.awssdk.SdkClientException;
import software.amazon.awssdk.Request;
import software.amazon.awssdk.DefaultRequest;
import software.amazon.awssdk.http.HttpMethodName;
import software.amazon.awssdk.services.elasticache.model.*;
import software.amazon.awssdk.runtime.transform.Marshaller;
import software.amazon.awssdk.util.StringUtils;

/**
 * CreateCacheClusterRequest Marshaller
 */

@Generated("software.amazon.awssdk:aws-java-sdk-code-generator")
public class CreateCacheClusterRequestMarshaller implements
        Marshaller, CreateCacheClusterRequest> {

    public Request marshall(CreateCacheClusterRequest createCacheClusterRequest) {

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

        Request request = new DefaultRequest(createCacheClusterRequest,
                "ElastiCacheClient");
        request.addParameter("Action", "CreateCacheCluster");
        request.addParameter("Version", "2015-02-02");
        request.setHttpMethod(HttpMethodName.POST);

        if (createCacheClusterRequest.cacheClusterId() != null) {
            request.addParameter("CacheClusterId", StringUtils.fromString(createCacheClusterRequest.cacheClusterId()));
        }

        if (createCacheClusterRequest.replicationGroupId() != null) {
            request.addParameter("ReplicationGroupId", StringUtils.fromString(createCacheClusterRequest.replicationGroupId()));
        }

        if (createCacheClusterRequest.azMode() != null) {
            request.addParameter("AZMode", StringUtils.fromString(createCacheClusterRequest.azMode()));
        }

        if (createCacheClusterRequest.preferredAvailabilityZone() != null) {
            request.addParameter("PreferredAvailabilityZone",
                    StringUtils.fromString(createCacheClusterRequest.preferredAvailabilityZone()));
        }

        java.util.List preferredAvailabilityZonesList = createCacheClusterRequest.preferredAvailabilityZones();

        if (preferredAvailabilityZonesList != null) {
            if (!preferredAvailabilityZonesList.isEmpty()) {
                int preferredAvailabilityZonesListIndex = 1;

                for (String preferredAvailabilityZonesListValue : preferredAvailabilityZonesList) {
                    if (preferredAvailabilityZonesListValue != null) {
                        request.addParameter("PreferredAvailabilityZones.PreferredAvailabilityZone."
                                + preferredAvailabilityZonesListIndex,
                                StringUtils.fromString(preferredAvailabilityZonesListValue));
                    }
                    preferredAvailabilityZonesListIndex++;
                }
            } else {
                request.addParameter("PreferredAvailabilityZones", "");
            }
        }

        if (createCacheClusterRequest.numCacheNodes() != null) {
            request.addParameter("NumCacheNodes", StringUtils.fromInteger(createCacheClusterRequest.numCacheNodes()));
        }

        if (createCacheClusterRequest.cacheNodeType() != null) {
            request.addParameter("CacheNodeType", StringUtils.fromString(createCacheClusterRequest.cacheNodeType()));
        }

        if (createCacheClusterRequest.engine() != null) {
            request.addParameter("Engine", StringUtils.fromString(createCacheClusterRequest.engine()));
        }

        if (createCacheClusterRequest.engineVersion() != null) {
            request.addParameter("EngineVersion", StringUtils.fromString(createCacheClusterRequest.engineVersion()));
        }

        if (createCacheClusterRequest.cacheParameterGroupName() != null) {
            request.addParameter("CacheParameterGroupName",
                    StringUtils.fromString(createCacheClusterRequest.cacheParameterGroupName()));
        }

        if (createCacheClusterRequest.cacheSubnetGroupName() != null) {
            request.addParameter("CacheSubnetGroupName", StringUtils.fromString(createCacheClusterRequest.cacheSubnetGroupName()));
        }

        java.util.List cacheSecurityGroupNamesList = createCacheClusterRequest.cacheSecurityGroupNames();

        if (cacheSecurityGroupNamesList != null) {
            if (!cacheSecurityGroupNamesList.isEmpty()) {
                int cacheSecurityGroupNamesListIndex = 1;

                for (String cacheSecurityGroupNamesListValue : cacheSecurityGroupNamesList) {
                    if (cacheSecurityGroupNamesListValue != null) {
                        request.addParameter(
                                "CacheSecurityGroupNames.CacheSecurityGroupName." + cacheSecurityGroupNamesListIndex,
                                StringUtils.fromString(cacheSecurityGroupNamesListValue));
                    }
                    cacheSecurityGroupNamesListIndex++;
                }
            } else {
                request.addParameter("CacheSecurityGroupNames", "");
            }
        }

        java.util.List securityGroupIdsList = createCacheClusterRequest.securityGroupIds();

        if (securityGroupIdsList != null) {
            if (!securityGroupIdsList.isEmpty()) {
                int securityGroupIdsListIndex = 1;

                for (String securityGroupIdsListValue : securityGroupIdsList) {
                    if (securityGroupIdsListValue != null) {
                        request.addParameter("SecurityGroupIds.SecurityGroupId." + securityGroupIdsListIndex,
                                StringUtils.fromString(securityGroupIdsListValue));
                    }
                    securityGroupIdsListIndex++;
                }
            } else {
                request.addParameter("SecurityGroupIds", "");
            }
        }

        java.util.List tagsList = createCacheClusterRequest.tags();

        if (tagsList != null) {
            if (!tagsList.isEmpty()) {
                int tagsListIndex = 1;

                for (Tag tagsListValue : tagsList) {

                    if (tagsListValue.key() != null) {
                        request.addParameter("Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.key()));
                    }

                    if (tagsListValue.value() != null) {
                        request.addParameter("Tags.Tag." + tagsListIndex + ".Value",
                                StringUtils.fromString(tagsListValue.value()));
                    }
                    tagsListIndex++;
                }
            } else {
                request.addParameter("Tags", "");
            }
        }

        java.util.List snapshotArnsList = createCacheClusterRequest.snapshotArns();

        if (snapshotArnsList != null) {
            if (!snapshotArnsList.isEmpty()) {
                int snapshotArnsListIndex = 1;

                for (String snapshotArnsListValue : snapshotArnsList) {
                    if (snapshotArnsListValue != null) {
                        request.addParameter("SnapshotArns.SnapshotArn." + snapshotArnsListIndex,
                                StringUtils.fromString(snapshotArnsListValue));
                    }
                    snapshotArnsListIndex++;
                }
            } else {
                request.addParameter("SnapshotArns", "");
            }
        }

        if (createCacheClusterRequest.snapshotName() != null) {
            request.addParameter("SnapshotName", StringUtils.fromString(createCacheClusterRequest.snapshotName()));
        }

        if (createCacheClusterRequest.preferredMaintenanceWindow() != null) {
            request.addParameter("PreferredMaintenanceWindow",
                    StringUtils.fromString(createCacheClusterRequest.preferredMaintenanceWindow()));
        }

        if (createCacheClusterRequest.port() != null) {
            request.addParameter("Port", StringUtils.fromInteger(createCacheClusterRequest.port()));
        }

        if (createCacheClusterRequest.notificationTopicArn() != null) {
            request.addParameter("NotificationTopicArn", StringUtils.fromString(createCacheClusterRequest.notificationTopicArn()));
        }

        if (createCacheClusterRequest.autoMinorVersionUpgrade() != null) {
            request.addParameter("AutoMinorVersionUpgrade",
                    StringUtils.fromBoolean(createCacheClusterRequest.autoMinorVersionUpgrade()));
        }

        if (createCacheClusterRequest.snapshotRetentionLimit() != null) {
            request.addParameter("SnapshotRetentionLimit",
                    StringUtils.fromInteger(createCacheClusterRequest.snapshotRetentionLimit()));
        }

        if (createCacheClusterRequest.snapshotWindow() != null) {
            request.addParameter("SnapshotWindow", StringUtils.fromString(createCacheClusterRequest.snapshotWindow()));
        }

        if (createCacheClusterRequest.authToken() != null) {
            request.addParameter("AuthToken", StringUtils.fromString(createCacheClusterRequest.authToken()));
        }

        return request;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy