software.amazon.awssdk.services.opensearch.model.DomainPackageDetails 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.opensearch.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.Consumer;
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;
/**
*
* Information about a package that is associated with a domain. For more information, see Custom packages for
* Amazon OpenSearch Service.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DomainPackageDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PACKAGE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PackageID").getter(getter(DomainPackageDetails::packageID)).setter(setter(Builder::packageID))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PackageID").build()).build();
private static final SdkField PACKAGE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PackageName").getter(getter(DomainPackageDetails::packageName)).setter(setter(Builder::packageName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PackageName").build()).build();
private static final SdkField PACKAGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PackageType").getter(getter(DomainPackageDetails::packageTypeAsString))
.setter(setter(Builder::packageType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PackageType").build()).build();
private static final SdkField LAST_UPDATED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdated").getter(getter(DomainPackageDetails::lastUpdated)).setter(setter(Builder::lastUpdated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdated").build()).build();
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainName").getter(getter(DomainPackageDetails::domainName)).setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField DOMAIN_PACKAGE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainPackageStatus").getter(getter(DomainPackageDetails::domainPackageStatusAsString))
.setter(setter(Builder::domainPackageStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainPackageStatus").build())
.build();
private static final SdkField PACKAGE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PackageVersion").getter(getter(DomainPackageDetails::packageVersion))
.setter(setter(Builder::packageVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PackageVersion").build()).build();
private static final SdkField REFERENCE_PATH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReferencePath").getter(getter(DomainPackageDetails::referencePath))
.setter(setter(Builder::referencePath))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReferencePath").build()).build();
private static final SdkField ERROR_DETAILS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("ErrorDetails").getter(getter(DomainPackageDetails::errorDetails)).setter(setter(Builder::errorDetails))
.constructor(ErrorDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorDetails").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PACKAGE_ID_FIELD,
PACKAGE_NAME_FIELD, PACKAGE_TYPE_FIELD, LAST_UPDATED_FIELD, DOMAIN_NAME_FIELD, DOMAIN_PACKAGE_STATUS_FIELD,
PACKAGE_VERSION_FIELD, REFERENCE_PATH_FIELD, ERROR_DETAILS_FIELD));
private static final long serialVersionUID = 1L;
private final String packageID;
private final String packageName;
private final String packageType;
private final Instant lastUpdated;
private final String domainName;
private final String domainPackageStatus;
private final String packageVersion;
private final String referencePath;
private final ErrorDetails errorDetails;
private DomainPackageDetails(BuilderImpl builder) {
this.packageID = builder.packageID;
this.packageName = builder.packageName;
this.packageType = builder.packageType;
this.lastUpdated = builder.lastUpdated;
this.domainName = builder.domainName;
this.domainPackageStatus = builder.domainPackageStatus;
this.packageVersion = builder.packageVersion;
this.referencePath = builder.referencePath;
this.errorDetails = builder.errorDetails;
}
/**
*
* Internal ID of the package.
*
*
* @return Internal ID of the package.
*/
public final String packageID() {
return packageID;
}
/**
*
* User-specified name of the package.
*
*
* @return User-specified name of the package.
*/
public final String packageName() {
return packageName;
}
/**
*
* The type of package.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #packageType} will
* return {@link PackageType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #packageTypeAsString}.
*
*
* @return The type of package.
* @see PackageType
*/
public final PackageType packageType() {
return PackageType.fromValue(packageType);
}
/**
*
* The type of package.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #packageType} will
* return {@link PackageType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #packageTypeAsString}.
*
*
* @return The type of package.
* @see PackageType
*/
public final String packageTypeAsString() {
return packageType;
}
/**
*
* Timestamp of the most recent update to the package association status.
*
*
* @return Timestamp of the most recent update to the package association status.
*/
public final Instant lastUpdated() {
return lastUpdated;
}
/**
*
* Name of the domain that the package is associated with.
*
*
* @return Name of the domain that the package is associated with.
*/
public final String domainName() {
return domainName;
}
/**
*
* State of the association.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #domainPackageStatus} will return {@link DomainPackageStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #domainPackageStatusAsString}.
*
*
* @return State of the association.
* @see DomainPackageStatus
*/
public final DomainPackageStatus domainPackageStatus() {
return DomainPackageStatus.fromValue(domainPackageStatus);
}
/**
*
* State of the association.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #domainPackageStatus} will return {@link DomainPackageStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #domainPackageStatusAsString}.
*
*
* @return State of the association.
* @see DomainPackageStatus
*/
public final String domainPackageStatusAsString() {
return domainPackageStatus;
}
/**
*
* The current version of the package.
*
*
* @return The current version of the package.
*/
public final String packageVersion() {
return packageVersion;
}
/**
*
* The relative path of the package on the OpenSearch Service cluster nodes. This is synonym_path
when
* the package is for synonym files.
*
*
* @return The relative path of the package on the OpenSearch Service cluster nodes. This is
* synonym_path
when the package is for synonym files.
*/
public final String referencePath() {
return referencePath;
}
/**
*
* Additional information if the package is in an error state. Null otherwise.
*
*
* @return Additional information if the package is in an error state. Null otherwise.
*/
public final ErrorDetails errorDetails() {
return errorDetails;
}
@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(packageID());
hashCode = 31 * hashCode + Objects.hashCode(packageName());
hashCode = 31 * hashCode + Objects.hashCode(packageTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdated());
hashCode = 31 * hashCode + Objects.hashCode(domainName());
hashCode = 31 * hashCode + Objects.hashCode(domainPackageStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(packageVersion());
hashCode = 31 * hashCode + Objects.hashCode(referencePath());
hashCode = 31 * hashCode + Objects.hashCode(errorDetails());
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 DomainPackageDetails)) {
return false;
}
DomainPackageDetails other = (DomainPackageDetails) obj;
return Objects.equals(packageID(), other.packageID()) && Objects.equals(packageName(), other.packageName())
&& Objects.equals(packageTypeAsString(), other.packageTypeAsString())
&& Objects.equals(lastUpdated(), other.lastUpdated()) && Objects.equals(domainName(), other.domainName())
&& Objects.equals(domainPackageStatusAsString(), other.domainPackageStatusAsString())
&& Objects.equals(packageVersion(), other.packageVersion())
&& Objects.equals(referencePath(), other.referencePath()) && Objects.equals(errorDetails(), other.errorDetails());
}
/**
* 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("DomainPackageDetails").add("PackageID", packageID()).add("PackageName", packageName())
.add("PackageType", packageTypeAsString()).add("LastUpdated", lastUpdated()).add("DomainName", domainName())
.add("DomainPackageStatus", domainPackageStatusAsString()).add("PackageVersion", packageVersion())
.add("ReferencePath", referencePath()).add("ErrorDetails", errorDetails()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "PackageID":
return Optional.ofNullable(clazz.cast(packageID()));
case "PackageName":
return Optional.ofNullable(clazz.cast(packageName()));
case "PackageType":
return Optional.ofNullable(clazz.cast(packageTypeAsString()));
case "LastUpdated":
return Optional.ofNullable(clazz.cast(lastUpdated()));
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "DomainPackageStatus":
return Optional.ofNullable(clazz.cast(domainPackageStatusAsString()));
case "PackageVersion":
return Optional.ofNullable(clazz.cast(packageVersion()));
case "ReferencePath":
return Optional.ofNullable(clazz.cast(referencePath()));
case "ErrorDetails":
return Optional.ofNullable(clazz.cast(errorDetails()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function