
software.amazon.awssdk.services.migrationhubrefactorspaces.model.UpdateRouteResponse Maven / Gradle / Ivy
/*
* 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.migrationhubrefactorspaces.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 UpdateRouteResponse extends MigrationHubRefactorSpacesResponse implements
ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(UpdateRouteResponse::applicationId))
.setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(UpdateRouteResponse::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTime").getter(getter(UpdateRouteResponse::lastUpdatedTime))
.setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build();
private static final SdkField ROUTE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RouteId").getter(getter(UpdateRouteResponse::routeId)).setter(setter(Builder::routeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RouteId").build()).build();
private static final SdkField SERVICE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServiceId").getter(getter(UpdateRouteResponse::serviceId)).setter(setter(Builder::serviceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceId").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(UpdateRouteResponse::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
ARN_FIELD, LAST_UPDATED_TIME_FIELD, ROUTE_ID_FIELD, SERVICE_ID_FIELD, STATE_FIELD));
private final String applicationId;
private final String arn;
private final Instant lastUpdatedTime;
private final String routeId;
private final String serviceId;
private final String state;
private UpdateRouteResponse(BuilderImpl builder) {
super(builder);
this.applicationId = builder.applicationId;
this.arn = builder.arn;
this.lastUpdatedTime = builder.lastUpdatedTime;
this.routeId = builder.routeId;
this.serviceId = builder.serviceId;
this.state = builder.state;
}
/**
*
* The ID of the application in which the route is being updated.
*
*
* @return The ID of the application in which the route is being updated.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The Amazon Resource Name (ARN) of the route. The format for this ARN is
* arn:aws:refactor-spaces:region:account-id:resource-type/resource-id
. For more
* information about ARNs, see
* Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
*
*
* @return The Amazon Resource Name (ARN) of the route. The format for this ARN is
* arn:aws:refactor-spaces:region:account-id:resource-type/resource-id
.
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
*/
public final String arn() {
return arn;
}
/**
*
* A timestamp that indicates when the route was last updated.
*
*
* @return A timestamp that indicates when the route was last updated.
*/
public final Instant lastUpdatedTime() {
return lastUpdatedTime;
}
/**
*
* The unique identifier of the route.
*
*
* @return The unique identifier of the route.
*/
public final String routeId() {
return routeId;
}
/**
*
* The ID of service in which the route was created. Traffic that matches this route is forwarded to this service.
*
*
* @return The ID of service in which the route was created. Traffic that matches this route is forwarded to this
* service.
*/
public final String serviceId() {
return serviceId;
}
/**
*
* The current state of the route.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link RouteState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of the route.
* @see RouteState
*/
public final RouteState state() {
return RouteState.fromValue(state);
}
/**
*
* The current state of the route.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link RouteState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of the route.
* @see RouteState
*/
public final String stateAsString() {
return state;
}
@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(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
hashCode = 31 * hashCode + Objects.hashCode(routeId());
hashCode = 31 * hashCode + Objects.hashCode(serviceId());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
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 UpdateRouteResponse)) {
return false;
}
UpdateRouteResponse other = (UpdateRouteResponse) obj;
return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(arn(), other.arn())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime()) && Objects.equals(routeId(), other.routeId())
&& Objects.equals(serviceId(), other.serviceId()) && Objects.equals(stateAsString(), other.stateAsString());
}
/**
* 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("UpdateRouteResponse").add("ApplicationId", applicationId()).add("Arn", arn())
.add("LastUpdatedTime", lastUpdatedTime()).add("RouteId", routeId()).add("ServiceId", serviceId())
.add("State", stateAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "LastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
case "RouteId":
return Optional.ofNullable(clazz.cast(routeId()));
case "ServiceId":
return Optional.ofNullable(clazz.cast(serviceId()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function