import * as HttpClient from "effect/unstable/http/HttpClient";
import * as S from "effect/Schema";
import * as stream from "effect/Stream";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import * as C from "../category.js";
const svc = T.AwsApiService({
    sdkId: "Redshift Data",
    serviceShapeName: "RedshiftData",
});
const auth = T.AwsAuthSigv4({ name: "redshift-data" });
const ver = T.ServiceVersion("2019-12-20");
const proto = T.AwsProtocolsAwsJson1_1();
const rules = T.EndpointResolver((p, _) => {
    const { Region, UseDualStack = false, UseFIPS = false, Endpoint } = p;
    const e = (u, p = {}, h = {}) => ({
        type: "endpoint",
        endpoint: { url: u, properties: p, headers: h },
    });
    const err = (m) => ({
        type: "error",
        message: m,
    });
    if (Endpoint != null) {
        if (UseFIPS === true) {
            return err("Invalid Configuration: FIPS and custom endpoint are not supported");
        }
        if (UseDualStack === true) {
            return err("Invalid Configuration: Dualstack and custom endpoint are not supported");
        }
        return e(Endpoint);
    }
    if (Region != null) {
        {
            const PartitionResult = _.partition(Region);
            if (PartitionResult != null && PartitionResult !== false) {
                if (UseFIPS === true && UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsFIPS") &&
                        true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://redshift-data-fips.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("FIPS and DualStack are enabled, but this partition does not support one or both");
                }
                if (UseFIPS === true) {
                    if (_.getAttr(PartitionResult, "supportsFIPS") === true) {
                        return e(`https://redshift-data-fips.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
                    }
                    return err("FIPS is enabled but this partition does not support FIPS");
                }
                if (UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://redshift-data.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("DualStack is enabled but this partition does not support DualStack");
                }
                return e(`https://redshift-data.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
            }
        }
    }
    return err("Invalid Configuration: Missing Region");
});
export const SqlList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const SqlParameter = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ name: S.String, value: S.String })).annotate({ identifier: "SqlParameter" });
export const SqlParametersList = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(SqlParameter);
export const BatchExecuteStatementInput = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Sqls: SqlList,
    ClusterIdentifier: S.optional(S.String),
    SecretArn: S.optional(S.String),
    DbUser: S.optional(S.String),
    Database: S.optional(S.String),
    WithEvent: S.optional(S.Boolean),
    StatementName: S.optional(S.String),
    Parameters: S.optional(SqlParametersList),
    WorkgroupName: S.optional(S.String),
    ClientToken: S.optional(S.String).pipe(T.IdempotencyToken()),
    ResultFormat: S.optional(S.String),
    SessionKeepAliveSeconds: S.optional(S.Number),
    SessionId: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "BatchExecuteStatementInput",
});
export const DbGroupList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const BatchExecuteStatementOutput = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Id: S.optional(S.String),
    CreatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    ClusterIdentifier: S.optional(S.String),
    DbUser: S.optional(S.String),
    DbGroups: S.optional(DbGroupList),
    Database: S.optional(S.String),
    SecretArn: S.optional(S.String),
    WorkgroupName: S.optional(S.String),
    SessionId: S.optional(S.String),
})).annotate({
    identifier: "BatchExecuteStatementOutput",
});
export const CancelStatementRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Id: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "CancelStatementRequest",
});
export const CancelStatementResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Status: S.optional(S.Boolean) })).annotate({
    identifier: "CancelStatementResponse",
});
export const DescribeStatementRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Id: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "DescribeStatementRequest",
});
export const SubStatementData = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Id: S.String,
    Duration: S.optional(S.Number),
    Error: S.optional(S.String),
    Status: S.optional(S.String),
    CreatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    UpdatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    QueryString: S.optional(S.String),
    ResultRows: S.optional(S.Number),
    ResultSize: S.optional(S.Number),
    RedshiftQueryId: S.optional(S.Number),
    HasResultSet: S.optional(S.Boolean),
})).annotate({
    identifier: "SubStatementData",
});
export const SubStatementList = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(SubStatementData);
export const DescribeStatementResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Id: S.String,
    SecretArn: S.optional(S.String),
    DbUser: S.optional(S.String),
    Database: S.optional(S.String),
    ClusterIdentifier: S.optional(S.String),
    Duration: S.optional(S.Number),
    Error: S.optional(S.String),
    Status: S.optional(S.String),
    CreatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    UpdatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    RedshiftPid: S.optional(S.Number),
    HasResultSet: S.optional(S.Boolean),
    QueryString: S.optional(S.String),
    ResultRows: S.optional(S.Number),
    ResultSize: S.optional(S.Number),
    RedshiftQueryId: S.optional(S.Number),
    QueryParameters: S.optional(SqlParametersList),
    SubStatements: S.optional(SubStatementList),
    WorkgroupName: S.optional(S.String),
    ResultFormat: S.optional(S.String),
    SessionId: S.optional(S.String),
})).annotate({
    identifier: "DescribeStatementResponse",
});
export const DescribeTableRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ClusterIdentifier: S.optional(S.String),
    SecretArn: S.optional(S.String),
    DbUser: S.optional(S.String),
    Database: S.String,
    ConnectedDatabase: S.optional(S.String),
    Schema: S.optional(S.String),
    Table: S.optional(S.String),
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
    WorkgroupName: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "DescribeTableRequest",
});
export const ColumnMetadata = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    isCaseSensitive: S.optional(S.Boolean),
    isCurrency: S.optional(S.Boolean),
    isSigned: S.optional(S.Boolean),
    label: S.optional(S.String),
    name: S.optional(S.String),
    nullable: S.optional(S.Number),
    precision: S.optional(S.Number),
    scale: S.optional(S.Number),
    schemaName: S.optional(S.String),
    tableName: S.optional(S.String),
    typeName: S.optional(S.String),
    length: S.optional(S.Number),
    columnDefault: S.optional(S.String),
})).annotate({ identifier: "ColumnMetadata" });
export const ColumnList = /*@__PURE__*/ /*#__PURE__*/ S.Array(ColumnMetadata);
export const DescribeTableResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    TableName: S.optional(S.String),
    ColumnList: S.optional(ColumnList),
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "DescribeTableResponse",
});
export const ExecuteStatementInput = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Sql: S.String,
    ClusterIdentifier: S.optional(S.String),
    SecretArn: S.optional(S.String),
    DbUser: S.optional(S.String),
    Database: S.optional(S.String),
    WithEvent: S.optional(S.Boolean),
    StatementName: S.optional(S.String),
    Parameters: S.optional(SqlParametersList),
    WorkgroupName: S.optional(S.String),
    ClientToken: S.optional(S.String).pipe(T.IdempotencyToken()),
    ResultFormat: S.optional(S.String),
    SessionKeepAliveSeconds: S.optional(S.Number),
    SessionId: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ExecuteStatementInput",
});
export const ExecuteStatementOutput = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Id: S.optional(S.String),
    CreatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    ClusterIdentifier: S.optional(S.String),
    DbUser: S.optional(S.String),
    DbGroups: S.optional(DbGroupList),
    Database: S.optional(S.String),
    SecretArn: S.optional(S.String),
    WorkgroupName: S.optional(S.String),
    SessionId: S.optional(S.String),
})).annotate({
    identifier: "ExecuteStatementOutput",
});
export const GetStatementResultRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Id: S.String, NextToken: S.optional(S.String) }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetStatementResultRequest",
});
export const Field = /*@__PURE__*/ /*#__PURE__*/ S.Union([
    S.Struct({ isNull: S.Boolean }),
    S.Struct({ booleanValue: S.Boolean }),
    S.Struct({ longValue: S.Number }),
    S.Struct({ doubleValue: S.Number }),
    S.Struct({ stringValue: S.String }),
    S.Struct({ blobValue: T.Blob }),
]);
export const FieldList = /*@__PURE__*/ /*#__PURE__*/ S.Array(Field);
export const SqlRecords = /*@__PURE__*/ /*#__PURE__*/ S.Array(FieldList);
export const ColumnMetadataList = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(ColumnMetadata);
export const GetStatementResultResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Records: SqlRecords,
    ColumnMetadata: S.optional(ColumnMetadataList),
    TotalNumRows: S.optional(S.Number),
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "GetStatementResultResponse",
});
export const GetStatementResultV2Request = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Id: S.String, NextToken: S.optional(S.String) }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetStatementResultV2Request",
});
export const QueryRecords = /*@__PURE__*/ /*#__PURE__*/ S.Union([
    S.Struct({ CSVRecords: S.String }),
]);
export const FormattedSqlRecords = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(QueryRecords);
export const GetStatementResultV2Response = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Records: FormattedSqlRecords,
    ColumnMetadata: S.optional(ColumnMetadataList),
    TotalNumRows: S.optional(S.Number),
    ResultFormat: S.optional(S.String),
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "GetStatementResultV2Response",
});
export const ListDatabasesRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ClusterIdentifier: S.optional(S.String),
    Database: S.String,
    SecretArn: S.optional(S.String),
    DbUser: S.optional(S.String),
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
    WorkgroupName: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListDatabasesRequest",
});
export const DatabaseList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const ListDatabasesResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Databases: S.optional(DatabaseList),
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "ListDatabasesResponse",
});
export const ListSchemasRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ClusterIdentifier: S.optional(S.String),
    SecretArn: S.optional(S.String),
    DbUser: S.optional(S.String),
    Database: S.String,
    ConnectedDatabase: S.optional(S.String),
    SchemaPattern: S.optional(S.String),
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
    WorkgroupName: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListSchemasRequest",
});
export const SchemaList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const ListSchemasResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Schemas: S.optional(SchemaList),
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "ListSchemasResponse",
});
export const ListStatementsRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
    StatementName: S.optional(S.String),
    Status: S.optional(S.String),
    RoleLevel: S.optional(S.Boolean),
    Database: S.optional(S.String),
    ClusterIdentifier: S.optional(S.String),
    WorkgroupName: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListStatementsRequest",
});
export const StatementStringList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const StatementData = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Id: S.String,
    QueryString: S.optional(S.String),
    QueryStrings: S.optional(StatementStringList),
    SecretArn: S.optional(S.String),
    Status: S.optional(S.String),
    StatementName: S.optional(S.String),
    CreatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    UpdatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    QueryParameters: S.optional(SqlParametersList),
    IsBatchStatement: S.optional(S.Boolean),
    ResultFormat: S.optional(S.String),
    SessionId: S.optional(S.String),
})).annotate({ identifier: "StatementData" });
export const StatementList = /*@__PURE__*/ /*#__PURE__*/ S.Array(StatementData);
export const ListStatementsResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Statements: StatementList, NextToken: S.optional(S.String) })).annotate({
    identifier: "ListStatementsResponse",
});
export const ListTablesRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ClusterIdentifier: S.optional(S.String),
    SecretArn: S.optional(S.String),
    DbUser: S.optional(S.String),
    Database: S.String,
    ConnectedDatabase: S.optional(S.String),
    SchemaPattern: S.optional(S.String),
    TablePattern: S.optional(S.String),
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
    WorkgroupName: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListTablesRequest",
});
export const TableMember = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    name: S.optional(S.String),
    type: S.optional(S.String),
    schema: S.optional(S.String),
})).annotate({ identifier: "TableMember" });
export const TableList = /*@__PURE__*/ /*#__PURE__*/ S.Array(TableMember);
export const ListTablesResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Tables: S.optional(TableList), NextToken: S.optional(S.String) })).annotate({
    identifier: "ListTablesResponse",
});
//# Errors
export class ActiveSessionsExceededException extends S.TaggedErrorClass()("ActiveSessionsExceededException", { Message: S.optional(S.String) }).pipe(C.withBadRequestError) {
}
export class ActiveStatementsExceededException extends S.TaggedErrorClass()("ActiveStatementsExceededException", { Message: S.optional(S.String) }).pipe(C.withBadRequestError) {
}
export class BatchExecuteStatementException extends S.TaggedErrorClass()("BatchExecuteStatementException", { Message: S.String, StatementId: S.String }).pipe(C.withServerError) {
}
export class InternalServerException extends S.TaggedErrorClass()("InternalServerException", { Message: S.String }).pipe(C.withServerError) {
}
export class ResourceNotFoundException extends S.TaggedErrorClass()("ResourceNotFoundException", { Message: S.String, ResourceId: S.String }).pipe(C.withBadRequestError) {
}
export class ValidationException extends S.TaggedErrorClass()("ValidationException", { Message: S.optional(S.String) }).pipe(C.withBadRequestError) {
}
export class DatabaseConnectionException extends S.TaggedErrorClass()("DatabaseConnectionException", { Message: S.String }).pipe(C.withServerError) {
}
export class QueryTimeoutException extends S.TaggedErrorClass()("QueryTimeoutException", { Message: S.optional(S.String) }).pipe(C.withBadRequestError) {
}
export class ExecuteStatementException extends S.TaggedErrorClass()("ExecuteStatementException", { Message: S.String, StatementId: S.String }).pipe(C.withServerError) {
}
/**
 * Runs one or more SQL statements, which can be data manipulation language (DML) or data definition language (DDL). Depending on the authorization method, use one of the following combinations of request parameters:
 *
 * - Secrets Manager - when connecting to a cluster, provide the `secret-arn` of a secret stored in Secrets Manager which has `username` and `password`. The specified secret contains credentials to connect to the `database` you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (`dbClusterIdentifier`), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
 *
 * - Temporary credentials - when connecting to your data warehouse, choose one of the following options:
 *
 * - When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift-serverless:GetCredentials` operation is required.
 *
 * - When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift:GetClusterCredentialsWithIAM` operation is required.
 *
 * - When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the `redshift:GetClusterCredentials` operation is required.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const batchExecuteStatement = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: BatchExecuteStatementInput,
    output: BatchExecuteStatementOutput,
    errors: [
        ActiveSessionsExceededException,
        ActiveStatementsExceededException,
        BatchExecuteStatementException,
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Cancels a running query. To be canceled, a query must be running.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const cancelStatement = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CancelStatementRequest,
    output: CancelStatementResponse,
    errors: [
        DatabaseConnectionException,
        InternalServerException,
        QueryTimeoutException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Describes the details about a specific instance when a query was run by the Amazon Redshift Data API. The information includes when the query started, when it finished, the query status, the number of rows returned, and the SQL statement.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const describeStatement = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DescribeStatementRequest,
    output: DescribeStatementResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Describes the detailed information about a table from metadata in the cluster. The information includes its columns. A token is returned to page through the column list. Depending on the authorization method, use one of the following combinations of request parameters:
 *
 * - Secrets Manager - when connecting to a cluster, provide the `secret-arn` of a secret stored in Secrets Manager which has `username` and `password`. The specified secret contains credentials to connect to the `database` you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (`dbClusterIdentifier`), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
 *
 * - Temporary credentials - when connecting to your data warehouse, choose one of the following options:
 *
 * - When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift-serverless:GetCredentials` operation is required.
 *
 * - When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift:GetClusterCredentialsWithIAM` operation is required.
 *
 * - When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the `redshift:GetClusterCredentials` operation is required.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const describeTable = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: DescribeTableRequest,
    output: DescribeTableResponse,
    errors: [
        DatabaseConnectionException,
        InternalServerException,
        QueryTimeoutException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "ColumnList",
        pageSize: "MaxResults",
    },
}));
/**
 * Runs an SQL statement, which can be data manipulation language (DML) or data definition language (DDL). This statement must be a single SQL statement. Depending on the authorization method, use one of the following combinations of request parameters:
 *
 * - Secrets Manager - when connecting to a cluster, provide the `secret-arn` of a secret stored in Secrets Manager which has `username` and `password`. The specified secret contains credentials to connect to the `database` you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (`dbClusterIdentifier`), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
 *
 * - Temporary credentials - when connecting to your data warehouse, choose one of the following options:
 *
 * - When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift-serverless:GetCredentials` operation is required.
 *
 * - When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift:GetClusterCredentialsWithIAM` operation is required.
 *
 * - When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the `redshift:GetClusterCredentials` operation is required.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const executeStatement = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ExecuteStatementInput,
    output: ExecuteStatementOutput,
    errors: [
        ActiveSessionsExceededException,
        ActiveStatementsExceededException,
        ExecuteStatementException,
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Fetches the temporarily cached result of an SQL statement in JSON format. The `ExecuteStatement` or `BatchExecuteStatement` operation that ran the SQL statement must have specified `ResultFormat` as `JSON` , or let the format default to JSON. A token is returned to page through the statement results.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const getStatementResult = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: GetStatementResultRequest,
    output: GetStatementResultResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "Records",
    },
}));
/**
 * Fetches the temporarily cached result of an SQL statement in CSV format. The `ExecuteStatement` or `BatchExecuteStatement` operation that ran the SQL statement must have specified `ResultFormat` as `CSV`. A token is returned to page through the statement results.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const getStatementResultV2 = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: GetStatementResultV2Request,
    output: GetStatementResultV2Response,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "Records",
    },
}));
/**
 * List the databases in a cluster. A token is returned to page through the database list. Depending on the authorization method, use one of the following combinations of request parameters:
 *
 * - Secrets Manager - when connecting to a cluster, provide the `secret-arn` of a secret stored in Secrets Manager which has `username` and `password`. The specified secret contains credentials to connect to the `database` you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (`dbClusterIdentifier`), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
 *
 * - Temporary credentials - when connecting to your data warehouse, choose one of the following options:
 *
 * - When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift-serverless:GetCredentials` operation is required.
 *
 * - When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift:GetClusterCredentialsWithIAM` operation is required.
 *
 * - When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the `redshift:GetClusterCredentials` operation is required.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const listDatabases = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListDatabasesRequest,
    output: ListDatabasesResponse,
    errors: [
        DatabaseConnectionException,
        InternalServerException,
        QueryTimeoutException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "Databases",
        pageSize: "MaxResults",
    },
}));
/**
 * Lists the schemas in a database. A token is returned to page through the schema list. Depending on the authorization method, use one of the following combinations of request parameters:
 *
 * - Secrets Manager - when connecting to a cluster, provide the `secret-arn` of a secret stored in Secrets Manager which has `username` and `password`. The specified secret contains credentials to connect to the `database` you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (`dbClusterIdentifier`), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
 *
 * - Temporary credentials - when connecting to your data warehouse, choose one of the following options:
 *
 * - When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift-serverless:GetCredentials` operation is required.
 *
 * - When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift:GetClusterCredentialsWithIAM` operation is required.
 *
 * - When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the `redshift:GetClusterCredentials` operation is required.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const listSchemas = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListSchemasRequest,
    output: ListSchemasResponse,
    errors: [
        DatabaseConnectionException,
        InternalServerException,
        QueryTimeoutException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "Schemas",
        pageSize: "MaxResults",
    },
}));
/**
 * List of SQL statements. By default, only finished statements are shown. A token is returned to page through the statement list.
 *
 * When you use identity-enhanced role sessions to list statements, you must provide either the `cluster-identifier` or `workgroup-name` parameter. This ensures that the IdC user can only access the Amazon Redshift IdC applications they are assigned. For more information, see Trusted identity propagation overview.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const listStatements = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListStatementsRequest,
    output: ListStatementsResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "Statements",
        pageSize: "MaxResults",
    },
}));
/**
 * List the tables in a database. If neither `SchemaPattern` nor `TablePattern` are specified, then all tables in the database are returned. A token is returned to page through the table list. Depending on the authorization method, use one of the following combinations of request parameters:
 *
 * - Secrets Manager - when connecting to a cluster, provide the `secret-arn` of a secret stored in Secrets Manager which has `username` and `password`. The specified secret contains credentials to connect to the `database` you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (`dbClusterIdentifier`), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
 *
 * - Temporary credentials - when connecting to your data warehouse, choose one of the following options:
 *
 * - When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift-serverless:GetCredentials` operation is required.
 *
 * - When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, `arn:iam::123456789012:user:foo` has the database user name `IAM:foo`. Also, permission to call the `redshift:GetClusterCredentialsWithIAM` operation is required.
 *
 * - When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the `redshift:GetClusterCredentials` operation is required.
 *
 * For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the *Amazon Redshift Management Guide*.
 */
export const listTables = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListTablesRequest,
    output: ListTablesResponse,
    errors: [
        DatabaseConnectionException,
        InternalServerException,
        QueryTimeoutException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "Tables",
        pageSize: "MaxResults",
    },
}));
//# sourceMappingURL=redshift-data.js.map