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

software.amazon.awssdk.services.redshiftdata.model.DescribeStatementResponse 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.redshiftdata.model;

import java.beans.Transient;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class DescribeStatementResponse extends RedshiftDataResponse implements
        ToCopyableBuilder {
    private static final SdkField CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ClusterIdentifier").getter(getter(DescribeStatementResponse::clusterIdentifier))
            .setter(setter(Builder::clusterIdentifier))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterIdentifier").build()).build();

    private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("CreatedAt").getter(getter(DescribeStatementResponse::createdAt)).setter(setter(Builder::createdAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();

    private static final SdkField DATABASE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Database").getter(getter(DescribeStatementResponse::database)).setter(setter(Builder::database))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Database").build()).build();

    private static final SdkField DB_USER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("DbUser")
            .getter(getter(DescribeStatementResponse::dbUser)).setter(setter(Builder::dbUser))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DbUser").build()).build();

    private static final SdkField DURATION_FIELD = SdkField. builder(MarshallingType.LONG).memberName("Duration")
            .getter(getter(DescribeStatementResponse::duration)).setter(setter(Builder::duration))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Duration").build()).build();

    private static final SdkField ERROR_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Error")
            .getter(getter(DescribeStatementResponse::error)).setter(setter(Builder::error))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Error").build()).build();

    private static final SdkField HAS_RESULT_SET_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("HasResultSet").getter(getter(DescribeStatementResponse::hasResultSet))
            .setter(setter(Builder::hasResultSet))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HasResultSet").build()).build();

    private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
            .getter(getter(DescribeStatementResponse::id)).setter(setter(Builder::id))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();

    private static final SdkField> QUERY_PARAMETERS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("QueryParameters")
            .getter(getter(DescribeStatementResponse::queryParameters))
            .setter(setter(Builder::queryParameters))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryParameters").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(SqlParameter::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField QUERY_STRING_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("QueryString").getter(getter(DescribeStatementResponse::queryString))
            .setter(setter(Builder::queryString))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryString").build()).build();

    private static final SdkField REDSHIFT_PID_FIELD = SdkField. builder(MarshallingType.LONG)
            .memberName("RedshiftPid").getter(getter(DescribeStatementResponse::redshiftPid))
            .setter(setter(Builder::redshiftPid))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RedshiftPid").build()).build();

    private static final SdkField REDSHIFT_QUERY_ID_FIELD = SdkField. builder(MarshallingType.LONG)
            .memberName("RedshiftQueryId").getter(getter(DescribeStatementResponse::redshiftQueryId))
            .setter(setter(Builder::redshiftQueryId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RedshiftQueryId").build()).build();

    private static final SdkField RESULT_ROWS_FIELD = SdkField. builder(MarshallingType.LONG)
            .memberName("ResultRows").getter(getter(DescribeStatementResponse::resultRows)).setter(setter(Builder::resultRows))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResultRows").build()).build();

    private static final SdkField RESULT_SIZE_FIELD = SdkField. builder(MarshallingType.LONG)
            .memberName("ResultSize").getter(getter(DescribeStatementResponse::resultSize)).setter(setter(Builder::resultSize))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResultSize").build()).build();

    private static final SdkField SECRET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("SecretArn").getter(getter(DescribeStatementResponse::secretArn)).setter(setter(Builder::secretArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecretArn").build()).build();

    private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
            .getter(getter(DescribeStatementResponse::statusAsString)).setter(setter(Builder::status))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();

    private static final SdkField> SUB_STATEMENTS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("SubStatements")
            .getter(getter(DescribeStatementResponse::subStatements))
            .setter(setter(Builder::subStatements))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubStatements").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(SubStatementData::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("UpdatedAt").getter(getter(DescribeStatementResponse::updatedAt)).setter(setter(Builder::updatedAt))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdatedAt").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLUSTER_IDENTIFIER_FIELD,
            CREATED_AT_FIELD, DATABASE_FIELD, DB_USER_FIELD, DURATION_FIELD, ERROR_FIELD, HAS_RESULT_SET_FIELD, ID_FIELD,
            QUERY_PARAMETERS_FIELD, QUERY_STRING_FIELD, REDSHIFT_PID_FIELD, REDSHIFT_QUERY_ID_FIELD, RESULT_ROWS_FIELD,
            RESULT_SIZE_FIELD, SECRET_ARN_FIELD, STATUS_FIELD, SUB_STATEMENTS_FIELD, UPDATED_AT_FIELD));

    private final String clusterIdentifier;

    private final Instant createdAt;

    private final String database;

    private final String dbUser;

    private final Long duration;

    private final String error;

    private final Boolean hasResultSet;

    private final String id;

    private final List queryParameters;

    private final String queryString;

    private final Long redshiftPid;

    private final Long redshiftQueryId;

    private final Long resultRows;

    private final Long resultSize;

    private final String secretArn;

    private final String status;

    private final List subStatements;

    private final Instant updatedAt;

    private DescribeStatementResponse(BuilderImpl builder) {
        super(builder);
        this.clusterIdentifier = builder.clusterIdentifier;
        this.createdAt = builder.createdAt;
        this.database = builder.database;
        this.dbUser = builder.dbUser;
        this.duration = builder.duration;
        this.error = builder.error;
        this.hasResultSet = builder.hasResultSet;
        this.id = builder.id;
        this.queryParameters = builder.queryParameters;
        this.queryString = builder.queryString;
        this.redshiftPid = builder.redshiftPid;
        this.redshiftQueryId = builder.redshiftQueryId;
        this.resultRows = builder.resultRows;
        this.resultSize = builder.resultSize;
        this.secretArn = builder.secretArn;
        this.status = builder.status;
        this.subStatements = builder.subStatements;
        this.updatedAt = builder.updatedAt;
    }

    /**
     * 

* The cluster identifier. *

* * @return The cluster identifier. */ public final String clusterIdentifier() { return clusterIdentifier; } /** *

* The date and time (UTC) when the SQL statement was submitted to run. *

* * @return The date and time (UTC) when the SQL statement was submitted to run. */ public final Instant createdAt() { return createdAt; } /** *

* The name of the database. *

* * @return The name of the database. */ public final String database() { return database; } /** *

* The database user name. *

* * @return The database user name. */ public final String dbUser() { return dbUser; } /** *

* The amount of time in nanoseconds that the statement ran. *

* * @return The amount of time in nanoseconds that the statement ran. */ public final Long duration() { return duration; } /** *

* The error message from the cluster if the SQL statement encountered an error while running. *

* * @return The error message from the cluster if the SQL statement encountered an error while running. */ public final String error() { return error; } /** *

* A value that indicates whether the statement has a result set. The result set can be empty. The value is true for * an empty result set. The value is true if any substatement returns a result set. *

* * @return A value that indicates whether the statement has a result set. The result set can be empty. The value is * true for an empty result set. The value is true if any substatement returns a result set. */ public final Boolean hasResultSet() { return hasResultSet; } /** *

* The identifier of the SQL statement described. This value is a universally unique identifier (UUID) generated by * Amazon Redshift Data API. *

* * @return The identifier of the SQL statement described. This value is a universally unique identifier (UUID) * generated by Amazon Redshift Data API. */ public final String id() { return id; } /** * For responses, this returns true if the service returned a value for the QueryParameters 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 hasQueryParameters() { return queryParameters != null && !(queryParameters instanceof SdkAutoConstructList); } /** *

* The parameters for the SQL statement. *

*

* 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 #hasQueryParameters} method. *

* * @return The parameters for the SQL statement. */ public final List queryParameters() { return queryParameters; } /** *

* The SQL statement text. *

* * @return The SQL statement text. */ public final String queryString() { return queryString; } /** *

* The process identifier from Amazon Redshift. *

* * @return The process identifier from Amazon Redshift. */ public final Long redshiftPid() { return redshiftPid; } /** *

* The identifier of the query generated by Amazon Redshift. These identifiers are also available in the * query column of the STL_QUERY system view. *

* * @return The identifier of the query generated by Amazon Redshift. These identifiers are also available in the * query column of the STL_QUERY system view. */ public final Long redshiftQueryId() { return redshiftQueryId; } /** *

* Either the number of rows returned from the SQL statement or the number of rows affected. If result size is * greater than zero, the result rows can be the number of rows affected by SQL statements such as INSERT, UPDATE, * DELETE, COPY, and others. A -1 indicates the value is null. *

* * @return Either the number of rows returned from the SQL statement or the number of rows affected. If result size * is greater than zero, the result rows can be the number of rows affected by SQL statements such as * INSERT, UPDATE, DELETE, COPY, and others. A -1 indicates the value is null. */ public final Long resultRows() { return resultRows; } /** *

* The size in bytes of the returned results. A -1 indicates the value is null. *

* * @return The size in bytes of the returned results. A -1 indicates the value is null. */ public final Long resultSize() { return resultSize; } /** *

* The name or Amazon Resource Name (ARN) of the secret that enables access to the database. *

* * @return The name or Amazon Resource Name (ARN) of the secret that enables access to the database. */ public final String secretArn() { return secretArn; } /** *

* The status of the SQL statement being described. Status values are defined as follows: *

*
    *
  • *

    * ABORTED - The query run was stopped by the user. *

    *
  • *
  • *

    * ALL - A status value that includes all query statuses. This value can be used to filter results. *

    *
  • *
  • *

    * FAILED - The query run failed. *

    *
  • *
  • *

    * FINISHED - The query has finished running. *

    *
  • *
  • *

    * PICKED - The query has been chosen to be run. *

    *
  • *
  • *

    * STARTED - The query run has started. *

    *
  • *
  • *

    * SUBMITTED - The query was submitted, but not yet processed. *

    *
  • *
*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link StatusString#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The status of the SQL statement being described. Status values are defined as follows:

*
    *
  • *

    * ABORTED - The query run was stopped by the user. *

    *
  • *
  • *

    * ALL - A status value that includes all query statuses. This value can be used to filter results. *

    *
  • *
  • *

    * FAILED - The query run failed. *

    *
  • *
  • *

    * FINISHED - The query has finished running. *

    *
  • *
  • *

    * PICKED - The query has been chosen to be run. *

    *
  • *
  • *

    * STARTED - The query run has started. *

    *
  • *
  • *

    * SUBMITTED - The query was submitted, but not yet processed. *

    *
  • * @see StatusString */ public final StatusString status() { return StatusString.fromValue(status); } /** *

    * The status of the SQL statement being described. Status values are defined as follows: *

    *
      *
    • *

      * ABORTED - The query run was stopped by the user. *

      *
    • *
    • *

      * ALL - A status value that includes all query statuses. This value can be used to filter results. *

      *
    • *
    • *

      * FAILED - The query run failed. *

      *
    • *
    • *

      * FINISHED - The query has finished running. *

      *
    • *
    • *

      * PICKED - The query has been chosen to be run. *

      *
    • *
    • *

      * STARTED - The query run has started. *

      *
    • *
    • *

      * SUBMITTED - The query was submitted, but not yet processed. *

      *
    • *
    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link StatusString#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

    * * @return The status of the SQL statement being described. Status values are defined as follows:

    *
      *
    • *

      * ABORTED - The query run was stopped by the user. *

      *
    • *
    • *

      * ALL - A status value that includes all query statuses. This value can be used to filter results. *

      *
    • *
    • *

      * FAILED - The query run failed. *

      *
    • *
    • *

      * FINISHED - The query has finished running. *

      *
    • *
    • *

      * PICKED - The query has been chosen to be run. *

      *
    • *
    • *

      * STARTED - The query run has started. *

      *
    • *
    • *

      * SUBMITTED - The query was submitted, but not yet processed. *

      *
    • * @see StatusString */ public final String statusAsString() { return status; } /** * For responses, this returns true if the service returned a value for the SubStatements 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 hasSubStatements() { return subStatements != null && !(subStatements instanceof SdkAutoConstructList); } /** *

      * The SQL statements from a multiple statement run. *

      *

      * 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 #hasSubStatements} method. *

      * * @return The SQL statements from a multiple statement run. */ public final List subStatements() { return subStatements; } /** *

      * The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the time the * status last changed. *

      * * @return The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the time * the status last changed. */ public final Instant updatedAt() { return updatedAt; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(clusterIdentifier()); hashCode = 31 * hashCode + Objects.hashCode(createdAt()); hashCode = 31 * hashCode + Objects.hashCode(database()); hashCode = 31 * hashCode + Objects.hashCode(dbUser()); hashCode = 31 * hashCode + Objects.hashCode(duration()); hashCode = 31 * hashCode + Objects.hashCode(error()); hashCode = 31 * hashCode + Objects.hashCode(hasResultSet()); hashCode = 31 * hashCode + Objects.hashCode(id()); hashCode = 31 * hashCode + Objects.hashCode(hasQueryParameters() ? queryParameters() : null); hashCode = 31 * hashCode + Objects.hashCode(queryString()); hashCode = 31 * hashCode + Objects.hashCode(redshiftPid()); hashCode = 31 * hashCode + Objects.hashCode(redshiftQueryId()); hashCode = 31 * hashCode + Objects.hashCode(resultRows()); hashCode = 31 * hashCode + Objects.hashCode(resultSize()); hashCode = 31 * hashCode + Objects.hashCode(secretArn()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasSubStatements() ? subStatements() : null); hashCode = 31 * hashCode + Objects.hashCode(updatedAt()); 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 DescribeStatementResponse)) { return false; } DescribeStatementResponse other = (DescribeStatementResponse) obj; return Objects.equals(clusterIdentifier(), other.clusterIdentifier()) && Objects.equals(createdAt(), other.createdAt()) && Objects.equals(database(), other.database()) && Objects.equals(dbUser(), other.dbUser()) && Objects.equals(duration(), other.duration()) && Objects.equals(error(), other.error()) && Objects.equals(hasResultSet(), other.hasResultSet()) && Objects.equals(id(), other.id()) && hasQueryParameters() == other.hasQueryParameters() && Objects.equals(queryParameters(), other.queryParameters()) && Objects.equals(queryString(), other.queryString()) && Objects.equals(redshiftPid(), other.redshiftPid()) && Objects.equals(redshiftQueryId(), other.redshiftQueryId()) && Objects.equals(resultRows(), other.resultRows()) && Objects.equals(resultSize(), other.resultSize()) && Objects.equals(secretArn(), other.secretArn()) && Objects.equals(statusAsString(), other.statusAsString()) && hasSubStatements() == other.hasSubStatements() && Objects.equals(subStatements(), other.subStatements()) && Objects.equals(updatedAt(), other.updatedAt()); } /** * 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("DescribeStatementResponse").add("ClusterIdentifier", clusterIdentifier()) .add("CreatedAt", createdAt()).add("Database", database()).add("DbUser", dbUser()).add("Duration", duration()) .add("Error", error()).add("HasResultSet", hasResultSet()).add("Id", id()) .add("QueryParameters", hasQueryParameters() ? queryParameters() : null).add("QueryString", queryString()) .add("RedshiftPid", redshiftPid()).add("RedshiftQueryId", redshiftQueryId()).add("ResultRows", resultRows()) .add("ResultSize", resultSize()).add("SecretArn", secretArn()).add("Status", statusAsString()) .add("SubStatements", hasSubStatements() ? subStatements() : null).add("UpdatedAt", updatedAt()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ClusterIdentifier": return Optional.ofNullable(clazz.cast(clusterIdentifier())); case "CreatedAt": return Optional.ofNullable(clazz.cast(createdAt())); case "Database": return Optional.ofNullable(clazz.cast(database())); case "DbUser": return Optional.ofNullable(clazz.cast(dbUser())); case "Duration": return Optional.ofNullable(clazz.cast(duration())); case "Error": return Optional.ofNullable(clazz.cast(error())); case "HasResultSet": return Optional.ofNullable(clazz.cast(hasResultSet())); case "Id": return Optional.ofNullable(clazz.cast(id())); case "QueryParameters": return Optional.ofNullable(clazz.cast(queryParameters())); case "QueryString": return Optional.ofNullable(clazz.cast(queryString())); case "RedshiftPid": return Optional.ofNullable(clazz.cast(redshiftPid())); case "RedshiftQueryId": return Optional.ofNullable(clazz.cast(redshiftQueryId())); case "ResultRows": return Optional.ofNullable(clazz.cast(resultRows())); case "ResultSize": return Optional.ofNullable(clazz.cast(resultSize())); case "SecretArn": return Optional.ofNullable(clazz.cast(secretArn())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "SubStatements": return Optional.ofNullable(clazz.cast(subStatements())); case "UpdatedAt": return Optional.ofNullable(clazz.cast(updatedAt())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DescribeStatementResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends RedshiftDataResponse.Builder, SdkPojo, CopyableBuilder { /** *

      * The cluster identifier. *

      * * @param clusterIdentifier * The cluster identifier. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clusterIdentifier(String clusterIdentifier); /** *

      * The date and time (UTC) when the SQL statement was submitted to run. *

      * * @param createdAt * The date and time (UTC) when the SQL statement was submitted to run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdAt(Instant createdAt); /** *

      * The name of the database. *

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

      * The database user name. *

      * * @param dbUser * The database user name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dbUser(String dbUser); /** *

      * The amount of time in nanoseconds that the statement ran. *

      * * @param duration * The amount of time in nanoseconds that the statement ran. * @return Returns a reference to this object so that method calls can be chained together. */ Builder duration(Long duration); /** *

      * The error message from the cluster if the SQL statement encountered an error while running. *

      * * @param error * The error message from the cluster if the SQL statement encountered an error while running. * @return Returns a reference to this object so that method calls can be chained together. */ Builder error(String error); /** *

      * A value that indicates whether the statement has a result set. The result set can be empty. The value is true * for an empty result set. The value is true if any substatement returns a result set. *

      * * @param hasResultSet * A value that indicates whether the statement has a result set. The result set can be empty. The value * is true for an empty result set. The value is true if any substatement returns a result set. * @return Returns a reference to this object so that method calls can be chained together. */ Builder hasResultSet(Boolean hasResultSet); /** *

      * The identifier of the SQL statement described. This value is a universally unique identifier (UUID) generated * by Amazon Redshift Data API. *

      * * @param id * The identifier of the SQL statement described. This value is a universally unique identifier (UUID) * generated by Amazon Redshift Data API. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** *

      * The parameters for the SQL statement. *

      * * @param queryParameters * The parameters for the SQL statement. * @return Returns a reference to this object so that method calls can be chained together. */ Builder queryParameters(Collection queryParameters); /** *

      * The parameters for the SQL statement. *

      * * @param queryParameters * The parameters for the SQL statement. * @return Returns a reference to this object so that method calls can be chained together. */ Builder queryParameters(SqlParameter... queryParameters); /** *

      * The parameters for the SQL statement. *

      * This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its * result is passed to {@link #queryParameters(List)}. * * @param queryParameters * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #queryParameters(List) */ Builder queryParameters(Consumer... queryParameters); /** *

      * The SQL statement text. *

      * * @param queryString * The SQL statement text. * @return Returns a reference to this object so that method calls can be chained together. */ Builder queryString(String queryString); /** *

      * The process identifier from Amazon Redshift. *

      * * @param redshiftPid * The process identifier from Amazon Redshift. * @return Returns a reference to this object so that method calls can be chained together. */ Builder redshiftPid(Long redshiftPid); /** *

      * The identifier of the query generated by Amazon Redshift. These identifiers are also available in the * query column of the STL_QUERY system view. *

      * * @param redshiftQueryId * The identifier of the query generated by Amazon Redshift. These identifiers are also available in the * query column of the STL_QUERY system view. * @return Returns a reference to this object so that method calls can be chained together. */ Builder redshiftQueryId(Long redshiftQueryId); /** *

      * Either the number of rows returned from the SQL statement or the number of rows affected. If result size is * greater than zero, the result rows can be the number of rows affected by SQL statements such as INSERT, * UPDATE, DELETE, COPY, and others. A -1 indicates the value is null. *

      * * @param resultRows * Either the number of rows returned from the SQL statement or the number of rows affected. If result * size is greater than zero, the result rows can be the number of rows affected by SQL statements such * as INSERT, UPDATE, DELETE, COPY, and others. A -1 indicates the value is null. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resultRows(Long resultRows); /** *

      * The size in bytes of the returned results. A -1 indicates the value is null. *

      * * @param resultSize * The size in bytes of the returned results. A -1 indicates the value is null. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resultSize(Long resultSize); /** *

      * The name or Amazon Resource Name (ARN) of the secret that enables access to the database. *

      * * @param secretArn * The name or Amazon Resource Name (ARN) of the secret that enables access to the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder secretArn(String secretArn); /** *

      * The status of the SQL statement being described. Status values are defined as follows: *

      *
        *
      • *

        * ABORTED - The query run was stopped by the user. *

        *
      • *
      • *

        * ALL - A status value that includes all query statuses. This value can be used to filter results. *

        *
      • *
      • *

        * FAILED - The query run failed. *

        *
      • *
      • *

        * FINISHED - The query has finished running. *

        *
      • *
      • *

        * PICKED - The query has been chosen to be run. *

        *
      • *
      • *

        * STARTED - The query run has started. *

        *
      • *
      • *

        * SUBMITTED - The query was submitted, but not yet processed. *

        *
      • *
      * * @param status * The status of the SQL statement being described. Status values are defined as follows:

      *
        *
      • *

        * ABORTED - The query run was stopped by the user. *

        *
      • *
      • *

        * ALL - A status value that includes all query statuses. This value can be used to filter results. *

        *
      • *
      • *

        * FAILED - The query run failed. *

        *
      • *
      • *

        * FINISHED - The query has finished running. *

        *
      • *
      • *

        * PICKED - The query has been chosen to be run. *

        *
      • *
      • *

        * STARTED - The query run has started. *

        *
      • *
      • *

        * SUBMITTED - The query was submitted, but not yet processed. *

        *
      • * @see StatusString * @return Returns a reference to this object so that method calls can be chained together. * @see StatusString */ Builder status(String status); /** *

        * The status of the SQL statement being described. Status values are defined as follows: *

        *
          *
        • *

          * ABORTED - The query run was stopped by the user. *

          *
        • *
        • *

          * ALL - A status value that includes all query statuses. This value can be used to filter results. *

          *
        • *
        • *

          * FAILED - The query run failed. *

          *
        • *
        • *

          * FINISHED - The query has finished running. *

          *
        • *
        • *

          * PICKED - The query has been chosen to be run. *

          *
        • *
        • *

          * STARTED - The query run has started. *

          *
        • *
        • *

          * SUBMITTED - The query was submitted, but not yet processed. *

          *
        • *
        * * @param status * The status of the SQL statement being described. Status values are defined as follows:

        *
          *
        • *

          * ABORTED - The query run was stopped by the user. *

          *
        • *
        • *

          * ALL - A status value that includes all query statuses. This value can be used to filter results. *

          *
        • *
        • *

          * FAILED - The query run failed. *

          *
        • *
        • *

          * FINISHED - The query has finished running. *

          *
        • *
        • *

          * PICKED - The query has been chosen to be run. *

          *
        • *
        • *

          * STARTED - The query run has started. *

          *
        • *
        • *

          * SUBMITTED - The query was submitted, but not yet processed. *

          *
        • * @see StatusString * @return Returns a reference to this object so that method calls can be chained together. * @see StatusString */ Builder status(StatusString status); /** *

          * The SQL statements from a multiple statement run. *

          * * @param subStatements * The SQL statements from a multiple statement run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder subStatements(Collection subStatements); /** *

          * The SQL statements from a multiple statement run. *

          * * @param subStatements * The SQL statements from a multiple statement run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder subStatements(SubStatementData... subStatements); /** *

          * The SQL statements from a multiple statement run. *

          * This is a convenience that creates an instance of the {@link List.Builder} avoiding the * need to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and * its result is passed to {@link #subStatements(List)}. * * @param subStatements * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #subStatements(List) */ Builder subStatements(Consumer... subStatements); /** *

          * The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the time the * status last changed. *

          * * @param updatedAt * The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the * time the status last changed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder updatedAt(Instant updatedAt); } static final class BuilderImpl extends RedshiftDataResponse.BuilderImpl implements Builder { private String clusterIdentifier; private Instant createdAt; private String database; private String dbUser; private Long duration; private String error; private Boolean hasResultSet; private String id; private List queryParameters = DefaultSdkAutoConstructList.getInstance(); private String queryString; private Long redshiftPid; private Long redshiftQueryId; private Long resultRows; private Long resultSize; private String secretArn; private String status; private List subStatements = DefaultSdkAutoConstructList.getInstance(); private Instant updatedAt; private BuilderImpl() { } private BuilderImpl(DescribeStatementResponse model) { super(model); clusterIdentifier(model.clusterIdentifier); createdAt(model.createdAt); database(model.database); dbUser(model.dbUser); duration(model.duration); error(model.error); hasResultSet(model.hasResultSet); id(model.id); queryParameters(model.queryParameters); queryString(model.queryString); redshiftPid(model.redshiftPid); redshiftQueryId(model.redshiftQueryId); resultRows(model.resultRows); resultSize(model.resultSize); secretArn(model.secretArn); status(model.status); subStatements(model.subStatements); updatedAt(model.updatedAt); } public final String getClusterIdentifier() { return clusterIdentifier; } public final void setClusterIdentifier(String clusterIdentifier) { this.clusterIdentifier = clusterIdentifier; } @Override @Transient public final Builder clusterIdentifier(String clusterIdentifier) { this.clusterIdentifier = clusterIdentifier; return this; } public final Instant getCreatedAt() { return createdAt; } public final void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; } @Override @Transient public final Builder createdAt(Instant createdAt) { this.createdAt = createdAt; return this; } public final String getDatabase() { return database; } public final void setDatabase(String database) { this.database = database; } @Override @Transient public final Builder database(String database) { this.database = database; return this; } public final String getDbUser() { return dbUser; } public final void setDbUser(String dbUser) { this.dbUser = dbUser; } @Override @Transient public final Builder dbUser(String dbUser) { this.dbUser = dbUser; return this; } public final Long getDuration() { return duration; } public final void setDuration(Long duration) { this.duration = duration; } @Override @Transient public final Builder duration(Long duration) { this.duration = duration; return this; } public final String getError() { return error; } public final void setError(String error) { this.error = error; } @Override @Transient public final Builder error(String error) { this.error = error; return this; } public final Boolean getHasResultSet() { return hasResultSet; } public final void setHasResultSet(Boolean hasResultSet) { this.hasResultSet = hasResultSet; } @Override @Transient public final Builder hasResultSet(Boolean hasResultSet) { this.hasResultSet = hasResultSet; return this; } public final String getId() { return id; } public final void setId(String id) { this.id = id; } @Override @Transient public final Builder id(String id) { this.id = id; return this; } public final List getQueryParameters() { List result = SqlParametersListCopier.copyToBuilder(this.queryParameters); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setQueryParameters(Collection queryParameters) { this.queryParameters = SqlParametersListCopier.copyFromBuilder(queryParameters); } @Override @Transient public final Builder queryParameters(Collection queryParameters) { this.queryParameters = SqlParametersListCopier.copy(queryParameters); return this; } @Override @Transient @SafeVarargs public final Builder queryParameters(SqlParameter... queryParameters) { queryParameters(Arrays.asList(queryParameters)); return this; } @Override @Transient @SafeVarargs public final Builder queryParameters(Consumer... queryParameters) { queryParameters(Stream.of(queryParameters).map(c -> SqlParameter.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getQueryString() { return queryString; } public final void setQueryString(String queryString) { this.queryString = queryString; } @Override @Transient public final Builder queryString(String queryString) { this.queryString = queryString; return this; } public final Long getRedshiftPid() { return redshiftPid; } public final void setRedshiftPid(Long redshiftPid) { this.redshiftPid = redshiftPid; } @Override @Transient public final Builder redshiftPid(Long redshiftPid) { this.redshiftPid = redshiftPid; return this; } public final Long getRedshiftQueryId() { return redshiftQueryId; } public final void setRedshiftQueryId(Long redshiftQueryId) { this.redshiftQueryId = redshiftQueryId; } @Override @Transient public final Builder redshiftQueryId(Long redshiftQueryId) { this.redshiftQueryId = redshiftQueryId; return this; } public final Long getResultRows() { return resultRows; } public final void setResultRows(Long resultRows) { this.resultRows = resultRows; } @Override @Transient public final Builder resultRows(Long resultRows) { this.resultRows = resultRows; return this; } public final Long getResultSize() { return resultSize; } public final void setResultSize(Long resultSize) { this.resultSize = resultSize; } @Override @Transient public final Builder resultSize(Long resultSize) { this.resultSize = resultSize; return this; } public final String getSecretArn() { return secretArn; } public final void setSecretArn(String secretArn) { this.secretArn = secretArn; } @Override @Transient public final Builder secretArn(String secretArn) { this.secretArn = secretArn; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override @Transient public final Builder status(String status) { this.status = status; return this; } @Override @Transient public final Builder status(StatusString status) { this.status(status == null ? null : status.toString()); return this; } public final List getSubStatements() { List result = SubStatementListCopier.copyToBuilder(this.subStatements); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setSubStatements(Collection subStatements) { this.subStatements = SubStatementListCopier.copyFromBuilder(subStatements); } @Override @Transient public final Builder subStatements(Collection subStatements) { this.subStatements = SubStatementListCopier.copy(subStatements); return this; } @Override @Transient @SafeVarargs public final Builder subStatements(SubStatementData... subStatements) { subStatements(Arrays.asList(subStatements)); return this; } @Override @Transient @SafeVarargs public final Builder subStatements(Consumer... subStatements) { subStatements(Stream.of(subStatements).map(c -> SubStatementData.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final Instant getUpdatedAt() { return updatedAt; } public final void setUpdatedAt(Instant updatedAt) { this.updatedAt = updatedAt; } @Override @Transient public final Builder updatedAt(Instant updatedAt) { this.updatedAt = updatedAt; return this; } @Override public DescribeStatementResponse build() { return new DescribeStatementResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy