com.amazonaws.services.elasticache.model.transform.DecreaseReplicaCountRequestMarshaller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-elasticache Show documentation
Show all versions of aws-java-sdk-elasticache Show documentation
The AWS Java SDK for Amazon ElastiCache module holds the client classes that are used for communicating with Amazon ElastiCache Service
/*
* 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.elasticache.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.elasticache.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;
/**
* DecreaseReplicaCountRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DecreaseReplicaCountRequestMarshaller implements Marshaller, DecreaseReplicaCountRequest> {
public Request marshall(DecreaseReplicaCountRequest decreaseReplicaCountRequest) {
if (decreaseReplicaCountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
Request request = new DefaultRequest(decreaseReplicaCountRequest, "AmazonElastiCache");
request.addParameter("Action", "DecreaseReplicaCount");
request.addParameter("Version", "2015-02-02");
request.setHttpMethod(HttpMethodName.POST);
if (decreaseReplicaCountRequest.getReplicationGroupId() != null) {
request.addParameter("ReplicationGroupId", StringUtils.fromString(decreaseReplicaCountRequest.getReplicationGroupId()));
}
if (decreaseReplicaCountRequest.getNewReplicaCount() != null) {
request.addParameter("NewReplicaCount", StringUtils.fromInteger(decreaseReplicaCountRequest.getNewReplicaCount()));
}
if (!decreaseReplicaCountRequest.getReplicaConfiguration().isEmpty()
|| !((com.amazonaws.internal.SdkInternalList) decreaseReplicaCountRequest.getReplicaConfiguration()).isAutoConstruct()) {
com.amazonaws.internal.SdkInternalList replicaConfigurationList = (com.amazonaws.internal.SdkInternalList) decreaseReplicaCountRequest
.getReplicaConfiguration();
int replicaConfigurationListIndex = 1;
for (ConfigureShard replicaConfigurationListValue : replicaConfigurationList) {
if (replicaConfigurationListValue != null) {
if (replicaConfigurationListValue.getNodeGroupId() != null) {
request.addParameter("ReplicaConfiguration.ConfigureShard." + replicaConfigurationListIndex + ".NodeGroupId",
StringUtils.fromString(replicaConfigurationListValue.getNodeGroupId()));
}
if (replicaConfigurationListValue.getNewReplicaCount() != null) {
request.addParameter("ReplicaConfiguration.ConfigureShard." + replicaConfigurationListIndex + ".NewReplicaCount",
StringUtils.fromInteger(replicaConfigurationListValue.getNewReplicaCount()));
}
if (!replicaConfigurationListValue.getPreferredAvailabilityZones().isEmpty()
|| !((com.amazonaws.internal.SdkInternalList) replicaConfigurationListValue.getPreferredAvailabilityZones())
.isAutoConstruct()) {
com.amazonaws.internal.SdkInternalList preferredAvailabilityZonesList = (com.amazonaws.internal.SdkInternalList) replicaConfigurationListValue
.getPreferredAvailabilityZones();
int preferredAvailabilityZonesListIndex = 1;
for (String preferredAvailabilityZonesListValue : preferredAvailabilityZonesList) {
if (preferredAvailabilityZonesListValue != null) {
request.addParameter("ReplicaConfiguration.ConfigureShard." + replicaConfigurationListIndex
+ ".PreferredAvailabilityZones.PreferredAvailabilityZone." + preferredAvailabilityZonesListIndex,
StringUtils.fromString(preferredAvailabilityZonesListValue));
}
preferredAvailabilityZonesListIndex++;
}
}
if (!replicaConfigurationListValue.getPreferredOutpostArns().isEmpty()
|| !((com.amazonaws.internal.SdkInternalList) replicaConfigurationListValue.getPreferredOutpostArns()).isAutoConstruct()) {
com.amazonaws.internal.SdkInternalList preferredOutpostArnsList = (com.amazonaws.internal.SdkInternalList) replicaConfigurationListValue
.getPreferredOutpostArns();
int preferredOutpostArnsListIndex = 1;
for (String preferredOutpostArnsListValue : preferredOutpostArnsList) {
if (preferredOutpostArnsListValue != null) {
request.addParameter("ReplicaConfiguration.ConfigureShard." + replicaConfigurationListIndex
+ ".PreferredOutpostArns.PreferredOutpostArn." + preferredOutpostArnsListIndex,
StringUtils.fromString(preferredOutpostArnsListValue));
}
preferredOutpostArnsListIndex++;
}
}
}
replicaConfigurationListIndex++;
}
}
if (!decreaseReplicaCountRequest.getReplicasToRemove().isEmpty()
|| !((com.amazonaws.internal.SdkInternalList) decreaseReplicaCountRequest.getReplicasToRemove()).isAutoConstruct()) {
com.amazonaws.internal.SdkInternalList replicasToRemoveList = (com.amazonaws.internal.SdkInternalList) decreaseReplicaCountRequest
.getReplicasToRemove();
int replicasToRemoveListIndex = 1;
for (String replicasToRemoveListValue : replicasToRemoveList) {
if (replicasToRemoveListValue != null) {
request.addParameter("ReplicasToRemove.member." + replicasToRemoveListIndex, StringUtils.fromString(replicasToRemoveListValue));
}
replicasToRemoveListIndex++;
}
}
if (decreaseReplicaCountRequest.getApplyImmediately() != null) {
request.addParameter("ApplyImmediately", StringUtils.fromBoolean(decreaseReplicaCountRequest.getApplyImmediately()));
}
return request;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy