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

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

* Internal ID of the package. *

* * @param packageID * Internal ID of the package. * @return Returns a reference to this object so that method calls can be chained together. */ Builder packageID(String packageID); /** *

* User-specified name of the package. *

* * @param packageName * User-specified name of the package. * @return Returns a reference to this object so that method calls can be chained together. */ Builder packageName(String packageName); /** *

* The type of package. *

* * @param packageType * The type of package. * @see PackageType * @return Returns a reference to this object so that method calls can be chained together. * @see PackageType */ Builder packageType(String packageType); /** *

* The type of package. *

* * @param packageType * The type of package. * @see PackageType * @return Returns a reference to this object so that method calls can be chained together. * @see PackageType */ Builder packageType(PackageType packageType); /** *

* Timestamp of the most recent update to the package association status. *

* * @param lastUpdated * Timestamp of the most recent update to the package association status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdated(Instant lastUpdated); /** *

* Name of the domain that the package is associated with. *

* * @param domainName * Name of the domain that the package is associated with. * @return Returns a reference to this object so that method calls can be chained together. */ Builder domainName(String domainName); /** *

* State of the association. *

* * @param domainPackageStatus * State of the association. * @see DomainPackageStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DomainPackageStatus */ Builder domainPackageStatus(String domainPackageStatus); /** *

* State of the association. *

* * @param domainPackageStatus * State of the association. * @see DomainPackageStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DomainPackageStatus */ Builder domainPackageStatus(DomainPackageStatus domainPackageStatus); /** *

* The current version of the package. *

* * @param packageVersion * The current version of the package. * @return Returns a reference to this object so that method calls can be chained together. */ Builder packageVersion(String packageVersion); /** *

* The relative path of the package on the OpenSearch Service cluster nodes. This is synonym_path * when the package is for synonym files. *

* * @param referencePath * The relative path of the package on the OpenSearch Service cluster nodes. This is * synonym_path when the package is for synonym files. * @return Returns a reference to this object so that method calls can be chained together. */ Builder referencePath(String referencePath); /** *

* Additional information if the package is in an error state. Null otherwise. *

* * @param errorDetails * Additional information if the package is in an error state. Null otherwise. * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorDetails(ErrorDetails errorDetails); /** *

* Additional information if the package is in an error state. Null otherwise. *

* This is a convenience method that creates an instance of the {@link ErrorDetails.Builder} avoiding the need * to create one manually via {@link ErrorDetails#builder()}. * *

* When the {@link Consumer} completes, {@link ErrorDetails.Builder#build()} is called immediately and its * result is passed to {@link #errorDetails(ErrorDetails)}. * * @param errorDetails * a consumer that will call methods on {@link ErrorDetails.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #errorDetails(ErrorDetails) */ default Builder errorDetails(Consumer errorDetails) { return errorDetails(ErrorDetails.builder().applyMutation(errorDetails).build()); } } static final class BuilderImpl implements Builder { private String packageID; private String packageName; private String packageType; private Instant lastUpdated; private String domainName; private String domainPackageStatus; private String packageVersion; private String referencePath; private ErrorDetails errorDetails; private BuilderImpl() { } private BuilderImpl(DomainPackageDetails model) { packageID(model.packageID); packageName(model.packageName); packageType(model.packageType); lastUpdated(model.lastUpdated); domainName(model.domainName); domainPackageStatus(model.domainPackageStatus); packageVersion(model.packageVersion); referencePath(model.referencePath); errorDetails(model.errorDetails); } public final String getPackageID() { return packageID; } public final void setPackageID(String packageID) { this.packageID = packageID; } @Override public final Builder packageID(String packageID) { this.packageID = packageID; return this; } public final String getPackageName() { return packageName; } public final void setPackageName(String packageName) { this.packageName = packageName; } @Override public final Builder packageName(String packageName) { this.packageName = packageName; return this; } public final String getPackageType() { return packageType; } public final void setPackageType(String packageType) { this.packageType = packageType; } @Override public final Builder packageType(String packageType) { this.packageType = packageType; return this; } @Override public final Builder packageType(PackageType packageType) { this.packageType(packageType == null ? null : packageType.toString()); return this; } public final Instant getLastUpdated() { return lastUpdated; } public final void setLastUpdated(Instant lastUpdated) { this.lastUpdated = lastUpdated; } @Override public final Builder lastUpdated(Instant lastUpdated) { this.lastUpdated = lastUpdated; return this; } public final String getDomainName() { return domainName; } public final void setDomainName(String domainName) { this.domainName = domainName; } @Override public final Builder domainName(String domainName) { this.domainName = domainName; return this; } public final String getDomainPackageStatus() { return domainPackageStatus; } public final void setDomainPackageStatus(String domainPackageStatus) { this.domainPackageStatus = domainPackageStatus; } @Override public final Builder domainPackageStatus(String domainPackageStatus) { this.domainPackageStatus = domainPackageStatus; return this; } @Override public final Builder domainPackageStatus(DomainPackageStatus domainPackageStatus) { this.domainPackageStatus(domainPackageStatus == null ? null : domainPackageStatus.toString()); return this; } public final String getPackageVersion() { return packageVersion; } public final void setPackageVersion(String packageVersion) { this.packageVersion = packageVersion; } @Override public final Builder packageVersion(String packageVersion) { this.packageVersion = packageVersion; return this; } public final String getReferencePath() { return referencePath; } public final void setReferencePath(String referencePath) { this.referencePath = referencePath; } @Override public final Builder referencePath(String referencePath) { this.referencePath = referencePath; return this; } public final ErrorDetails.Builder getErrorDetails() { return errorDetails != null ? errorDetails.toBuilder() : null; } public final void setErrorDetails(ErrorDetails.BuilderImpl errorDetails) { this.errorDetails = errorDetails != null ? errorDetails.build() : null; } @Override public final Builder errorDetails(ErrorDetails errorDetails) { this.errorDetails = errorDetails; return this; } @Override public DomainPackageDetails build() { return new DomainPackageDetails(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy