software.amazon.awssdk.services.cleanrooms.model.SchemaSummary 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.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.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 schema summary for the objects listed by the request.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SchemaSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(SchemaSummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type")
.getter(getter(SchemaSummary::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build();
private static final SdkField CREATOR_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("creatorAccountId").getter(getter(SchemaSummary::creatorAccountId))
.setter(setter(Builder::creatorAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creatorAccountId").build()).build();
private static final SdkField CREATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createTime").getter(getter(SchemaSummary::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(SchemaSummary::updateTime)).setter(setter(Builder::updateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateTime").build()).build();
private static final SdkField COLLABORATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("collaborationId").getter(getter(SchemaSummary::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(SchemaSummary::collaborationArn))
.setter(setter(Builder::collaborationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collaborationArn").build()).build();
private static final SdkField> ANALYSIS_RULE_TYPES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("analysisRuleTypes")
.getter(getter(SchemaSummary::analysisRuleTypesAsStrings))
.setter(setter(Builder::analysisRuleTypesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("analysisRuleTypes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ANALYSIS_METHOD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("analysisMethod").getter(getter(SchemaSummary::analysisMethodAsString))
.setter(setter(Builder::analysisMethod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("analysisMethod").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, TYPE_FIELD,
CREATOR_ACCOUNT_ID_FIELD, CREATE_TIME_FIELD, UPDATE_TIME_FIELD, COLLABORATION_ID_FIELD, COLLABORATION_ARN_FIELD,
ANALYSIS_RULE_TYPES_FIELD, ANALYSIS_METHOD_FIELD));
private static final long serialVersionUID = 1L;
private final String name;
private final String type;
private final String creatorAccountId;
private final Instant createTime;
private final Instant updateTime;
private final String collaborationId;
private final String collaborationArn;
private final List analysisRuleTypes;
private final String analysisMethod;
private SchemaSummary(BuilderImpl builder) {
this.name = builder.name;
this.type = builder.type;
this.creatorAccountId = builder.creatorAccountId;
this.createTime = builder.createTime;
this.updateTime = builder.updateTime;
this.collaborationId = builder.collaborationId;
this.collaborationArn = builder.collaborationArn;
this.analysisRuleTypes = builder.analysisRuleTypes;
this.analysisMethod = builder.analysisMethod;
}
/**
*
* The name for the schema object.
*
*
* @return The name for the schema object.
*/
public final String name() {
return name;
}
/**
*
* The type of schema object. The only valid schema type is currently `TABLE`.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link SchemaType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of schema object. The only valid schema type is currently `TABLE`.
* @see SchemaType
*/
public final SchemaType type() {
return SchemaType.fromValue(type);
}
/**
*
* The type of schema object. The only valid schema type is currently `TABLE`.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link SchemaType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of schema object. The only valid schema type is currently `TABLE`.
* @see SchemaType
*/
public final String typeAsString() {
return type;
}
/**
*
* The unique account ID for the Amazon Web Services account that owns the schema.
*
*
* @return The unique account ID for the Amazon Web Services account that owns the schema.
*/
public final String creatorAccountId() {
return creatorAccountId;
}
/**
*
* The time the schema object was created.
*
*
* @return The time the schema object was created.
*/
public final Instant createTime() {
return createTime;
}
/**
*
* The time the schema object was last updated.
*
*
* @return The time the schema object was last updated.
*/
public final Instant updateTime() {
return updateTime;
}
/**
*
* The unique ID for the collaboration that the schema belongs to.
*
*
* @return The unique ID for the collaboration that the schema belongs to.
*/
public final String collaborationId() {
return collaborationId;
}
/**
*
* The unique ARN for the collaboration that the schema belongs to.
*
*
* @return The unique ARN for the collaboration that the schema belongs to.
*/
public final String collaborationArn() {
return collaborationArn;
}
/**
*
* The types of analysis rules that are associated with this schema object.
*
*
* 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 #hasAnalysisRuleTypes} method.
*
*
* @return The types of analysis rules that are associated with this schema object.
*/
public final List analysisRuleTypes() {
return AnalysisRuleTypeListCopier.copyStringToEnum(analysisRuleTypes);
}
/**
* For responses, this returns true if the service returned a value for the AnalysisRuleTypes 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 hasAnalysisRuleTypes() {
return analysisRuleTypes != null && !(analysisRuleTypes instanceof SdkAutoConstructList);
}
/**
*
* The types of analysis rules that are associated with this schema object.
*
*
* 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 #hasAnalysisRuleTypes} method.
*
*
* @return The types of analysis rules that are associated with this schema object.
*/
public final List analysisRuleTypesAsStrings() {
return analysisRuleTypes;
}
/**
*
* The analysis method for the associated schema. The only valid value is currently `DIRECT_QUERY`.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #analysisMethod}
* will return {@link AnalysisMethod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #analysisMethodAsString}.
*
*
* @return The analysis method for the associated schema. The only valid value is currently `DIRECT_QUERY`.
* @see AnalysisMethod
*/
public final AnalysisMethod analysisMethod() {
return AnalysisMethod.fromValue(analysisMethod);
}
/**
*
* The analysis method for the associated schema. The only valid value is currently `DIRECT_QUERY`.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #analysisMethod}
* will return {@link AnalysisMethod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #analysisMethodAsString}.
*
*
* @return The analysis method for the associated schema. The only valid value is currently `DIRECT_QUERY`.
* @see AnalysisMethod
*/
public final String analysisMethodAsString() {
return analysisMethod;
}
@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(name());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(creatorAccountId());
hashCode = 31 * hashCode + Objects.hashCode(createTime());
hashCode = 31 * hashCode + Objects.hashCode(updateTime());
hashCode = 31 * hashCode + Objects.hashCode(collaborationId());
hashCode = 31 * hashCode + Objects.hashCode(collaborationArn());
hashCode = 31 * hashCode + Objects.hashCode(hasAnalysisRuleTypes() ? analysisRuleTypesAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(analysisMethodAsString());
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 SchemaSummary)) {
return false;
}
SchemaSummary other = (SchemaSummary) obj;
return Objects.equals(name(), other.name()) && Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(creatorAccountId(), other.creatorAccountId())
&& Objects.equals(createTime(), other.createTime()) && Objects.equals(updateTime(), other.updateTime())
&& Objects.equals(collaborationId(), other.collaborationId())
&& Objects.equals(collaborationArn(), other.collaborationArn())
&& hasAnalysisRuleTypes() == other.hasAnalysisRuleTypes()
&& Objects.equals(analysisRuleTypesAsStrings(), other.analysisRuleTypesAsStrings())
&& Objects.equals(analysisMethodAsString(), other.analysisMethodAsString());
}
/**
* 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("SchemaSummary").add("Name", name()).add("Type", typeAsString())
.add("CreatorAccountId", creatorAccountId()).add("CreateTime", createTime()).add("UpdateTime", updateTime())
.add("CollaborationId", collaborationId()).add("CollaborationArn", collaborationArn())
.add("AnalysisRuleTypes", hasAnalysisRuleTypes() ? analysisRuleTypesAsStrings() : null)
.add("AnalysisMethod", analysisMethodAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "creatorAccountId":
return Optional.ofNullable(clazz.cast(creatorAccountId()));
case "createTime":
return Optional.ofNullable(clazz.cast(createTime()));
case "updateTime":
return Optional.ofNullable(clazz.cast(updateTime()));
case "collaborationId":
return Optional.ofNullable(clazz.cast(collaborationId()));
case "collaborationArn":
return Optional.ofNullable(clazz.cast(collaborationArn()));
case "analysisRuleTypes":
return Optional.ofNullable(clazz.cast(analysisRuleTypesAsStrings()));
case "analysisMethod":
return Optional.ofNullable(clazz.cast(analysisMethodAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function