
software.amazon.awssdk.services.networkfirewall.model.Attachment 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.networkfirewall.model;
import java.io.Serializable;
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;
/**
*
* The configuration and status for a single subnet that you've specified for use by the Network Firewall firewall. This
* is part of the FirewallStatus.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Attachment implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField SUBNET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SubnetId").getter(getter(Attachment::subnetId)).setter(setter(Builder::subnetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubnetId").build()).build();
private static final SdkField ENDPOINT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointId").getter(getter(Attachment::endpointId)).setter(setter(Builder::endpointId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(Attachment::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusMessage").getter(getter(Attachment::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SUBNET_ID_FIELD,
ENDPOINT_ID_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String subnetId;
private final String endpointId;
private final String status;
private final String statusMessage;
private Attachment(BuilderImpl builder) {
this.subnetId = builder.subnetId;
this.endpointId = builder.endpointId;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
}
/**
*
* The unique identifier of the subnet that you've specified to be used for a firewall endpoint.
*
*
* @return The unique identifier of the subnet that you've specified to be used for a firewall endpoint.
*/
public final String subnetId() {
return subnetId;
}
/**
*
* The identifier of the firewall endpoint that Network Firewall has instantiated in the subnet. You use this to
* identify the firewall endpoint in the VPC route tables, when you redirect the VPC traffic through the endpoint.
*
*
* @return The identifier of the firewall endpoint that Network Firewall has instantiated in the subnet. You use
* this to identify the firewall endpoint in the VPC route tables, when you redirect the VPC traffic through
* the endpoint.
*/
public final String endpointId() {
return endpointId;
}
/**
*
* The current status of the firewall endpoint in the subnet. This value reflects both the instantiation of the
* endpoint in the VPC subnet and the sync states that are reported in the Config
settings. When this
* value is READY
, the endpoint is available and configured properly to handle network traffic. When
* the endpoint isn't available for traffic, this value will reflect its state, for example CREATING
or
* DELETING
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AttachmentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current status of the firewall endpoint in the subnet. This value reflects both the instantiation of
* the endpoint in the VPC subnet and the sync states that are reported in the Config
settings.
* When this value is READY
, the endpoint is available and configured properly to handle
* network traffic. When the endpoint isn't available for traffic, this value will reflect its state, for
* example CREATING
or DELETING
.
* @see AttachmentStatus
*/
public final AttachmentStatus status() {
return AttachmentStatus.fromValue(status);
}
/**
*
* The current status of the firewall endpoint in the subnet. This value reflects both the instantiation of the
* endpoint in the VPC subnet and the sync states that are reported in the Config
settings. When this
* value is READY
, the endpoint is available and configured properly to handle network traffic. When
* the endpoint isn't available for traffic, this value will reflect its state, for example CREATING
or
* DELETING
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AttachmentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current status of the firewall endpoint in the subnet. This value reflects both the instantiation of
* the endpoint in the VPC subnet and the sync states that are reported in the Config
settings.
* When this value is READY
, the endpoint is available and configured properly to handle
* network traffic. When the endpoint isn't available for traffic, this value will reflect its state, for
* example CREATING
or DELETING
.
* @see AttachmentStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* If Network Firewall fails to create or delete the firewall endpoint in the subnet, it populates this with the
* reason for the error or failure and how to resolve it. A FAILED
status indicates a non-recoverable
* state, and a ERROR
status indicates an issue that you can fix. Depending on the error, it can take
* as many as 15 minutes to populate this field. For more information about the causes for failiure or errors and
* solutions available for this field, see Troubleshooting firewall endpoint failures in the Network Firewall Developer Guide.
*
*
* @return If Network Firewall fails to create or delete the firewall endpoint in the subnet, it populates this with
* the reason for the error or failure and how to resolve it. A FAILED
status indicates a
* non-recoverable state, and a ERROR
status indicates an issue that you can fix. Depending on
* the error, it can take as many as 15 minutes to populate this field. For more information about the
* causes for failiure or errors and solutions available for this field, see Troubleshooting firewall endpoint failures in the Network Firewall Developer Guide.
*/
public final String statusMessage() {
return statusMessage;
}
@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(subnetId());
hashCode = 31 * hashCode + Objects.hashCode(endpointId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
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 Attachment)) {
return false;
}
Attachment other = (Attachment) obj;
return Objects.equals(subnetId(), other.subnetId()) && Objects.equals(endpointId(), other.endpointId())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage());
}
/**
* 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("Attachment").add("SubnetId", subnetId()).add("EndpointId", endpointId())
.add("Status", statusAsString()).add("StatusMessage", statusMessage()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SubnetId":
return Optional.ofNullable(clazz.cast(subnetId()));
case "EndpointId":
return Optional.ofNullable(clazz.cast(endpointId()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StatusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function