software.amazon.awssdk.services.cleanrooms.model.AnalysisTemplate Maven / Gradle / Ivy
Show all versions of cleanrooms 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.cleanrooms.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 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;
/**
*
* The analysis template.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AnalysisTemplate implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(AnalysisTemplate::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(AnalysisTemplate::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField COLLABORATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("collaborationId").getter(getter(AnalysisTemplate::collaborationId))
.setter(setter(Builder::collaborationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationId").build()).build();
private static final SdkField COLLABORATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("collaborationArn").getter(getter(AnalysisTemplate::collaborationArn))
.setter(setter(Builder::collaborationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationArn").build()).build();
private static final SdkField MEMBERSHIP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("membershipId").getter(getter(AnalysisTemplate::membershipId)).setter(setter(Builder::membershipId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("membershipId").build()).build();
private static final SdkField MEMBERSHIP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("membershipArn").getter(getter(AnalysisTemplate::membershipArn)).setter(setter(Builder::membershipArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("membershipArn").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(AnalysisTemplate::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(AnalysisTemplate::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField CREATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createTime").getter(getter(AnalysisTemplate::createTime)).setter(setter(Builder::createTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createTime").build()).build();
private static final SdkField UPDATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("updateTime").getter(getter(AnalysisTemplate::updateTime)).setter(setter(Builder::updateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateTime").build()).build();
private static final SdkField SCHEMA_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("schema").getter(getter(AnalysisTemplate::schema)).setter(setter(Builder::schema))
.constructor(AnalysisSchema::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("schema").build()).build();
private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("format")
.getter(getter(AnalysisTemplate::formatAsString)).setter(setter(Builder::format))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("format").build()).build();
private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("source").getter(getter(AnalysisTemplate::source)).setter(setter(Builder::source))
.constructor(AnalysisSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("source").build()).build();
private static final SdkField> ANALYSIS_PARAMETERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("analysisParameters")
.getter(getter(AnalysisTemplate::analysisParameters))
.setter(setter(Builder::analysisParameters))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("analysisParameters").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AnalysisParameter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays
.asList(ID_FIELD, ARN_FIELD, COLLABORATION_ID_FIELD, COLLABORATION_ARN_FIELD, MEMBERSHIP_ID_FIELD,
MEMBERSHIP_ARN_FIELD, DESCRIPTION_FIELD, NAME_FIELD, CREATE_TIME_FIELD, UPDATE_TIME_FIELD, SCHEMA_FIELD,
FORMAT_FIELD, SOURCE_FIELD, ANALYSIS_PARAMETERS_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String arn;
private final String collaborationId;
private final String collaborationArn;
private final String membershipId;
private final String membershipArn;
private final String description;
private final String name;
private final Instant createTime;
private final Instant updateTime;
private final AnalysisSchema schema;
private final String format;
private final AnalysisSource source;
private final List analysisParameters;
private AnalysisTemplate(BuilderImpl builder) {
this.id = builder.id;
this.arn = builder.arn;
this.collaborationId = builder.collaborationId;
this.collaborationArn = builder.collaborationArn;
this.membershipId = builder.membershipId;
this.membershipArn = builder.membershipArn;
this.description = builder.description;
this.name = builder.name;
this.createTime = builder.createTime;
this.updateTime = builder.updateTime;
this.schema = builder.schema;
this.format = builder.format;
this.source = builder.source;
this.analysisParameters = builder.analysisParameters;
}
/**
*
* The identifier for the analysis template.
*
*
* @return The identifier for the analysis template.
*/
public final String id() {
return id;
}
/**
*
* The Amazon Resource Name (ARN) of the analysis template.
*
*
* @return The Amazon Resource Name (ARN) of the analysis template.
*/
public final String arn() {
return arn;
}
/**
*
* The unique ID for the associated collaboration of the analysis template.
*
*
* @return The unique ID for the associated collaboration of the analysis template.
*/
public final String collaborationId() {
return collaborationId;
}
/**
*
* The unique ARN for the analysis template’s associated collaboration.
*
*
* @return The unique ARN for the analysis template’s associated collaboration.
*/
public final String collaborationArn() {
return collaborationArn;
}
/**
*
* The identifier of a member who created the analysis template.
*
*
* @return The identifier of a member who created the analysis template.
*/
public final String membershipId() {
return membershipId;
}
/**
*
* The Amazon Resource Name (ARN) of the member who created the analysis template.
*
*
* @return The Amazon Resource Name (ARN) of the member who created the analysis template.
*/
public final String membershipArn() {
return membershipArn;
}
/**
*
* The description of the analysis template.
*
*
* @return The description of the analysis template.
*/
public final String description() {
return description;
}
/**
*
* The name of the analysis template.
*
*
* @return The name of the analysis template.
*/
public final String name() {
return name;
}
/**
*
* The time that the analysis template was created.
*
*
* @return The time that the analysis template was created.
*/
public final Instant createTime() {
return createTime;
}
/**
*
* The time that the analysis template was last updated.
*
*
* @return The time that the analysis template was last updated.
*/
public final Instant updateTime() {
return updateTime;
}
/**
*
* The entire schema object.
*
*
* @return The entire schema object.
*/
public final AnalysisSchema schema() {
return schema;
}
/**
*
* The format of the analysis template.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #format} will
* return {@link AnalysisFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #formatAsString}.
*
*
* @return The format of the analysis template.
* @see AnalysisFormat
*/
public final AnalysisFormat format() {
return AnalysisFormat.fromValue(format);
}
/**
*
* The format of the analysis template.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #format} will
* return {@link AnalysisFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #formatAsString}.
*
*
* @return The format of the analysis template.
* @see AnalysisFormat
*/
public final String formatAsString() {
return format;
}
/**
*
* The source of the analysis template.
*
*
* @return The source of the analysis template.
*/
public final AnalysisSource source() {
return source;
}
/**
* For responses, this returns true if the service returned a value for the AnalysisParameters 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 hasAnalysisParameters() {
return analysisParameters != null && !(analysisParameters instanceof SdkAutoConstructList);
}
/**
*
* The parameters of the analysis template.
*
*
* 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 #hasAnalysisParameters} method.
*
*
* @return The parameters of the analysis template.
*/
public final List analysisParameters() {
return analysisParameters;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(collaborationId());
hashCode = 31 * hashCode + Objects.hashCode(collaborationArn());
hashCode = 31 * hashCode + Objects.hashCode(membershipId());
hashCode = 31 * hashCode + Objects.hashCode(membershipArn());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(createTime());
hashCode = 31 * hashCode + Objects.hashCode(updateTime());
hashCode = 31 * hashCode + Objects.hashCode(schema());
hashCode = 31 * hashCode + Objects.hashCode(formatAsString());
hashCode = 31 * hashCode + Objects.hashCode(source());
hashCode = 31 * hashCode + Objects.hashCode(hasAnalysisParameters() ? analysisParameters() : 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 AnalysisTemplate)) {
return false;
}
AnalysisTemplate other = (AnalysisTemplate) obj;
return Objects.equals(id(), other.id()) && Objects.equals(arn(), other.arn())
&& Objects.equals(collaborationId(), other.collaborationId())
&& Objects.equals(collaborationArn(), other.collaborationArn())
&& Objects.equals(membershipId(), other.membershipId()) && Objects.equals(membershipArn(), other.membershipArn())
&& Objects.equals(description(), other.description()) && Objects.equals(name(), other.name())
&& Objects.equals(createTime(), other.createTime()) && Objects.equals(updateTime(), other.updateTime())
&& Objects.equals(schema(), other.schema()) && Objects.equals(formatAsString(), other.formatAsString())
&& Objects.equals(source(), other.source()) && hasAnalysisParameters() == other.hasAnalysisParameters()
&& Objects.equals(analysisParameters(), other.analysisParameters());
}
/**
* 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("AnalysisTemplate").add("Id", id()).add("Arn", arn()).add("CollaborationId", collaborationId())
.add("CollaborationArn", collaborationArn()).add("MembershipId", membershipId())
.add("MembershipArn", membershipArn()).add("Description", description()).add("Name", name())
.add("CreateTime", createTime()).add("UpdateTime", updateTime()).add("Schema", schema())
.add("Format", formatAsString()).add("Source", source() == null ? null : "*** Sensitive Data Redacted ***")
.add("AnalysisParameters", analysisParameters() == null ? null : "*** Sensitive Data Redacted ***").build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "collaborationId":
return Optional.ofNullable(clazz.cast(collaborationId()));
case "collaborationArn":
return Optional.ofNullable(clazz.cast(collaborationArn()));
case "membershipId":
return Optional.ofNullable(clazz.cast(membershipId()));
case "membershipArn":
return Optional.ofNullable(clazz.cast(membershipArn()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "createTime":
return Optional.ofNullable(clazz.cast(createTime()));
case "updateTime":
return Optional.ofNullable(clazz.cast(updateTime()));
case "schema":
return Optional.ofNullable(clazz.cast(schema()));
case "format":
return Optional.ofNullable(clazz.cast(formatAsString()));
case "source":
return Optional.ofNullable(clazz.cast(source()));
case "analysisParameters":
return Optional.ofNullable(clazz.cast(analysisParameters()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function