software.amazon.awssdk.services.route53profiles.model.ProfileResourceAssociation 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.route53profiles.model;
import java.io.Serializable;
import java.time.Instant;
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 association between a Route 53 Profile and resources.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ProfileResourceAssociation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(ProfileResourceAssociation::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ProfileResourceAssociation::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField MODIFICATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ModificationTime").getter(getter(ProfileResourceAssociation::modificationTime))
.setter(setter(Builder::modificationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModificationTime").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ProfileResourceAssociation::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField OWNER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OwnerId").getter(getter(ProfileResourceAssociation::ownerId)).setter(setter(Builder::ownerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnerId").build()).build();
private static final SdkField PROFILE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProfileId").getter(getter(ProfileResourceAssociation::profileId)).setter(setter(Builder::profileId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProfileId").build()).build();
private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceArn").getter(getter(ProfileResourceAssociation::resourceArn))
.setter(setter(Builder::resourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceArn").build()).build();
private static final SdkField RESOURCE_PROPERTIES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceProperties").getter(getter(ProfileResourceAssociation::resourceProperties))
.setter(setter(Builder::resourceProperties))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceProperties").build())
.build();
private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceType").getter(getter(ProfileResourceAssociation::resourceType))
.setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ProfileResourceAssociation::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(ProfileResourceAssociation::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(CREATION_TIME_FIELD, ID_FIELD,
MODIFICATION_TIME_FIELD, NAME_FIELD, OWNER_ID_FIELD, PROFILE_ID_FIELD, RESOURCE_ARN_FIELD, RESOURCE_PROPERTIES_FIELD,
RESOURCE_TYPE_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD));
private static final long serialVersionUID = 1L;
private final Instant creationTime;
private final String id;
private final Instant modificationTime;
private final String name;
private final String ownerId;
private final String profileId;
private final String resourceArn;
private final String resourceProperties;
private final String resourceType;
private final String status;
private final String statusMessage;
private ProfileResourceAssociation(BuilderImpl builder) {
this.creationTime = builder.creationTime;
this.id = builder.id;
this.modificationTime = builder.modificationTime;
this.name = builder.name;
this.ownerId = builder.ownerId;
this.profileId = builder.profileId;
this.resourceArn = builder.resourceArn;
this.resourceProperties = builder.resourceProperties;
this.resourceType = builder.resourceType;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
}
/**
*
* The date and time that the Profile resource association was created, in Unix time format and Coordinated
* Universal Time (UTC).
*
*
* @return The date and time that the Profile resource association was created, in Unix time format and Coordinated
* Universal Time (UTC).
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* ID of the Profile resource association.
*
*
* @return ID of the Profile resource association.
*/
public final String id() {
return id;
}
/**
*
* The date and time that the Profile resource association was modified, in Unix time format and Coordinated
* Universal Time (UTC).
*
*
* @return The date and time that the Profile resource association was modified, in Unix time format and Coordinated
* Universal Time (UTC).
*/
public final Instant modificationTime() {
return modificationTime;
}
/**
*
* Name of the Profile resource association.
*
*
* @return Name of the Profile resource association.
*/
public final String name() {
return name;
}
/**
*
* Amazon Web Services account ID of the Profile resource association owner.
*
*
* @return Amazon Web Services account ID of the Profile resource association owner.
*/
public final String ownerId() {
return ownerId;
}
/**
*
* Profile ID of the Profile that the resources are associated with.
*
*
* @return Profile ID of the Profile that the resources are associated with.
*/
public final String profileId() {
return profileId;
}
/**
*
* The Amazon Resource Name (ARN) of the resource association.
*
*
* @return The Amazon Resource Name (ARN) of the resource association.
*/
public final String resourceArn() {
return resourceArn;
}
/**
*
* If the DNS resource is a DNS Firewall rule group, this indicates the priority.
*
*
* @return If the DNS resource is a DNS Firewall rule group, this indicates the priority.
*/
public final String resourceProperties() {
return resourceProperties;
}
/**
*
* Resource type, such as a private hosted zone, or DNS Firewall rule group.
*
*
* @return Resource type, such as a private hosted zone, or DNS Firewall rule group.
*/
public final String resourceType() {
return resourceType;
}
/**
*
* Status of the Profile resource association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ProfileStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Status of the Profile resource association.
* @see ProfileStatus
*/
public final ProfileStatus status() {
return ProfileStatus.fromValue(status);
}
/**
*
* Status of the Profile resource association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ProfileStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Status of the Profile resource association.
* @see ProfileStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* Additional information about the Profile resource association.
*
*
* @return Additional information about the Profile resource association.
*/
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(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(modificationTime());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(ownerId());
hashCode = 31 * hashCode + Objects.hashCode(profileId());
hashCode = 31 * hashCode + Objects.hashCode(resourceArn());
hashCode = 31 * hashCode + Objects.hashCode(resourceProperties());
hashCode = 31 * hashCode + Objects.hashCode(resourceType());
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 ProfileResourceAssociation)) {
return false;
}
ProfileResourceAssociation other = (ProfileResourceAssociation) obj;
return Objects.equals(creationTime(), other.creationTime()) && Objects.equals(id(), other.id())
&& Objects.equals(modificationTime(), other.modificationTime()) && Objects.equals(name(), other.name())
&& Objects.equals(ownerId(), other.ownerId()) && Objects.equals(profileId(), other.profileId())
&& Objects.equals(resourceArn(), other.resourceArn())
&& Objects.equals(resourceProperties(), other.resourceProperties())
&& Objects.equals(resourceType(), other.resourceType())
&& 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("ProfileResourceAssociation").add("CreationTime", creationTime()).add("Id", id())
.add("ModificationTime", modificationTime()).add("Name", name()).add("OwnerId", ownerId())
.add("ProfileId", profileId()).add("ResourceArn", resourceArn()).add("ResourceProperties", resourceProperties())
.add("ResourceType", resourceType()).add("Status", statusAsString()).add("StatusMessage", statusMessage())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "ModificationTime":
return Optional.ofNullable(clazz.cast(modificationTime()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "OwnerId":
return Optional.ofNullable(clazz.cast(ownerId()));
case "ProfileId":
return Optional.ofNullable(clazz.cast(profileId()));
case "ResourceArn":
return Optional.ofNullable(clazz.cast(resourceArn()));
case "ResourceProperties":
return Optional.ofNullable(clazz.cast(resourceProperties()));
case "ResourceType":
return Optional.ofNullable(clazz.cast(resourceType()));
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