software.amazon.awssdk.services.sms.model.ServerReplicationParameters Maven / Gradle / Ivy
Show all versions of sms Show documentation
/*
* Copyright 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.sms.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The replication parameters for replicating a server.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ServerReplicationParameters implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField SEED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(ServerReplicationParameters::seedTime)).setter(setter(Builder::seedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("seedTime").build()).build();
private static final SdkField FREQUENCY_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(ServerReplicationParameters::frequency)).setter(setter(Builder::frequency))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("frequency").build()).build();
private static final SdkField RUN_ONCE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ServerReplicationParameters::runOnce)).setter(setter(Builder::runOnce))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("runOnce").build()).build();
private static final SdkField LICENSE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ServerReplicationParameters::licenseTypeAsString)).setter(setter(Builder::licenseType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("licenseType").build()).build();
private static final SdkField NUMBER_OF_RECENT_AMIS_TO_KEEP_FIELD = SdkField
. builder(MarshallingType.INTEGER).getter(getter(ServerReplicationParameters::numberOfRecentAmisToKeep))
.setter(setter(Builder::numberOfRecentAmisToKeep))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numberOfRecentAmisToKeep").build())
.build();
private static final SdkField ENCRYPTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ServerReplicationParameters::encrypted)).setter(setter(Builder::encrypted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("encrypted").build()).build();
private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ServerReplicationParameters::kmsKeyId)).setter(setter(Builder::kmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kmsKeyId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SEED_TIME_FIELD,
FREQUENCY_FIELD, RUN_ONCE_FIELD, LICENSE_TYPE_FIELD, NUMBER_OF_RECENT_AMIS_TO_KEEP_FIELD, ENCRYPTED_FIELD,
KMS_KEY_ID_FIELD));
private static final long serialVersionUID = 1L;
private final Instant seedTime;
private final Integer frequency;
private final Boolean runOnce;
private final String licenseType;
private final Integer numberOfRecentAmisToKeep;
private final Boolean encrypted;
private final String kmsKeyId;
private ServerReplicationParameters(BuilderImpl builder) {
this.seedTime = builder.seedTime;
this.frequency = builder.frequency;
this.runOnce = builder.runOnce;
this.licenseType = builder.licenseType;
this.numberOfRecentAmisToKeep = builder.numberOfRecentAmisToKeep;
this.encrypted = builder.encrypted;
this.kmsKeyId = builder.kmsKeyId;
}
/**
*
* The seed time for creating a replication job for the server.
*
*
* @return The seed time for creating a replication job for the server.
*/
public Instant seedTime() {
return seedTime;
}
/**
*
* The frequency of creating replication jobs for the server.
*
*
* @return The frequency of creating replication jobs for the server.
*/
public Integer frequency() {
return frequency;
}
/**
*
* Indicates whether to run the replication job one time.
*
*
* @return Indicates whether to run the replication job one time.
*/
public Boolean runOnce() {
return runOnce;
}
/**
*
* The license type for creating a replication job for the server.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #licenseType} will
* return {@link LicenseType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #licenseTypeAsString}.
*
*
* @return The license type for creating a replication job for the server.
* @see LicenseType
*/
public LicenseType licenseType() {
return LicenseType.fromValue(licenseType);
}
/**
*
* The license type for creating a replication job for the server.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #licenseType} will
* return {@link LicenseType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #licenseTypeAsString}.
*
*
* @return The license type for creating a replication job for the server.
* @see LicenseType
*/
public String licenseTypeAsString() {
return licenseType;
}
/**
*
* The number of recent AMIs to keep when creating a replication job for this server.
*
*
* @return The number of recent AMIs to keep when creating a replication job for this server.
*/
public Integer numberOfRecentAmisToKeep() {
return numberOfRecentAmisToKeep;
}
/**
*
* Indicates whether the replication job produces encrypted AMIs.
*
*
* @return Indicates whether the replication job produces encrypted AMIs.
*/
public Boolean encrypted() {
return encrypted;
}
/**
*
* The ID of the KMS key for replication jobs that produce encrypted AMIs. This value can be any of the following:
*
*
* -
*
* KMS key ID
*
*
* -
*
* KMS key alias
*
*
* -
*
* ARN referring to the KMS key ID
*
*
* -
*
* ARN referring to the KMS key alias
*
*
*
*
* If encrypted is enabled but a KMS key ID is not specified, the customer's default KMS key for Amazon EBS is used.
*
*
* @return The ID of the KMS key for replication jobs that produce encrypted AMIs. This value can be any of the
* following:
*
* -
*
* KMS key ID
*
*
* -
*
* KMS key alias
*
*
* -
*
* ARN referring to the KMS key ID
*
*
* -
*
* ARN referring to the KMS key alias
*
*
*
*
* If encrypted is enabled but a KMS key ID is not specified, the customer's default KMS key for Amazon EBS
* is used.
*/
public String kmsKeyId() {
return kmsKeyId;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(seedTime());
hashCode = 31 * hashCode + Objects.hashCode(frequency());
hashCode = 31 * hashCode + Objects.hashCode(runOnce());
hashCode = 31 * hashCode + Objects.hashCode(licenseTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(numberOfRecentAmisToKeep());
hashCode = 31 * hashCode + Objects.hashCode(encrypted());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ServerReplicationParameters)) {
return false;
}
ServerReplicationParameters other = (ServerReplicationParameters) obj;
return Objects.equals(seedTime(), other.seedTime()) && Objects.equals(frequency(), other.frequency())
&& Objects.equals(runOnce(), other.runOnce())
&& Objects.equals(licenseTypeAsString(), other.licenseTypeAsString())
&& Objects.equals(numberOfRecentAmisToKeep(), other.numberOfRecentAmisToKeep())
&& Objects.equals(encrypted(), other.encrypted()) && Objects.equals(kmsKeyId(), other.kmsKeyId());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public String toString() {
return ToString.builder("ServerReplicationParameters").add("SeedTime", seedTime()).add("Frequency", frequency())
.add("RunOnce", runOnce()).add("LicenseType", licenseTypeAsString())
.add("NumberOfRecentAmisToKeep", numberOfRecentAmisToKeep()).add("Encrypted", encrypted())
.add("KmsKeyId", kmsKeyId()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "seedTime":
return Optional.ofNullable(clazz.cast(seedTime()));
case "frequency":
return Optional.ofNullable(clazz.cast(frequency()));
case "runOnce":
return Optional.ofNullable(clazz.cast(runOnce()));
case "licenseType":
return Optional.ofNullable(clazz.cast(licenseTypeAsString()));
case "numberOfRecentAmisToKeep":
return Optional.ofNullable(clazz.cast(numberOfRecentAmisToKeep()));
case "encrypted":
return Optional.ofNullable(clazz.cast(encrypted()));
case "kmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* -
*
* KMS key ID
*
*
* -
*
* KMS key alias
*
*
* -
*
* ARN referring to the KMS key ID
*
*
* -
*
* ARN referring to the KMS key alias
*
*
*
*
* If encrypted is enabled but a KMS key ID is not specified, the customer's default KMS key for Amazon
* EBS is used.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder kmsKeyId(String kmsKeyId);
}
static final class BuilderImpl implements Builder {
private Instant seedTime;
private Integer frequency;
private Boolean runOnce;
private String licenseType;
private Integer numberOfRecentAmisToKeep;
private Boolean encrypted;
private String kmsKeyId;
private BuilderImpl() {
}
private BuilderImpl(ServerReplicationParameters model) {
seedTime(model.seedTime);
frequency(model.frequency);
runOnce(model.runOnce);
licenseType(model.licenseType);
numberOfRecentAmisToKeep(model.numberOfRecentAmisToKeep);
encrypted(model.encrypted);
kmsKeyId(model.kmsKeyId);
}
public final Instant getSeedTime() {
return seedTime;
}
@Override
public final Builder seedTime(Instant seedTime) {
this.seedTime = seedTime;
return this;
}
public final void setSeedTime(Instant seedTime) {
this.seedTime = seedTime;
}
public final Integer getFrequency() {
return frequency;
}
@Override
public final Builder frequency(Integer frequency) {
this.frequency = frequency;
return this;
}
public final void setFrequency(Integer frequency) {
this.frequency = frequency;
}
public final Boolean getRunOnce() {
return runOnce;
}
@Override
public final Builder runOnce(Boolean runOnce) {
this.runOnce = runOnce;
return this;
}
public final void setRunOnce(Boolean runOnce) {
this.runOnce = runOnce;
}
public final String getLicenseType() {
return licenseType;
}
@Override
public final Builder licenseType(String licenseType) {
this.licenseType = licenseType;
return this;
}
@Override
public final Builder licenseType(LicenseType licenseType) {
this.licenseType(licenseType == null ? null : licenseType.toString());
return this;
}
public final void setLicenseType(String licenseType) {
this.licenseType = licenseType;
}
public final Integer getNumberOfRecentAmisToKeep() {
return numberOfRecentAmisToKeep;
}
@Override
public final Builder numberOfRecentAmisToKeep(Integer numberOfRecentAmisToKeep) {
this.numberOfRecentAmisToKeep = numberOfRecentAmisToKeep;
return this;
}
public final void setNumberOfRecentAmisToKeep(Integer numberOfRecentAmisToKeep) {
this.numberOfRecentAmisToKeep = numberOfRecentAmisToKeep;
}
public final Boolean getEncrypted() {
return encrypted;
}
@Override
public final Builder encrypted(Boolean encrypted) {
this.encrypted = encrypted;
return this;
}
public final void setEncrypted(Boolean encrypted) {
this.encrypted = encrypted;
}
public final String getKmsKeyId() {
return kmsKeyId;
}
@Override
public final Builder kmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
return this;
}
public final void setKmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
}
@Override
public ServerReplicationParameters build() {
return new ServerReplicationParameters(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}