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

software.amazon.awssdk.services.sms.model.CreateReplicationJobRequest Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.16
Show newest version
/*
 * 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.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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class CreateReplicationJobRequest extends SmsRequest implements
        ToCopyableBuilder {
    private static final SdkField SERVER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateReplicationJobRequest::serverId)).setter(setter(Builder::serverId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serverId").build()).build();

    private static final SdkField SEED_REPLICATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .getter(getter(CreateReplicationJobRequest::seedReplicationTime)).setter(setter(Builder::seedReplicationTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("seedReplicationTime").build())
            .build();

    private static final SdkField FREQUENCY_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .getter(getter(CreateReplicationJobRequest::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(CreateReplicationJobRequest::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(CreateReplicationJobRequest::licenseTypeAsString)).setter(setter(Builder::licenseType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("licenseType").build()).build();

    private static final SdkField ROLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateReplicationJobRequest::roleName)).setter(setter(Builder::roleName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleName").build()).build();

    private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateReplicationJobRequest::description)).setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();

    private static final SdkField NUMBER_OF_RECENT_AMIS_TO_KEEP_FIELD = SdkField
            . builder(MarshallingType.INTEGER).getter(getter(CreateReplicationJobRequest::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(CreateReplicationJobRequest::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(CreateReplicationJobRequest::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(SERVER_ID_FIELD,
            SEED_REPLICATION_TIME_FIELD, FREQUENCY_FIELD, RUN_ONCE_FIELD, LICENSE_TYPE_FIELD, ROLE_NAME_FIELD, DESCRIPTION_FIELD,
            NUMBER_OF_RECENT_AMIS_TO_KEEP_FIELD, ENCRYPTED_FIELD, KMS_KEY_ID_FIELD));

    private final String serverId;

    private final Instant seedReplicationTime;

    private final Integer frequency;

    private final Boolean runOnce;

    private final String licenseType;

    private final String roleName;

    private final String description;

    private final Integer numberOfRecentAmisToKeep;

    private final Boolean encrypted;

    private final String kmsKeyId;

    private CreateReplicationJobRequest(BuilderImpl builder) {
        super(builder);
        this.serverId = builder.serverId;
        this.seedReplicationTime = builder.seedReplicationTime;
        this.frequency = builder.frequency;
        this.runOnce = builder.runOnce;
        this.licenseType = builder.licenseType;
        this.roleName = builder.roleName;
        this.description = builder.description;
        this.numberOfRecentAmisToKeep = builder.numberOfRecentAmisToKeep;
        this.encrypted = builder.encrypted;
        this.kmsKeyId = builder.kmsKeyId;
    }

    /**
     * 

* The identifier of the server. *

* * @return The identifier of the server. */ public String serverId() { return serverId; } /** *

* The seed replication time. *

* * @return The seed replication time. */ public Instant seedReplicationTime() { return seedReplicationTime; } /** *

* The time between consecutive replication runs, in hours. *

* * @return The time between consecutive replication runs, in hours. */ public Integer frequency() { return frequency; } /** *

* * @return */ public Boolean runOnce() { return runOnce; } /** *

* The license type to be used for the AMI created by a successful replication run. *

*

* 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 to be used for the AMI created by a successful replication run. * @see LicenseType */ public LicenseType licenseType() { return LicenseType.fromValue(licenseType); } /** *

* The license type to be used for the AMI created by a successful replication run. *

*

* 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 to be used for the AMI created by a successful replication run. * @see LicenseType */ public String licenseTypeAsString() { return licenseType; } /** *

* The name of the IAM role to be used by the AWS SMS. *

* * @return The name of the IAM role to be used by the AWS SMS. */ public String roleName() { return roleName; } /** *

* The description of the replication job. *

* * @return The description of the replication job. */ public String description() { return description; } /** *

* The maximum number of SMS-created AMIs to retain. The oldest will be deleted once the maximum number is reached * and a new AMI is created. *

* * @return The maximum number of SMS-created AMIs to retain. The oldest will be deleted once the maximum number is * reached and a new AMI is created. */ public Integer numberOfRecentAmisToKeep() { return numberOfRecentAmisToKeep; } /** *

* When true, the replication job produces encrypted AMIs. See also KmsKeyId below. *

* * @return When true, the replication job produces encrypted AMIs. See also KmsKeyId below. */ public Boolean encrypted() { return encrypted; } /** *

* KMS key ID for replication jobs that produce encrypted AMIs. Can be any of the following: *

*
    *
  • *

    * KMS key ID *

    *
  • *
  • *

    * KMS key alias *

    *
  • *
  • *

    * ARN referring to KMS key ID *

    *
  • *
  • *

    * ARN referring to KMS key alias *

    *
  • *
*

* If encrypted is true but a KMS key id is not specified, the customer's default KMS key for EBS is used. *

* * @return KMS key ID for replication jobs that produce encrypted AMIs. Can be any of the following:

*
    *
  • *

    * KMS key ID *

    *
  • *
  • *

    * KMS key alias *

    *
  • *
  • *

    * ARN referring to KMS key ID *

    *
  • *
  • *

    * ARN referring to KMS key alias *

    *
  • *
*

* If encrypted is true but a KMS key id is not specified, the customer's default KMS key for 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 serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(serverId()); hashCode = 31 * hashCode + Objects.hashCode(seedReplicationTime()); hashCode = 31 * hashCode + Objects.hashCode(frequency()); hashCode = 31 * hashCode + Objects.hashCode(runOnce()); hashCode = 31 * hashCode + Objects.hashCode(licenseTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(roleName()); hashCode = 31 * hashCode + Objects.hashCode(description()); 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 super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CreateReplicationJobRequest)) { return false; } CreateReplicationJobRequest other = (CreateReplicationJobRequest) obj; return Objects.equals(serverId(), other.serverId()) && Objects.equals(seedReplicationTime(), other.seedReplicationTime()) && Objects.equals(frequency(), other.frequency()) && Objects.equals(runOnce(), other.runOnce()) && Objects.equals(licenseTypeAsString(), other.licenseTypeAsString()) && Objects.equals(roleName(), other.roleName()) && Objects.equals(description(), other.description()) && 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("CreateReplicationJobRequest").add("ServerId", serverId()) .add("SeedReplicationTime", seedReplicationTime()).add("Frequency", frequency()).add("RunOnce", runOnce()) .add("LicenseType", licenseTypeAsString()).add("RoleName", roleName()).add("Description", description()) .add("NumberOfRecentAmisToKeep", numberOfRecentAmisToKeep()).add("Encrypted", encrypted()) .add("KmsKeyId", kmsKeyId()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "serverId": return Optional.ofNullable(clazz.cast(serverId())); case "seedReplicationTime": return Optional.ofNullable(clazz.cast(seedReplicationTime())); 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 "roleName": return Optional.ofNullable(clazz.cast(roleName())); case "description": return Optional.ofNullable(clazz.cast(description())); 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 getter(Function g) { return obj -> g.apply((CreateReplicationJobRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SmsRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The identifier of the server. *

* * @param serverId * The identifier of the server. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serverId(String serverId); /** *

* The seed replication time. *

* * @param seedReplicationTime * The seed replication time. * @return Returns a reference to this object so that method calls can be chained together. */ Builder seedReplicationTime(Instant seedReplicationTime); /** *

* The time between consecutive replication runs, in hours. *

* * @param frequency * The time between consecutive replication runs, in hours. * @return Returns a reference to this object so that method calls can be chained together. */ Builder frequency(Integer frequency); /** *

* * @param runOnce * @return Returns a reference to this object so that method calls can be chained together. */ Builder runOnce(Boolean runOnce); /** *

* The license type to be used for the AMI created by a successful replication run. *

* * @param licenseType * The license type to be used for the AMI created by a successful replication run. * @see LicenseType * @return Returns a reference to this object so that method calls can be chained together. * @see LicenseType */ Builder licenseType(String licenseType); /** *

* The license type to be used for the AMI created by a successful replication run. *

* * @param licenseType * The license type to be used for the AMI created by a successful replication run. * @see LicenseType * @return Returns a reference to this object so that method calls can be chained together. * @see LicenseType */ Builder licenseType(LicenseType licenseType); /** *

* The name of the IAM role to be used by the AWS SMS. *

* * @param roleName * The name of the IAM role to be used by the AWS SMS. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleName(String roleName); /** *

* The description of the replication job. *

* * @param description * The description of the replication job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The maximum number of SMS-created AMIs to retain. The oldest will be deleted once the maximum number is * reached and a new AMI is created. *

* * @param numberOfRecentAmisToKeep * The maximum number of SMS-created AMIs to retain. The oldest will be deleted once the maximum number * is reached and a new AMI is created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder numberOfRecentAmisToKeep(Integer numberOfRecentAmisToKeep); /** *

* When true, the replication job produces encrypted AMIs. See also KmsKeyId below. *

* * @param encrypted * When true, the replication job produces encrypted AMIs. See also KmsKeyId below. * @return Returns a reference to this object so that method calls can be chained together. */ Builder encrypted(Boolean encrypted); /** *

* KMS key ID for replication jobs that produce encrypted AMIs. Can be any of the following: *

*
    *
  • *

    * KMS key ID *

    *
  • *
  • *

    * KMS key alias *

    *
  • *
  • *

    * ARN referring to KMS key ID *

    *
  • *
  • *

    * ARN referring to KMS key alias *

    *
  • *
*

* If encrypted is true but a KMS key id is not specified, the customer's default KMS key for EBS is * used. *

* * @param kmsKeyId * KMS key ID for replication jobs that produce encrypted AMIs. Can be any of the following:

*
    *
  • *

    * KMS key ID *

    *
  • *
  • *

    * KMS key alias *

    *
  • *
  • *

    * ARN referring to KMS key ID *

    *
  • *
  • *

    * ARN referring to KMS key alias *

    *
  • *
*

* If encrypted is true but a KMS key id is not specified, the customer's default KMS key for EBS * is used. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kmsKeyId(String kmsKeyId); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SmsRequest.BuilderImpl implements Builder { private String serverId; private Instant seedReplicationTime; private Integer frequency; private Boolean runOnce; private String licenseType; private String roleName; private String description; private Integer numberOfRecentAmisToKeep; private Boolean encrypted; private String kmsKeyId; private BuilderImpl() { } private BuilderImpl(CreateReplicationJobRequest model) { super(model); serverId(model.serverId); seedReplicationTime(model.seedReplicationTime); frequency(model.frequency); runOnce(model.runOnce); licenseType(model.licenseType); roleName(model.roleName); description(model.description); numberOfRecentAmisToKeep(model.numberOfRecentAmisToKeep); encrypted(model.encrypted); kmsKeyId(model.kmsKeyId); } public final String getServerId() { return serverId; } @Override public final Builder serverId(String serverId) { this.serverId = serverId; return this; } public final void setServerId(String serverId) { this.serverId = serverId; } public final Instant getSeedReplicationTime() { return seedReplicationTime; } @Override public final Builder seedReplicationTime(Instant seedReplicationTime) { this.seedReplicationTime = seedReplicationTime; return this; } public final void setSeedReplicationTime(Instant seedReplicationTime) { this.seedReplicationTime = seedReplicationTime; } 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 String getRoleName() { return roleName; } @Override public final Builder roleName(String roleName) { this.roleName = roleName; return this; } public final void setRoleName(String roleName) { this.roleName = roleName; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } 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 Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateReplicationJobRequest build() { return new CreateReplicationJobRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy