software.amazon.awssdk.services.ec2.model.IpamResourceDiscoveryAssociation 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.Collection;
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.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;
/**
*
* An IPAM resource discovery association. An associated resource discovery is a resource discovery that has been
* associated with an IPAM. IPAM aggregates the resource CIDRs discovered by the associated resource discovery.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class IpamResourceDiscoveryAssociation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField OWNER_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("OwnerId")
.getter(getter(IpamResourceDiscoveryAssociation::ownerId))
.setter(setter(Builder::ownerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnerId")
.unmarshallLocationName("ownerId").build()).build();
private static final SdkField IPAM_RESOURCE_DISCOVERY_ASSOCIATION_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("IpamResourceDiscoveryAssociationId")
.getter(getter(IpamResourceDiscoveryAssociation::ipamResourceDiscoveryAssociationId))
.setter(setter(Builder::ipamResourceDiscoveryAssociationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IpamResourceDiscoveryAssociationId")
.unmarshallLocationName("ipamResourceDiscoveryAssociationId").build()).build();
private static final SdkField IPAM_RESOURCE_DISCOVERY_ASSOCIATION_ARN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("IpamResourceDiscoveryAssociationArn")
.getter(getter(IpamResourceDiscoveryAssociation::ipamResourceDiscoveryAssociationArn))
.setter(setter(Builder::ipamResourceDiscoveryAssociationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("IpamResourceDiscoveryAssociationArn")
.unmarshallLocationName("ipamResourceDiscoveryAssociationArn").build()).build();
private static final SdkField IPAM_RESOURCE_DISCOVERY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("IpamResourceDiscoveryId")
.getter(getter(IpamResourceDiscoveryAssociation::ipamResourceDiscoveryId))
.setter(setter(Builder::ipamResourceDiscoveryId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IpamResourceDiscoveryId")
.unmarshallLocationName("ipamResourceDiscoveryId").build()).build();
private static final SdkField IPAM_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("IpamId")
.getter(getter(IpamResourceDiscoveryAssociation::ipamId))
.setter(setter(Builder::ipamId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IpamId")
.unmarshallLocationName("ipamId").build()).build();
private static final SdkField IPAM_ARN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("IpamArn")
.getter(getter(IpamResourceDiscoveryAssociation::ipamArn))
.setter(setter(Builder::ipamArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IpamArn")
.unmarshallLocationName("ipamArn").build()).build();
private static final SdkField IPAM_REGION_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("IpamRegion")
.getter(getter(IpamResourceDiscoveryAssociation::ipamRegion))
.setter(setter(Builder::ipamRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IpamRegion")
.unmarshallLocationName("ipamRegion").build()).build();
private static final SdkField IS_DEFAULT_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("IsDefault")
.getter(getter(IpamResourceDiscoveryAssociation::isDefault))
.setter(setter(Builder::isDefault))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsDefault")
.unmarshallLocationName("isDefault").build()).build();
private static final SdkField RESOURCE_DISCOVERY_STATUS_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ResourceDiscoveryStatus")
.getter(getter(IpamResourceDiscoveryAssociation::resourceDiscoveryStatusAsString))
.setter(setter(Builder::resourceDiscoveryStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceDiscoveryStatus")
.unmarshallLocationName("resourceDiscoveryStatus").build()).build();
private static final SdkField STATE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("State")
.getter(getter(IpamResourceDiscoveryAssociation::stateAsString))
.setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State")
.unmarshallLocationName("state").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(IpamResourceDiscoveryAssociation::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TagSet")
.unmarshallLocationName("tagSet").build(),
ListTrait
.builder()
.memberLocationName("item")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Item").unmarshallLocationName("item").build()).build())
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OWNER_ID_FIELD,
IPAM_RESOURCE_DISCOVERY_ASSOCIATION_ID_FIELD, IPAM_RESOURCE_DISCOVERY_ASSOCIATION_ARN_FIELD,
IPAM_RESOURCE_DISCOVERY_ID_FIELD, IPAM_ID_FIELD, IPAM_ARN_FIELD, IPAM_REGION_FIELD, IS_DEFAULT_FIELD,
RESOURCE_DISCOVERY_STATUS_FIELD, STATE_FIELD, TAGS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("OwnerId", OWNER_ID_FIELD);
put("IpamResourceDiscoveryAssociationId", IPAM_RESOURCE_DISCOVERY_ASSOCIATION_ID_FIELD);
put("IpamResourceDiscoveryAssociationArn", IPAM_RESOURCE_DISCOVERY_ASSOCIATION_ARN_FIELD);
put("IpamResourceDiscoveryId", IPAM_RESOURCE_DISCOVERY_ID_FIELD);
put("IpamId", IPAM_ID_FIELD);
put("IpamArn", IPAM_ARN_FIELD);
put("IpamRegion", IPAM_REGION_FIELD);
put("IsDefault", IS_DEFAULT_FIELD);
put("ResourceDiscoveryStatus", RESOURCE_DISCOVERY_STATUS_FIELD);
put("State", STATE_FIELD);
put("TagSet", TAGS_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String ownerId;
private final String ipamResourceDiscoveryAssociationId;
private final String ipamResourceDiscoveryAssociationArn;
private final String ipamResourceDiscoveryId;
private final String ipamId;
private final String ipamArn;
private final String ipamRegion;
private final Boolean isDefault;
private final String resourceDiscoveryStatus;
private final String state;
private final List tags;
private IpamResourceDiscoveryAssociation(BuilderImpl builder) {
this.ownerId = builder.ownerId;
this.ipamResourceDiscoveryAssociationId = builder.ipamResourceDiscoveryAssociationId;
this.ipamResourceDiscoveryAssociationArn = builder.ipamResourceDiscoveryAssociationArn;
this.ipamResourceDiscoveryId = builder.ipamResourceDiscoveryId;
this.ipamId = builder.ipamId;
this.ipamArn = builder.ipamArn;
this.ipamRegion = builder.ipamRegion;
this.isDefault = builder.isDefault;
this.resourceDiscoveryStatus = builder.resourceDiscoveryStatus;
this.state = builder.state;
this.tags = builder.tags;
}
/**
*
* The Amazon Web Services account ID of the resource discovery owner.
*
*
* @return The Amazon Web Services account ID of the resource discovery owner.
*/
public final String ownerId() {
return ownerId;
}
/**
*
* The resource discovery association ID.
*
*
* @return The resource discovery association ID.
*/
public final String ipamResourceDiscoveryAssociationId() {
return ipamResourceDiscoveryAssociationId;
}
/**
*
* The resource discovery association Amazon Resource Name (ARN).
*
*
* @return The resource discovery association Amazon Resource Name (ARN).
*/
public final String ipamResourceDiscoveryAssociationArn() {
return ipamResourceDiscoveryAssociationArn;
}
/**
*
* The resource discovery ID.
*
*
* @return The resource discovery ID.
*/
public final String ipamResourceDiscoveryId() {
return ipamResourceDiscoveryId;
}
/**
*
* The IPAM ID.
*
*
* @return The IPAM ID.
*/
public final String ipamId() {
return ipamId;
}
/**
*
* The IPAM ARN.
*
*
* @return The IPAM ARN.
*/
public final String ipamArn() {
return ipamArn;
}
/**
*
* The IPAM home Region.
*
*
* @return The IPAM home Region.
*/
public final String ipamRegion() {
return ipamRegion;
}
/**
*
* Defines if the resource discovery is the default. When you create an IPAM, a default resource discovery is
* created for your IPAM and it's associated with your IPAM.
*
*
* @return Defines if the resource discovery is the default. When you create an IPAM, a default resource discovery
* is created for your IPAM and it's associated with your IPAM.
*/
public final Boolean isDefault() {
return isDefault;
}
/**
*
* The resource discovery status.
*
*
* -
*
* active
- Connection or permissions required to read the results of the resource discovery are
* intact.
*
*
* -
*
* not-found
- Connection or permissions required to read the results of the resource discovery are
* broken. This may happen if the owner of the resource discovery stopped sharing it or deleted the resource
* discovery. Verify the resource discovery still exists and the Amazon Web Services RAM resource share is still
* intact.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #resourceDiscoveryStatus} will return {@link IpamAssociatedResourceDiscoveryStatus#UNKNOWN_TO_SDK_VERSION}
* . The raw value returned by the service is available from {@link #resourceDiscoveryStatusAsString}.
*
*
* @return The resource discovery status.
*
* -
*
* active
- Connection or permissions required to read the results of the resource discovery
* are intact.
*
*
* -
*
* not-found
- Connection or permissions required to read the results of the resource discovery
* are broken. This may happen if the owner of the resource discovery stopped sharing it or deleted the
* resource discovery. Verify the resource discovery still exists and the Amazon Web Services RAM resource
* share is still intact.
*
*
* @see IpamAssociatedResourceDiscoveryStatus
*/
public final IpamAssociatedResourceDiscoveryStatus resourceDiscoveryStatus() {
return IpamAssociatedResourceDiscoveryStatus.fromValue(resourceDiscoveryStatus);
}
/**
*
* The resource discovery status.
*
*
* -
*
* active
- Connection or permissions required to read the results of the resource discovery are
* intact.
*
*
* -
*
* not-found
- Connection or permissions required to read the results of the resource discovery are
* broken. This may happen if the owner of the resource discovery stopped sharing it or deleted the resource
* discovery. Verify the resource discovery still exists and the Amazon Web Services RAM resource share is still
* intact.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #resourceDiscoveryStatus} will return {@link IpamAssociatedResourceDiscoveryStatus#UNKNOWN_TO_SDK_VERSION}
* . The raw value returned by the service is available from {@link #resourceDiscoveryStatusAsString}.
*
*
* @return The resource discovery status.
*
* -
*
* active
- Connection or permissions required to read the results of the resource discovery
* are intact.
*
*
* -
*
* not-found
- Connection or permissions required to read the results of the resource discovery
* are broken. This may happen if the owner of the resource discovery stopped sharing it or deleted the
* resource discovery. Verify the resource discovery still exists and the Amazon Web Services RAM resource
* share is still intact.
*
*
* @see IpamAssociatedResourceDiscoveryStatus
*/
public final String resourceDiscoveryStatusAsString() {
return resourceDiscoveryStatus;
}
/**
*
* The lifecycle state of the association when you associate or disassociate a resource discovery.
*
*
* -
*
* associate-in-progress
- Resource discovery is being associated.
*
*
* -
*
* associate-complete
- Resource discovery association is complete.
*
*
* -
*
* associate-failed
- Resource discovery association has failed.
*
*
* -
*
* disassociate-in-progress
- Resource discovery is being disassociated.
*
*
* -
*
* disassociate-complete
- Resource discovery disassociation is complete.
*
*
* -
*
* disassociate-failed
- Resource discovery disassociation has failed.
*
*
* -
*
* isolate-in-progress
- Amazon Web Services account that created the resource discovery association
* has been removed and the resource discovery associatation is being isolated.
*
*
* -
*
* isolate-complete
- Resource discovery isolation is complete..
*
*
* -
*
* restore-in-progress
- Resource discovery is being restored.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link IpamResourceDiscoveryAssociationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #stateAsString}.
*
*
* @return The lifecycle state of the association when you associate or disassociate a resource discovery.
*
* -
*
* associate-in-progress
- Resource discovery is being associated.
*
*
* -
*
* associate-complete
- Resource discovery association is complete.
*
*
* -
*
* associate-failed
- Resource discovery association has failed.
*
*
* -
*
* disassociate-in-progress
- Resource discovery is being disassociated.
*
*
* -
*
* disassociate-complete
- Resource discovery disassociation is complete.
*
*
* -
*
* disassociate-failed
- Resource discovery disassociation has failed.
*
*
* -
*
* isolate-in-progress
- Amazon Web Services account that created the resource discovery
* association has been removed and the resource discovery associatation is being isolated.
*
*
* -
*
* isolate-complete
- Resource discovery isolation is complete..
*
*
* -
*
* restore-in-progress
- Resource discovery is being restored.
*
*
* @see IpamResourceDiscoveryAssociationState
*/
public final IpamResourceDiscoveryAssociationState state() {
return IpamResourceDiscoveryAssociationState.fromValue(state);
}
/**
*
* The lifecycle state of the association when you associate or disassociate a resource discovery.
*
*
* -
*
* associate-in-progress
- Resource discovery is being associated.
*
*
* -
*
* associate-complete
- Resource discovery association is complete.
*
*
* -
*
* associate-failed
- Resource discovery association has failed.
*
*
* -
*
* disassociate-in-progress
- Resource discovery is being disassociated.
*
*
* -
*
* disassociate-complete
- Resource discovery disassociation is complete.
*
*
* -
*
* disassociate-failed
- Resource discovery disassociation has failed.
*
*
* -
*
* isolate-in-progress
- Amazon Web Services account that created the resource discovery association
* has been removed and the resource discovery associatation is being isolated.
*
*
* -
*
* isolate-complete
- Resource discovery isolation is complete..
*
*
* -
*
* restore-in-progress
- Resource discovery is being restored.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link IpamResourceDiscoveryAssociationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #stateAsString}.
*
*
* @return The lifecycle state of the association when you associate or disassociate a resource discovery.
*
* -
*
* associate-in-progress
- Resource discovery is being associated.
*
*
* -
*
* associate-complete
- Resource discovery association is complete.
*
*
* -
*
* associate-failed
- Resource discovery association has failed.
*
*
* -
*
* disassociate-in-progress
- Resource discovery is being disassociated.
*
*
* -
*
* disassociate-complete
- Resource discovery disassociation is complete.
*
*
* -
*
* disassociate-failed
- Resource discovery disassociation has failed.
*
*
* -
*
* isolate-in-progress
- Amazon Web Services account that created the resource discovery
* association has been removed and the resource discovery associatation is being isolated.
*
*
* -
*
* isolate-complete
- Resource discovery isolation is complete..
*
*
* -
*
* restore-in-progress
- Resource discovery is being restored.
*
*
* @see IpamResourceDiscoveryAssociationState
*/
public final String stateAsString() {
return state;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key and an optional
* value. You can use tags to search and filter your resources or track your Amazon Web Services costs.
*
*
* 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 #hasTags} method.
*
*
* @return A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key and an
* optional value. You can use tags to search and filter your resources or track your Amazon Web Services
* costs.
*/
public final List tags() {
return tags;
}
@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(ownerId());
hashCode = 31 * hashCode + Objects.hashCode(ipamResourceDiscoveryAssociationId());
hashCode = 31 * hashCode + Objects.hashCode(ipamResourceDiscoveryAssociationArn());
hashCode = 31 * hashCode + Objects.hashCode(ipamResourceDiscoveryId());
hashCode = 31 * hashCode + Objects.hashCode(ipamId());
hashCode = 31 * hashCode + Objects.hashCode(ipamArn());
hashCode = 31 * hashCode + Objects.hashCode(ipamRegion());
hashCode = 31 * hashCode + Objects.hashCode(isDefault());
hashCode = 31 * hashCode + Objects.hashCode(resourceDiscoveryStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : 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 IpamResourceDiscoveryAssociation)) {
return false;
}
IpamResourceDiscoveryAssociation other = (IpamResourceDiscoveryAssociation) obj;
return Objects.equals(ownerId(), other.ownerId())
&& Objects.equals(ipamResourceDiscoveryAssociationId(), other.ipamResourceDiscoveryAssociationId())
&& Objects.equals(ipamResourceDiscoveryAssociationArn(), other.ipamResourceDiscoveryAssociationArn())
&& Objects.equals(ipamResourceDiscoveryId(), other.ipamResourceDiscoveryId())
&& Objects.equals(ipamId(), other.ipamId()) && Objects.equals(ipamArn(), other.ipamArn())
&& Objects.equals(ipamRegion(), other.ipamRegion()) && Objects.equals(isDefault(), other.isDefault())
&& Objects.equals(resourceDiscoveryStatusAsString(), other.resourceDiscoveryStatusAsString())
&& Objects.equals(stateAsString(), other.stateAsString()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* 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("IpamResourceDiscoveryAssociation").add("OwnerId", ownerId())
.add("IpamResourceDiscoveryAssociationId", ipamResourceDiscoveryAssociationId())
.add("IpamResourceDiscoveryAssociationArn", ipamResourceDiscoveryAssociationArn())
.add("IpamResourceDiscoveryId", ipamResourceDiscoveryId()).add("IpamId", ipamId()).add("IpamArn", ipamArn())
.add("IpamRegion", ipamRegion()).add("IsDefault", isDefault())
.add("ResourceDiscoveryStatus", resourceDiscoveryStatusAsString()).add("State", stateAsString())
.add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "OwnerId":
return Optional.ofNullable(clazz.cast(ownerId()));
case "IpamResourceDiscoveryAssociationId":
return Optional.ofNullable(clazz.cast(ipamResourceDiscoveryAssociationId()));
case "IpamResourceDiscoveryAssociationArn":
return Optional.ofNullable(clazz.cast(ipamResourceDiscoveryAssociationArn()));
case "IpamResourceDiscoveryId":
return Optional.ofNullable(clazz.cast(ipamResourceDiscoveryId()));
case "IpamId":
return Optional.ofNullable(clazz.cast(ipamId()));
case "IpamArn":
return Optional.ofNullable(clazz.cast(ipamArn()));
case "IpamRegion":
return Optional.ofNullable(clazz.cast(ipamRegion()));
case "IsDefault":
return Optional.ofNullable(clazz.cast(isDefault()));
case "ResourceDiscoveryStatus":
return Optional.ofNullable(clazz.cast(resourceDiscoveryStatusAsString()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
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