All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 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 getter(Function g) { return obj -> g.apply((ByoipCidr) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The address range, in CIDR notation. *

* * @param cidr * The address range, in CIDR notation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cidr(String cidr); /** *

* The state of the address pool. *

* * @param state * The state of the address pool. * @see ByoipCidrState * @return Returns a reference to this object so that method calls can be chained together. * @see ByoipCidrState */ Builder state(String state); /** *

* The state of the address pool. *

* * @param state * The state of the address pool. * @see ByoipCidrState * @return Returns a reference to this object so that method calls can be chained together. * @see ByoipCidrState */ Builder state(ByoipCidrState state); /** *

* 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). *

* * @param events * 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). * @return Returns a reference to this object so that method calls can be chained together. */ Builder events(Collection events); /** *

* 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). *

* * @param events * 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). * @return Returns a reference to this object so that method calls can be chained together. */ Builder events(ByoipCidrEvent... events); /** *

* 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). *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need * to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and * its result is passed to {@link #events(List)}. * * @param events * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #events(List) */ Builder events(Consumer... events); } static final class BuilderImpl implements Builder { private String cidr; private String state; private List events = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ByoipCidr model) { cidr(model.cidr); state(model.state); events(model.events); } public final String getCidr() { return cidr; } @Override public final Builder cidr(String cidr) { this.cidr = cidr; return this; } public final void setCidr(String cidr) { this.cidr = cidr; } public final String getStateAsString() { return state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(ByoipCidrState state) { this.state(state == null ? null : state.toString()); return this; } public final void setState(String state) { this.state = state; } public final Collection getEvents() { return events != null ? events.stream().map(ByoipCidrEvent::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder events(Collection events) { this.events = ByoipCidrEventsCopier.copy(events); return this; } @Override @SafeVarargs public final Builder events(ByoipCidrEvent... events) { events(Arrays.asList(events)); return this; } @Override @SafeVarargs public final Builder events(Consumer... events) { events(Stream.of(events).map(c -> ByoipCidrEvent.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setEvents(Collection events) { this.events = ByoipCidrEventsCopier.copyFromBuilder(events); } @Override public ByoipCidr build() { return new ByoipCidr(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy