software.amazon.awssdk.services.arczonalshift.model.StartZonalShiftResponse Maven / Gradle / Ivy
Show all versions of arczonalshift 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.arczonalshift.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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class StartZonalShiftResponse extends ArcZonalShiftResponse implements
ToCopyableBuilder {
private static final SdkField AWAY_FROM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("awayFrom").getter(getter(StartZonalShiftResponse::awayFrom)).setter(setter(Builder::awayFrom))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("awayFrom").build()).build();
private static final SdkField COMMENT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("comment")
.getter(getter(StartZonalShiftResponse::comment)).setter(setter(Builder::comment))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("comment").build()).build();
private static final SdkField EXPIRY_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("expiryTime").getter(getter(StartZonalShiftResponse::expiryTime)).setter(setter(Builder::expiryTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("expiryTime").build()).build();
private static final SdkField RESOURCE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("resourceIdentifier").getter(getter(StartZonalShiftResponse::resourceIdentifier))
.setter(setter(Builder::resourceIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceIdentifier").build())
.build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startTime").getter(getter(StartZonalShiftResponse::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(StartZonalShiftResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField ZONAL_SHIFT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("zonalShiftId").getter(getter(StartZonalShiftResponse::zonalShiftId))
.setter(setter(Builder::zonalShiftId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("zonalShiftId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AWAY_FROM_FIELD,
COMMENT_FIELD, EXPIRY_TIME_FIELD, RESOURCE_IDENTIFIER_FIELD, START_TIME_FIELD, STATUS_FIELD, ZONAL_SHIFT_ID_FIELD));
private final String awayFrom;
private final String comment;
private final Instant expiryTime;
private final String resourceIdentifier;
private final Instant startTime;
private final String status;
private final String zonalShiftId;
private StartZonalShiftResponse(BuilderImpl builder) {
super(builder);
this.awayFrom = builder.awayFrom;
this.comment = builder.comment;
this.expiryTime = builder.expiryTime;
this.resourceIdentifier = builder.resourceIdentifier;
this.startTime = builder.startTime;
this.status = builder.status;
this.zonalShiftId = builder.zonalShiftId;
}
/**
*
* The Availability Zone (for example, use1-az1
) that traffic is moved away from for a resource when
* you start a zonal shift. Until the zonal shift expires or you cancel it, traffic for the resource is instead
* moved to other Availability Zones in the Amazon Web Services Region.
*
*
* @return The Availability Zone (for example, use1-az1
) that traffic is moved away from for a resource
* when you start a zonal shift. Until the zonal shift expires or you cancel it, traffic for the resource is
* instead moved to other Availability Zones in the Amazon Web Services Region.
*/
public final String awayFrom() {
return awayFrom;
}
/**
*
* A comment that you enter about the zonal shift. Only the latest comment is retained; no comment history is
* maintained. A new comment overwrites any existing comment string.
*
*
* @return A comment that you enter about the zonal shift. Only the latest comment is retained; no comment history
* is maintained. A new comment overwrites any existing comment string.
*/
public final String comment() {
return comment;
}
/**
*
* The expiry time (expiration time) for a customer-initiated zonal shift. A zonal shift is temporary and must be
* set to expire when you start the zonal shift. You can initially set a zonal shift to expire in a maximum of three
* days (72 hours). However, you can update a zonal shift to set a new expiration at any time.
*
*
* When you start a zonal shift, you specify how long you want it to be active, which Route 53 ARC converts to an
* expiry time (expiration time). You can cancel a zonal shift when you're ready to restore traffic to the
* Availability Zone, or just wait for it to expire. Or you can update the zonal shift to specify another length of
* time to expire in.
*
*
* @return The expiry time (expiration time) for a customer-initiated zonal shift. A zonal shift is temporary and
* must be set to expire when you start the zonal shift. You can initially set a zonal shift to expire in a
* maximum of three days (72 hours). However, you can update a zonal shift to set a new expiration at any
* time.
*
* When you start a zonal shift, you specify how long you want it to be active, which Route 53 ARC converts
* to an expiry time (expiration time). You can cancel a zonal shift when you're ready to restore traffic to
* the Availability Zone, or just wait for it to expire. Or you can update the zonal shift to specify
* another length of time to expire in.
*/
public final Instant expiryTime() {
return expiryTime;
}
/**
*
* The identifier for the resource that Amazon Web Services shifts traffic for. The identifier is the Amazon
* Resource Name (ARN) for the resource.
*
*
* At this time, supported resources are Network Load Balancers and Application Load Balancers with cross-zone load
* balancing turned off.
*
*
* @return The identifier for the resource that Amazon Web Services shifts traffic for. The identifier is the Amazon
* Resource Name (ARN) for the resource.
*
* At this time, supported resources are Network Load Balancers and Application Load Balancers with
* cross-zone load balancing turned off.
*/
public final String resourceIdentifier() {
return resourceIdentifier;
}
/**
*
* The time (UTC) when the zonal shift starts.
*
*
* @return The time (UTC) when the zonal shift starts.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* A status for a zonal shift.
*
*
* The Status
for a zonal shift can have one of the following values:
*
*
* -
*
* ACTIVE: The zonal shift has been started and active.
*
*
* -
*
* EXPIRED: The zonal shift has expired (the expiry time was exceeded).
*
*
* -
*
* CANCELED: The zonal shift was canceled.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ZonalShiftStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return A status for a zonal shift.
*
* The Status
for a zonal shift can have one of the following values:
*
*
* -
*
* ACTIVE: The zonal shift has been started and active.
*
*
* -
*
* EXPIRED: The zonal shift has expired (the expiry time was exceeded).
*
*
* -
*
* CANCELED: The zonal shift was canceled.
*
*
* @see ZonalShiftStatus
*/
public final ZonalShiftStatus status() {
return ZonalShiftStatus.fromValue(status);
}
/**
*
* A status for a zonal shift.
*
*
* The Status
for a zonal shift can have one of the following values:
*
*
* -
*
* ACTIVE: The zonal shift has been started and active.
*
*
* -
*
* EXPIRED: The zonal shift has expired (the expiry time was exceeded).
*
*
* -
*
* CANCELED: The zonal shift was canceled.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ZonalShiftStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return A status for a zonal shift.
*
* The Status
for a zonal shift can have one of the following values:
*
*
* -
*
* ACTIVE: The zonal shift has been started and active.
*
*
* -
*
* EXPIRED: The zonal shift has expired (the expiry time was exceeded).
*
*
* -
*
* CANCELED: The zonal shift was canceled.
*
*
* @see ZonalShiftStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The identifier of a zonal shift.
*
*
* @return The identifier of a zonal shift.
*/
public final String zonalShiftId() {
return zonalShiftId;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(awayFrom());
hashCode = 31 * hashCode + Objects.hashCode(comment());
hashCode = 31 * hashCode + Objects.hashCode(expiryTime());
hashCode = 31 * hashCode + Objects.hashCode(resourceIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(zonalShiftId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof StartZonalShiftResponse)) {
return false;
}
StartZonalShiftResponse other = (StartZonalShiftResponse) obj;
return Objects.equals(awayFrom(), other.awayFrom()) && Objects.equals(comment(), other.comment())
&& Objects.equals(expiryTime(), other.expiryTime())
&& Objects.equals(resourceIdentifier(), other.resourceIdentifier())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(zonalShiftId(), other.zonalShiftId());
}
/**
* 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 final String toString() {
return ToString.builder("StartZonalShiftResponse").add("AwayFrom", awayFrom()).add("Comment", comment())
.add("ExpiryTime", expiryTime()).add("ResourceIdentifier", resourceIdentifier()).add("StartTime", startTime())
.add("Status", statusAsString()).add("ZonalShiftId", zonalShiftId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "awayFrom":
return Optional.ofNullable(clazz.cast(awayFrom()));
case "comment":
return Optional.ofNullable(clazz.cast(comment()));
case "expiryTime":
return Optional.ofNullable(clazz.cast(expiryTime()));
case "resourceIdentifier":
return Optional.ofNullable(clazz.cast(resourceIdentifier()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "zonalShiftId":
return Optional.ofNullable(clazz.cast(zonalShiftId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function