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

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

/*
 * Copyright 2013-2018 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.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.services.sms.transform.ReplicationJobMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * Object representing a Replication Job
 */
@Generated("software.amazon.awssdk:codegen")
public final class ReplicationJob implements StructuredPojo, ToCopyableBuilder {
    private final String replicationJobId;

    private final String serverId;

    private final String serverType;

    private final VmServer vmServer;

    private final Instant seedReplicationTime;

    private final Integer frequency;

    private final Instant nextReplicationRunStartTime;

    private final String licenseType;

    private final String roleName;

    private final String latestAmiId;

    private final String state;

    private final String statusMessage;

    private final String description;

    private final List replicationRunList;

    private ReplicationJob(BuilderImpl builder) {
        this.replicationJobId = builder.replicationJobId;
        this.serverId = builder.serverId;
        this.serverType = builder.serverType;
        this.vmServer = builder.vmServer;
        this.seedReplicationTime = builder.seedReplicationTime;
        this.frequency = builder.frequency;
        this.nextReplicationRunStartTime = builder.nextReplicationRunStartTime;
        this.licenseType = builder.licenseType;
        this.roleName = builder.roleName;
        this.latestAmiId = builder.latestAmiId;
        this.state = builder.state;
        this.statusMessage = builder.statusMessage;
        this.description = builder.description;
        this.replicationRunList = builder.replicationRunList;
    }

    /**
     * Returns the value of the ReplicationJobId property for this object.
     * 
     * @return The value of the ReplicationJobId property for this object.
     */
    public String replicationJobId() {
        return replicationJobId;
    }

    /**
     * Returns the value of the ServerId property for this object.
     * 
     * @return The value of the ServerId property for this object.
     */
    public String serverId() {
        return serverId;
    }

