software.amazon.awssdk.services.globalaccelerator.model.ByoipCidr Maven / Gradle / Ivy
Show all versions of globalaccelerator 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.globalaccelerator.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about an IP address range that is provisioned for use with your Amazon Web Services resources through
* bring your own IP address (BYOIP).
*
*
* The following describes each BYOIP State
that your IP address range can be in.
*
*
* -
*
* PENDING_PROVISIONING — You’ve submitted a request to provision an IP address range but it is not yet
* provisioned with Global Accelerator.
*
*
* -
*
* READY — The address range is provisioned with Global Accelerator and can be advertised.
*
*
* -
*
* PENDING_ADVERTISING — You’ve submitted a request for Global Accelerator to advertise an address range but it
* is not yet being advertised.
*
*
* -
*
* ADVERTISING — The address range is being advertised by Global Accelerator.
*
*
* -
*
* PENDING_WITHDRAWING — You’ve submitted a request to withdraw an address range from being advertised but it is
* still being advertised by Global Accelerator.
*
*
* -
*
* PENDING_DEPROVISIONING — You’ve submitted a request to deprovision an address range from Global Accelerator
* but it is still provisioned.
*
*
* -
*
* DEPROVISIONED — The address range is deprovisioned from Global Accelerator.
*
*
* -
*
* FAILED_PROVISION — The request to provision the address range from Global Accelerator was not successful.
* Please make sure that you provide all of the correct information, and try again. If the request fails a second time,
* contact Amazon Web Services support.
*
*
* -
*
* FAILED_ADVERTISING — The request for Global Accelerator to advertise the address range was not successful.
* Please make sure that you provide all of the correct information, and try again. If the request fails a second time,
* contact Amazon Web Services support.
*
*
* -
*
* FAILED_WITHDRAW — The request to withdraw the address range from advertising by Global Accelerator was not
* successful. Please make sure that you provide all of the correct information, and try again. If the request fails a
* second time, contact Amazon Web Services support.
*
*
* -
*
* FAILED_DEPROVISION — The request to deprovision the address range from Global Accelerator was not successful.
* Please make sure that you provide all of the correct information, and try again. If the request fails a second time,
* contact Amazon Web Services support.
*
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ByoipCidr implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CIDR_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Cidr")
.getter(getter(ByoipCidr::cidr)).setter(setter(Builder::cidr))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Cidr").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(ByoipCidr::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField> EVENTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Events")
.getter(getter(ByoipCidr::events))
.setter(setter(Builder::events))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Events").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ByoipCidrEvent::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CIDR_FIELD, STATE_FIELD,
EVENTS_FIELD));
private static final long serialVersionUID = 1L;
private final String cidr;
private final String state;
private final List events;
private ByoipCidr(BuilderImpl builder) {
this.cidr = builder.cidr;
this.state = builder.state;
this.events = builder.events;
}
/**
*
* The address range, in CIDR notation.
*
*
* For more information, see Bring your own IP addresses
* (BYOIP) in the Global Accelerator Developer Guide.
*
*
* @return The address range, in CIDR notation.
*
* For more information, see Bring your own IP
* addresses (BYOIP) in the Global Accelerator Developer Guide.
*/
public final String cidr() {
return cidr;
}
/**
*
* The state of the address pool.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link ByoipCidrState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the address pool.
* @see ByoipCidrState
*/
public final ByoipCidrState state() {
return ByoipCidrState.fromValue(state);
}
/**
*
* The state of the address pool.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link ByoipCidrState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the address pool.
* @see ByoipCidrState
*/
public final String stateAsString() {
return state;
}
/**
* For responses, this returns true if the service returned a value for the Events property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasEvents() {
return events != null && !(events instanceof SdkAutoConstructList);
}
/**
*
* A history of status changes for an IP address range that you bring to Global Accelerator through bring your own
* IP address (BYOIP).
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasEvents} method.
*
*
* @return A history of status changes for an IP address range that you bring to Global Accelerator through bring
* your own IP address (BYOIP).
*/
public final List events() {
return events;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(cidr());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasEvents() ? events() : null);
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 ByoipCidr)) {
return false;
}
ByoipCidr other = (ByoipCidr) obj;
return Objects.equals(cidr(), other.cidr()) && Objects.equals(stateAsString(), other.stateAsString())
&& hasEvents() == other.hasEvents() && Objects.equals(events(), other.events());
}
/**
* 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("ByoipCidr").add("Cidr", cidr()).add("State", stateAsString())
.add("Events", hasEvents() ? events() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Cidr":
return Optional.ofNullable(clazz.cast(cidr()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "Events":
return Optional.ofNullable(clazz.cast(events()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function