software.amazon.awssdk.services.finspacedata.model.GetDataViewResponse Maven / Gradle / Ivy
Show all versions of finspacedata 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.finspacedata.model;
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 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;
/**
* Response from retrieving a dataview, which includes details on the target database and table name
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetDataViewResponse extends FinspaceDataResponse implements
ToCopyableBuilder {
private static final SdkField AUTO_UPDATE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("autoUpdate").getter(getter(GetDataViewResponse::autoUpdate)).setter(setter(Builder::autoUpdate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("autoUpdate").build()).build();
private static final SdkField> PARTITION_COLUMNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("partitionColumns")
.getter(getter(GetDataViewResponse::partitionColumns))
.setter(setter(Builder::partitionColumns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("partitionColumns").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 DATASET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("datasetId").getter(getter(GetDataViewResponse::datasetId)).setter(setter(Builder::datasetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("datasetId").build()).build();
private static final SdkField AS_OF_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("asOfTimestamp").getter(getter(GetDataViewResponse::asOfTimestamp))
.setter(setter(Builder::asOfTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("asOfTimestamp").build()).build();
private static final SdkField ERROR_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("errorInfo")
.getter(getter(GetDataViewResponse::errorInfo)).setter(setter(Builder::errorInfo))
.constructor(DataViewErrorInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("errorInfo").build()).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("lastModifiedTime").getter(getter(GetDataViewResponse::lastModifiedTime))
.setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedTime").build()).build();
private static final SdkField CREATE_TIME_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("createTime").getter(getter(GetDataViewResponse::createTime)).setter(setter(Builder::createTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createTime").build()).build();
private static final SdkField> SORT_COLUMNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("sortColumns")
.getter(getter(GetDataViewResponse::sortColumns))
.setter(setter(Builder::sortColumns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sortColumns").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 DATA_VIEW_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("dataViewId").getter(getter(GetDataViewResponse::dataViewId)).setter(setter(Builder::dataViewId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataViewId").build()).build();
private static final SdkField DATA_VIEW_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("dataViewArn").getter(getter(GetDataViewResponse::dataViewArn)).setter(setter(Builder::dataViewArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataViewArn").build()).build();
private static final SdkField DESTINATION_TYPE_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("destinationTypeParams")
.getter(getter(GetDataViewResponse::destinationTypeParams)).setter(setter(Builder::destinationTypeParams))
.constructor(DataViewDestinationTypeParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destinationTypeParams").build())
.build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(GetDataViewResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTO_UPDATE_FIELD,
PARTITION_COLUMNS_FIELD, DATASET_ID_FIELD, AS_OF_TIMESTAMP_FIELD, ERROR_INFO_FIELD, LAST_MODIFIED_TIME_FIELD,
CREATE_TIME_FIELD, SORT_COLUMNS_FIELD, DATA_VIEW_ID_FIELD, DATA_VIEW_ARN_FIELD, DESTINATION_TYPE_PARAMS_FIELD,
STATUS_FIELD));
private final Boolean autoUpdate;
private final List partitionColumns;
private final String datasetId;
private final Long asOfTimestamp;
private final DataViewErrorInfo errorInfo;
private final Long lastModifiedTime;
private final Long createTime;
private final List sortColumns;
private final String dataViewId;
private final String dataViewArn;
private final DataViewDestinationTypeParams destinationTypeParams;
private final String status;
private GetDataViewResponse(BuilderImpl builder) {
super(builder);
this.autoUpdate = builder.autoUpdate;
this.partitionColumns = builder.partitionColumns;
this.datasetId = builder.datasetId;
this.asOfTimestamp = builder.asOfTimestamp;
this.errorInfo = builder.errorInfo;
this.lastModifiedTime = builder.lastModifiedTime;
this.createTime = builder.createTime;
this.sortColumns = builder.sortColumns;
this.dataViewId = builder.dataViewId;
this.dataViewArn = builder.dataViewArn;
this.destinationTypeParams = builder.destinationTypeParams;
this.status = builder.status;
}
/**
*
* Flag to indicate Dataview should be updated automatically.
*
*
* @return Flag to indicate Dataview should be updated automatically.
*/
public final Boolean autoUpdate() {
return autoUpdate;
}
/**
* For responses, this returns true if the service returned a value for the PartitionColumns 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 hasPartitionColumns() {
return partitionColumns != null && !(partitionColumns instanceof SdkAutoConstructList);
}
/**
*
* Ordered set of column names used to partition data.
*
*
* 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 #hasPartitionColumns} method.
*
*
* @return Ordered set of column names used to partition data.
*/
public final List partitionColumns() {
return partitionColumns;
}
/**
*
* The unique identifier for the Dataset used in the Dataview.
*
*
* @return The unique identifier for the Dataset used in the Dataview.
*/
public final String datasetId() {
return datasetId;
}
/**
*
* Time range to use for the Dataview. The value is determined as epoch time in milliseconds. For example, the value
* for Monday, November 1, 2021 12:00:00 PM UTC is specified as 1635768000000.
*
*
* @return Time range to use for the Dataview. The value is determined as epoch time in milliseconds. For example,
* the value for Monday, November 1, 2021 12:00:00 PM UTC is specified as 1635768000000.
*/
public final Long asOfTimestamp() {
return asOfTimestamp;
}
/**
*
* Information about an error that occurred for the Dataview.
*
*
* @return Information about an error that occurred for the Dataview.
*/
public final DataViewErrorInfo errorInfo() {
return errorInfo;
}
/**
*
* The last time that a Dataview was modified. The value is determined as epoch time in milliseconds. For example,
* the value for Monday, November 1, 2021 12:00:00 PM UTC is specified as 1635768000000.
*
*
* @return The last time that a Dataview was modified. The value is determined as epoch time in milliseconds. For
* example, the value for Monday, November 1, 2021 12:00:00 PM UTC is specified as 1635768000000.
*/
public final Long lastModifiedTime() {
return lastModifiedTime;
}
/**
*
* The timestamp at which the Dataview was created in FinSpace. The value is determined as epoch time in
* milliseconds. For example, the value for Monday, November 1, 2021 12:00:00 PM UTC is specified as 1635768000000.
*
*
* @return The timestamp at which the Dataview was created in FinSpace. The value is determined as epoch time in
* milliseconds. For example, the value for Monday, November 1, 2021 12:00:00 PM UTC is specified as
* 1635768000000.
*/
public final Long createTime() {
return createTime;
}
/**
* For responses, this returns true if the service returned a value for the SortColumns 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 hasSortColumns() {
return sortColumns != null && !(sortColumns instanceof SdkAutoConstructList);
}
/**
*
* Columns to be used for sorting the data.
*
*
* 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 #hasSortColumns} method.
*
*
* @return Columns to be used for sorting the data.
*/
public final List sortColumns() {
return sortColumns;
}
/**
*
* The unique identifier for the Dataview.
*
*
* @return The unique identifier for the Dataview.
*/
public final String dataViewId() {
return dataViewId;
}
/**
*
* The ARN identifier of the Dataview.
*
*
* @return The ARN identifier of the Dataview.
*/
public final String dataViewArn() {
return dataViewArn;
}
/**
*
* Options that define the destination type for the Dataview.
*
*
* @return Options that define the destination type for the Dataview.
*/
public final DataViewDestinationTypeParams destinationTypeParams() {
return destinationTypeParams;
}
/**
*
* The status of a Dataview creation.
*
*
* -
*
* RUNNING
– Dataview creation is running.
*
*
* -
*
* STARTING
– Dataview creation is starting.
*
*
* -
*
* FAILED
– Dataview creation has failed.
*
*
* -
*
* CANCELLED
– Dataview creation has been cancelled.
*
*
* -
*
* TIMEOUT
– Dataview creation has timed out.
*
*
* -
*
* SUCCESS
– Dataview creation has succeeded.
*
*
* -
*
* PENDING
– Dataview creation is pending.
*
*
* -
*
* FAILED_CLEANUP_FAILED
– Dataview creation failed and resource cleanup failed.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DataViewStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of a Dataview creation.
*
* -
*
* RUNNING
– Dataview creation is running.
*
*
* -
*
* STARTING
– Dataview creation is starting.
*
*
* -
*
* FAILED
– Dataview creation has failed.
*
*
* -
*
* CANCELLED
– Dataview creation has been cancelled.
*
*
* -
*
* TIMEOUT
– Dataview creation has timed out.
*
*
* -
*
* SUCCESS
– Dataview creation has succeeded.
*
*
* -
*
* PENDING
– Dataview creation is pending.
*
*
* -
*
* FAILED_CLEANUP_FAILED
– Dataview creation failed and resource cleanup failed.
*
*
* @see DataViewStatus
*/
public final DataViewStatus status() {
return DataViewStatus.fromValue(status);
}
/**
*
* The status of a Dataview creation.
*
*
* -
*
* RUNNING
– Dataview creation is running.
*
*
* -
*
* STARTING
– Dataview creation is starting.
*
*
* -
*
* FAILED
– Dataview creation has failed.
*
*
* -
*
* CANCELLED
– Dataview creation has been cancelled.
*
*
* -
*
* TIMEOUT
– Dataview creation has timed out.
*
*
* -
*
* SUCCESS
– Dataview creation has succeeded.
*
*
* -
*
* PENDING
– Dataview creation is pending.
*
*
* -
*
* FAILED_CLEANUP_FAILED
– Dataview creation failed and resource cleanup failed.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DataViewStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of a Dataview creation.
*
* -
*
* RUNNING
– Dataview creation is running.
*
*
* -
*
* STARTING
– Dataview creation is starting.
*
*
* -
*
* FAILED
– Dataview creation has failed.
*
*
* -
*
* CANCELLED
– Dataview creation has been cancelled.
*
*
* -
*
* TIMEOUT
– Dataview creation has timed out.
*
*
* -
*
* SUCCESS
– Dataview creation has succeeded.
*
*
* -
*
* PENDING
– Dataview creation is pending.
*
*
* -
*
* FAILED_CLEANUP_FAILED
– Dataview creation failed and resource cleanup failed.
*
*
* @see DataViewStatus
*/
public final String statusAsString() {
return status;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(autoUpdate());
hashCode = 31 * hashCode + Objects.hashCode(hasPartitionColumns() ? partitionColumns() : null);
hashCode = 31 * hashCode + Objects.hashCode(datasetId());
hashCode = 31 * hashCode + Objects.hashCode(asOfTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(errorInfo());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(createTime());
hashCode = 31 * hashCode + Objects.hashCode(hasSortColumns() ? sortColumns() : null);
hashCode = 31 * hashCode + Objects.hashCode(dataViewId());
hashCode = 31 * hashCode + Objects.hashCode(dataViewArn());
hashCode = 31 * hashCode + Objects.hashCode(destinationTypeParams());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetDataViewResponse)) {
return false;
}
GetDataViewResponse other = (GetDataViewResponse) obj;
return Objects.equals(autoUpdate(), other.autoUpdate()) && hasPartitionColumns() == other.hasPartitionColumns()
&& Objects.equals(partitionColumns(), other.partitionColumns()) && Objects.equals(datasetId(), other.datasetId())
&& Objects.equals(asOfTimestamp(), other.asOfTimestamp()) && Objects.equals(errorInfo(), other.errorInfo())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime())
&& Objects.equals(createTime(), other.createTime()) && hasSortColumns() == other.hasSortColumns()
&& Objects.equals(sortColumns(), other.sortColumns()) && Objects.equals(dataViewId(), other.dataViewId())
&& Objects.equals(dataViewArn(), other.dataViewArn())
&& Objects.equals(destinationTypeParams(), other.destinationTypeParams())
&& Objects.equals(statusAsString(), other.statusAsString());
}
/**
* 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("GetDataViewResponse").add("AutoUpdate", autoUpdate())
.add("PartitionColumns", hasPartitionColumns() ? partitionColumns() : null).add("DatasetId", datasetId())
.add("AsOfTimestamp", asOfTimestamp()).add("ErrorInfo", errorInfo()).add("LastModifiedTime", lastModifiedTime())
.add("CreateTime", createTime()).add("SortColumns", hasSortColumns() ? sortColumns() : null)
.add("DataViewId", dataViewId()).add("DataViewArn", dataViewArn())
.add("DestinationTypeParams", destinationTypeParams()).add("Status", statusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "autoUpdate":
return Optional.ofNullable(clazz.cast(autoUpdate()));
case "partitionColumns":
return Optional.ofNullable(clazz.cast(partitionColumns()));
case "datasetId":
return Optional.ofNullable(clazz.cast(datasetId()));
case "asOfTimestamp":
return Optional.ofNullable(clazz.cast(asOfTimestamp()));
case "errorInfo":
return Optional.ofNullable(clazz.cast(errorInfo()));
case "lastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "createTime":
return Optional.ofNullable(clazz.cast(createTime()));
case "sortColumns":
return Optional.ofNullable(clazz.cast(sortColumns()));
case "dataViewId":
return Optional.ofNullable(clazz.cast(dataViewId()));
case "dataViewArn":
return Optional.ofNullable(clazz.cast(dataViewArn()));
case "destinationTypeParams":
return Optional.ofNullable(clazz.cast(destinationTypeParams()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function