software.amazon.awssdk.services.ec2.model.TransitGatewayPropagation Maven / Gradle / Ivy
Show all versions of ec2 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.ec2.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Describes route propagation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TransitGatewayPropagation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TRANSIT_GATEWAY_ATTACHMENT_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("TransitGatewayAttachmentId")
.getter(getter(TransitGatewayPropagation::transitGatewayAttachmentId))
.setter(setter(Builder::transitGatewayAttachmentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransitGatewayAttachmentId")
.unmarshallLocationName("transitGatewayAttachmentId").build()).build();
private static final SdkField RESOURCE_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ResourceId")
.getter(getter(TransitGatewayPropagation::resourceId))
.setter(setter(Builder::resourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceId")
.unmarshallLocationName("resourceId").build()).build();
private static final SdkField RESOURCE_TYPE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ResourceType")
.getter(getter(TransitGatewayPropagation::resourceTypeAsString))
.setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType")
.unmarshallLocationName("resourceType").build()).build();
private static final SdkField TRANSIT_GATEWAY_ROUTE_TABLE_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("TransitGatewayRouteTableId")
.getter(getter(TransitGatewayPropagation::transitGatewayRouteTableId))
.setter(setter(Builder::transitGatewayRouteTableId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransitGatewayRouteTableId")
.unmarshallLocationName("transitGatewayRouteTableId").build()).build();
private static final SdkField STATE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("State")
.getter(getter(TransitGatewayPropagation::stateAsString))
.setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State")
.unmarshallLocationName("state").build()).build();
private static final SdkField TRANSIT_GATEWAY_ROUTE_TABLE_ANNOUNCEMENT_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("TransitGatewayRouteTableAnnouncementId")
.getter(getter(TransitGatewayPropagation::transitGatewayRouteTableAnnouncementId))
.setter(setter(Builder::transitGatewayRouteTableAnnouncementId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("TransitGatewayRouteTableAnnouncementId")
.unmarshallLocationName("transitGatewayRouteTableAnnouncementId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
TRANSIT_GATEWAY_ATTACHMENT_ID_FIELD, RESOURCE_ID_FIELD, RESOURCE_TYPE_FIELD, TRANSIT_GATEWAY_ROUTE_TABLE_ID_FIELD,
STATE_FIELD, TRANSIT_GATEWAY_ROUTE_TABLE_ANNOUNCEMENT_ID_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("TransitGatewayAttachmentId", TRANSIT_GATEWAY_ATTACHMENT_ID_FIELD);
put("ResourceId", RESOURCE_ID_FIELD);
put("ResourceType", RESOURCE_TYPE_FIELD);
put("TransitGatewayRouteTableId", TRANSIT_GATEWAY_ROUTE_TABLE_ID_FIELD);
put("State", STATE_FIELD);
put("TransitGatewayRouteTableAnnouncementId", TRANSIT_GATEWAY_ROUTE_TABLE_ANNOUNCEMENT_ID_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String transitGatewayAttachmentId;
private final String resourceId;
private final String resourceType;
private final String transitGatewayRouteTableId;
private final String state;
private final String transitGatewayRouteTableAnnouncementId;
private TransitGatewayPropagation(BuilderImpl builder) {
this.transitGatewayAttachmentId = builder.transitGatewayAttachmentId;
this.resourceId = builder.resourceId;
this.resourceType = builder.resourceType;
this.transitGatewayRouteTableId = builder.transitGatewayRouteTableId;
this.state = builder.state;
this.transitGatewayRouteTableAnnouncementId = builder.transitGatewayRouteTableAnnouncementId;
}
/**
*
* The ID of the attachment.
*
*
* @return The ID of the attachment.
*/
public final String transitGatewayAttachmentId() {
return transitGatewayAttachmentId;
}
/**
*
* The ID of the resource.
*
*
* @return The ID of the resource.
*/
public final String resourceId() {
return resourceId;
}
/**
*
* The resource type. Note that the tgw-peering
resource type has been deprecated.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will
* return {@link TransitGatewayAttachmentResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #resourceTypeAsString}.
*
*
* @return The resource type. Note that the tgw-peering
resource type has been deprecated.
* @see TransitGatewayAttachmentResourceType
*/
public final TransitGatewayAttachmentResourceType resourceType() {
return TransitGatewayAttachmentResourceType.fromValue(resourceType);
}
/**
*
* The resource type. Note that the tgw-peering
resource type has been deprecated.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will
* return {@link TransitGatewayAttachmentResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #resourceTypeAsString}.
*
*
* @return The resource type. Note that the tgw-peering
resource type has been deprecated.
* @see TransitGatewayAttachmentResourceType
*/
public final String resourceTypeAsString() {
return resourceType;
}
/**
*
* The ID of the transit gateway route table.
*
*
* @return The ID of the transit gateway route table.
*/
public final String transitGatewayRouteTableId() {
return transitGatewayRouteTableId;
}
/**
*
* The state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link TransitGatewayPropagationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #stateAsString}.
*
*
* @return The state.
* @see TransitGatewayPropagationState
*/
public final TransitGatewayPropagationState state() {
return TransitGatewayPropagationState.fromValue(state);
}
/**
*
* The state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link TransitGatewayPropagationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #stateAsString}.
*
*
* @return The state.
* @see TransitGatewayPropagationState
*/
public final String stateAsString() {
return state;
}
/**
*
* The ID of the transit gateway route table announcement.
*
*
* @return The ID of the transit gateway route table announcement.
*/
public final String transitGatewayRouteTableAnnouncementId() {
return transitGatewayRouteTableAnnouncementId;
}
@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 + Objects.hashCode(transitGatewayAttachmentId());
hashCode = 31 * hashCode + Objects.hashCode(resourceId());
hashCode = 31 * hashCode + Objects.hashCode(resourceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(transitGatewayRouteTableId());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(transitGatewayRouteTableAnnouncementId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TransitGatewayPropagation)) {
return false;
}
TransitGatewayPropagation other = (TransitGatewayPropagation) obj;
return Objects.equals(transitGatewayAttachmentId(), other.transitGatewayAttachmentId())
&& Objects.equals(resourceId(), other.resourceId())
&& Objects.equals(resourceTypeAsString(), other.resourceTypeAsString())
&& Objects.equals(transitGatewayRouteTableId(), other.transitGatewayRouteTableId())
&& Objects.equals(stateAsString(), other.stateAsString())
&& Objects.equals(transitGatewayRouteTableAnnouncementId(), other.transitGatewayRouteTableAnnouncementId());
}
/**
* 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("TransitGatewayPropagation").add("TransitGatewayAttachmentId", transitGatewayAttachmentId())
.add("ResourceId", resourceId()).add("ResourceType", resourceTypeAsString())
.add("TransitGatewayRouteTableId", transitGatewayRouteTableId()).add("State", stateAsString())
.add("TransitGatewayRouteTableAnnouncementId", transitGatewayRouteTableAnnouncementId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TransitGatewayAttachmentId":
return Optional.ofNullable(clazz.cast(transitGatewayAttachmentId()));
case "ResourceId":
return Optional.ofNullable(clazz.cast(resourceId()));
case "ResourceType":
return Optional.ofNullable(clazz.cast(resourceTypeAsString()));
case "TransitGatewayRouteTableId":
return Optional.ofNullable(clazz.cast(transitGatewayRouteTableId()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "TransitGatewayRouteTableAnnouncementId":
return Optional.ofNullable(clazz.cast(transitGatewayRouteTableAnnouncementId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function