software.amazon.awssdk.services.globalaccelerator.model.ByoipCidr 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.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 AWS 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 AWS Global Accelerator.
*
*
* -
*
* READY — The address range is provisioned with AWS Global Accelerator and can be advertised.
*
*
* -
*
* PENDING_ADVERTISING — You’ve submitted a request for AWS Global Accelerator to advertise an address range but
* it is not yet being advertised.
*
*
* -
*
* ADVERTISING — The address range is being advertised by AWS Global Accelerator.
*
*
* -
*
* PENDING_WITHDRAWING — You’ve submitted a request to withdraw an address range from being advertised but it is
* still being advertised by AWS Global Accelerator.
*
*
* -
*
* PENDING_DEPROVISIONING — You’ve submitted a request to deprovision an address range from AWS Global
* Accelerator but it is still provisioned.
*
*
* -
*
* DEPROVISIONED — The address range is deprovisioned from AWS Global Accelerator.
*
*
* -
*
* FAILED_PROVISION — The request to provision the address range from AWS 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 AWS support.
*
*
* -
*
* FAILED_ADVERTISING — The request for AWS 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 AWS support.
*
*
* -
*
* FAILED_WITHDRAW — The request to withdraw the address range from advertising by AWS 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 AWS support.
*
*
* -
*
* FAILED_DEPROVISION — The request to deprovision the address range from AWS 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 AWS support.
*
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ByoipCidr implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CIDR_FIELD = SdkField. builder(MarshallingType.STRING)
.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)
.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)
.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.
*
*
* @return The address range, in CIDR notation.
*/
public 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 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 String stateAsString() {
return state;
}
/**
* Returns true if the Events property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasEvents() {
return events != null && !(events instanceof SdkAutoConstructList);
}
/**
*
* A history of status changes for an IP address range that that you bring to AWS Global Accelerator through bring
* your own IP address (BYOIP).
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasEvents()} to see if a value was sent in this field.
*
*
* @return A history of status changes for an IP address range that that you bring to AWS Global Accelerator through
* bring your own IP address (BYOIP).
*/
public List events() {
return events;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(cidr());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(events());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public 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())
&& 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 String toString() {
return ToString.builder("ByoipCidr").add("Cidr", cidr()).add("State", stateAsString()).add("Events", events()).build();
}
public 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 List> sdkFields() {
return SDK_FIELDS;
}
private static Function