software.amazon.awssdk.services.opensearch.model.PackageDetails Maven / Gradle / Ivy
Show all versions of opensearch 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.opensearch.model;
import java.beans.Transient;
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;
/**
*
* Basic information about a package.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PackageDetails implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField PACKAGE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PackageID").getter(getter(PackageDetails::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(PackageDetails::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(PackageDetails::packageTypeAsString)).setter(setter(Builder::packageType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PackageType").build()).build();
private static final SdkField PACKAGE_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PackageDescription").getter(getter(PackageDetails::packageDescription))
.setter(setter(Builder::packageDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PackageDescription").build())
.build();
private static final SdkField PACKAGE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PackageStatus").getter(getter(PackageDetails::packageStatusAsString))
.setter(setter(Builder::packageStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PackageStatus").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedAt").getter(getter(PackageDetails::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();
private static final SdkField LAST_UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedAt").getter(getter(PackageDetails::lastUpdatedAt)).setter(setter(Builder::lastUpdatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedAt").build()).build();
private static final SdkField AVAILABLE_PACKAGE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AvailablePackageVersion").getter(getter(PackageDetails::availablePackageVersion))
.setter(setter(Builder::availablePackageVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailablePackageVersion").build())
.build();
private static final SdkField ERROR_DETAILS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("ErrorDetails").getter(getter(PackageDetails::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, PACKAGE_DESCRIPTION_FIELD, PACKAGE_STATUS_FIELD, CREATED_AT_FIELD,
LAST_UPDATED_AT_FIELD, AVAILABLE_PACKAGE_VERSION_FIELD, ERROR_DETAILS_FIELD));
private static final long serialVersionUID = 1L;
private final String packageID;
private final String packageName;
private final String packageType;
private final String packageDescription;
private final String packageStatus;
private final Instant createdAt;
private final Instant lastUpdatedAt;
private final String availablePackageVersion;
private final ErrorDetails errorDetails;
private PackageDetails(BuilderImpl builder) {
this.packageID = builder.packageID;
this.packageName = builder.packageName;
this.packageType = builder.packageType;
this.packageDescription = builder.packageDescription;
this.packageStatus = builder.packageStatus;
this.createdAt = builder.createdAt;
this.lastUpdatedAt = builder.lastUpdatedAt;
this.availablePackageVersion = builder.availablePackageVersion;
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;
}
/**
*
* Currently supports only TXT-DICTIONARY.
*
*
* 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 Currently supports only TXT-DICTIONARY.
* @see PackageType
*/
public final PackageType packageType() {
return PackageType.fromValue(packageType);
}
/**
*
* Currently supports only TXT-DICTIONARY.
*
*
* 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 Currently supports only TXT-DICTIONARY.
* @see PackageType
*/
public final String packageTypeAsString() {
return packageType;
}
/**
*
* User-specified description of the package.
*
*
* @return User-specified description of the package.
*/
public final String packageDescription() {
return packageDescription;
}
/**
*
* Current state of the package. Values are COPYING, COPY_FAILED, AVAILABLE, DELETING, and DELETE_FAILED.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #packageStatus}
* will return {@link PackageStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #packageStatusAsString}.
*
*
* @return Current state of the package. Values are COPYING, COPY_FAILED, AVAILABLE, DELETING, and DELETE_FAILED.
* @see PackageStatus
*/
public final PackageStatus packageStatus() {
return PackageStatus.fromValue(packageStatus);
}
/**
*
* Current state of the package. Values are COPYING, COPY_FAILED, AVAILABLE, DELETING, and DELETE_FAILED.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #packageStatus}
* will return {@link PackageStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #packageStatusAsString}.
*
*
* @return Current state of the package. Values are COPYING, COPY_FAILED, AVAILABLE, DELETING, and DELETE_FAILED.
* @see PackageStatus
*/
public final String packageStatusAsString() {
return packageStatus;
}
/**
*
* The timestamp of when the package was created.
*
*
* @return The timestamp of when the package was created.
*/
public final Instant createdAt() {
return createdAt;
}
/**
* Returns the value of the LastUpdatedAt property for this object.
*
* @return The value of the LastUpdatedAt property for this object.
*/
public final Instant lastUpdatedAt() {
return lastUpdatedAt;
}
/**
* Returns the value of the AvailablePackageVersion property for this object.
*
* @return The value of the AvailablePackageVersion property for this object.
*/
public final String availablePackageVersion() {
return availablePackageVersion;
}
/**
*
* 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(packageDescription());
hashCode = 31 * hashCode + Objects.hashCode(packageStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedAt());
hashCode = 31 * hashCode + Objects.hashCode(availablePackageVersion());
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 PackageDetails)) {
return false;
}
PackageDetails other = (PackageDetails) obj;
return Objects.equals(packageID(), other.packageID()) && Objects.equals(packageName(), other.packageName())
&& Objects.equals(packageTypeAsString(), other.packageTypeAsString())
&& Objects.equals(packageDescription(), other.packageDescription())
&& Objects.equals(packageStatusAsString(), other.packageStatusAsString())
&& Objects.equals(createdAt(), other.createdAt()) && Objects.equals(lastUpdatedAt(), other.lastUpdatedAt())
&& Objects.equals(availablePackageVersion(), other.availablePackageVersion())
&& 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("PackageDetails").add("PackageID", packageID()).add("PackageName", packageName())
.add("PackageType", packageTypeAsString()).add("PackageDescription", packageDescription())
.add("PackageStatus", packageStatusAsString()).add("CreatedAt", createdAt())
.add("LastUpdatedAt", lastUpdatedAt()).add("AvailablePackageVersion", availablePackageVersion())
.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 "PackageDescription":
return Optional.ofNullable(clazz.cast(packageDescription()));
case "PackageStatus":
return Optional.ofNullable(clazz.cast(packageStatusAsString()));
case "CreatedAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "LastUpdatedAt":
return Optional.ofNullable(clazz.cast(lastUpdatedAt()));
case "AvailablePackageVersion":
return Optional.ofNullable(clazz.cast(availablePackageVersion()));
case "ErrorDetails":
return Optional.ofNullable(clazz.cast(errorDetails()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function