    /**
     * Returns the value of the ServerType property for this object.
     * 

* If the service returns an enum value that is not available in the current SDK version, {@link #serverType} will * return {@link ServerType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #serverTypeAsString}. *

* * @return The value of the ServerType property for this object. * @see ServerType */ public ServerType serverType() { return ServerType.fromValue(serverType); } /** * Returns the value of the ServerType property for this object. *

* If the service returns an enum value that is not available in the current SDK version, {@link #serverType} will * return {@link ServerType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #serverTypeAsString}. *

* * @return The value of the ServerType property for this object. * @see ServerType */ public String serverTypeAsString() { return serverType; } /** * Returns the value of the VmServer property for this object. * * @return The value of the VmServer property for this object. */ public VmServer vmServer() { return vmServer; } /** * Returns the value of the SeedReplicationTime property for this object. * * @return The value of the SeedReplicationTime property for this object. */ public Instant seedReplicationTime() { return seedReplicationTime; } /** * Returns the value of the Frequency property for this object. * * @return The value of the Frequency property for this object. */ public Integer frequency() { return frequency; } /** * Returns the value of the NextReplicationRunStartTime property for this object. * * @return The value of the NextReplicationRunStartTime property for this object. */ public Instant nextReplicationRunStartTime() { return nextReplicationRunStartTime; } /** * Returns the value of the LicenseType property for this object. *

* 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 value of the LicenseType property for this object. * @see LicenseType */ public LicenseType licenseType() { return LicenseType.fromValue(licenseType); } /** * Returns the value of the LicenseType property for this object. *

* 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 value of the LicenseType property for this object. * @see LicenseType */ public String licenseTypeAsString() { return licenseType; } /** * Returns the value of the RoleName property for this object. * * @return The value of the RoleName property for this object. */ public String roleName() { return roleName; } /** * Returns the value of the LatestAmiId property for this object. * * @return The value of the LatestAmiId property for this object. */ public String latestAmiId() { return latestAmiId; } /** * Returns the value of the State property for this object. *

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link ReplicationJobState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The value of the State property for this object. * @see ReplicationJobState */ public ReplicationJobState state() { return ReplicationJobState.fromValue(state); } /** * Returns the value of the State property for this object. *

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link ReplicationJobState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The value of the State property for this object. * @see ReplicationJobState */ public String stateAsString() { return state; } /** * Returns the value of the StatusMessage property for this object. * * @return The value of the StatusMessage property for this object. */ public String statusMessage() { return statusMessage; } /** * Returns the value of the Description property for this object. * * @return The value of the Description property for this object. */ public String description() { return description; } /** * Returns the value of the ReplicationRunList property for this object. *

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The value of the ReplicationRunList property for this object. */ public List replicationRunList() { return replicationRunList; } @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 + Objects.hashCode(replicationJobId()); hashCode = 31 * hashCode + Objects.hashCode(serverId()); hashCode = 31 * hashCode + Objects.hashCode(serverTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(vmServer()); hashCode = 31 * hashCode + Objects.hashCode(seedReplicationTime()); hashCode = 31 * hashCode + Objects.hashCode(frequency()); hashCode = 31 * hashCode + Objects.hashCode(nextReplicationRunStartTime()); hashCode = 31 * hashCode + Objects.hashCode(licenseTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(roleName()); hashCode = 31 * hashCode + Objects.hashCode(latestAmiId()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(statusMessage()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(replicationRunList()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ReplicationJob)) { return false; } ReplicationJob other = (ReplicationJob) obj; return Objects.equals(replicationJobId(), other.replicationJobId()) && Objects.equals(serverId(), other.serverId()) && Objects.equals(serverTypeAsString(), other.serverTypeAsString()) && Objects.equals(vmServer(), other.vmServer()) && Objects.equals(seedReplicationTime(), other.seedReplicationTime()) && Objects.equals(frequency(), other.frequency()) && Objects.equals(nextReplicationRunStartTime(), other.nextReplicationRunStartTime()) && Objects.equals(licenseTypeAsString(), other.licenseTypeAsString()) && Objects.equals(roleName(), other.roleName()) && Objects.equals(latestAmiId(), other.latestAmiId()) && Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(statusMessage(), other.statusMessage()) && Objects.equals(description(), other.description()) && Objects.equals(replicationRunList(), other.replicationRunList()); } @Override public String toString() { return ToString.builder("ReplicationJob").add("ReplicationJobId", replicationJobId()).add("ServerId", serverId()) .add("ServerType", serverTypeAsString()).add("VmServer", vmServer()) .add("SeedReplicationTime", seedReplicationTime()).add("Frequency", frequency()) .add("NextReplicationRunStartTime", nextReplicationRunStartTime()).add("LicenseType", licenseTypeAsString()) .add("RoleName", roleName()).add("LatestAmiId", latestAmiId()).add("State", stateAsString()) .add("StatusMessage", statusMessage()).add("Description", description()) .add("ReplicationRunList", replicationRunList()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "replicationJobId": return Optional.ofNullable(clazz.cast(replicationJobId())); case "serverId": return Optional.ofNullable(clazz.cast(serverId())); case "serverType": return Optional.ofNullable(clazz.cast(serverTypeAsString())); case "vmServer": return Optional.ofNullable(clazz.cast(vmServer())); case "seedReplicationTime": return Optional.ofNullable(clazz.cast(seedReplicationTime())); case "frequency": return Optional.ofNullable(clazz.cast(frequency())); case "nextReplicationRunStartTime": return Optional.ofNullable(clazz.cast(nextReplicationRunStartTime())); case "licenseType": return Optional.ofNullable(clazz.cast(licenseTypeAsString())); case "roleName": return Optional.ofNullable(clazz.cast(roleName())); case "latestAmiId": return Optional.ofNullable(clazz.cast(latestAmiId())); case "state": return Optional.ofNullable(clazz.cast(stateAsString())); case "statusMessage": return Optional.ofNullable(clazz.cast(statusMessage())); case "description": return Optional.ofNullable(clazz.cast(description())); case "replicationRunList": return Optional.ofNullable(clazz.cast(replicationRunList())); default: return Optional.empty(); } } @SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { ReplicationJobMarshaller.getInstance().marshall(this, protocolMarshaller); } public interface Builder extends CopyableBuilder { /** * Sets the value of the ReplicationJobId property for this object. * * @param replicationJobId * The new value for the ReplicationJobId property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicationJobId(String replicationJobId); /** * Sets the value of the ServerId property for this object. * * @param serverId * The new value for the ServerId property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serverId(String serverId); /** * Sets the value of the ServerType property for this object. * * @param serverType * The new value for the ServerType property for this object. * @see ServerType * @return Returns a reference to this object so that method calls can be chained together. * @see ServerType */ Builder serverType(String serverType); /** * Sets the value of the ServerType property for this object. * * @param serverType * The new value for the ServerType property for this object. * @see ServerType * @return Returns a reference to this object so that method calls can be chained together. * @see ServerType */ Builder serverType(ServerType serverType); /** * Sets the value of the VmServer property for this object. * * @param vmServer * The new value for the VmServer property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vmServer(VmServer vmServer); /** * Sets the value of the VmServer property for this object. * * This is a convenience that creates an instance of the {@link VmServer.Builder} avoiding the need to create * one manually via {@link VmServer#builder()}. * * When the {@link Consumer} completes, {@link VmServer.Builder#build()} is called immediately and its result is * passed to {@link #vmServer(VmServer)}. * * @param vmServer * a consumer that will call methods on {@link VmServer.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #vmServer(VmServer) */ default Builder vmServer(Consumer vmServer) { return vmServer(VmServer.builder().applyMutation(vmServer).build()); } /** * Sets the value of the SeedReplicationTime property for this object. * * @param seedReplicationTime * The new value for the SeedReplicationTime property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder seedReplicationTime(Instant seedReplicationTime); /** * Sets the value of the Frequency property for this object. * * @param frequency * The new value for the Frequency property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder frequency(Integer frequency); /** * Sets the value of the NextReplicationRunStartTime property for this object. * * @param nextReplicationRunStartTime * The new value for the NextReplicationRunStartTime property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder nextReplicationRunStartTime(Instant nextReplicationRunStartTime); /** * Sets the value of the LicenseType property for this object. * * @param licenseType * The new value for the LicenseType property for this object. * @see LicenseType * @return Returns a reference to this object so that method calls can be chained together. * @see LicenseType */ Builder licenseType(String licenseType); /** * Sets the value of the LicenseType property for this object. * * @param licenseType * The new value for the LicenseType property for this object. * @see LicenseType * @return Returns a reference to this object so that method calls can be chained together. * @see LicenseType */ Builder licenseType(LicenseType licenseType); /** * Sets the value of the RoleName property for this object. * * @param roleName * The new value for the RoleName property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleName(String roleName); /** * Sets the value of the LatestAmiId property for this object. * * @param latestAmiId * The new value for the LatestAmiId property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder latestAmiId(String latestAmiId); /** * Sets the value of the State property for this object. * * @param state * The new value for the State property for this object. * @see ReplicationJobState * @return Returns a reference to this object so that method calls can be chained together. * @see ReplicationJobState */ Builder state(String state); /** * Sets the value of the State property for this object. * * @param state * The new value for the State property for this object. * @see ReplicationJobState * @return Returns a reference to this object so that method calls can be chained together. * @see ReplicationJobState */ Builder state(ReplicationJobState state); /** * Sets the value of the StatusMessage property for this object. * * @param statusMessage * The new value for the StatusMessage property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusMessage(String statusMessage); /** * Sets the value of the Description property for this object. * * @param description * The new value for the Description property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** * Sets the value of the ReplicationRunList property for this object. * * @param replicationRunList * The new value for the ReplicationRunList property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicationRunList(Collection replicationRunList); /** * Sets the value of the ReplicationRunList property for this object. * * @param replicationRunList * The new value for the ReplicationRunList property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicationRunList(ReplicationRun... replicationRunList); /** * Sets the value of the ReplicationRunList property for this object. * * This is a convenience that creates an instance of the {@link List.Builder} avoiding the need * to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and * its result is passed to {@link #replicationRunList(List)}. * * @param replicationRunList * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #replicationRunList(List) */ Builder replicationRunList(Consumer... replicationRunList); } static final class BuilderImpl implements Builder { private String replicationJobId; private String serverId; private String serverType; private VmServer vmServer; private Instant seedReplicationTime; private Integer frequency; private Instant nextReplicationRunStartTime; private String licenseType; private String roleName; private String latestAmiId; private String state; private String statusMessage; private String description; private List replicationRunList = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ReplicationJob model) { replicationJobId(model.replicationJobId); serverId(model.serverId); serverType(model.serverType); vmServer(model.vmServer); seedReplicationTime(model.seedReplicationTime); frequency(model.frequency); nextReplicationRunStartTime(model.nextReplicationRunStartTime); licenseType(model.licenseType); roleName(model.roleName); latestAmiId(model.latestAmiId); state(model.state); statusMessage(model.statusMessage); description(model.description); replicationRunList(model.replicationRunList); } public final String getReplicationJobId() { return replicationJobId; } @Override public final Builder replicationJobId(String replicationJobId) { this.replicationJobId = replicationJobId; return this; } public final void setReplicationJobId(String replicationJobId) { this.replicationJobId = replicationJobId; } 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 String getServerType() { return serverType; } @Override public final Builder serverType(String serverType) { this.serverType = serverType; return this; } @Override public final Builder serverType(ServerType serverType) { this.serverType(serverType.toString()); return this; } public final void setServerType(String serverType) { this.serverType = serverType; } public final VmServer.Builder getVmServer() { return vmServer != null ? vmServer.toBuilder() : null; } @Override public final Builder vmServer(VmServer vmServer) { this.vmServer = vmServer; return this; } public final void setVmServer(VmServer.BuilderImpl vmServer) { this.vmServer = vmServer != null ? vmServer.build() : null; } 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 Instant getNextReplicationRunStartTime() { return nextReplicationRunStartTime; } @Override public final Builder nextReplicationRunStartTime(Instant nextReplicationRunStartTime) { this.nextReplicationRunStartTime = nextReplicationRunStartTime; return this; } public final void setNextReplicationRunStartTime(Instant nextReplicationRunStartTime) { this.nextReplicationRunStartTime = nextReplicationRunStartTime; } 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.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 getLatestAmiId() { return latestAmiId; } @Override public final Builder latestAmiId(String latestAmiId) { this.latestAmiId = latestAmiId; return this; } public final void setLatestAmiId(String latestAmiId) { this.latestAmiId = latestAmiId; } public final String getState() { return state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(ReplicationJobState state) { this.state(state.toString()); return this; } public final void setState(String state) { this.state = state; } public final String getStatusMessage() { return statusMessage; } @Override public final Builder statusMessage(String statusMessage) { this.statusMessage = statusMessage; return this; } public final void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } 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 Collection getReplicationRunList() { return replicationRunList != null ? replicationRunList.stream().map(ReplicationRun::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder replicationRunList(Collection replicationRunList) { this.replicationRunList = ReplicationRunListCopier.copy(replicationRunList); return this; } @Override @SafeVarargs public final Builder replicationRunList(ReplicationRun... replicationRunList) { replicationRunList(Arrays.asList(replicationRunList)); return this; } @Override @SafeVarargs public final Builder replicationRunList(Consumer... replicationRunList) { replicationRunList(Stream.of(replicationRunList).map(c -> ReplicationRun.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setReplicationRunList(Collection replicationRunList) { this.replicationRunList = ReplicationRunListCopier.copyFromBuilder(replicationRunList); } @Override public ReplicationJob build() { return new ReplicationJob(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy