repo_name stringlengths 1 52 | repo_creator stringclasses 6
values | programming_language stringclasses 4
values | code stringlengths 0 9.68M | num_lines int64 1 234k |
|---|---|---|---|---|
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Ends a SQL transaction started with the BeginTransaction operation and commits
// the changes.
func (c *Client) CommitTransaction(ctx context.Context, params *CommitTransactionInput, optFns ...func(*Options)) (*CommitTransactionOutput, error) {
if params == nil {
params = &CommitTransactionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CommitTransaction", params, optFns, c.addOperationCommitTransactionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CommitTransactionOutput)
out.ResultMetadata = metadata
return out, nil
}
// The request parameters represent the input of a commit transaction request.
type CommitTransactionInput struct {
// The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
//
// This member is required.
ResourceArn *string
// The name or ARN of the secret that enables access to the DB cluster.
//
// This member is required.
SecretArn *string
// The identifier of the transaction to end and commit.
//
// This member is required.
TransactionId *string
noSmithyDocumentSerde
}
// The response elements represent the output of a commit transaction request.
type CommitTransactionOutput struct {
// The status of the commit operation.
TransactionStatus *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCommitTransactionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpCommitTransaction{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCommitTransaction{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCommitTransactionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCommitTransaction(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCommitTransaction(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds-data",
OperationName: "CommitTransaction",
}
}
| 137 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rdsdata/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Runs one or more SQL statements. This operation is deprecated. Use the
// BatchExecuteStatement or ExecuteStatement operation.
//
// Deprecated: The ExecuteSql API is deprecated, please use the ExecuteStatement
// API.
func (c *Client) ExecuteSql(ctx context.Context, params *ExecuteSqlInput, optFns ...func(*Options)) (*ExecuteSqlOutput, error) {
if params == nil {
params = &ExecuteSqlInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ExecuteSql", params, optFns, c.addOperationExecuteSqlMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ExecuteSqlOutput)
out.ResultMetadata = metadata
return out, nil
}
// The request parameters represent the input of a request to run one or more SQL
// statements.
type ExecuteSqlInput struct {
// The Amazon Resource Name (ARN) of the secret that enables access to the DB
// cluster. Enter the database user name and password for the credentials in the
// secret. For information about creating the secret, see Create a database secret (https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_database_secret.html)
// .
//
// This member is required.
AwsSecretStoreArn *string
// The ARN of the Aurora Serverless DB cluster.
//
// This member is required.
DbClusterOrInstanceArn *string
// One or more SQL statements to run on the DB cluster. You can separate SQL
// statements from each other with a semicolon (;). Any valid SQL statement is
// permitted, including data definition, data manipulation, and commit statements.
//
// This member is required.
SqlStatements *string
// The name of the database.
Database *string
// The name of the database schema.
Schema *string
noSmithyDocumentSerde
}
// The response elements represent the output of a request to run one or more SQL
// statements.
type ExecuteSqlOutput struct {
// The results of the SQL statement or statements.
SqlStatementResults []types.SqlStatementResult
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationExecuteSqlMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteSql{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteSql{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpExecuteSqlValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteSql(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opExecuteSql(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds-data",
OperationName: "ExecuteSql",
}
}
| 154 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rdsdata/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Runs a SQL statement against a database. If a call isn't part of a transaction
// because it doesn't include the transactionID parameter, changes that result
// from the call are committed automatically. If the binary response data from the
// database is more than 1 MB, the call is terminated.
func (c *Client) ExecuteStatement(ctx context.Context, params *ExecuteStatementInput, optFns ...func(*Options)) (*ExecuteStatementOutput, error) {
if params == nil {
params = &ExecuteStatementInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ExecuteStatement", params, optFns, c.addOperationExecuteStatementMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ExecuteStatementOutput)
out.ResultMetadata = metadata
return out, nil
}
// The request parameters represent the input of a request to run a SQL statement
// against a database.
type ExecuteStatementInput struct {
// The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
//
// This member is required.
ResourceArn *string
// The ARN of the secret that enables access to the DB cluster. Enter the database
// user name and password for the credentials in the secret. For information about
// creating the secret, see Create a database secret (https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_database_secret.html)
// .
//
// This member is required.
SecretArn *string
// The SQL statement to run.
//
// This member is required.
Sql *string
// A value that indicates whether to continue running the statement after the call
// times out. By default, the statement stops running when the call times out. For
// DDL statements, we recommend continuing to run the statement after the call
// times out. When a DDL statement terminates before it is finished running, it can
// result in errors and possibly corrupted data structures.
ContinueAfterTimeout bool
// The name of the database.
Database *string
// A value that indicates whether to format the result set as a single JSON
// string. This parameter only applies to SELECT statements and is ignored for
// other types of statements. Allowed values are NONE and JSON . The default value
// is NONE . The result is returned in the formattedRecords field. For usage
// information about the JSON format for result sets, see Using the Data API (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html)
// in the Amazon Aurora User Guide.
FormatRecordsAs types.RecordsFormatType
// A value that indicates whether to include metadata in the results.
IncludeResultMetadata bool
// The parameters for the SQL statement. Array parameters are not supported.
Parameters []types.SqlParameter
// Options that control how the result set is returned.
ResultSetOptions *types.ResultSetOptions
// The name of the database schema. Currently, the schema parameter isn't
// supported.
Schema *string
// The identifier of a transaction that was started by using the BeginTransaction
// operation. Specify the transaction ID of the transaction that you want to
// include the SQL statement in. If the SQL statement is not part of a transaction,
// don't set this parameter.
TransactionId *string
noSmithyDocumentSerde
}
// The response elements represent the output of a request to run a SQL statement
// against a database.
type ExecuteStatementOutput struct {
// Metadata for the columns included in the results. This field is blank if the
// formatRecordsAs parameter is set to JSON .
ColumnMetadata []types.ColumnMetadata
// A string value that represents the result set of a SELECT statement in JSON
// format. This value is only present when the formatRecordsAs parameter is set to
// JSON . The size limit for this field is currently 10 MB. If the JSON-formatted
// string representing the result set requires more than 10 MB, the call returns an
// error.
FormattedRecords *string
// Values for fields generated during a DML request. The generatedFields data
// isn't supported by Aurora PostgreSQL. To get the values of generated fields, use
// the RETURNING clause. For more information, see Returning Data From Modified
// Rows (https://www.postgresql.org/docs/10/dml-returning.html) in the PostgreSQL
// documentation.
GeneratedFields []types.Field
// The number of records updated by the request.
NumberOfRecordsUpdated int64
// The records returned by the SQL statement. This field is blank if the
// formatRecordsAs parameter is set to JSON .
Records [][]types.Field
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationExecuteStatementMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteStatement{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteStatement{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpExecuteStatementValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteStatement(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opExecuteStatement(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds-data",
OperationName: "ExecuteStatement",
}
}
| 204 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Performs a rollback of a transaction. Rolling back a transaction cancels its
// changes.
func (c *Client) RollbackTransaction(ctx context.Context, params *RollbackTransactionInput, optFns ...func(*Options)) (*RollbackTransactionOutput, error) {
if params == nil {
params = &RollbackTransactionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "RollbackTransaction", params, optFns, c.addOperationRollbackTransactionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*RollbackTransactionOutput)
out.ResultMetadata = metadata
return out, nil
}
// The request parameters represent the input of a request to perform a rollback
// of a transaction.
type RollbackTransactionInput struct {
// The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
//
// This member is required.
ResourceArn *string
// The name or ARN of the secret that enables access to the DB cluster.
//
// This member is required.
SecretArn *string
// The identifier of the transaction to roll back.
//
// This member is required.
TransactionId *string
noSmithyDocumentSerde
}
// The response elements represent the output of a request to perform a rollback
// of a transaction.
type RollbackTransactionOutput struct {
// The status of the rollback operation.
TransactionStatus *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationRollbackTransactionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpRollbackTransaction{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRollbackTransaction{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpRollbackTransactionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRollbackTransaction(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opRollbackTransaction(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds-data",
OperationName: "RollbackTransaction",
}
}
| 139 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/rdsdata/types"
smithy "github.com/aws/smithy-go"
smithyio "github.com/aws/smithy-go/io"
"github.com/aws/smithy-go/middleware"
"github.com/aws/smithy-go/ptr"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
"math"
"strings"
)
type awsRestjson1_deserializeOpBatchExecuteStatement struct {
}
func (*awsRestjson1_deserializeOpBatchExecuteStatement) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpBatchExecuteStatement) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorBatchExecuteStatement(response, &metadata)
}
output := &BatchExecuteStatementOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentBatchExecuteStatementOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorBatchExecuteStatement(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("BadRequestException", errorCode):
return awsRestjson1_deserializeErrorBadRequestException(response, errorBody)
case strings.EqualFold("ForbiddenException", errorCode):
return awsRestjson1_deserializeErrorForbiddenException(response, errorBody)
case strings.EqualFold("InternalServerErrorException", errorCode):
return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody)
case strings.EqualFold("ServiceUnavailableError", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableError(response, errorBody)
case strings.EqualFold("StatementTimeoutException", errorCode):
return awsRestjson1_deserializeErrorStatementTimeoutException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentBatchExecuteStatementOutput(v **BatchExecuteStatementOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *BatchExecuteStatementOutput
if *v == nil {
sv = &BatchExecuteStatementOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "updateResults":
if err := awsRestjson1_deserializeDocumentUpdateResults(&sv.UpdateResults, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpBeginTransaction struct {
}
func (*awsRestjson1_deserializeOpBeginTransaction) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpBeginTransaction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorBeginTransaction(response, &metadata)
}
output := &BeginTransactionOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentBeginTransactionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorBeginTransaction(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("BadRequestException", errorCode):
return awsRestjson1_deserializeErrorBadRequestException(response, errorBody)
case strings.EqualFold("ForbiddenException", errorCode):
return awsRestjson1_deserializeErrorForbiddenException(response, errorBody)
case strings.EqualFold("InternalServerErrorException", errorCode):
return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody)
case strings.EqualFold("ServiceUnavailableError", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableError(response, errorBody)
case strings.EqualFold("StatementTimeoutException", errorCode):
return awsRestjson1_deserializeErrorStatementTimeoutException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentBeginTransactionOutput(v **BeginTransactionOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *BeginTransactionOutput
if *v == nil {
sv = &BeginTransactionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "transactionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.TransactionId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCommitTransaction struct {
}
func (*awsRestjson1_deserializeOpCommitTransaction) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCommitTransaction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorCommitTransaction(response, &metadata)
}
output := &CommitTransactionOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentCommitTransactionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCommitTransaction(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("BadRequestException", errorCode):
return awsRestjson1_deserializeErrorBadRequestException(response, errorBody)
case strings.EqualFold("ForbiddenException", errorCode):
return awsRestjson1_deserializeErrorForbiddenException(response, errorBody)
case strings.EqualFold("InternalServerErrorException", errorCode):
return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody)
case strings.EqualFold("NotFoundException", errorCode):
return awsRestjson1_deserializeErrorNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableError", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableError(response, errorBody)
case strings.EqualFold("StatementTimeoutException", errorCode):
return awsRestjson1_deserializeErrorStatementTimeoutException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCommitTransactionOutput(v **CommitTransactionOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *CommitTransactionOutput
if *v == nil {
sv = &CommitTransactionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "transactionStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TransactionStatus to be of type string, got %T instead", value)
}
sv.TransactionStatus = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpExecuteSql struct {
}
func (*awsRestjson1_deserializeOpExecuteSql) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpExecuteSql) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorExecuteSql(response, &metadata)
}
output := &ExecuteSqlOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentExecuteSqlOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorExecuteSql(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("BadRequestException", errorCode):
return awsRestjson1_deserializeErrorBadRequestException(response, errorBody)
case strings.EqualFold("ForbiddenException", errorCode):
return awsRestjson1_deserializeErrorForbiddenException(response, errorBody)
case strings.EqualFold("InternalServerErrorException", errorCode):
return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody)
case strings.EqualFold("ServiceUnavailableError", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableError(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentExecuteSqlOutput(v **ExecuteSqlOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *ExecuteSqlOutput
if *v == nil {
sv = &ExecuteSqlOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "sqlStatementResults":
if err := awsRestjson1_deserializeDocumentSqlStatementResults(&sv.SqlStatementResults, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpExecuteStatement struct {
}
func (*awsRestjson1_deserializeOpExecuteStatement) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpExecuteStatement) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorExecuteStatement(response, &metadata)
}
output := &ExecuteStatementOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentExecuteStatementOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorExecuteStatement(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("BadRequestException", errorCode):
return awsRestjson1_deserializeErrorBadRequestException(response, errorBody)
case strings.EqualFold("ForbiddenException", errorCode):
return awsRestjson1_deserializeErrorForbiddenException(response, errorBody)
case strings.EqualFold("InternalServerErrorException", errorCode):
return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody)
case strings.EqualFold("ServiceUnavailableError", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableError(response, errorBody)
case strings.EqualFold("StatementTimeoutException", errorCode):
return awsRestjson1_deserializeErrorStatementTimeoutException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentExecuteStatementOutput(v **ExecuteStatementOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *ExecuteStatementOutput
if *v == nil {
sv = &ExecuteStatementOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "columnMetadata":
if err := awsRestjson1_deserializeDocumentMetadata(&sv.ColumnMetadata, value); err != nil {
return err
}
case "formattedRecords":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected FormattedSqlRecords to be of type string, got %T instead", value)
}
sv.FormattedRecords = ptr.String(jtv)
}
case "generatedFields":
if err := awsRestjson1_deserializeDocumentFieldList(&sv.GeneratedFields, value); err != nil {
return err
}
case "numberOfRecordsUpdated":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected RecordsUpdated to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.NumberOfRecordsUpdated = i64
}
case "records":
if err := awsRestjson1_deserializeDocumentSqlRecords(&sv.Records, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpRollbackTransaction struct {
}
func (*awsRestjson1_deserializeOpRollbackTransaction) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpRollbackTransaction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorRollbackTransaction(response, &metadata)
}
output := &RollbackTransactionOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentRollbackTransactionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorRollbackTransaction(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("BadRequestException", errorCode):
return awsRestjson1_deserializeErrorBadRequestException(response, errorBody)
case strings.EqualFold("ForbiddenException", errorCode):
return awsRestjson1_deserializeErrorForbiddenException(response, errorBody)
case strings.EqualFold("InternalServerErrorException", errorCode):
return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody)
case strings.EqualFold("NotFoundException", errorCode):
return awsRestjson1_deserializeErrorNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableError", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableError(response, errorBody)
case strings.EqualFold("StatementTimeoutException", errorCode):
return awsRestjson1_deserializeErrorStatementTimeoutException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentRollbackTransactionOutput(v **RollbackTransactionOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *RollbackTransactionOutput
if *v == nil {
sv = &RollbackTransactionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "transactionStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TransactionStatus to be of type string, got %T instead", value)
}
sv.TransactionStatus = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.AccessDeniedException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.BadRequestException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorForbiddenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ForbiddenException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentForbiddenException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorInternalServerErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InternalServerErrorException{}
return output
}
func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.NotFoundException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorServiceUnavailableError(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ServiceUnavailableError{}
return output
}
func awsRestjson1_deserializeErrorStatementTimeoutException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.StatementTimeoutException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentStatementTimeoutException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.AccessDeniedException
if *v == nil {
sv = &types.AccessDeniedException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentArrayOfArray(v *[]types.ArrayValue, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.ArrayValue
if *v == nil {
cv = []types.ArrayValue{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ArrayValue
if err := awsRestjson1_deserializeDocumentArrayValue(&col, value); err != nil {
return err
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentArrayValue(v *types.ArrayValue, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var uv types.ArrayValue
loop:
for key, value := range shape {
if value == nil {
continue
}
switch key {
case "arrayValues":
var mv []types.ArrayValue
if err := awsRestjson1_deserializeDocumentArrayOfArray(&mv, value); err != nil {
return err
}
uv = &types.ArrayValueMemberArrayValues{Value: mv}
break loop
case "booleanValues":
var mv []bool
if err := awsRestjson1_deserializeDocumentBooleanArray(&mv, value); err != nil {
return err
}
uv = &types.ArrayValueMemberBooleanValues{Value: mv}
break loop
case "doubleValues":
var mv []float64
if err := awsRestjson1_deserializeDocumentDoubleArray(&mv, value); err != nil {
return err
}
uv = &types.ArrayValueMemberDoubleValues{Value: mv}
break loop
case "longValues":
var mv []int64
if err := awsRestjson1_deserializeDocumentLongArray(&mv, value); err != nil {
return err
}
uv = &types.ArrayValueMemberLongValues{Value: mv}
break loop
case "stringValues":
var mv []string
if err := awsRestjson1_deserializeDocumentStringArray(&mv, value); err != nil {
return err
}
uv = &types.ArrayValueMemberStringValues{Value: mv}
break loop
default:
uv = &types.UnknownUnionMember{Tag: key}
break loop
}
}
*v = uv
return nil
}
func awsRestjson1_deserializeDocumentArrayValueList(v *[]types.Value, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Value
if *v == nil {
cv = []types.Value{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Value
if err := awsRestjson1_deserializeDocumentValue(&col, value); err != nil {
return err
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.BadRequestException
if *v == nil {
sv = &types.BadRequestException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentBooleanArray(v *[]bool, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []bool
if *v == nil {
cv = []bool{}
} else {
cv = *v
}
for _, value := range shape {
var col bool
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentColumnMetadata(v **types.ColumnMetadata, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ColumnMetadata
if *v == nil {
sv = &types.ColumnMetadata{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arrayBaseColumnType":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ArrayBaseColumnType = int32(i64)
}
case "isAutoIncrement":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsAutoIncrement = jtv
}
case "isCaseSensitive":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsCaseSensitive = jtv
}
case "isCurrency":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsCurrency = jtv
}
case "isSigned":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsSigned = jtv
}
case "label":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Label = ptr.String(jtv)
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "nullable":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Nullable = int32(i64)
}
case "precision":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Precision = int32(i64)
}
case "scale":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Scale = int32(i64)
}
case "schemaName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SchemaName = ptr.String(jtv)
}
case "tableName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.TableName = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Type = int32(i64)
}
case "typeName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.TypeName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDoubleArray(v *[]float64, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []float64
if *v == nil {
cv = []float64{}
} else {
cv = *v
}
for _, value := range shape {
var col float64
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
col = f64
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
col = f64
default:
return fmt.Errorf("expected BoxedDouble to be a JSON Number, got %T instead", value)
}
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentField(v *types.Field, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var uv types.Field
loop:
for key, value := range shape {
if value == nil {
continue
}
switch key {
case "arrayValue":
var mv types.ArrayValue
if err := awsRestjson1_deserializeDocumentArrayValue(&mv, value); err != nil {
return err
}
uv = &types.FieldMemberArrayValue{Value: mv}
break loop
case "blobValue":
var mv []byte
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Blob to be []byte, got %T instead", value)
}
dv, err := base64.StdEncoding.DecodeString(jtv)
if err != nil {
return fmt.Errorf("failed to base64 decode Blob, %w", err)
}
mv = dv
}
uv = &types.FieldMemberBlobValue{Value: mv}
break loop
case "booleanValue":
var mv bool
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value)
}
mv = jtv
}
uv = &types.FieldMemberBooleanValue{Value: mv}
break loop
case "doubleValue":
var mv float64
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
mv = f64
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
mv = f64
default:
return fmt.Errorf("expected BoxedDouble to be a JSON Number, got %T instead", value)
}
}
uv = &types.FieldMemberDoubleValue{Value: mv}
break loop
case "isNull":
var mv bool
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value)
}
mv = jtv
}
uv = &types.FieldMemberIsNull{Value: mv}
break loop
case "longValue":
var mv int64
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected BoxedLong to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
mv = i64
}
uv = &types.FieldMemberLongValue{Value: mv}
break loop
case "stringValue":
var mv string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
mv = jtv
}
uv = &types.FieldMemberStringValue{Value: mv}
break loop
default:
uv = &types.UnknownUnionMember{Tag: key}
break loop
}
}
*v = uv
return nil
}
func awsRestjson1_deserializeDocumentFieldList(v *[]types.Field, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Field
if *v == nil {
cv = []types.Field{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Field
if err := awsRestjson1_deserializeDocumentField(&col, value); err != nil {
return err
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentForbiddenException(v **types.ForbiddenException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ForbiddenException
if *v == nil {
sv = &types.ForbiddenException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInternalServerErrorException(v **types.InternalServerErrorException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.InternalServerErrorException
if *v == nil {
sv = &types.InternalServerErrorException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentLongArray(v *[]int64, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []int64
if *v == nil {
cv = []int64{}
} else {
cv = *v
}
for _, value := range shape {
var col int64
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected BoxedLong to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
col = i64
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentMetadata(v *[]types.ColumnMetadata, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.ColumnMetadata
if *v == nil {
cv = []types.ColumnMetadata{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ColumnMetadata
destAddr := &col
if err := awsRestjson1_deserializeDocumentColumnMetadata(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.NotFoundException
if *v == nil {
sv = &types.NotFoundException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentRecord(v **types.Record, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.Record
if *v == nil {
sv = &types.Record{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "values":
if err := awsRestjson1_deserializeDocumentRow(&sv.Values, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentRecords(v *[]types.Record, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Record
if *v == nil {
cv = []types.Record{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Record
destAddr := &col
if err := awsRestjson1_deserializeDocumentRecord(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResultFrame(v **types.ResultFrame, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ResultFrame
if *v == nil {
sv = &types.ResultFrame{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "records":
if err := awsRestjson1_deserializeDocumentRecords(&sv.Records, value); err != nil {
return err
}
case "resultSetMetadata":
if err := awsRestjson1_deserializeDocumentResultSetMetadata(&sv.ResultSetMetadata, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResultSetMetadata(v **types.ResultSetMetadata, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ResultSetMetadata
if *v == nil {
sv = &types.ResultSetMetadata{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "columnCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ColumnCount = i64
}
case "columnMetadata":
if err := awsRestjson1_deserializeDocumentMetadata(&sv.ColumnMetadata, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentRow(v *[]types.Value, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Value
if *v == nil {
cv = []types.Value{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Value
if err := awsRestjson1_deserializeDocumentValue(&col, value); err != nil {
return err
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentServiceUnavailableError(v **types.ServiceUnavailableError, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ServiceUnavailableError
if *v == nil {
sv = &types.ServiceUnavailableError{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSqlRecords(v *[][]types.Field, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv [][]types.Field
if *v == nil {
cv = [][]types.Field{}
} else {
cv = *v
}
for _, value := range shape {
var col []types.Field
if err := awsRestjson1_deserializeDocumentFieldList(&col, value); err != nil {
return err
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentSqlStatementResult(v **types.SqlStatementResult, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.SqlStatementResult
if *v == nil {
sv = &types.SqlStatementResult{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "numberOfRecordsUpdated":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected RecordsUpdated to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.NumberOfRecordsUpdated = i64
}
case "resultFrame":
if err := awsRestjson1_deserializeDocumentResultFrame(&sv.ResultFrame, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSqlStatementResults(v *[]types.SqlStatementResult, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.SqlStatementResult
if *v == nil {
cv = []types.SqlStatementResult{}
} else {
cv = *v
}
for _, value := range shape {
var col types.SqlStatementResult
destAddr := &col
if err := awsRestjson1_deserializeDocumentSqlStatementResult(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentStatementTimeoutException(v **types.StatementTimeoutException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.StatementTimeoutException
if *v == nil {
sv = &types.StatementTimeoutException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "dbConnectionId":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.DbConnectionId = i64
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStringArray(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentStructValue(v **types.StructValue, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.StructValue
if *v == nil {
sv = &types.StructValue{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "attributes":
if err := awsRestjson1_deserializeDocumentArrayValueList(&sv.Attributes, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentUpdateResult(v **types.UpdateResult, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.UpdateResult
if *v == nil {
sv = &types.UpdateResult{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "generatedFields":
if err := awsRestjson1_deserializeDocumentFieldList(&sv.GeneratedFields, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentUpdateResults(v *[]types.UpdateResult, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.UpdateResult
if *v == nil {
cv = []types.UpdateResult{}
} else {
cv = *v
}
for _, value := range shape {
var col types.UpdateResult
destAddr := &col
if err := awsRestjson1_deserializeDocumentUpdateResult(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentValue(v *types.Value, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var uv types.Value
loop:
for key, value := range shape {
if value == nil {
continue
}
switch key {
case "arrayValues":
var mv []types.Value
if err := awsRestjson1_deserializeDocumentArrayValueList(&mv, value); err != nil {
return err
}
uv = &types.ValueMemberArrayValues{Value: mv}
break loop
case "bigIntValue":
var mv int64
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected BoxedLong to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
mv = i64
}
uv = &types.ValueMemberBigIntValue{Value: mv}
break loop
case "bitValue":
var mv bool
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value)
}
mv = jtv
}
uv = &types.ValueMemberBitValue{Value: mv}
break loop
case "blobValue":
var mv []byte
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Blob to be []byte, got %T instead", value)
}
dv, err := base64.StdEncoding.DecodeString(jtv)
if err != nil {
return fmt.Errorf("failed to base64 decode Blob, %w", err)
}
mv = dv
}
uv = &types.ValueMemberBlobValue{Value: mv}
break loop
case "doubleValue":
var mv float64
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
mv = f64
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
mv = f64
default:
return fmt.Errorf("expected BoxedDouble to be a JSON Number, got %T instead", value)
}
}
uv = &types.ValueMemberDoubleValue{Value: mv}
break loop
case "intValue":
var mv int32
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected BoxedInteger to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
mv = int32(i64)
}
uv = &types.ValueMemberIntValue{Value: mv}
break loop
case "isNull":
var mv bool
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value)
}
mv = jtv
}
uv = &types.ValueMemberIsNull{Value: mv}
break loop
case "realValue":
var mv float32
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
mv = float32(f64)
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
mv = float32(f64)
default:
return fmt.Errorf("expected BoxedFloat to be a JSON Number, got %T instead", value)
}
}
uv = &types.ValueMemberRealValue{Value: mv}
break loop
case "stringValue":
var mv string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
mv = jtv
}
uv = &types.ValueMemberStringValue{Value: mv}
break loop
case "structValue":
var mv types.StructValue
destAddr := &mv
if err := awsRestjson1_deserializeDocumentStructValue(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.ValueMemberStructValue{Value: mv}
break loop
default:
uv = &types.UnknownUnionMember{Tag: key}
break loop
}
}
*v = uv
return nil
}
| 2,818 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package rdsdata provides the API client, operations, and parameter types for
// AWS RDS DataService.
//
// Amazon RDS Data Service Amazon RDS provides an HTTP endpoint to run SQL
// statements on an Amazon Aurora Serverless v1 DB cluster. To run these
// statements, you work with the Data Service API. The Data Service API isn't
// supported on Amazon Aurora Serverless v2 DB clusters. For more information about
// the Data Service API, see Using the Data API (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html)
// in the Amazon Aurora User Guide.
package rdsdata
| 13 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"context"
"errors"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
internalendpoints "github.com/aws/aws-sdk-go-v2/service/rdsdata/internal/endpoints"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net/url"
"strings"
)
// EndpointResolverOptions is the service endpoint resolver options
type EndpointResolverOptions = internalendpoints.Options
// EndpointResolver interface for resolving service endpoints.
type EndpointResolver interface {
ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error)
}
var _ EndpointResolver = &internalendpoints.Resolver{}
// NewDefaultEndpointResolver constructs a new service endpoint resolver
func NewDefaultEndpointResolver() *internalendpoints.Resolver {
return internalendpoints.New()
}
// EndpointResolverFunc is a helper utility that wraps a function so it satisfies
// the EndpointResolver interface. This is useful when you want to add additional
// endpoint resolving logic, or stub out specific endpoints with custom values.
type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error)
func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
return fn(region, options)
}
func resolveDefaultEndpointConfiguration(o *Options) {
if o.EndpointResolver != nil {
return
}
o.EndpointResolver = NewDefaultEndpointResolver()
}
// EndpointResolverFromURL returns an EndpointResolver configured using the
// provided endpoint url. By default, the resolved endpoint resolver uses the
// client region as signing region, and the endpoint source is set to
// EndpointSourceCustom.You can provide functional options to configure endpoint
// values for the resolved endpoint.
func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver {
e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom}
for _, fn := range optFns {
fn(&e)
}
return EndpointResolverFunc(
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
if len(e.SigningRegion) == 0 {
e.SigningRegion = region
}
return e, nil
},
)
}
type ResolveEndpoint struct {
Resolver EndpointResolver
Options EndpointResolverOptions
}
func (*ResolveEndpoint) ID() string {
return "ResolveEndpoint"
}
func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
req, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
}
if m.Resolver == nil {
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
}
eo := m.Options
eo.Logger = middleware.GetLogger(ctx)
var endpoint aws.Endpoint
endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo)
if err != nil {
return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
}
req.URL, err = url.Parse(endpoint.URL)
if err != nil {
return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err)
}
if len(awsmiddleware.GetSigningName(ctx)) == 0 {
signingName := endpoint.SigningName
if len(signingName) == 0 {
signingName = "rds-data"
}
ctx = awsmiddleware.SetSigningName(ctx, signingName)
}
ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source)
ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable)
ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion)
ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID)
return next.HandleSerialize(ctx, in)
}
func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error {
return stack.Serialize.Insert(&ResolveEndpoint{
Resolver: o.EndpointResolver,
Options: o.EndpointOptions,
}, "OperationSerializer", middleware.Before)
}
func removeResolveEndpointMiddleware(stack *middleware.Stack) error {
_, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID())
return err
}
type wrappedEndpointResolver struct {
awsResolver aws.EndpointResolverWithOptions
resolver EndpointResolver
}
func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
if w.awsResolver == nil {
goto fallback
}
endpoint, err = w.awsResolver.ResolveEndpoint(ServiceID, region, options)
if err == nil {
return endpoint, nil
}
if nf := (&aws.EndpointNotFoundError{}); !errors.As(err, &nf) {
return endpoint, err
}
fallback:
if w.resolver == nil {
return endpoint, fmt.Errorf("default endpoint resolver provided was nil")
}
return w.resolver.ResolveEndpoint(region, options)
}
type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error)
func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) {
return a(service, region)
}
var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil)
// withEndpointResolver returns an EndpointResolver that first delegates endpoint resolution to the awsResolver.
// If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided
// fallbackResolver for resolution.
//
// fallbackResolver must not be nil
func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions, fallbackResolver EndpointResolver) EndpointResolver {
var resolver aws.EndpointResolverWithOptions
if awsResolverWithOptions != nil {
resolver = awsResolverWithOptions
} else if awsResolver != nil {
resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint)
}
return &wrappedEndpointResolver{
awsResolver: resolver,
resolver: fallbackResolver,
}
}
func finalizeClientEndpointResolverOptions(options *Options) {
options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage()
if len(options.EndpointOptions.ResolvedRegion) == 0 {
const fipsInfix = "-fips-"
const fipsPrefix = "fips-"
const fipsSuffix = "-fips"
if strings.Contains(options.Region, fipsInfix) ||
strings.Contains(options.Region, fipsPrefix) ||
strings.Contains(options.Region, fipsSuffix) {
options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(
options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "")
options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled
}
}
}
| 201 |
aws-sdk-go-v2 | aws | Go | // Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT.
package rdsdata
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.13.12"
| 7 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
| 4 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/rdsdata/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/encoding/httpbinding"
smithyjson "github.com/aws/smithy-go/encoding/json"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"math"
)
type awsRestjson1_serializeOpBatchExecuteStatement struct {
}
func (*awsRestjson1_serializeOpBatchExecuteStatement) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpBatchExecuteStatement) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
input, ok := in.Parameters.(*BatchExecuteStatementInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/BatchExecute")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentBatchExecuteStatementInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsBatchExecuteStatementInput(v *BatchExecuteStatementInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentBatchExecuteStatementInput(v *BatchExecuteStatementInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Database != nil {
ok := object.Key("database")
ok.String(*v.Database)
}
if v.ParameterSets != nil {
ok := object.Key("parameterSets")
if err := awsRestjson1_serializeDocumentSqlParameterSets(v.ParameterSets, ok); err != nil {
return err
}
}
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.Schema != nil {
ok := object.Key("schema")
ok.String(*v.Schema)
}
if v.SecretArn != nil {
ok := object.Key("secretArn")
ok.String(*v.SecretArn)
}
if v.Sql != nil {
ok := object.Key("sql")
ok.String(*v.Sql)
}
if v.TransactionId != nil {
ok := object.Key("transactionId")
ok.String(*v.TransactionId)
}
return nil
}
type awsRestjson1_serializeOpBeginTransaction struct {
}
func (*awsRestjson1_serializeOpBeginTransaction) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpBeginTransaction) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
input, ok := in.Parameters.(*BeginTransactionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/BeginTransaction")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentBeginTransactionInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsBeginTransactionInput(v *BeginTransactionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentBeginTransactionInput(v *BeginTransactionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Database != nil {
ok := object.Key("database")
ok.String(*v.Database)
}
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.Schema != nil {
ok := object.Key("schema")
ok.String(*v.Schema)
}
if v.SecretArn != nil {
ok := object.Key("secretArn")
ok.String(*v.SecretArn)
}
return nil
}
type awsRestjson1_serializeOpCommitTransaction struct {
}
func (*awsRestjson1_serializeOpCommitTransaction) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCommitTransaction) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
input, ok := in.Parameters.(*CommitTransactionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/CommitTransaction")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentCommitTransactionInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsCommitTransactionInput(v *CommitTransactionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentCommitTransactionInput(v *CommitTransactionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.SecretArn != nil {
ok := object.Key("secretArn")
ok.String(*v.SecretArn)
}
if v.TransactionId != nil {
ok := object.Key("transactionId")
ok.String(*v.TransactionId)
}
return nil
}
type awsRestjson1_serializeOpExecuteSql struct {
}
func (*awsRestjson1_serializeOpExecuteSql) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpExecuteSql) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
input, ok := in.Parameters.(*ExecuteSqlInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/ExecuteSql")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentExecuteSqlInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsExecuteSqlInput(v *ExecuteSqlInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentExecuteSqlInput(v *ExecuteSqlInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.AwsSecretStoreArn != nil {
ok := object.Key("awsSecretStoreArn")
ok.String(*v.AwsSecretStoreArn)
}
if v.Database != nil {
ok := object.Key("database")
ok.String(*v.Database)
}
if v.DbClusterOrInstanceArn != nil {
ok := object.Key("dbClusterOrInstanceArn")
ok.String(*v.DbClusterOrInstanceArn)
}
if v.Schema != nil {
ok := object.Key("schema")
ok.String(*v.Schema)
}
if v.SqlStatements != nil {
ok := object.Key("sqlStatements")
ok.String(*v.SqlStatements)
}
return nil
}
type awsRestjson1_serializeOpExecuteStatement struct {
}
func (*awsRestjson1_serializeOpExecuteStatement) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpExecuteStatement) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
input, ok := in.Parameters.(*ExecuteStatementInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/Execute")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentExecuteStatementInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsExecuteStatementInput(v *ExecuteStatementInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentExecuteStatementInput(v *ExecuteStatementInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ContinueAfterTimeout {
ok := object.Key("continueAfterTimeout")
ok.Boolean(v.ContinueAfterTimeout)
}
if v.Database != nil {
ok := object.Key("database")
ok.String(*v.Database)
}
if len(v.FormatRecordsAs) > 0 {
ok := object.Key("formatRecordsAs")
ok.String(string(v.FormatRecordsAs))
}
if v.IncludeResultMetadata {
ok := object.Key("includeResultMetadata")
ok.Boolean(v.IncludeResultMetadata)
}
if v.Parameters != nil {
ok := object.Key("parameters")
if err := awsRestjson1_serializeDocumentSqlParametersList(v.Parameters, ok); err != nil {
return err
}
}
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.ResultSetOptions != nil {
ok := object.Key("resultSetOptions")
if err := awsRestjson1_serializeDocumentResultSetOptions(v.ResultSetOptions, ok); err != nil {
return err
}
}
if v.Schema != nil {
ok := object.Key("schema")
ok.String(*v.Schema)
}
if v.SecretArn != nil {
ok := object.Key("secretArn")
ok.String(*v.SecretArn)
}
if v.Sql != nil {
ok := object.Key("sql")
ok.String(*v.Sql)
}
if v.TransactionId != nil {
ok := object.Key("transactionId")
ok.String(*v.TransactionId)
}
return nil
}
type awsRestjson1_serializeOpRollbackTransaction struct {
}
func (*awsRestjson1_serializeOpRollbackTransaction) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpRollbackTransaction) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
input, ok := in.Parameters.(*RollbackTransactionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/RollbackTransaction")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentRollbackTransactionInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsRollbackTransactionInput(v *RollbackTransactionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentRollbackTransactionInput(v *RollbackTransactionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.SecretArn != nil {
ok := object.Key("secretArn")
ok.String(*v.SecretArn)
}
if v.TransactionId != nil {
ok := object.Key("transactionId")
ok.String(*v.TransactionId)
}
return nil
}
func awsRestjson1_serializeDocumentArrayOfArray(v []types.ArrayValue, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if vv := v[i]; vv == nil {
continue
}
if err := awsRestjson1_serializeDocumentArrayValue(v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentArrayValue(v types.ArrayValue, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
switch uv := v.(type) {
case *types.ArrayValueMemberArrayValues:
av := object.Key("arrayValues")
if err := awsRestjson1_serializeDocumentArrayOfArray(uv.Value, av); err != nil {
return err
}
case *types.ArrayValueMemberBooleanValues:
av := object.Key("booleanValues")
if err := awsRestjson1_serializeDocumentBooleanArray(uv.Value, av); err != nil {
return err
}
case *types.ArrayValueMemberDoubleValues:
av := object.Key("doubleValues")
if err := awsRestjson1_serializeDocumentDoubleArray(uv.Value, av); err != nil {
return err
}
case *types.ArrayValueMemberLongValues:
av := object.Key("longValues")
if err := awsRestjson1_serializeDocumentLongArray(uv.Value, av); err != nil {
return err
}
case *types.ArrayValueMemberStringValues:
av := object.Key("stringValues")
if err := awsRestjson1_serializeDocumentStringArray(uv.Value, av); err != nil {
return err
}
default:
return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v)
}
return nil
}
func awsRestjson1_serializeDocumentBooleanArray(v []bool, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.Boolean(v[i])
}
return nil
}
func awsRestjson1_serializeDocumentDoubleArray(v []float64, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
switch {
case math.IsNaN(v[i]):
av.String("NaN")
case math.IsInf(v[i], 1):
av.String("Infinity")
case math.IsInf(v[i], -1):
av.String("-Infinity")
default:
av.Double(v[i])
}
}
return nil
}
func awsRestjson1_serializeDocumentField(v types.Field, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
switch uv := v.(type) {
case *types.FieldMemberArrayValue:
av := object.Key("arrayValue")
if err := awsRestjson1_serializeDocumentArrayValue(uv.Value, av); err != nil {
return err
}
case *types.FieldMemberBlobValue:
av := object.Key("blobValue")
av.Base64EncodeBytes(uv.Value)
case *types.FieldMemberBooleanValue:
av := object.Key("booleanValue")
av.Boolean(uv.Value)
case *types.FieldMemberDoubleValue:
av := object.Key("doubleValue")
switch {
case math.IsNaN(uv.Value):
av.String("NaN")
case math.IsInf(uv.Value, 1):
av.String("Infinity")
case math.IsInf(uv.Value, -1):
av.String("-Infinity")
default:
av.Double(uv.Value)
}
case *types.FieldMemberIsNull:
av := object.Key("isNull")
av.Boolean(uv.Value)
case *types.FieldMemberLongValue:
av := object.Key("longValue")
av.Long(uv.Value)
case *types.FieldMemberStringValue:
av := object.Key("stringValue")
av.String(uv.Value)
default:
return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v)
}
return nil
}
func awsRestjson1_serializeDocumentLongArray(v []int64, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.Long(v[i])
}
return nil
}
func awsRestjson1_serializeDocumentResultSetOptions(v *types.ResultSetOptions, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.DecimalReturnType) > 0 {
ok := object.Key("decimalReturnType")
ok.String(string(v.DecimalReturnType))
}
if len(v.LongReturnType) > 0 {
ok := object.Key("longReturnType")
ok.String(string(v.LongReturnType))
}
return nil
}
func awsRestjson1_serializeDocumentSqlParameter(v *types.SqlParameter, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Name != nil {
ok := object.Key("name")
ok.String(*v.Name)
}
if len(v.TypeHint) > 0 {
ok := object.Key("typeHint")
ok.String(string(v.TypeHint))
}
if v.Value != nil {
ok := object.Key("value")
if err := awsRestjson1_serializeDocumentField(v.Value, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentSqlParameterSets(v [][]types.SqlParameter, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if vv := v[i]; vv == nil {
continue
}
if err := awsRestjson1_serializeDocumentSqlParametersList(v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentSqlParametersList(v []types.SqlParameter, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentSqlParameter(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentStringArray(v []string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(v[i])
}
return nil
}
| 806 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
import (
"context"
"fmt"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
)
type validateOpBatchExecuteStatement struct {
}
func (*validateOpBatchExecuteStatement) ID() string {
return "OperationInputValidation"
}
func (m *validateOpBatchExecuteStatement) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*BatchExecuteStatementInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpBatchExecuteStatementInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpBeginTransaction struct {
}
func (*validateOpBeginTransaction) ID() string {
return "OperationInputValidation"
}
func (m *validateOpBeginTransaction) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*BeginTransactionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpBeginTransactionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCommitTransaction struct {
}
func (*validateOpCommitTransaction) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCommitTransaction) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CommitTransactionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCommitTransactionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpExecuteSql struct {
}
func (*validateOpExecuteSql) ID() string {
return "OperationInputValidation"
}
func (m *validateOpExecuteSql) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ExecuteSqlInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpExecuteSqlInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpExecuteStatement struct {
}
func (*validateOpExecuteStatement) ID() string {
return "OperationInputValidation"
}
func (m *validateOpExecuteStatement) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ExecuteStatementInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpExecuteStatementInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpRollbackTransaction struct {
}
func (*validateOpRollbackTransaction) ID() string {
return "OperationInputValidation"
}
func (m *validateOpRollbackTransaction) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*RollbackTransactionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpRollbackTransactionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
func addOpBatchExecuteStatementValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpBatchExecuteStatement{}, middleware.After)
}
func addOpBeginTransactionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpBeginTransaction{}, middleware.After)
}
func addOpCommitTransactionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCommitTransaction{}, middleware.After)
}
func addOpExecuteSqlValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpExecuteSql{}, middleware.After)
}
func addOpExecuteStatementValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpExecuteStatement{}, middleware.After)
}
func addOpRollbackTransactionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpRollbackTransaction{}, middleware.After)
}
func validateOpBatchExecuteStatementInput(v *BatchExecuteStatementInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "BatchExecuteStatementInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.SecretArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("SecretArn"))
}
if v.Sql == nil {
invalidParams.Add(smithy.NewErrParamRequired("Sql"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpBeginTransactionInput(v *BeginTransactionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "BeginTransactionInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.SecretArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("SecretArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCommitTransactionInput(v *CommitTransactionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CommitTransactionInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.SecretArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("SecretArn"))
}
if v.TransactionId == nil {
invalidParams.Add(smithy.NewErrParamRequired("TransactionId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpExecuteSqlInput(v *ExecuteSqlInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ExecuteSqlInput"}
if v.DbClusterOrInstanceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("DbClusterOrInstanceArn"))
}
if v.AwsSecretStoreArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("AwsSecretStoreArn"))
}
if v.SqlStatements == nil {
invalidParams.Add(smithy.NewErrParamRequired("SqlStatements"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpExecuteStatementInput(v *ExecuteStatementInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ExecuteStatementInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.SecretArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("SecretArn"))
}
if v.Sql == nil {
invalidParams.Add(smithy.NewErrParamRequired("Sql"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpRollbackTransactionInput(v *RollbackTransactionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "RollbackTransactionInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.SecretArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("SecretArn"))
}
if v.TransactionId == nil {
invalidParams.Add(smithy.NewErrParamRequired("TransactionId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
| 278 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package endpoints
import (
"github.com/aws/aws-sdk-go-v2/aws"
endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2"
"github.com/aws/smithy-go/logging"
"regexp"
)
// Options is the endpoint resolver configuration options
type Options struct {
// Logger is a logging implementation that log events should be sent to.
Logger logging.Logger
// LogDeprecated indicates that deprecated endpoints should be logged to the
// provided logger.
LogDeprecated bool
// ResolvedRegion is used to override the region to be resolved, rather then the
// using the value passed to the ResolveEndpoint method. This value is used by the
// SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative
// name. You must not set this value directly in your application.
ResolvedRegion string
// DisableHTTPS informs the resolver to return an endpoint that does not use the
// HTTPS scheme.
DisableHTTPS bool
// UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint.
UseDualStackEndpoint aws.DualStackEndpointState
// UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint.
UseFIPSEndpoint aws.FIPSEndpointState
}
func (o Options) GetResolvedRegion() string {
return o.ResolvedRegion
}
func (o Options) GetDisableHTTPS() bool {
return o.DisableHTTPS
}
func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState {
return o.UseDualStackEndpoint
}
func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState {
return o.UseFIPSEndpoint
}
func transformToSharedOptions(options Options) endpoints.Options {
return endpoints.Options{
Logger: options.Logger,
LogDeprecated: options.LogDeprecated,
ResolvedRegion: options.ResolvedRegion,
DisableHTTPS: options.DisableHTTPS,
UseDualStackEndpoint: options.UseDualStackEndpoint,
UseFIPSEndpoint: options.UseFIPSEndpoint,
}
}
// Resolver RDS Data endpoint resolver
type Resolver struct {
partitions endpoints.Partitions
}
// ResolveEndpoint resolves the service endpoint for the given region and options
func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) {
if len(region) == 0 {
return endpoint, &aws.MissingRegionError{}
}
opt := transformToSharedOptions(options)
return r.partitions.ResolveEndpoint(region, opt)
}
// New returns a new Resolver
func New() *Resolver {
return &Resolver{
partitions: defaultPartitions,
}
}
var partitionRegexp = struct {
Aws *regexp.Regexp
AwsCn *regexp.Regexp
AwsIso *regexp.Regexp
AwsIsoB *regexp.Regexp
AwsIsoE *regexp.Regexp
AwsIsoF *regexp.Regexp
AwsUsGov *regexp.Regexp
}{
Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"),
AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"),
AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"),
AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"),
}
var defaultPartitions = endpoints.Partitions{
{
ID: "aws",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "rds-data.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "rds-data-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rds-data.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.Aws,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "ap-northeast-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-northeast-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-southeast-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-southeast-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-west-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-west-3",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "fips-us-east-1",
}: endpoints.Endpoint{
Hostname: "rds-data-fips.us-east-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-east-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-east-2",
}: endpoints.Endpoint{
Hostname: "rds-data-fips.us-east-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-east-2",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-west-1",
}: endpoints.Endpoint{
Hostname: "rds-data-fips.us-west-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-west-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-west-2",
}: endpoints.Endpoint{
Hostname: "rds-data-fips.us-west-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-west-2",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "us-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.us-east-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-east-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.us-east-2.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.us-west-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.us-west-2.amazonaws.com",
},
},
},
{
ID: "aws-cn",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "rds-data.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.{region}.amazonaws.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "rds-data-fips.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rds-data.{region}.amazonaws.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsCn,
IsRegionalized: true,
},
{
ID: "aws-iso",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rds-data.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIso,
IsRegionalized: true,
},
{
ID: "aws-iso-b",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rds-data.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoB,
IsRegionalized: true,
},
{
ID: "aws-iso-e",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rds-data.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoE,
IsRegionalized: true,
},
{
ID: "aws-iso-f",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rds-data.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoF,
IsRegionalized: true,
},
{
ID: "aws-us-gov",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "rds-data.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rds-data-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "rds-data-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rds-data.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsUsGov,
IsRegionalized: true,
},
}
| 401 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package endpoints
import (
"testing"
)
func TestRegexCompile(t *testing.T) {
_ = defaultPartitions
}
| 12 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
type DecimalReturnType string
// Enum values for DecimalReturnType
const (
DecimalReturnTypeString DecimalReturnType = "STRING"
DecimalReturnTypeDoubleOrLong DecimalReturnType = "DOUBLE_OR_LONG"
)
// Values returns all known values for DecimalReturnType. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (DecimalReturnType) Values() []DecimalReturnType {
return []DecimalReturnType{
"STRING",
"DOUBLE_OR_LONG",
}
}
type LongReturnType string
// Enum values for LongReturnType
const (
LongReturnTypeString LongReturnType = "STRING"
LongReturnTypeLong LongReturnType = "LONG"
)
// Values returns all known values for LongReturnType. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (LongReturnType) Values() []LongReturnType {
return []LongReturnType{
"STRING",
"LONG",
}
}
type RecordsFormatType string
// Enum values for RecordsFormatType
const (
RecordsFormatTypeNone RecordsFormatType = "NONE"
RecordsFormatTypeJson RecordsFormatType = "JSON"
)
// Values returns all known values for RecordsFormatType. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (RecordsFormatType) Values() []RecordsFormatType {
return []RecordsFormatType{
"NONE",
"JSON",
}
}
type TypeHint string
// Enum values for TypeHint
const (
TypeHintJson TypeHint = "JSON"
TypeHintUuid TypeHint = "UUID"
TypeHintTimestamp TypeHint = "TIMESTAMP"
TypeHintDate TypeHint = "DATE"
TypeHintTime TypeHint = "TIME"
TypeHintDecimal TypeHint = "DECIMAL"
)
// Values returns all known values for TypeHint. Note that this can be expanded in
// the future, and so it is only as up to date as the client. The ordering of this
// slice is not guaranteed to be stable across updates.
func (TypeHint) Values() []TypeHint {
return []TypeHint{
"JSON",
"UUID",
"TIMESTAMP",
"DATE",
"TIME",
"DECIMAL",
}
}
| 84 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
"fmt"
smithy "github.com/aws/smithy-go"
)
// You do not have sufficient access to perform this action.
type AccessDeniedException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *AccessDeniedException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *AccessDeniedException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *AccessDeniedException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "AccessDeniedException"
}
return *e.ErrorCodeOverride
}
func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// There is an error in the call or in a SQL statement.
type BadRequestException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *BadRequestException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *BadRequestException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *BadRequestException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "BadRequestException"
}
return *e.ErrorCodeOverride
}
func (e *BadRequestException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// There are insufficient privileges to make the call.
type ForbiddenException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ForbiddenException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ForbiddenException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ForbiddenException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ForbiddenException"
}
return *e.ErrorCodeOverride
}
func (e *ForbiddenException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// An internal error occurred.
type InternalServerErrorException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InternalServerErrorException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InternalServerErrorException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InternalServerErrorException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InternalServerErrorException"
}
return *e.ErrorCodeOverride
}
func (e *InternalServerErrorException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
// The resourceArn , secretArn , or transactionId value can't be found.
type NotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *NotFoundException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *NotFoundException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *NotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "NotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *NotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The service specified by the resourceArn parameter is not available.
type ServiceUnavailableError struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ServiceUnavailableError) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ServiceUnavailableError) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ServiceUnavailableError) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ServiceUnavailableError"
}
return *e.ErrorCodeOverride
}
func (e *ServiceUnavailableError) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
// The execution of the SQL statement timed out.
type StatementTimeoutException struct {
Message *string
ErrorCodeOverride *string
DbConnectionId int64
noSmithyDocumentSerde
}
func (e *StatementTimeoutException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *StatementTimeoutException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *StatementTimeoutException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "StatementTimeoutException"
}
return *e.ErrorCodeOverride
}
func (e *StatementTimeoutException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
| 193 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
smithydocument "github.com/aws/smithy-go/document"
)
// Contains an array.
//
// The following types satisfy this interface:
//
// ArrayValueMemberArrayValues
// ArrayValueMemberBooleanValues
// ArrayValueMemberDoubleValues
// ArrayValueMemberLongValues
// ArrayValueMemberStringValues
type ArrayValue interface {
isArrayValue()
}
// An array of arrays.
type ArrayValueMemberArrayValues struct {
Value []ArrayValue
noSmithyDocumentSerde
}
func (*ArrayValueMemberArrayValues) isArrayValue() {}
// An array of Boolean values.
type ArrayValueMemberBooleanValues struct {
Value []bool
noSmithyDocumentSerde
}
func (*ArrayValueMemberBooleanValues) isArrayValue() {}
// An array of floating-point numbers.
type ArrayValueMemberDoubleValues struct {
Value []float64
noSmithyDocumentSerde
}
func (*ArrayValueMemberDoubleValues) isArrayValue() {}
// An array of integers.
type ArrayValueMemberLongValues struct {
Value []int64
noSmithyDocumentSerde
}
func (*ArrayValueMemberLongValues) isArrayValue() {}
// An array of strings.
type ArrayValueMemberStringValues struct {
Value []string
noSmithyDocumentSerde
}
func (*ArrayValueMemberStringValues) isArrayValue() {}
// Contains the metadata for a column.
type ColumnMetadata struct {
// The type of the column.
ArrayBaseColumnType int32
// A value that indicates whether the column increments automatically.
IsAutoIncrement bool
// A value that indicates whether the column is case-sensitive.
IsCaseSensitive bool
// A value that indicates whether the column contains currency values.
IsCurrency bool
// A value that indicates whether an integer column is signed.
IsSigned bool
// The label for the column.
Label *string
// The name of the column.
Name *string
// A value that indicates whether the column is nullable.
Nullable int32
// The precision value of a decimal number column.
Precision int32
// The scale value of a decimal number column.
Scale int32
// The name of the schema that owns the table that includes the column.
SchemaName *string
// The name of the table that includes the column.
TableName *string
// The type of the column.
Type int32
// The database-specific data type of the column.
TypeName *string
noSmithyDocumentSerde
}
// Contains a value.
//
// The following types satisfy this interface:
//
// FieldMemberArrayValue
// FieldMemberBlobValue
// FieldMemberBooleanValue
// FieldMemberDoubleValue
// FieldMemberIsNull
// FieldMemberLongValue
// FieldMemberStringValue
type Field interface {
isField()
}
// An array of values.
type FieldMemberArrayValue struct {
Value ArrayValue
noSmithyDocumentSerde
}
func (*FieldMemberArrayValue) isField() {}
// A value of BLOB data type.
type FieldMemberBlobValue struct {
Value []byte
noSmithyDocumentSerde
}
func (*FieldMemberBlobValue) isField() {}
// A value of Boolean data type.
type FieldMemberBooleanValue struct {
Value bool
noSmithyDocumentSerde
}
func (*FieldMemberBooleanValue) isField() {}
// A value of double data type.
type FieldMemberDoubleValue struct {
Value float64
noSmithyDocumentSerde
}
func (*FieldMemberDoubleValue) isField() {}
// A NULL value.
type FieldMemberIsNull struct {
Value bool
noSmithyDocumentSerde
}
func (*FieldMemberIsNull) isField() {}
// A value of long data type.
type FieldMemberLongValue struct {
Value int64
noSmithyDocumentSerde
}
func (*FieldMemberLongValue) isField() {}
// A value of string data type.
type FieldMemberStringValue struct {
Value string
noSmithyDocumentSerde
}
func (*FieldMemberStringValue) isField() {}
// A record returned by a call. This data structure is only used with the
// deprecated ExecuteSql operation. Use the BatchExecuteStatement or
// ExecuteStatement operation instead.
type Record struct {
// The values returned in the record.
Values []Value
noSmithyDocumentSerde
}
// The result set returned by a SQL statement. This data structure is only used
// with the deprecated ExecuteSql operation. Use the BatchExecuteStatement or
// ExecuteStatement operation instead.
type ResultFrame struct {
// The records in the result set.
Records []Record
// The result-set metadata in the result set.
ResultSetMetadata *ResultSetMetadata
noSmithyDocumentSerde
}
// The metadata of the result set returned by a SQL statement.
type ResultSetMetadata struct {
// The number of columns in the result set.
ColumnCount int64
// The metadata of the columns in the result set.
ColumnMetadata []ColumnMetadata
noSmithyDocumentSerde
}
// Options that control how the result set is returned.
type ResultSetOptions struct {
// A value that indicates how a field of DECIMAL type is represented in the
// response. The value of STRING , the default, specifies that it is converted to a
// String value. The value of DOUBLE_OR_LONG specifies that it is converted to a
// Long value if its scale is 0, or to a Double value otherwise. Conversion to
// Double or Long can result in roundoff errors due to precision loss. We recommend
// converting to String, especially when working with currency values.
DecimalReturnType DecimalReturnType
// A value that indicates how a field of LONG type is represented. Allowed values
// are LONG and STRING . The default is LONG . Specify STRING if the length or
// precision of numeric values might cause truncation or rounding errors.
LongReturnType LongReturnType
noSmithyDocumentSerde
}
// A parameter used in a SQL statement.
type SqlParameter struct {
// The name of the parameter.
Name *string
// A hint that specifies the correct object type for data type mapping. Possible
// values are as follows:
// - DATE - The corresponding String parameter value is sent as an object of DATE
// type to the database. The accepted format is YYYY-MM-DD .
// - DECIMAL - The corresponding String parameter value is sent as an object of
// DECIMAL type to the database.
// - JSON - The corresponding String parameter value is sent as an object of JSON
// type to the database.
// - TIME - The corresponding String parameter value is sent as an object of TIME
// type to the database. The accepted format is HH:MM:SS[.FFF] .
// - TIMESTAMP - The corresponding String parameter value is sent as an object of
// TIMESTAMP type to the database. The accepted format is YYYY-MM-DD
// HH:MM:SS[.FFF] .
// - UUID - The corresponding String parameter value is sent as an object of UUID
// type to the database.
TypeHint TypeHint
// The value of the parameter.
Value Field
noSmithyDocumentSerde
}
// The result of a SQL statement. This data structure is only used with the
// deprecated ExecuteSql operation. Use the BatchExecuteStatement or
// ExecuteStatement operation instead.
type SqlStatementResult struct {
// The number of records updated by a SQL statement.
NumberOfRecordsUpdated int64
// The result set of the SQL statement.
ResultFrame *ResultFrame
noSmithyDocumentSerde
}
// A structure value returned by a call. This data structure is only used with the
// deprecated ExecuteSql operation. Use the BatchExecuteStatement or
// ExecuteStatement operation instead.
type StructValue struct {
// The attributes returned in the record.
Attributes []Value
noSmithyDocumentSerde
}
// The response elements represent the results of an update.
type UpdateResult struct {
// Values for fields generated during the request.
GeneratedFields []Field
noSmithyDocumentSerde
}
// Contains the value of a column. This data structure is only used with the
// deprecated ExecuteSql operation. Use the BatchExecuteStatement or
// ExecuteStatement operation instead.
//
// The following types satisfy this interface:
//
// ValueMemberArrayValues
// ValueMemberBigIntValue
// ValueMemberBitValue
// ValueMemberBlobValue
// ValueMemberDoubleValue
// ValueMemberIntValue
// ValueMemberIsNull
// ValueMemberRealValue
// ValueMemberStringValue
// ValueMemberStructValue
type Value interface {
isValue()
}
// An array of column values.
type ValueMemberArrayValues struct {
Value []Value
noSmithyDocumentSerde
}
func (*ValueMemberArrayValues) isValue() {}
// A value for a column of big integer data type.
type ValueMemberBigIntValue struct {
Value int64
noSmithyDocumentSerde
}
func (*ValueMemberBigIntValue) isValue() {}
// A value for a column of BIT data type.
type ValueMemberBitValue struct {
Value bool
noSmithyDocumentSerde
}
func (*ValueMemberBitValue) isValue() {}
// A value for a column of BLOB data type.
type ValueMemberBlobValue struct {
Value []byte
noSmithyDocumentSerde
}
func (*ValueMemberBlobValue) isValue() {}
// A value for a column of double data type.
type ValueMemberDoubleValue struct {
Value float64
noSmithyDocumentSerde
}
func (*ValueMemberDoubleValue) isValue() {}
// A value for a column of integer data type.
type ValueMemberIntValue struct {
Value int32
noSmithyDocumentSerde
}
func (*ValueMemberIntValue) isValue() {}
// A NULL value.
type ValueMemberIsNull struct {
Value bool
noSmithyDocumentSerde
}
func (*ValueMemberIsNull) isValue() {}
// A value for a column of real data type.
type ValueMemberRealValue struct {
Value float32
noSmithyDocumentSerde
}
func (*ValueMemberRealValue) isValue() {}
// A value for a column of string data type.
type ValueMemberStringValue struct {
Value string
noSmithyDocumentSerde
}
func (*ValueMemberStringValue) isValue() {}
// A value for a column of STRUCT data type.
type ValueMemberStructValue struct {
Value StructValue
noSmithyDocumentSerde
}
func (*ValueMemberStructValue) isValue() {}
type noSmithyDocumentSerde = smithydocument.NoSerde
// UnknownUnionMember is returned when a union member is returned over the wire,
// but has an unknown tag.
type UnknownUnionMember struct {
Tag string
Value []byte
noSmithyDocumentSerde
}
func (*UnknownUnionMember) isArrayValue() {}
func (*UnknownUnionMember) isField() {}
func (*UnknownUnionMember) isValue() {}
| 436 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types_test
import (
"fmt"
"github.com/aws/aws-sdk-go-v2/service/rdsdata/types"
)
func ExampleArrayValue_outputUsage() {
var union types.ArrayValue
// type switches can be used to check the union value
switch v := union.(type) {
case *types.ArrayValueMemberArrayValues:
_ = v.Value // Value is []types.ArrayValue
case *types.ArrayValueMemberBooleanValues:
_ = v.Value // Value is []bool
case *types.ArrayValueMemberDoubleValues:
_ = v.Value // Value is []float64
case *types.ArrayValueMemberLongValues:
_ = v.Value // Value is []int64
case *types.ArrayValueMemberStringValues:
_ = v.Value // Value is []string
case *types.UnknownUnionMember:
fmt.Println("unknown tag:", v.Tag)
default:
fmt.Println("union is nil or unknown type")
}
}
var _ []int64
var _ []float64
var _ []string
var _ []types.ArrayValue
var _ []bool
func ExampleField_outputUsage() {
var union types.Field
// type switches can be used to check the union value
switch v := union.(type) {
case *types.FieldMemberArrayValue:
_ = v.Value // Value is types.ArrayValue
case *types.FieldMemberBlobValue:
_ = v.Value // Value is []byte
case *types.FieldMemberBooleanValue:
_ = v.Value // Value is bool
case *types.FieldMemberDoubleValue:
_ = v.Value // Value is float64
case *types.FieldMemberIsNull:
_ = v.Value // Value is bool
case *types.FieldMemberLongValue:
_ = v.Value // Value is int64
case *types.FieldMemberStringValue:
_ = v.Value // Value is string
case *types.UnknownUnionMember:
fmt.Println("unknown tag:", v.Tag)
default:
fmt.Println("union is nil or unknown type")
}
}
var _ types.ArrayValue
var _ *string
var _ *bool
var _ *int64
var _ *float64
var _ []byte
func ExampleValue_outputUsage() {
var union types.Value
// type switches can be used to check the union value
switch v := union.(type) {
case *types.ValueMemberArrayValues:
_ = v.Value // Value is []types.Value
case *types.ValueMemberBigIntValue:
_ = v.Value // Value is int64
case *types.ValueMemberBitValue:
_ = v.Value // Value is bool
case *types.ValueMemberBlobValue:
_ = v.Value // Value is []byte
case *types.ValueMemberDoubleValue:
_ = v.Value // Value is float64
case *types.ValueMemberIntValue:
_ = v.Value // Value is int32
case *types.ValueMemberIsNull:
_ = v.Value // Value is bool
case *types.ValueMemberRealValue:
_ = v.Value // Value is float32
case *types.ValueMemberStringValue:
_ = v.Value // Value is string
case *types.ValueMemberStructValue:
_ = v.Value // Value is types.StructValue
case *types.UnknownUnionMember:
fmt.Println("unknown tag:", v.Tag)
default:
fmt.Println("union is nil or unknown type")
}
}
var _ *types.StructValue
var _ *string
var _ *int32
var _ *int64
var _ *bool
var _ *float64
var _ []types.Value
var _ *float32
var _ []byte
| 137 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/defaults"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
smithy "github.com/aws/smithy-go"
smithydocument "github.com/aws/smithy-go/document"
"github.com/aws/smithy-go/logging"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net"
"net/http"
"time"
)
const ServiceID = "Redshift"
const ServiceAPIVersion = "2012-12-01"
// Client provides the API client to make operations call for Amazon Redshift.
type Client struct {
options Options
}
// New returns an initialized Client based on the functional options. Provide
// additional functional options to further configure the behavior of the client,
// such as changing the client's endpoint or adding custom middleware behavior.
func New(options Options, optFns ...func(*Options)) *Client {
options = options.Copy()
resolveDefaultLogger(&options)
setResolvedDefaultsMode(&options)
resolveRetryer(&options)
resolveHTTPClient(&options)
resolveHTTPSignerV4(&options)
resolveDefaultEndpointConfiguration(&options)
for _, fn := range optFns {
fn(&options)
}
client := &Client{
options: options,
}
return client
}
type Options struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// Configures the events that will be sent to the configured logger.
ClientLogMode aws.ClientLogMode
// The credentials object to use when signing requests.
Credentials aws.CredentialsProvider
// The configuration DefaultsMode that the SDK should use when constructing the
// clients initial default settings.
DefaultsMode aws.DefaultsMode
// The endpoint options to be used when attempting to resolve an endpoint.
EndpointOptions EndpointResolverOptions
// The service endpoint resolver.
EndpointResolver EndpointResolver
// Signature Version 4 (SigV4) Signer
HTTPSignerV4 HTTPSignerV4
// The logger writer interface to write logging messages to.
Logger logging.Logger
// The region to send requests to. (Required)
Region string
// RetryMaxAttempts specifies the maximum number attempts an API client will call
// an operation that fails with a retryable error. A value of 0 is ignored, and
// will not be used to configure the API client created default retryer, or modify
// per operation call's retry max attempts. When creating a new API Clients this
// member will only be used if the Retryer Options member is nil. This value will
// be ignored if Retryer is not nil. If specified in an operation call's functional
// options with a value that is different than the constructed client's Options,
// the Client's Retryer will be wrapped to use the operation's specific
// RetryMaxAttempts value.
RetryMaxAttempts int
// RetryMode specifies the retry mode the API client will be created with, if
// Retryer option is not also specified. When creating a new API Clients this
// member will only be used if the Retryer Options member is nil. This value will
// be ignored if Retryer is not nil. Currently does not support per operation call
// overrides, may in the future.
RetryMode aws.RetryMode
// Retryer guides how HTTP requests should be retried in case of recoverable
// failures. When nil the API client will use a default retryer. The kind of
// default retry created by the API client can be changed with the RetryMode
// option.
Retryer aws.Retryer
// The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You
// should not populate this structure programmatically, or rely on the values here
// within your applications.
RuntimeEnvironment aws.RuntimeEnvironment
// The initial DefaultsMode used when the client options were constructed. If the
// DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved
// value was at that point in time. Currently does not support per operation call
// overrides, may in the future.
resolvedDefaultsMode aws.DefaultsMode
// The HTTP client to invoke API calls with. Defaults to client's default HTTP
// implementation if nil.
HTTPClient HTTPClient
}
// WithAPIOptions returns a functional option for setting the Client's APIOptions
// option.
func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) {
return func(o *Options) {
o.APIOptions = append(o.APIOptions, optFns...)
}
}
// WithEndpointResolver returns a functional option for setting the Client's
// EndpointResolver option.
func WithEndpointResolver(v EndpointResolver) func(*Options) {
return func(o *Options) {
o.EndpointResolver = v
}
}
type HTTPClient interface {
Do(*http.Request) (*http.Response, error)
}
// Copy creates a clone where the APIOptions list is deep copied.
func (o Options) Copy() Options {
to := o
to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))
copy(to.APIOptions, o.APIOptions)
return to
}
func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) {
ctx = middleware.ClearStackValues(ctx)
stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
options := c.options.Copy()
for _, fn := range optFns {
fn(&options)
}
finalizeRetryMaxAttemptOptions(&options, *c)
finalizeClientEndpointResolverOptions(&options)
for _, fn := range stackFns {
if err := fn(stack, options); err != nil {
return nil, metadata, err
}
}
for _, fn := range options.APIOptions {
if err := fn(stack); err != nil {
return nil, metadata, err
}
}
handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack)
result, metadata, err = handler.Handle(ctx, params)
if err != nil {
err = &smithy.OperationError{
ServiceID: ServiceID,
OperationName: opID,
Err: err,
}
}
return result, metadata, err
}
type noSmithyDocumentSerde = smithydocument.NoSerde
func resolveDefaultLogger(o *Options) {
if o.Logger != nil {
return
}
o.Logger = logging.Nop{}
}
func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error {
return middleware.AddSetLoggerMiddleware(stack, o.Logger)
}
func setResolvedDefaultsMode(o *Options) {
if len(o.resolvedDefaultsMode) > 0 {
return
}
var mode aws.DefaultsMode
mode.SetFromString(string(o.DefaultsMode))
if mode == aws.DefaultsModeAuto {
mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment)
}
o.resolvedDefaultsMode = mode
}
// NewFromConfig returns a new client from the provided config.
func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
opts := Options{
Region: cfg.Region,
DefaultsMode: cfg.DefaultsMode,
RuntimeEnvironment: cfg.RuntimeEnvironment,
HTTPClient: cfg.HTTPClient,
Credentials: cfg.Credentials,
APIOptions: cfg.APIOptions,
Logger: cfg.Logger,
ClientLogMode: cfg.ClientLogMode,
}
resolveAWSRetryerProvider(cfg, &opts)
resolveAWSRetryMaxAttempts(cfg, &opts)
resolveAWSRetryMode(cfg, &opts)
resolveAWSEndpointResolver(cfg, &opts)
resolveUseDualStackEndpoint(cfg, &opts)
resolveUseFIPSEndpoint(cfg, &opts)
return New(opts, optFns...)
}
func resolveHTTPClient(o *Options) {
var buildable *awshttp.BuildableClient
if o.HTTPClient != nil {
var ok bool
buildable, ok = o.HTTPClient.(*awshttp.BuildableClient)
if !ok {
return
}
} else {
buildable = awshttp.NewBuildableClient()
}
modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
if err == nil {
buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) {
if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok {
dialer.Timeout = dialerTimeout
}
})
buildable = buildable.WithTransportOptions(func(transport *http.Transport) {
if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok {
transport.TLSHandshakeTimeout = tlsHandshakeTimeout
}
})
}
o.HTTPClient = buildable
}
func resolveRetryer(o *Options) {
if o.Retryer != nil {
return
}
if len(o.RetryMode) == 0 {
modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
if err == nil {
o.RetryMode = modeConfig.RetryMode
}
}
if len(o.RetryMode) == 0 {
o.RetryMode = aws.RetryModeStandard
}
var standardOptions []func(*retry.StandardOptions)
if v := o.RetryMaxAttempts; v != 0 {
standardOptions = append(standardOptions, func(so *retry.StandardOptions) {
so.MaxAttempts = v
})
}
switch o.RetryMode {
case aws.RetryModeAdaptive:
var adaptiveOptions []func(*retry.AdaptiveModeOptions)
if len(standardOptions) != 0 {
adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) {
ao.StandardOptions = append(ao.StandardOptions, standardOptions...)
})
}
o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...)
default:
o.Retryer = retry.NewStandard(standardOptions...)
}
}
func resolveAWSRetryerProvider(cfg aws.Config, o *Options) {
if cfg.Retryer == nil {
return
}
o.Retryer = cfg.Retryer()
}
func resolveAWSRetryMode(cfg aws.Config, o *Options) {
if len(cfg.RetryMode) == 0 {
return
}
o.RetryMode = cfg.RetryMode
}
func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) {
if cfg.RetryMaxAttempts == 0 {
return
}
o.RetryMaxAttempts = cfg.RetryMaxAttempts
}
func finalizeRetryMaxAttemptOptions(o *Options, client Client) {
if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts {
return
}
o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
}
func resolveAWSEndpointResolver(cfg aws.Config, o *Options) {
if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil {
return
}
o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions, NewDefaultEndpointResolver())
}
func addClientUserAgent(stack *middleware.Stack) error {
return awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "redshift", goModuleVersion)(stack)
}
func addHTTPSignerV4Middleware(stack *middleware.Stack, o Options) error {
mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{
CredentialsProvider: o.Credentials,
Signer: o.HTTPSignerV4,
LogSigning: o.ClientLogMode.IsSigning(),
})
return stack.Finalize.Add(mw, middleware.After)
}
type HTTPSignerV4 interface {
SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
}
func resolveHTTPSignerV4(o *Options) {
if o.HTTPSignerV4 != nil {
return
}
o.HTTPSignerV4 = newDefaultV4Signer(*o)
}
func newDefaultV4Signer(o Options) *v4.Signer {
return v4.NewSigner(func(so *v4.SignerOptions) {
so.Logger = o.Logger
so.LogSigning = o.ClientLogMode.IsSigning()
})
}
func addRetryMiddlewares(stack *middleware.Stack, o Options) error {
mo := retry.AddRetryMiddlewaresOptions{
Retryer: o.Retryer,
LogRetryAttempts: o.ClientLogMode.IsRetries(),
}
return retry.AddRetryMiddlewares(stack, mo)
}
// resolves dual-stack endpoint configuration
func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error {
if len(cfg.ConfigSources) == 0 {
return nil
}
value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources)
if err != nil {
return err
}
if found {
o.EndpointOptions.UseDualStackEndpoint = value
}
return nil
}
// resolves FIPS endpoint configuration
func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error {
if len(cfg.ConfigSources) == 0 {
return nil
}
value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources)
if err != nil {
return err
}
if found {
o.EndpointOptions.UseFIPSEndpoint = value
}
return nil
}
func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error {
return awsmiddleware.AddRequestIDRetrieverMiddleware(stack)
}
func addResponseErrorMiddleware(stack *middleware.Stack) error {
return awshttp.AddResponseErrorMiddleware(stack)
}
func addRequestResponseLogging(stack *middleware.Stack, o Options) error {
return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{
LogRequest: o.ClientLogMode.IsRequest(),
LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(),
LogResponse: o.ClientLogMode.IsResponse(),
LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(),
}, middleware.After)
}
| 434 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io/ioutil"
"net/http"
"strings"
"testing"
)
func TestClient_resolveRetryOptions(t *testing.T) {
nopClient := smithyhttp.ClientDoFunc(func(_ *http.Request) (*http.Response, error) {
return &http.Response{
StatusCode: 200,
Header: http.Header{},
Body: ioutil.NopCloser(strings.NewReader("")),
}, nil
})
cases := map[string]struct {
defaultsMode aws.DefaultsMode
retryer aws.Retryer
retryMaxAttempts int
opRetryMaxAttempts *int
retryMode aws.RetryMode
expectClientRetryMode aws.RetryMode
expectClientMaxAttempts int
expectOpMaxAttempts int
}{
"defaults": {
defaultsMode: aws.DefaultsModeStandard,
expectClientRetryMode: aws.RetryModeStandard,
expectClientMaxAttempts: 3,
expectOpMaxAttempts: 3,
},
"custom default retry": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 10,
},
"custom op max attempts": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
opRetryMaxAttempts: aws.Int(2),
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 2,
},
"custom op no change max attempts": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
opRetryMaxAttempts: aws.Int(10),
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 10,
},
"custom op 0 max attempts": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
opRetryMaxAttempts: aws.Int(0),
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 10,
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
client := NewFromConfig(aws.Config{
DefaultsMode: c.defaultsMode,
Retryer: func() func() aws.Retryer {
if c.retryer == nil {
return nil
}
return func() aws.Retryer { return c.retryer }
}(),
HTTPClient: nopClient,
RetryMaxAttempts: c.retryMaxAttempts,
RetryMode: c.retryMode,
})
if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a {
t.Errorf("expect %v retry mode, got %v", e, a)
}
if e, a := c.expectClientMaxAttempts, client.options.Retryer.MaxAttempts(); e != a {
t.Errorf("expect %v max attempts, got %v", e, a)
}
_, _, err := client.invokeOperation(context.Background(), "mockOperation", struct{}{},
[]func(*Options){
func(o *Options) {
if c.opRetryMaxAttempts == nil {
return
}
o.RetryMaxAttempts = *c.opRetryMaxAttempts
},
},
func(s *middleware.Stack, o Options) error {
s.Initialize.Clear()
s.Serialize.Clear()
s.Build.Clear()
s.Finalize.Clear()
s.Deserialize.Clear()
if e, a := c.expectOpMaxAttempts, o.Retryer.MaxAttempts(); e != a {
t.Errorf("expect %v op max attempts, got %v", e, a)
}
return nil
})
if err != nil {
t.Fatalf("expect no operation error, got %v", err)
}
})
}
}
| 124 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Exchanges a DC1 Reserved Node for a DC2 Reserved Node with no changes to the
// configuration (term, payment type, or number of nodes) and no additional costs.
func (c *Client) AcceptReservedNodeExchange(ctx context.Context, params *AcceptReservedNodeExchangeInput, optFns ...func(*Options)) (*AcceptReservedNodeExchangeOutput, error) {
if params == nil {
params = &AcceptReservedNodeExchangeInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AcceptReservedNodeExchange", params, optFns, c.addOperationAcceptReservedNodeExchangeMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AcceptReservedNodeExchangeOutput)
out.ResultMetadata = metadata
return out, nil
}
type AcceptReservedNodeExchangeInput struct {
// A string representing the node identifier of the DC1 Reserved Node to be
// exchanged.
//
// This member is required.
ReservedNodeId *string
// The unique identifier of the DC2 Reserved Node offering to be used for the
// exchange. You can obtain the value for the parameter by calling
// GetReservedNodeExchangeOfferings
//
// This member is required.
TargetReservedNodeOfferingId *string
noSmithyDocumentSerde
}
type AcceptReservedNodeExchangeOutput struct {
//
ExchangedReservedNode *types.ReservedNode
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAcceptReservedNodeExchangeMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAcceptReservedNodeExchange{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAcceptReservedNodeExchange{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpAcceptReservedNodeExchangeValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAcceptReservedNodeExchange(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAcceptReservedNodeExchange(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "AcceptReservedNodeExchange",
}
}
| 134 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds a partner integration to a cluster. This operation authorizes a partner to
// push status updates for the specified database. To complete the integration, you
// also set up the integration on the partner website.
func (c *Client) AddPartner(ctx context.Context, params *AddPartnerInput, optFns ...func(*Options)) (*AddPartnerOutput, error) {
if params == nil {
params = &AddPartnerInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddPartner", params, optFns, c.addOperationAddPartnerMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddPartnerOutput)
out.ResultMetadata = metadata
return out, nil
}
type AddPartnerInput struct {
// The Amazon Web Services account ID that owns the cluster.
//
// This member is required.
AccountId *string
// The cluster identifier of the cluster that receives data from the partner.
//
// This member is required.
ClusterIdentifier *string
// The name of the database that receives data from the partner.
//
// This member is required.
DatabaseName *string
// The name of the partner that is authorized to send data.
//
// This member is required.
PartnerName *string
noSmithyDocumentSerde
}
type AddPartnerOutput struct {
// The name of the database that receives data from the partner.
DatabaseName *string
// The name of the partner that is authorized to send data.
PartnerName *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddPartnerMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAddPartner{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAddPartner{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpAddPartnerValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddPartner(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAddPartner(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "AddPartner",
}
}
| 144 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// From a datashare consumer account, associates a datashare with the account
// (AssociateEntireAccount) or the specified namespace (ConsumerArn). If you make
// this association, the consumer can consume the datashare.
func (c *Client) AssociateDataShareConsumer(ctx context.Context, params *AssociateDataShareConsumerInput, optFns ...func(*Options)) (*AssociateDataShareConsumerOutput, error) {
if params == nil {
params = &AssociateDataShareConsumerInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AssociateDataShareConsumer", params, optFns, c.addOperationAssociateDataShareConsumerMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AssociateDataShareConsumerOutput)
out.ResultMetadata = metadata
return out, nil
}
type AssociateDataShareConsumerInput struct {
// The Amazon Resource Name (ARN) of the datashare that the consumer is to use
// with the account or the namespace.
//
// This member is required.
DataShareArn *string
// A value that specifies whether the datashare is associated with the entire
// account.
AssociateEntireAccount *bool
// The Amazon Resource Name (ARN) of the consumer that is associated with the
// datashare.
ConsumerArn *string
// From a datashare consumer account, associates a datashare with all existing and
// future namespaces in the specified Amazon Web Services Region.
ConsumerRegion *string
noSmithyDocumentSerde
}
type AssociateDataShareConsumerOutput struct {
// A value that specifies whether the datashare can be shared to a publicly
// accessible cluster.
AllowPubliclyAccessibleConsumers bool
// An Amazon Resource Name (ARN) that references the datashare that is owned by a
// specific namespace of the producer cluster. A datashare ARN is in the
// arn:aws:redshift:{region}:{account-id}:{datashare}:{namespace-guid}/{datashare-name}
// format.
DataShareArn *string
// A value that specifies when the datashare has an association between producer
// and data consumers.
DataShareAssociations []types.DataShareAssociation
// The identifier of a datashare to show its managing entity.
ManagedBy *string
// The Amazon Resource Name (ARN) of the producer.
ProducerArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAssociateDataShareConsumerMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAssociateDataShareConsumer{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAssociateDataShareConsumer{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpAssociateDataShareConsumerValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateDataShareConsumer(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAssociateDataShareConsumer(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "AssociateDataShareConsumer",
}
}
| 157 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds an inbound (ingress) rule to an Amazon Redshift security group. Depending
// on whether the application accessing your cluster is running on the Internet or
// an Amazon EC2 instance, you can authorize inbound access to either a Classless
// Interdomain Routing (CIDR)/Internet Protocol (IP) range or to an Amazon EC2
// security group. You can add as many as 20 ingress rules to an Amazon Redshift
// security group. If you authorize access to an Amazon EC2 security group, specify
// EC2SecurityGroupName and EC2SecurityGroupOwnerId. The Amazon EC2 security group
// and Amazon Redshift cluster must be in the same Amazon Web Services Region. If
// you authorize access to a CIDR/IP address range, specify CIDRIP. For an overview
// of CIDR blocks, see the Wikipedia article on Classless Inter-Domain Routing (http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
// . You must also associate the security group with a cluster so that clients
// running on these IP addresses or the EC2 instance are authorized to connect to
// the cluster. For information about managing security groups, go to Working with
// Security Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-security-groups.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) AuthorizeClusterSecurityGroupIngress(ctx context.Context, params *AuthorizeClusterSecurityGroupIngressInput, optFns ...func(*Options)) (*AuthorizeClusterSecurityGroupIngressOutput, error) {
if params == nil {
params = &AuthorizeClusterSecurityGroupIngressInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AuthorizeClusterSecurityGroupIngress", params, optFns, c.addOperationAuthorizeClusterSecurityGroupIngressMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AuthorizeClusterSecurityGroupIngressOutput)
out.ResultMetadata = metadata
return out, nil
}
type AuthorizeClusterSecurityGroupIngressInput struct {
// The name of the security group to which the ingress rule is added.
//
// This member is required.
ClusterSecurityGroupName *string
// The IP range to be added the Amazon Redshift security group.
CIDRIP *string
// The EC2 security group to be added the Amazon Redshift security group.
EC2SecurityGroupName *string
// The Amazon Web Services account number of the owner of the security group
// specified by the EC2SecurityGroupName parameter. The Amazon Web Services Access
// Key ID is not an acceptable value. Example: 111122223333
EC2SecurityGroupOwnerId *string
noSmithyDocumentSerde
}
type AuthorizeClusterSecurityGroupIngressOutput struct {
// Describes a security group.
ClusterSecurityGroup *types.ClusterSecurityGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAuthorizeClusterSecurityGroupIngressMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAuthorizeClusterSecurityGroupIngress{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAuthorizeClusterSecurityGroupIngress{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpAuthorizeClusterSecurityGroupIngressValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAuthorizeClusterSecurityGroupIngress(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAuthorizeClusterSecurityGroupIngress(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "AuthorizeClusterSecurityGroupIngress",
}
}
| 150 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// From a data producer account, authorizes the sharing of a datashare with one or
// more consumer accounts or managing entities. To authorize a datashare for a data
// consumer, the producer account must have the correct access permissions.
func (c *Client) AuthorizeDataShare(ctx context.Context, params *AuthorizeDataShareInput, optFns ...func(*Options)) (*AuthorizeDataShareOutput, error) {
if params == nil {
params = &AuthorizeDataShareInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AuthorizeDataShare", params, optFns, c.addOperationAuthorizeDataShareMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AuthorizeDataShareOutput)
out.ResultMetadata = metadata
return out, nil
}
type AuthorizeDataShareInput struct {
// The identifier of the data consumer that is authorized to access the datashare.
// This identifier is an Amazon Web Services account ID or a keyword, such as ADX.
//
// This member is required.
ConsumerIdentifier *string
// The Amazon Resource Name (ARN) of the datashare that producers are to authorize
// sharing for.
//
// This member is required.
DataShareArn *string
noSmithyDocumentSerde
}
type AuthorizeDataShareOutput struct {
// A value that specifies whether the datashare can be shared to a publicly
// accessible cluster.
AllowPubliclyAccessibleConsumers bool
// An Amazon Resource Name (ARN) that references the datashare that is owned by a
// specific namespace of the producer cluster. A datashare ARN is in the
// arn:aws:redshift:{region}:{account-id}:{datashare}:{namespace-guid}/{datashare-name}
// format.
DataShareArn *string
// A value that specifies when the datashare has an association between producer
// and data consumers.
DataShareAssociations []types.DataShareAssociation
// The identifier of a datashare to show its managing entity.
ManagedBy *string
// The Amazon Resource Name (ARN) of the producer.
ProducerArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAuthorizeDataShareMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAuthorizeDataShare{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAuthorizeDataShare{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpAuthorizeDataShareValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAuthorizeDataShare(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAuthorizeDataShare(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "AuthorizeDataShare",
}
}
| 151 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Grants access to a cluster.
func (c *Client) AuthorizeEndpointAccess(ctx context.Context, params *AuthorizeEndpointAccessInput, optFns ...func(*Options)) (*AuthorizeEndpointAccessOutput, error) {
if params == nil {
params = &AuthorizeEndpointAccessInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AuthorizeEndpointAccess", params, optFns, c.addOperationAuthorizeEndpointAccessMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AuthorizeEndpointAccessOutput)
out.ResultMetadata = metadata
return out, nil
}
type AuthorizeEndpointAccessInput struct {
// The Amazon Web Services account ID to grant access to.
//
// This member is required.
Account *string
// The cluster identifier of the cluster to grant access to.
ClusterIdentifier *string
// The virtual private cloud (VPC) identifiers to grant access to.
VpcIds []string
noSmithyDocumentSerde
}
// Describes an endpoint authorization for authorizing Redshift-managed VPC
// endpoint access to a cluster across Amazon Web Services accounts.
type AuthorizeEndpointAccessOutput struct {
// Indicates whether all VPCs in the grantee account are allowed access to the
// cluster.
AllowedAllVPCs bool
// The VPCs allowed access to the cluster.
AllowedVPCs []string
// The time (UTC) when the authorization was created.
AuthorizeTime *time.Time
// The cluster identifier.
ClusterIdentifier *string
// The status of the cluster.
ClusterStatus *string
// The number of Redshift-managed VPC endpoints created for the authorization.
EndpointCount int32
// The Amazon Web Services account ID of the grantee of the cluster.
Grantee *string
// The Amazon Web Services account ID of the cluster owner.
Grantor *string
// The status of the authorization action.
Status types.AuthorizationStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAuthorizeEndpointAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAuthorizeEndpointAccess{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAuthorizeEndpointAccess{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpAuthorizeEndpointAccessValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAuthorizeEndpointAccess(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAuthorizeEndpointAccess(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "AuthorizeEndpointAccess",
}
}
| 159 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Authorizes the specified Amazon Web Services account to restore the specified
// snapshot. For more information about working with snapshots, go to Amazon
// Redshift Snapshots (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) AuthorizeSnapshotAccess(ctx context.Context, params *AuthorizeSnapshotAccessInput, optFns ...func(*Options)) (*AuthorizeSnapshotAccessOutput, error) {
if params == nil {
params = &AuthorizeSnapshotAccessInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AuthorizeSnapshotAccess", params, optFns, c.addOperationAuthorizeSnapshotAccessMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AuthorizeSnapshotAccessOutput)
out.ResultMetadata = metadata
return out, nil
}
type AuthorizeSnapshotAccessInput struct {
// The identifier of the Amazon Web Services account authorized to restore the
// specified snapshot. To share a snapshot with Amazon Web Services Support,
// specify amazon-redshift-support.
//
// This member is required.
AccountWithRestoreAccess *string
// The Amazon Resource Name (ARN) of the snapshot to authorize access to.
SnapshotArn *string
// The identifier of the cluster the snapshot was created from. This parameter is
// required if your IAM user has a policy containing a snapshot resource element
// that specifies anything other than * for the cluster name.
SnapshotClusterIdentifier *string
// The identifier of the snapshot the account is authorized to restore.
SnapshotIdentifier *string
noSmithyDocumentSerde
}
type AuthorizeSnapshotAccessOutput struct {
// Describes a snapshot.
Snapshot *types.Snapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAuthorizeSnapshotAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAuthorizeSnapshotAccess{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAuthorizeSnapshotAccess{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpAuthorizeSnapshotAccessValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAuthorizeSnapshotAccess(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAuthorizeSnapshotAccess(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "AuthorizeSnapshotAccess",
}
}
| 141 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a set of cluster snapshots.
func (c *Client) BatchDeleteClusterSnapshots(ctx context.Context, params *BatchDeleteClusterSnapshotsInput, optFns ...func(*Options)) (*BatchDeleteClusterSnapshotsOutput, error) {
if params == nil {
params = &BatchDeleteClusterSnapshotsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "BatchDeleteClusterSnapshots", params, optFns, c.addOperationBatchDeleteClusterSnapshotsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*BatchDeleteClusterSnapshotsOutput)
out.ResultMetadata = metadata
return out, nil
}
type BatchDeleteClusterSnapshotsInput struct {
// A list of identifiers for the snapshots that you want to delete.
//
// This member is required.
Identifiers []types.DeleteClusterSnapshotMessage
noSmithyDocumentSerde
}
type BatchDeleteClusterSnapshotsOutput struct {
// A list of any errors returned.
Errors []types.SnapshotErrorMessage
// A list of the snapshot identifiers that were deleted.
Resources []string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationBatchDeleteClusterSnapshotsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpBatchDeleteClusterSnapshots{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpBatchDeleteClusterSnapshots{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpBatchDeleteClusterSnapshotsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchDeleteClusterSnapshots(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opBatchDeleteClusterSnapshots(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "BatchDeleteClusterSnapshots",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Modifies the settings for a set of cluster snapshots.
func (c *Client) BatchModifyClusterSnapshots(ctx context.Context, params *BatchModifyClusterSnapshotsInput, optFns ...func(*Options)) (*BatchModifyClusterSnapshotsOutput, error) {
if params == nil {
params = &BatchModifyClusterSnapshotsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "BatchModifyClusterSnapshots", params, optFns, c.addOperationBatchModifyClusterSnapshotsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*BatchModifyClusterSnapshotsOutput)
out.ResultMetadata = metadata
return out, nil
}
type BatchModifyClusterSnapshotsInput struct {
// A list of snapshot identifiers you want to modify.
//
// This member is required.
SnapshotIdentifierList []string
// A boolean value indicating whether to override an exception if the retention
// period has passed.
Force bool
// The number of days that a manual snapshot is retained. If you specify the value
// -1, the manual snapshot is retained indefinitely. The number must be either -1
// or an integer between 1 and 3,653. If you decrease the manual snapshot retention
// period from its current value, existing manual snapshots that fall outside of
// the new retention period will return an error. If you want to suppress the
// errors and delete the snapshots, use the force option.
ManualSnapshotRetentionPeriod *int32
noSmithyDocumentSerde
}
type BatchModifyClusterSnapshotsOutput struct {
// A list of any errors returned.
Errors []types.SnapshotErrorMessage
// A list of the snapshots that were modified.
Resources []string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationBatchModifyClusterSnapshotsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpBatchModifyClusterSnapshots{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpBatchModifyClusterSnapshots{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpBatchModifyClusterSnapshotsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchModifyClusterSnapshots(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opBatchModifyClusterSnapshots(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "BatchModifyClusterSnapshots",
}
}
| 140 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Cancels a resize operation for a cluster.
func (c *Client) CancelResize(ctx context.Context, params *CancelResizeInput, optFns ...func(*Options)) (*CancelResizeOutput, error) {
if params == nil {
params = &CancelResizeInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CancelResize", params, optFns, c.addOperationCancelResizeMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CancelResizeOutput)
out.ResultMetadata = metadata
return out, nil
}
type CancelResizeInput struct {
// The unique identifier for the cluster that you want to cancel a resize
// operation for.
//
// This member is required.
ClusterIdentifier *string
noSmithyDocumentSerde
}
// Describes the result of a cluster resize operation.
type CancelResizeOutput struct {
// The average rate of the resize operation over the last few minutes, measured in
// megabytes per second. After the resize operation completes, this value shows the
// average rate of the entire resize operation.
AvgResizeRateInMegaBytesPerSecond *float64
// The percent of data transferred from source cluster to target cluster.
DataTransferProgressPercent *float64
// The amount of seconds that have elapsed since the resize operation began. After
// the resize operation completes, this value shows the total actual time, in
// seconds, for the resize operation.
ElapsedTimeInSeconds *int64
// The estimated time remaining, in seconds, until the resize operation is
// complete. This value is calculated based on the average resize rate and the
// estimated amount of data remaining to be processed. Once the resize operation is
// complete, this value will be 0.
EstimatedTimeToCompletionInSeconds *int64
// The names of tables that have been completely imported . Valid Values: List of
// table names.
ImportTablesCompleted []string
// The names of tables that are being currently imported. Valid Values: List of
// table names.
ImportTablesInProgress []string
// The names of tables that have not been yet imported. Valid Values: List of
// table names
ImportTablesNotStarted []string
// An optional string to provide additional details about the resize action.
Message *string
// While the resize operation is in progress, this value shows the current amount
// of data, in megabytes, that has been processed so far. When the resize operation
// is complete, this value shows the total amount of data, in megabytes, on the
// cluster, which may be more or less than TotalResizeDataInMegaBytes (the
// estimated total amount of data before resize).
ProgressInMegaBytes *int64
// An enum with possible values of ClassicResize and ElasticResize . These values
// describe the type of resize operation being performed.
ResizeType *string
// The status of the resize operation. Valid Values: NONE | IN_PROGRESS | FAILED |
// SUCCEEDED | CANCELLING
Status *string
// The cluster type after the resize operation is complete. Valid Values:
// multi-node | single-node
TargetClusterType *string
// The type of encryption for the cluster after the resize is complete. Possible
// values are KMS and None .
TargetEncryptionType *string
// The node type that the cluster will have after the resize operation is complete.
TargetNodeType *string
// The number of nodes that the cluster will have after the resize operation is
// complete.
TargetNumberOfNodes *int32
// The estimated total amount of data, in megabytes, on the cluster before the
// resize operation began.
TotalResizeDataInMegaBytes *int64
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCancelResizeMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCancelResize{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCancelResize{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCancelResizeValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelResize(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCancelResize(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CancelResize",
}
}
| 191 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Copies the specified automated cluster snapshot to a new manual cluster
// snapshot. The source must be an automated snapshot and it must be in the
// available state. When you delete a cluster, Amazon Redshift deletes any
// automated snapshots of the cluster. Also, when the retention period of the
// snapshot expires, Amazon Redshift automatically deletes it. If you want to keep
// an automated snapshot for a longer period, you can make a manual copy of the
// snapshot. Manual snapshots are retained until you delete them. For more
// information about working with snapshots, go to Amazon Redshift Snapshots (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CopyClusterSnapshot(ctx context.Context, params *CopyClusterSnapshotInput, optFns ...func(*Options)) (*CopyClusterSnapshotOutput, error) {
if params == nil {
params = &CopyClusterSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CopyClusterSnapshot", params, optFns, c.addOperationCopyClusterSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CopyClusterSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type CopyClusterSnapshotInput struct {
// The identifier for the source snapshot. Constraints:
// - Must be the identifier for a valid automated snapshot whose state is
// available .
//
// This member is required.
SourceSnapshotIdentifier *string
// The identifier given to the new manual snapshot. Constraints:
// - Cannot be null, empty, or blank.
// - Must contain from 1 to 255 alphanumeric characters or hyphens.
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
// - Must be unique for the Amazon Web Services account that is making the
// request.
//
// This member is required.
TargetSnapshotIdentifier *string
// The number of days that a manual snapshot is retained. If the value is -1, the
// manual snapshot is retained indefinitely. The value must be either -1 or an
// integer between 1 and 3,653. The default value is -1.
ManualSnapshotRetentionPeriod *int32
// The identifier of the cluster the source snapshot was created from. This
// parameter is required if your IAM user has a policy containing a snapshot
// resource element that specifies anything other than * for the cluster name.
// Constraints:
// - Must be the identifier for a valid cluster.
SourceSnapshotClusterIdentifier *string
noSmithyDocumentSerde
}
type CopyClusterSnapshotOutput struct {
// Describes a snapshot.
Snapshot *types.Snapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCopyClusterSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCopyClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCopyClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCopyClusterSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCopyClusterSnapshot(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCopyClusterSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CopyClusterSnapshot",
}
}
| 158 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an authentication profile with the specified parameters.
func (c *Client) CreateAuthenticationProfile(ctx context.Context, params *CreateAuthenticationProfileInput, optFns ...func(*Options)) (*CreateAuthenticationProfileOutput, error) {
if params == nil {
params = &CreateAuthenticationProfileInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateAuthenticationProfile", params, optFns, c.addOperationCreateAuthenticationProfileMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateAuthenticationProfileOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateAuthenticationProfileInput struct {
// The content of the authentication profile in JSON format. The maximum length of
// the JSON string is determined by a quota for your account.
//
// This member is required.
AuthenticationProfileContent *string
// The name of the authentication profile to be created.
//
// This member is required.
AuthenticationProfileName *string
noSmithyDocumentSerde
}
type CreateAuthenticationProfileOutput struct {
// The content of the authentication profile in JSON format.
AuthenticationProfileContent *string
// The name of the authentication profile that was created.
AuthenticationProfileName *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateAuthenticationProfileMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateAuthenticationProfile{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateAuthenticationProfile{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateAuthenticationProfileValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAuthenticationProfile(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateAuthenticationProfile(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateAuthenticationProfile",
}
}
| 133 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new cluster with the specified parameters. To create a cluster in
// Virtual Private Cloud (VPC), you must provide a cluster subnet group name. The
// cluster subnet group identifies the subnets of your VPC that Amazon Redshift
// uses when creating the cluster. For more information about managing clusters, go
// to Amazon Redshift Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateCluster(ctx context.Context, params *CreateClusterInput, optFns ...func(*Options)) (*CreateClusterOutput, error) {
if params == nil {
params = &CreateClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateCluster", params, optFns, c.addOperationCreateClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateClusterInput struct {
// A unique identifier for the cluster. You use this identifier to refer to the
// cluster for any subsequent cluster operations such as deleting or modifying. The
// identifier also appears in the Amazon Redshift console. Constraints:
// - Must contain from 1 to 63 alphanumeric characters or hyphens.
// - Alphabetic characters must be lowercase.
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
// - Must be unique for all clusters within an Amazon Web Services account.
// Example: myexamplecluster
//
// This member is required.
ClusterIdentifier *string
// The password associated with the admin user account for the cluster that is
// being created. Constraints:
// - Must be between 8 and 64 characters in length.
// - Must contain at least one uppercase letter.
// - Must contain at least one lowercase letter.
// - Must contain one number.
// - Can be any printable ASCII character (ASCII code 33-126) except ' (single
// quote), " (double quote), \ , / , or @ .
//
// This member is required.
MasterUserPassword *string
// The user name associated with the admin user account for the cluster that is
// being created. Constraints:
// - Must be 1 - 128 alphanumeric characters or hyphens. The user name can't be
// PUBLIC .
// - Must contain only lowercase letters, numbers, underscore, plus sign, period
// (dot), at symbol (@), or hyphen.
// - The first character must be a letter.
// - Must not contain a colon (:) or a slash (/).
// - Cannot be a reserved word. A list of reserved words can be found in
// Reserved Words (https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html)
// in the Amazon Redshift Database Developer Guide.
//
// This member is required.
MasterUsername *string
// The node type to be provisioned for the cluster. For information about node
// types, go to Working with Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html#how-many-nodes)
// in the Amazon Redshift Cluster Management Guide. Valid Values: ds2.xlarge |
// ds2.8xlarge | dc1.large | dc1.8xlarge | dc2.large | dc2.8xlarge | ra3.xlplus |
// ra3.4xlarge | ra3.16xlarge
//
// This member is required.
NodeType *string
// Reserved.
AdditionalInfo *string
// If true , major version upgrades can be applied during the maintenance window to
// the Amazon Redshift engine that is running on the cluster. When a new major
// version of the Amazon Redshift engine is released, you can request that the
// service automatically apply upgrades during the maintenance window to the Amazon
// Redshift engine that is running on your cluster. Default: true
AllowVersionUpgrade *bool
// This parameter is retired. It does not set the AQUA configuration status.
// Amazon Redshift automatically determines whether to use AQUA (Advanced Query
// Accelerator).
AquaConfigurationStatus types.AquaConfigurationStatus
// The number of days that automated snapshots are retained. If the value is 0,
// automated snapshots are disabled. Even if automated snapshots are disabled, you
// can still create manual snapshots when you want with CreateClusterSnapshot . You
// can't disable automated snapshots for RA3 node types. Set the automated
// retention period from 1-35 days. Default: 1 Constraints: Must be a value from 0
// to 35.
AutomatedSnapshotRetentionPeriod *int32
// The EC2 Availability Zone (AZ) in which you want Amazon Redshift to provision
// the cluster. For example, if you have several EC2 instances running in a
// specific Availability Zone, then you might want the cluster to be provisioned in
// the same zone in order to decrease network latency. Default: A random,
// system-chosen Availability Zone in the region that is specified by the endpoint.
// Example: us-east-2d Constraint: The specified Availability Zone must be in the
// same region as the current endpoint.
AvailabilityZone *string
// The option to enable relocation for an Amazon Redshift cluster between
// Availability Zones after the cluster is created.
AvailabilityZoneRelocation *bool
// The name of the parameter group to be associated with this cluster. Default:
// The default Amazon Redshift cluster parameter group. For information about the
// default parameter group, go to Working with Amazon Redshift Parameter Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html)
// Constraints:
// - Must be 1 to 255 alphanumeric characters or hyphens.
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
ClusterParameterGroupName *string
// A list of security groups to be associated with this cluster. Default: The
// default cluster security group for Amazon Redshift.
ClusterSecurityGroups []string
// The name of a cluster subnet group to be associated with this cluster. If this
// parameter is not provided the resulting cluster will be deployed outside virtual
// private cloud (VPC).
ClusterSubnetGroupName *string
// The type of the cluster. When cluster type is specified as
// - single-node , the NumberOfNodes parameter is not required.
// - multi-node , the NumberOfNodes parameter is required.
// Valid Values: multi-node | single-node Default: multi-node
ClusterType *string
// The version of the Amazon Redshift engine software that you want to deploy on
// the cluster. The version selected runs on all the nodes in the cluster.
// Constraints: Only version 1.0 is currently available. Example: 1.0
ClusterVersion *string
// The name of the first database to be created when the cluster is created. To
// create additional databases after the cluster is created, connect to the cluster
// with a SQL client and use SQL commands to create a database. For more
// information, go to Create a Database (https://docs.aws.amazon.com/redshift/latest/dg/t_creating_database.html)
// in the Amazon Redshift Database Developer Guide. Default: dev Constraints:
// - Must contain 1 to 64 alphanumeric characters.
// - Must contain only lowercase letters.
// - Cannot be a word that is reserved by the service. A list of reserved words
// can be found in Reserved Words (https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html)
// in the Amazon Redshift Database Developer Guide.
DBName *string
// The Amazon Resource Name (ARN) for the IAM role that was set as default for the
// cluster when the cluster was created.
DefaultIamRoleArn *string
// The Elastic IP (EIP) address for the cluster. Constraints: The cluster must be
// provisioned in EC2-VPC and publicly-accessible through an Internet gateway.
// Don't specify the Elastic IP address for a publicly accessible cluster with
// availability zone relocation turned on. For more information about provisioning
// clusters in EC2-VPC, go to Supported Platforms to Launch Your Cluster (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html#cluster-platforms)
// in the Amazon Redshift Cluster Management Guide.
ElasticIp *string
// If true , the data in the cluster is encrypted at rest. Default: false
Encrypted *bool
// An option that specifies whether to create the cluster with enhanced VPC
// routing enabled. To create a cluster that uses enhanced VPC routing, the cluster
// must be in a VPC. For more information, see Enhanced VPC Routing (https://docs.aws.amazon.com/redshift/latest/mgmt/enhanced-vpc-routing.html)
// in the Amazon Redshift Cluster Management Guide. If this option is true ,
// enhanced VPC routing is enabled. Default: false
EnhancedVpcRouting *bool
// Specifies the name of the HSM client certificate the Amazon Redshift cluster
// uses to retrieve the data encryption keys stored in an HSM.
HsmClientCertificateIdentifier *string
// Specifies the name of the HSM configuration that contains the information the
// Amazon Redshift cluster can use to retrieve and store keys in an HSM.
HsmConfigurationIdentifier *string
// A list of Identity and Access Management (IAM) roles that can be used by the
// cluster to access other Amazon Web Services services. You must supply the IAM
// roles in their Amazon Resource Name (ARN) format. The maximum number of IAM
// roles that you can associate is subject to a quota. For more information, go to
// Quotas and limits (https://docs.aws.amazon.com/redshift/latest/mgmt/amazon-redshift-limits.html)
// in the Amazon Redshift Cluster Management Guide.
IamRoles []string
// The Key Management Service (KMS) key ID of the encryption key that you want to
// use to encrypt data in the cluster.
KmsKeyId *string
// A flag that specifies whether to load sample data once the cluster is created.
LoadSampleData *string
// An optional parameter for the name of the maintenance track for the cluster. If
// you don't provide a maintenance track name, the cluster is assigned to the
// current track.
MaintenanceTrackName *string
// The default number of days to retain a manual snapshot. If the value is -1, the
// snapshot is retained indefinitely. This setting doesn't change the retention
// period of existing snapshots. The value must be either -1 or an integer between
// 1 and 3,653.
ManualSnapshotRetentionPeriod *int32
// The number of compute nodes in the cluster. This parameter is required when the
// ClusterType parameter is specified as multi-node . For information about
// determining how many nodes you need, go to Working with Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html#how-many-nodes)
// in the Amazon Redshift Cluster Management Guide. If you don't specify this
// parameter, you get a single-node cluster. When requesting a multi-node cluster,
// you must specify the number of nodes that you want in the cluster. Default: 1
// Constraints: Value must be at least 1 and no more than 100.
NumberOfNodes *int32
// The port number on which the cluster accepts incoming connections. The cluster
// is accessible only via the JDBC and ODBC connection strings. Part of the
// connection string requires the port on which the cluster will listen for
// incoming connections. Default: 5439 Valid Values: 1150-65535
Port *int32
// The weekly time range (in UTC) during which automated cluster maintenance can
// occur. Format: ddd:hh24:mi-ddd:hh24:mi Default: A 30-minute window selected at
// random from an 8-hour block of time per region, occurring on a random day of the
// week. For more information about the time blocks for each region, see
// Maintenance Windows (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html#rs-maintenance-windows)
// in Amazon Redshift Cluster Management Guide. Valid Days: Mon | Tue | Wed | Thu |
// Fri | Sat | Sun Constraints: Minimum 30-minute window.
PreferredMaintenanceWindow *string
// If true , the cluster can be accessed from a public network.
PubliclyAccessible *bool
// A unique identifier for the snapshot schedule.
SnapshotScheduleIdentifier *string
// A list of tag instances.
Tags []types.Tag
// A list of Virtual Private Cloud (VPC) security groups to be associated with the
// cluster. Default: The default VPC security group is associated with the cluster.
VpcSecurityGroupIds []string
noSmithyDocumentSerde
}
type CreateClusterOutput struct {
// Describes a cluster.
Cluster *types.Cluster
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateCluster{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateClusterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateCluster(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateCluster",
}
}
| 344 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an Amazon Redshift parameter group. Creating parameter groups is
// independent of creating clusters. You can associate a cluster with a parameter
// group when you create the cluster. You can also associate an existing cluster
// with a parameter group after the cluster is created by using ModifyCluster .
// Parameters in the parameter group define specific behavior that applies to the
// databases you create on the cluster. For more information about parameters and
// parameter groups, go to Amazon Redshift Parameter Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateClusterParameterGroup(ctx context.Context, params *CreateClusterParameterGroupInput, optFns ...func(*Options)) (*CreateClusterParameterGroupOutput, error) {
if params == nil {
params = &CreateClusterParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateClusterParameterGroup", params, optFns, c.addOperationCreateClusterParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateClusterParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateClusterParameterGroupInput struct {
// A description of the parameter group.
//
// This member is required.
Description *string
// The Amazon Redshift engine version to which the cluster parameter group
// applies. The cluster engine version determines the set of parameters. To get a
// list of valid parameter group family names, you can call
// DescribeClusterParameterGroups . By default, Amazon Redshift returns a list of
// all the parameter groups that are owned by your Amazon Web Services account,
// including the default parameter groups for each Amazon Redshift engine version.
// The parameter group family names associated with the default parameter groups
// provide you the valid values. For example, a valid family name is
// "redshift-1.0".
//
// This member is required.
ParameterGroupFamily *string
// The name of the cluster parameter group. Constraints:
// - Must be 1 to 255 alphanumeric characters or hyphens
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
// - Must be unique withing your Amazon Web Services account.
// This value is stored as a lower-case string.
//
// This member is required.
ParameterGroupName *string
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateClusterParameterGroupOutput struct {
// Describes a parameter group.
ClusterParameterGroup *types.ClusterParameterGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateClusterParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateClusterParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateClusterParameterGroup{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateClusterParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateClusterParameterGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateClusterParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateClusterParameterGroup",
}
}
| 158 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new Amazon Redshift security group. You use security groups to
// control access to non-VPC clusters. For information about managing security
// groups, go to Amazon Redshift Cluster Security Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-security-groups.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateClusterSecurityGroup(ctx context.Context, params *CreateClusterSecurityGroupInput, optFns ...func(*Options)) (*CreateClusterSecurityGroupOutput, error) {
if params == nil {
params = &CreateClusterSecurityGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateClusterSecurityGroup", params, optFns, c.addOperationCreateClusterSecurityGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateClusterSecurityGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateClusterSecurityGroupInput struct {
// The name for the security group. Amazon Redshift stores the value as a
// lowercase string. Constraints:
// - Must contain no more than 255 alphanumeric characters or hyphens.
// - Must not be "Default".
// - Must be unique for all security groups that are created by your Amazon Web
// Services account.
// Example: examplesecuritygroup
//
// This member is required.
ClusterSecurityGroupName *string
// A description for the security group.
//
// This member is required.
Description *string
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateClusterSecurityGroupOutput struct {
// Describes a security group.
ClusterSecurityGroup *types.ClusterSecurityGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateClusterSecurityGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateClusterSecurityGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateClusterSecurityGroup{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateClusterSecurityGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateClusterSecurityGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateClusterSecurityGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateClusterSecurityGroup",
}
}
| 142 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a manual snapshot of the specified cluster. The cluster must be in the
// available state. For more information about working with snapshots, go to
// Amazon Redshift Snapshots (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateClusterSnapshot(ctx context.Context, params *CreateClusterSnapshotInput, optFns ...func(*Options)) (*CreateClusterSnapshotOutput, error) {
if params == nil {
params = &CreateClusterSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateClusterSnapshot", params, optFns, c.addOperationCreateClusterSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateClusterSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateClusterSnapshotInput struct {
// The cluster identifier for which you want a snapshot.
//
// This member is required.
ClusterIdentifier *string
// A unique identifier for the snapshot that you are requesting. This identifier
// must be unique for all snapshots within the Amazon Web Services account.
// Constraints:
// - Cannot be null, empty, or blank
// - Must contain from 1 to 255 alphanumeric characters or hyphens
// - First character must be a letter
// - Cannot end with a hyphen or contain two consecutive hyphens
// Example: my-snapshot-id
//
// This member is required.
SnapshotIdentifier *string
// The number of days that a manual snapshot is retained. If the value is -1, the
// manual snapshot is retained indefinitely. The value must be either -1 or an
// integer between 1 and 3,653. The default value is -1.
ManualSnapshotRetentionPeriod *int32
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateClusterSnapshotOutput struct {
// Describes a snapshot.
Snapshot *types.Snapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateClusterSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateClusterSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateClusterSnapshot(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateClusterSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateClusterSnapshot",
}
}
| 148 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new Amazon Redshift subnet group. You must provide a list of one or
// more subnets in your existing Amazon Virtual Private Cloud (Amazon VPC) when
// creating Amazon Redshift subnet group. For information about subnet groups, go
// to Amazon Redshift Cluster Subnet Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-cluster-subnet-groups.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateClusterSubnetGroup(ctx context.Context, params *CreateClusterSubnetGroupInput, optFns ...func(*Options)) (*CreateClusterSubnetGroupOutput, error) {
if params == nil {
params = &CreateClusterSubnetGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateClusterSubnetGroup", params, optFns, c.addOperationCreateClusterSubnetGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateClusterSubnetGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateClusterSubnetGroupInput struct {
// The name for the subnet group. Amazon Redshift stores the value as a lowercase
// string. Constraints:
// - Must contain no more than 255 alphanumeric characters or hyphens.
// - Must not be "Default".
// - Must be unique for all subnet groups that are created by your Amazon Web
// Services account.
// Example: examplesubnetgroup
//
// This member is required.
ClusterSubnetGroupName *string
// A description for the subnet group.
//
// This member is required.
Description *string
// An array of VPC subnet IDs. A maximum of 20 subnets can be modified in a single
// request.
//
// This member is required.
SubnetIds []string
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateClusterSubnetGroupOutput struct {
// Describes a subnet group.
ClusterSubnetGroup *types.ClusterSubnetGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateClusterSubnetGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateClusterSubnetGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateClusterSubnetGroup{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateClusterSubnetGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateClusterSubnetGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateClusterSubnetGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateClusterSubnetGroup",
}
}
| 149 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Used to create a custom domain name for a cluster. Properties include the
// custom domain name, the cluster the custom domain is associated with, and the
// certificate Amazon Resource Name (ARN).
func (c *Client) CreateCustomDomainAssociation(ctx context.Context, params *CreateCustomDomainAssociationInput, optFns ...func(*Options)) (*CreateCustomDomainAssociationOutput, error) {
if params == nil {
params = &CreateCustomDomainAssociationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateCustomDomainAssociation", params, optFns, c.addOperationCreateCustomDomainAssociationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateCustomDomainAssociationOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateCustomDomainAssociationInput struct {
// The cluster identifier that the custom domain is associated with.
//
// This member is required.
ClusterIdentifier *string
// The certificate Amazon Resource Name (ARN) for the custom domain name
// association.
//
// This member is required.
CustomDomainCertificateArn *string
// The custom domain name for a custom domain association.
//
// This member is required.
CustomDomainName *string
noSmithyDocumentSerde
}
type CreateCustomDomainAssociationOutput struct {
// The identifier of the cluster that the custom domain is associated with.
ClusterIdentifier *string
// The expiration time for the certificate for the custom domain.
CustomDomainCertExpiryTime *string
// The Amazon Resource Name (ARN) for the certificate associated with the custom
// domain name.
CustomDomainCertificateArn *string
// The custom domain name for the association result.
CustomDomainName *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateCustomDomainAssociationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateCustomDomainAssociation{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateCustomDomainAssociation{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateCustomDomainAssociationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateCustomDomainAssociation(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateCustomDomainAssociation(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateCustomDomainAssociation",
}
}
| 147 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Creates a Redshift-managed VPC endpoint.
func (c *Client) CreateEndpointAccess(ctx context.Context, params *CreateEndpointAccessInput, optFns ...func(*Options)) (*CreateEndpointAccessOutput, error) {
if params == nil {
params = &CreateEndpointAccessInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateEndpointAccess", params, optFns, c.addOperationCreateEndpointAccessMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateEndpointAccessOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateEndpointAccessInput struct {
// The Redshift-managed VPC endpoint name. An endpoint name must contain 1-30
// characters. Valid characters are A-Z, a-z, 0-9, and hyphen(-). The first
// character must be a letter. The name can't contain two consecutive hyphens or
// end with a hyphen.
//
// This member is required.
EndpointName *string
// The subnet group from which Amazon Redshift chooses the subnet to deploy the
// endpoint.
//
// This member is required.
SubnetGroupName *string
// The cluster identifier of the cluster to access.
ClusterIdentifier *string
// The Amazon Web Services account ID of the owner of the cluster. This is only
// required if the cluster is in another Amazon Web Services account.
ResourceOwner *string
// The security group that defines the ports, protocols, and sources for inbound
// traffic that you are authorizing into your endpoint.
VpcSecurityGroupIds []string
noSmithyDocumentSerde
}
// Describes a Redshift-managed VPC endpoint.
type CreateEndpointAccessOutput struct {
// The DNS address of the endpoint.
Address *string
// The cluster identifier of the cluster associated with the endpoint.
ClusterIdentifier *string
// The time (UTC) that the endpoint was created.
EndpointCreateTime *time.Time
// The name of the endpoint.
EndpointName *string
// The status of the endpoint.
EndpointStatus *string
// The port number on which the cluster accepts incoming connections.
Port int32
// The Amazon Web Services account ID of the owner of the cluster.
ResourceOwner *string
// The subnet group name where Amazon Redshift chooses to deploy the endpoint.
SubnetGroupName *string
// The connection endpoint for connecting to an Amazon Redshift cluster through
// the proxy.
VpcEndpoint *types.VpcEndpoint
// The security groups associated with the endpoint.
VpcSecurityGroups []types.VpcSecurityGroupMembership
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateEndpointAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateEndpointAccess{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateEndpointAccess{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateEndpointAccessValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEndpointAccess(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateEndpointAccess(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateEndpointAccess",
}
}
| 175 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an Amazon Redshift event notification subscription. This action
// requires an ARN (Amazon Resource Name) of an Amazon SNS topic created by either
// the Amazon Redshift console, the Amazon SNS console, or the Amazon SNS API. To
// obtain an ARN with Amazon SNS, you must create a topic in Amazon SNS and
// subscribe to the topic. The ARN is displayed in the SNS console. You can specify
// the source type, and lists of Amazon Redshift source IDs, event categories, and
// event severities. Notifications will be sent for all events you want that match
// those criteria. For example, you can specify source type = cluster, source ID =
// my-cluster-1 and mycluster2, event categories = Availability, Backup, and
// severity = ERROR. The subscription will only send notifications for those ERROR
// events in the Availability and Backup categories for the specified clusters. If
// you specify both the source type and source IDs, such as source type = cluster
// and source identifier = my-cluster-1, notifications will be sent for all the
// cluster events for my-cluster-1. If you specify a source type but do not specify
// a source identifier, you will receive notice of the events for the objects of
// that type in your Amazon Web Services account. If you do not specify either the
// SourceType nor the SourceIdentifier, you will be notified of events generated
// from all Amazon Redshift sources belonging to your Amazon Web Services account.
// You must specify a source type if you specify a source ID.
func (c *Client) CreateEventSubscription(ctx context.Context, params *CreateEventSubscriptionInput, optFns ...func(*Options)) (*CreateEventSubscriptionOutput, error) {
if params == nil {
params = &CreateEventSubscriptionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateEventSubscription", params, optFns, c.addOperationCreateEventSubscriptionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateEventSubscriptionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateEventSubscriptionInput struct {
// The Amazon Resource Name (ARN) of the Amazon SNS topic used to transmit the
// event notifications. The ARN is created by Amazon SNS when you create a topic
// and subscribe to it.
//
// This member is required.
SnsTopicArn *string
// The name of the event subscription to be created. Constraints:
// - Cannot be null, empty, or blank.
// - Must contain from 1 to 255 alphanumeric characters or hyphens.
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
//
// This member is required.
SubscriptionName *string
// A boolean value; set to true to activate the subscription, and set to false to
// create the subscription but not activate it.
Enabled *bool
// Specifies the Amazon Redshift event categories to be published by the event
// notification subscription. Values: configuration, management, monitoring,
// security, pending
EventCategories []string
// Specifies the Amazon Redshift event severity to be published by the event
// notification subscription. Values: ERROR, INFO
Severity *string
// A list of one or more identifiers of Amazon Redshift source objects. All of the
// objects must be of the same type as was specified in the source type parameter.
// The event subscription will return only events generated by the specified
// objects. If not specified, then events are returned for all objects within the
// source type specified. Example: my-cluster-1, my-cluster-2 Example:
// my-snapshot-20131010
SourceIds []string
// The type of source that will be generating the events. For example, if you want
// to be notified of events generated by a cluster, you would set this parameter to
// cluster. If this value is not specified, events are returned for all Amazon
// Redshift objects in your Amazon Web Services account. You must specify a source
// type in order to specify source IDs. Valid values: cluster,
// cluster-parameter-group, cluster-security-group, cluster-snapshot, and
// scheduled-action.
SourceType *string
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateEventSubscriptionOutput struct {
// Describes event subscriptions.
EventSubscription *types.EventSubscription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateEventSubscriptionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateEventSubscription{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateEventSubscription{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateEventSubscriptionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEventSubscription(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateEventSubscription(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateEventSubscription",
}
}
| 187 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an HSM client certificate that an Amazon Redshift cluster will use to
// connect to the client's HSM in order to store and retrieve the keys used to
// encrypt the cluster databases. The command returns a public key, which you must
// store in the HSM. In addition to creating the HSM certificate, you must create
// an Amazon Redshift HSM configuration that provides a cluster the information
// needed to store and use encryption keys in the HSM. For more information, go to
// Hardware Security Modules (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-db-encryption.html#working-with-HSM)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateHsmClientCertificate(ctx context.Context, params *CreateHsmClientCertificateInput, optFns ...func(*Options)) (*CreateHsmClientCertificateOutput, error) {
if params == nil {
params = &CreateHsmClientCertificateInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateHsmClientCertificate", params, optFns, c.addOperationCreateHsmClientCertificateMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateHsmClientCertificateOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateHsmClientCertificateInput struct {
// The identifier to be assigned to the new HSM client certificate that the
// cluster will use to connect to the HSM to use the database encryption keys.
//
// This member is required.
HsmClientCertificateIdentifier *string
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateHsmClientCertificateOutput struct {
// Returns information about an HSM client certificate. The certificate is stored
// in a secure Hardware Storage Module (HSM), and used by the Amazon Redshift
// cluster to encrypt data files.
HsmClientCertificate *types.HsmClientCertificate
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateHsmClientCertificateMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateHsmClientCertificate{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateHsmClientCertificate{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateHsmClientCertificateValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateHsmClientCertificate(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateHsmClientCertificate(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateHsmClientCertificate",
}
}
| 138 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an HSM configuration that contains the information required by an
// Amazon Redshift cluster to store and use database encryption keys in a Hardware
// Security Module (HSM). After creating the HSM configuration, you can specify it
// as a parameter when creating a cluster. The cluster will then store its
// encryption keys in the HSM. In addition to creating an HSM configuration, you
// must also create an HSM client certificate. For more information, go to
// Hardware Security Modules (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-HSM.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateHsmConfiguration(ctx context.Context, params *CreateHsmConfigurationInput, optFns ...func(*Options)) (*CreateHsmConfigurationOutput, error) {
if params == nil {
params = &CreateHsmConfigurationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateHsmConfiguration", params, optFns, c.addOperationCreateHsmConfigurationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateHsmConfigurationOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateHsmConfigurationInput struct {
// A text description of the HSM configuration to be created.
//
// This member is required.
Description *string
// The identifier to be assigned to the new Amazon Redshift HSM configuration.
//
// This member is required.
HsmConfigurationIdentifier *string
// The IP address that the Amazon Redshift cluster must use to access the HSM.
//
// This member is required.
HsmIpAddress *string
// The name of the partition in the HSM where the Amazon Redshift clusters will
// store their database encryption keys.
//
// This member is required.
HsmPartitionName *string
// The password required to access the HSM partition.
//
// This member is required.
HsmPartitionPassword *string
// The HSMs public certificate file. When using Cloud HSM, the file name is
// server.pem.
//
// This member is required.
HsmServerPublicCertificate *string
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateHsmConfigurationOutput struct {
// Returns information about an HSM configuration, which is an object that
// describes to Amazon Redshift clusters the information they require to connect to
// an HSM where they can store database encryption keys.
HsmConfiguration *types.HsmConfiguration
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateHsmConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateHsmConfiguration{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateHsmConfiguration{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateHsmConfigurationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateHsmConfiguration(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateHsmConfiguration(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateHsmConfiguration",
}
}
| 164 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Creates a scheduled action. A scheduled action contains a schedule and an
// Amazon Redshift API action. For example, you can create a schedule of when to
// run the ResizeCluster API operation.
func (c *Client) CreateScheduledAction(ctx context.Context, params *CreateScheduledActionInput, optFns ...func(*Options)) (*CreateScheduledActionOutput, error) {
if params == nil {
params = &CreateScheduledActionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateScheduledAction", params, optFns, c.addOperationCreateScheduledActionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateScheduledActionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateScheduledActionInput struct {
// The IAM role to assume to run the target action. For more information about
// this parameter, see ScheduledAction .
//
// This member is required.
IamRole *string
// The schedule in at( ) or cron( ) format. For more information about this
// parameter, see ScheduledAction .
//
// This member is required.
Schedule *string
// The name of the scheduled action. The name must be unique within an account.
// For more information about this parameter, see ScheduledAction .
//
// This member is required.
ScheduledActionName *string
// A JSON format string of the Amazon Redshift API operation with input
// parameters. For more information about this parameter, see ScheduledAction .
//
// This member is required.
TargetAction *types.ScheduledActionType
// If true, the schedule is enabled. If false, the scheduled action does not
// trigger. For more information about state of the scheduled action, see
// ScheduledAction .
Enable *bool
// The end time in UTC of the scheduled action. After this time, the scheduled
// action does not trigger. For more information about this parameter, see
// ScheduledAction .
EndTime *time.Time
// The description of the scheduled action.
ScheduledActionDescription *string
// The start time in UTC of the scheduled action. Before this time, the scheduled
// action does not trigger. For more information about this parameter, see
// ScheduledAction .
StartTime *time.Time
noSmithyDocumentSerde
}
// Describes a scheduled action. You can use a scheduled action to trigger some
// Amazon Redshift API operations on a schedule. For information about which API
// operations can be scheduled, see ScheduledActionType .
type CreateScheduledActionOutput struct {
// The end time in UTC when the schedule is no longer active. After this time, the
// scheduled action does not trigger.
EndTime *time.Time
// The IAM role to assume to run the scheduled action. This IAM role must have
// permission to run the Amazon Redshift API operation in the scheduled action.
// This IAM role must allow the Amazon Redshift scheduler (Principal
// scheduler.redshift.amazonaws.com) to assume permissions on your behalf. For more
// information about the IAM role to use with the Amazon Redshift scheduler, see
// Using Identity-Based Policies for Amazon Redshift (https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-identity-based.html)
// in the Amazon Redshift Cluster Management Guide.
IamRole *string
// List of times when the scheduled action will run.
NextInvocations []time.Time
// The schedule for a one-time (at format) or recurring (cron format) scheduled
// action. Schedule invocations must be separated by at least one hour. Format of
// at expressions is " at(yyyy-mm-ddThh:mm:ss) ". For example, "
// at(2016-03-04T17:27:00) ". Format of cron expressions is " cron(Minutes Hours
// Day-of-month Month Day-of-week Year) ". For example, " cron(0 10 ? * MON *) ".
// For more information, see Cron Expressions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions)
// in the Amazon CloudWatch Events User Guide.
Schedule *string
// The description of the scheduled action.
ScheduledActionDescription *string
// The name of the scheduled action.
ScheduledActionName *string
// The start time in UTC when the schedule is active. Before this time, the
// scheduled action does not trigger.
StartTime *time.Time
// The state of the scheduled action. For example, DISABLED .
State types.ScheduledActionState
// A JSON format string of the Amazon Redshift API operation with input
// parameters. "
// {\"ResizeCluster\":{\"NodeType\":\"ds2.8xlarge\",\"ClusterIdentifier\":\"my-test-cluster\",\"NumberOfNodes\":3}}
// ".
TargetAction *types.ScheduledActionType
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateScheduledActionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateScheduledAction{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateScheduledAction{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateScheduledActionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateScheduledAction(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateScheduledAction(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateScheduledAction",
}
}
| 209 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a snapshot copy grant that permits Amazon Redshift to use an encrypted
// symmetric key from Key Management Service (KMS) to encrypt copied snapshots in a
// destination region. For more information about managing snapshot copy grants, go
// to Amazon Redshift Database Encryption (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-db-encryption.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) CreateSnapshotCopyGrant(ctx context.Context, params *CreateSnapshotCopyGrantInput, optFns ...func(*Options)) (*CreateSnapshotCopyGrantOutput, error) {
if params == nil {
params = &CreateSnapshotCopyGrantInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateSnapshotCopyGrant", params, optFns, c.addOperationCreateSnapshotCopyGrantMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateSnapshotCopyGrantOutput)
out.ResultMetadata = metadata
return out, nil
}
// The result of the CreateSnapshotCopyGrant action.
type CreateSnapshotCopyGrantInput struct {
// The name of the snapshot copy grant. This name must be unique in the region for
// the Amazon Web Services account. Constraints:
// - Must contain from 1 to 63 alphanumeric characters or hyphens.
// - Alphabetic characters must be lowercase.
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
// - Must be unique for all clusters within an Amazon Web Services account.
//
// This member is required.
SnapshotCopyGrantName *string
// The unique identifier of the encrypted symmetric key to which to grant Amazon
// Redshift permission. If no key is specified, the default key is used.
KmsKeyId *string
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateSnapshotCopyGrantOutput struct {
// The snapshot copy grant that grants Amazon Redshift permission to encrypt
// copied snapshots with the specified encrypted symmetric key from Amazon Web
// Services KMS in the destination region. For more information about managing
// snapshot copy grants, go to Amazon Redshift Database Encryption (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-db-encryption.html)
// in the Amazon Redshift Cluster Management Guide.
SnapshotCopyGrant *types.SnapshotCopyGrant
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateSnapshotCopyGrantMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateSnapshotCopyGrant{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateSnapshotCopyGrant{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateSnapshotCopyGrantValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateSnapshotCopyGrant(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateSnapshotCopyGrant(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateSnapshotCopyGrant",
}
}
| 147 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Create a snapshot schedule that can be associated to a cluster and which
// overrides the default system backup schedule.
func (c *Client) CreateSnapshotSchedule(ctx context.Context, params *CreateSnapshotScheduleInput, optFns ...func(*Options)) (*CreateSnapshotScheduleOutput, error) {
if params == nil {
params = &CreateSnapshotScheduleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateSnapshotSchedule", params, optFns, c.addOperationCreateSnapshotScheduleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateSnapshotScheduleOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateSnapshotScheduleInput struct {
//
DryRun *bool
//
NextInvocations *int32
// The definition of the snapshot schedule. The definition is made up of schedule
// expressions, for example "cron(30 12 *)" or "rate(12 hours)".
ScheduleDefinitions []string
// The description of the snapshot schedule.
ScheduleDescription *string
// A unique identifier for a snapshot schedule. Only alphanumeric characters are
// allowed for the identifier.
ScheduleIdentifier *string
// An optional set of tags you can use to search for the schedule.
Tags []types.Tag
noSmithyDocumentSerde
}
// Describes a snapshot schedule. You can set a regular interval for creating
// snapshots of a cluster. You can also schedule snapshots for specific dates.
type CreateSnapshotScheduleOutput struct {
// The number of clusters associated with the schedule.
AssociatedClusterCount *int32
// A list of clusters associated with the schedule. A maximum of 100 clusters is
// returned.
AssociatedClusters []types.ClusterAssociatedToSchedule
//
NextInvocations []time.Time
// A list of ScheduleDefinitions.
ScheduleDefinitions []string
// The description of the schedule.
ScheduleDescription *string
// A unique identifier for the schedule.
ScheduleIdentifier *string
// An optional set of tags describing the schedule.
Tags []types.Tag
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateSnapshotScheduleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateSnapshotSchedule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateSnapshotSchedule{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateSnapshotSchedule(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateSnapshotSchedule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateSnapshotSchedule",
}
}
| 160 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds tags to a cluster. A resource can have up to 50 tags. If you try to create
// more than 50 tags for a resource, you will receive an error and the attempt will
// fail. If you specify a key that already exists for the resource, the value for
// that key will be updated with the new value.
func (c *Client) CreateTags(ctx context.Context, params *CreateTagsInput, optFns ...func(*Options)) (*CreateTagsOutput, error) {
if params == nil {
params = &CreateTagsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateTags", params, optFns, c.addOperationCreateTagsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateTagsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Contains the output from the CreateTags action.
type CreateTagsInput struct {
// The Amazon Resource Name (ARN) to which you want to add the tag or tags. For
// example, arn:aws:redshift:us-east-2:123456789:cluster:t1 .
//
// This member is required.
ResourceName *string
// One or more name/value pairs to add as tags to the specified resource. Each tag
// name is passed in with the parameter Key and the corresponding value is passed
// in with the parameter Value . The Key and Value parameters are separated by a
// comma (,). Separate multiple tags with a space. For example, --tags
// "Key"="owner","Value"="admin" "Key"="environment","Value"="test"
// "Key"="version","Value"="1.0" .
//
// This member is required.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateTagsOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateTagsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateTags{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateTags{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateTagsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTags(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateTags(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateTags",
}
}
| 136 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a usage limit for a specified Amazon Redshift feature on a cluster. The
// usage limit is identified by the returned usage limit identifier.
func (c *Client) CreateUsageLimit(ctx context.Context, params *CreateUsageLimitInput, optFns ...func(*Options)) (*CreateUsageLimitOutput, error) {
if params == nil {
params = &CreateUsageLimitInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateUsageLimit", params, optFns, c.addOperationCreateUsageLimitMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateUsageLimitOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateUsageLimitInput struct {
// The limit amount. If time-based, this amount is in minutes. If data-based, this
// amount is in terabytes (TB). The value must be a positive number.
//
// This member is required.
Amount int64
// The identifier of the cluster that you want to limit usage.
//
// This member is required.
ClusterIdentifier *string
// The Amazon Redshift feature that you want to limit.
//
// This member is required.
FeatureType types.UsageLimitFeatureType
// The type of limit. Depending on the feature type, this can be based on a time
// duration or data size. If FeatureType is spectrum , then LimitType must be
// data-scanned . If FeatureType is concurrency-scaling , then LimitType must be
// time . If FeatureType is cross-region-datasharing , then LimitType must be
// data-scanned .
//
// This member is required.
LimitType types.UsageLimitLimitType
// The action that Amazon Redshift takes when the limit is reached. The default is
// log. For more information about this parameter, see UsageLimit .
BreachAction types.UsageLimitBreachAction
// The time period that the amount applies to. A weekly period begins on Sunday.
// The default is monthly .
Period types.UsageLimitPeriod
// A list of tag instances.
Tags []types.Tag
noSmithyDocumentSerde
}
// Describes a usage limit object for a cluster.
type CreateUsageLimitOutput struct {
// The limit amount. If time-based, this amount is in minutes. If data-based, this
// amount is in terabytes (TB).
Amount int64
// The action that Amazon Redshift takes when the limit is reached. Possible
// values are:
// - log - To log an event in a system table. The default is log.
// - emit-metric - To emit CloudWatch metrics.
// - disable - To disable the feature until the next usage period begins.
BreachAction types.UsageLimitBreachAction
// The identifier of the cluster with a usage limit.
ClusterIdentifier *string
// The Amazon Redshift feature to which the limit applies.
FeatureType types.UsageLimitFeatureType
// The type of limit. Depending on the feature type, this can be based on a time
// duration or data size.
LimitType types.UsageLimitLimitType
// The time period that the amount applies to. A weekly period begins on Sunday.
// The default is monthly .
Period types.UsageLimitPeriod
// A list of tag instances.
Tags []types.Tag
// The identifier of the usage limit.
UsageLimitId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateUsageLimitMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateUsageLimit{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateUsageLimit{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateUsageLimitValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateUsageLimit(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateUsageLimit(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "CreateUsageLimit",
}
}
| 186 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// From a datashare producer account, removes authorization from the specified
// datashare.
func (c *Client) DeauthorizeDataShare(ctx context.Context, params *DeauthorizeDataShareInput, optFns ...func(*Options)) (*DeauthorizeDataShareOutput, error) {
if params == nil {
params = &DeauthorizeDataShareInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeauthorizeDataShare", params, optFns, c.addOperationDeauthorizeDataShareMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeauthorizeDataShareOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeauthorizeDataShareInput struct {
// The identifier of the data consumer that is to have authorization removed from
// the datashare. This identifier is an Amazon Web Services account ID or a
// keyword, such as ADX.
//
// This member is required.
ConsumerIdentifier *string
// The Amazon Resource Name (ARN) of the datashare to remove authorization from.
//
// This member is required.
DataShareArn *string
noSmithyDocumentSerde
}
type DeauthorizeDataShareOutput struct {
// A value that specifies whether the datashare can be shared to a publicly
// accessible cluster.
AllowPubliclyAccessibleConsumers bool
// An Amazon Resource Name (ARN) that references the datashare that is owned by a
// specific namespace of the producer cluster. A datashare ARN is in the
// arn:aws:redshift:{region}:{account-id}:{datashare}:{namespace-guid}/{datashare-name}
// format.
DataShareArn *string
// A value that specifies when the datashare has an association between producer
// and data consumers.
DataShareAssociations []types.DataShareAssociation
// The identifier of a datashare to show its managing entity.
ManagedBy *string
// The Amazon Resource Name (ARN) of the producer.
ProducerArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeauthorizeDataShareMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeauthorizeDataShare{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeauthorizeDataShare{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeauthorizeDataShareValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeauthorizeDataShare(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeauthorizeDataShare(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeauthorizeDataShare",
}
}
| 150 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an authentication profile.
func (c *Client) DeleteAuthenticationProfile(ctx context.Context, params *DeleteAuthenticationProfileInput, optFns ...func(*Options)) (*DeleteAuthenticationProfileOutput, error) {
if params == nil {
params = &DeleteAuthenticationProfileInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteAuthenticationProfile", params, optFns, c.addOperationDeleteAuthenticationProfileMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteAuthenticationProfileOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteAuthenticationProfileInput struct {
// The name of the authentication profile to delete.
//
// This member is required.
AuthenticationProfileName *string
noSmithyDocumentSerde
}
type DeleteAuthenticationProfileOutput struct {
// The name of the authentication profile that was deleted.
AuthenticationProfileName *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteAuthenticationProfileMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteAuthenticationProfile{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteAuthenticationProfile{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteAuthenticationProfileValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAuthenticationProfile(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteAuthenticationProfile(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteAuthenticationProfile",
}
}
| 124 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a previously provisioned cluster without its final snapshot being
// created. A successful response from the web service indicates that the request
// was received correctly. Use DescribeClusters to monitor the status of the
// deletion. The delete operation cannot be canceled or reverted once submitted.
// For more information about managing clusters, go to Amazon Redshift Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html)
// in the Amazon Redshift Cluster Management Guide. If you want to shut down the
// cluster and retain it for future use, set SkipFinalClusterSnapshot to false and
// specify a name for FinalClusterSnapshotIdentifier. You can later restore this
// snapshot to resume using the cluster. If a final cluster snapshot is requested,
// the status of the cluster will be "final-snapshot" while the snapshot is being
// taken, then it's "deleting" once Amazon Redshift begins deleting the cluster.
// For more information about managing clusters, go to Amazon Redshift Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DeleteCluster(ctx context.Context, params *DeleteClusterInput, optFns ...func(*Options)) (*DeleteClusterOutput, error) {
if params == nil {
params = &DeleteClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteCluster", params, optFns, c.addOperationDeleteClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteClusterInput struct {
// The identifier of the cluster to be deleted. Constraints:
// - Must contain lowercase characters.
// - Must contain from 1 to 63 alphanumeric characters or hyphens.
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
//
// This member is required.
ClusterIdentifier *string
// The identifier of the final snapshot that is to be created immediately before
// deleting the cluster. If this parameter is provided, SkipFinalClusterSnapshot
// must be false . Constraints:
// - Must be 1 to 255 alphanumeric characters.
// - First character must be a letter.
// - Cannot end with a hyphen or contain two consecutive hyphens.
FinalClusterSnapshotIdentifier *string
// The number of days that a manual snapshot is retained. If the value is -1, the
// manual snapshot is retained indefinitely. The value must be either -1 or an
// integer between 1 and 3,653. The default value is -1.
FinalClusterSnapshotRetentionPeriod *int32
// Determines whether a final snapshot of the cluster is created before Amazon
// Redshift deletes the cluster. If true , a final cluster snapshot is not created.
// If false , a final cluster snapshot is created before the cluster is deleted.
// The FinalClusterSnapshotIdentifier parameter must be specified if
// SkipFinalClusterSnapshot is false . Default: false
SkipFinalClusterSnapshot bool
noSmithyDocumentSerde
}
type DeleteClusterOutput struct {
// Describes a cluster.
Cluster *types.Cluster
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteCluster{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteClusterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteCluster(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteCluster",
}
}
| 161 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a specified Amazon Redshift parameter group. You cannot delete a
// parameter group if it is associated with a cluster.
func (c *Client) DeleteClusterParameterGroup(ctx context.Context, params *DeleteClusterParameterGroupInput, optFns ...func(*Options)) (*DeleteClusterParameterGroupOutput, error) {
if params == nil {
params = &DeleteClusterParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteClusterParameterGroup", params, optFns, c.addOperationDeleteClusterParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteClusterParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteClusterParameterGroupInput struct {
// The name of the parameter group to be deleted. Constraints:
// - Must be the name of an existing cluster parameter group.
// - Cannot delete a default cluster parameter group.
//
// This member is required.
ParameterGroupName *string
noSmithyDocumentSerde
}
type DeleteClusterParameterGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteClusterParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteClusterParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteClusterParameterGroup{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteClusterParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteClusterParameterGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteClusterParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteClusterParameterGroup",
}
}
| 123 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an Amazon Redshift security group. You cannot delete a security group
// that is associated with any clusters. You cannot delete the default security
// group. For information about managing security groups, go to Amazon Redshift
// Cluster Security Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-security-groups.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DeleteClusterSecurityGroup(ctx context.Context, params *DeleteClusterSecurityGroupInput, optFns ...func(*Options)) (*DeleteClusterSecurityGroupOutput, error) {
if params == nil {
params = &DeleteClusterSecurityGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteClusterSecurityGroup", params, optFns, c.addOperationDeleteClusterSecurityGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteClusterSecurityGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteClusterSecurityGroupInput struct {
// The name of the cluster security group to be deleted.
//
// This member is required.
ClusterSecurityGroupName *string
noSmithyDocumentSerde
}
type DeleteClusterSecurityGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteClusterSecurityGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteClusterSecurityGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteClusterSecurityGroup{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteClusterSecurityGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteClusterSecurityGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteClusterSecurityGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteClusterSecurityGroup",
}
}
| 124 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified manual snapshot. The snapshot must be in the available
// state, with no other users authorized to access the snapshot. Unlike automated
// snapshots, manual snapshots are retained even after you delete your cluster.
// Amazon Redshift does not delete your manual snapshots. You must delete manual
// snapshot explicitly to avoid getting charged. If other accounts are authorized
// to access the snapshot, you must revoke all of the authorizations before you can
// delete the snapshot.
func (c *Client) DeleteClusterSnapshot(ctx context.Context, params *DeleteClusterSnapshotInput, optFns ...func(*Options)) (*DeleteClusterSnapshotOutput, error) {
if params == nil {
params = &DeleteClusterSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteClusterSnapshot", params, optFns, c.addOperationDeleteClusterSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteClusterSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteClusterSnapshotInput struct {
// The unique identifier of the manual snapshot to be deleted. Constraints: Must
// be the name of an existing snapshot that is in the available , failed , or
// cancelled state.
//
// This member is required.
SnapshotIdentifier *string
// The unique identifier of the cluster the snapshot was created from. This
// parameter is required if your IAM user has a policy containing a snapshot
// resource element that specifies anything other than * for the cluster name.
// Constraints: Must be the name of valid cluster.
SnapshotClusterIdentifier *string
noSmithyDocumentSerde
}
type DeleteClusterSnapshotOutput struct {
// Describes a snapshot.
Snapshot *types.Snapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteClusterSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteClusterSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteClusterSnapshot(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteClusterSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteClusterSnapshot",
}
}
| 139 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified cluster subnet group.
func (c *Client) DeleteClusterSubnetGroup(ctx context.Context, params *DeleteClusterSubnetGroupInput, optFns ...func(*Options)) (*DeleteClusterSubnetGroupOutput, error) {
if params == nil {
params = &DeleteClusterSubnetGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteClusterSubnetGroup", params, optFns, c.addOperationDeleteClusterSubnetGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteClusterSubnetGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteClusterSubnetGroupInput struct {
// The name of the cluster subnet group name to be deleted.
//
// This member is required.
ClusterSubnetGroupName *string
noSmithyDocumentSerde
}
type DeleteClusterSubnetGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteClusterSubnetGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteClusterSubnetGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteClusterSubnetGroup{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteClusterSubnetGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteClusterSubnetGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteClusterSubnetGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteClusterSubnetGroup",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Contains information about deleting a custom domain association for a cluster.
func (c *Client) DeleteCustomDomainAssociation(ctx context.Context, params *DeleteCustomDomainAssociationInput, optFns ...func(*Options)) (*DeleteCustomDomainAssociationOutput, error) {
if params == nil {
params = &DeleteCustomDomainAssociationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteCustomDomainAssociation", params, optFns, c.addOperationDeleteCustomDomainAssociationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteCustomDomainAssociationOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteCustomDomainAssociationInput struct {
// The identifier of the cluster to delete a custom domain association for.
//
// This member is required.
ClusterIdentifier *string
noSmithyDocumentSerde
}
type DeleteCustomDomainAssociationOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteCustomDomainAssociationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteCustomDomainAssociation{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteCustomDomainAssociation{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteCustomDomainAssociationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteCustomDomainAssociation(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteCustomDomainAssociation(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteCustomDomainAssociation",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Deletes a Redshift-managed VPC endpoint.
func (c *Client) DeleteEndpointAccess(ctx context.Context, params *DeleteEndpointAccessInput, optFns ...func(*Options)) (*DeleteEndpointAccessOutput, error) {
if params == nil {
params = &DeleteEndpointAccessInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteEndpointAccess", params, optFns, c.addOperationDeleteEndpointAccessMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteEndpointAccessOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteEndpointAccessInput struct {
// The Redshift-managed VPC endpoint to delete.
//
// This member is required.
EndpointName *string
noSmithyDocumentSerde
}
// Describes a Redshift-managed VPC endpoint.
type DeleteEndpointAccessOutput struct {
// The DNS address of the endpoint.
Address *string
// The cluster identifier of the cluster associated with the endpoint.
ClusterIdentifier *string
// The time (UTC) that the endpoint was created.
EndpointCreateTime *time.Time
// The name of the endpoint.
EndpointName *string
// The status of the endpoint.
EndpointStatus *string
// The port number on which the cluster accepts incoming connections.
Port int32
// The Amazon Web Services account ID of the owner of the cluster.
ResourceOwner *string
// The subnet group name where Amazon Redshift chooses to deploy the endpoint.
SubnetGroupName *string
// The connection endpoint for connecting to an Amazon Redshift cluster through
// the proxy.
VpcEndpoint *types.VpcEndpoint
// The security groups associated with the endpoint.
VpcSecurityGroups []types.VpcSecurityGroupMembership
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteEndpointAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteEndpointAccess{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteEndpointAccess{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteEndpointAccessValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteEndpointAccess(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteEndpointAccess(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteEndpointAccess",
}
}
| 155 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an Amazon Redshift event notification subscription.
func (c *Client) DeleteEventSubscription(ctx context.Context, params *DeleteEventSubscriptionInput, optFns ...func(*Options)) (*DeleteEventSubscriptionOutput, error) {
if params == nil {
params = &DeleteEventSubscriptionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteEventSubscription", params, optFns, c.addOperationDeleteEventSubscriptionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteEventSubscriptionOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteEventSubscriptionInput struct {
// The name of the Amazon Redshift event notification subscription to be deleted.
//
// This member is required.
SubscriptionName *string
noSmithyDocumentSerde
}
type DeleteEventSubscriptionOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteEventSubscriptionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteEventSubscription{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteEventSubscription{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteEventSubscriptionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteEventSubscription(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteEventSubscription(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteEventSubscription",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified HSM client certificate.
func (c *Client) DeleteHsmClientCertificate(ctx context.Context, params *DeleteHsmClientCertificateInput, optFns ...func(*Options)) (*DeleteHsmClientCertificateOutput, error) {
if params == nil {
params = &DeleteHsmClientCertificateInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteHsmClientCertificate", params, optFns, c.addOperationDeleteHsmClientCertificateMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteHsmClientCertificateOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteHsmClientCertificateInput struct {
// The identifier of the HSM client certificate to be deleted.
//
// This member is required.
HsmClientCertificateIdentifier *string
noSmithyDocumentSerde
}
type DeleteHsmClientCertificateOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteHsmClientCertificateMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteHsmClientCertificate{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteHsmClientCertificate{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteHsmClientCertificateValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteHsmClientCertificate(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteHsmClientCertificate(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteHsmClientCertificate",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified Amazon Redshift HSM configuration.
func (c *Client) DeleteHsmConfiguration(ctx context.Context, params *DeleteHsmConfigurationInput, optFns ...func(*Options)) (*DeleteHsmConfigurationOutput, error) {
if params == nil {
params = &DeleteHsmConfigurationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteHsmConfiguration", params, optFns, c.addOperationDeleteHsmConfigurationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteHsmConfigurationOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteHsmConfigurationInput struct {
// The identifier of the Amazon Redshift HSM configuration to be deleted.
//
// This member is required.
HsmConfigurationIdentifier *string
noSmithyDocumentSerde
}
type DeleteHsmConfigurationOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteHsmConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteHsmConfiguration{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteHsmConfiguration{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteHsmConfigurationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteHsmConfiguration(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteHsmConfiguration(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteHsmConfiguration",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a partner integration from a cluster. Data can still flow to the
// cluster until the integration is deleted at the partner's website.
func (c *Client) DeletePartner(ctx context.Context, params *DeletePartnerInput, optFns ...func(*Options)) (*DeletePartnerOutput, error) {
if params == nil {
params = &DeletePartnerInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeletePartner", params, optFns, c.addOperationDeletePartnerMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeletePartnerOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeletePartnerInput struct {
// The Amazon Web Services account ID that owns the cluster.
//
// This member is required.
AccountId *string
// The cluster identifier of the cluster that receives data from the partner.
//
// This member is required.
ClusterIdentifier *string
// The name of the database that receives data from the partner.
//
// This member is required.
DatabaseName *string
// The name of the partner that is authorized to send data.
//
// This member is required.
PartnerName *string
noSmithyDocumentSerde
}
type DeletePartnerOutput struct {
// The name of the database that receives data from the partner.
DatabaseName *string
// The name of the partner that is authorized to send data.
PartnerName *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeletePartnerMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeletePartner{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeletePartner{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeletePartnerValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeletePartner(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeletePartner(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeletePartner",
}
}
| 143 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a scheduled action.
func (c *Client) DeleteScheduledAction(ctx context.Context, params *DeleteScheduledActionInput, optFns ...func(*Options)) (*DeleteScheduledActionOutput, error) {
if params == nil {
params = &DeleteScheduledActionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteScheduledAction", params, optFns, c.addOperationDeleteScheduledActionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteScheduledActionOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteScheduledActionInput struct {
// The name of the scheduled action to delete.
//
// This member is required.
ScheduledActionName *string
noSmithyDocumentSerde
}
type DeleteScheduledActionOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteScheduledActionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteScheduledAction{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteScheduledAction{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteScheduledActionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteScheduledAction(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteScheduledAction(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteScheduledAction",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified snapshot copy grant.
func (c *Client) DeleteSnapshotCopyGrant(ctx context.Context, params *DeleteSnapshotCopyGrantInput, optFns ...func(*Options)) (*DeleteSnapshotCopyGrantOutput, error) {
if params == nil {
params = &DeleteSnapshotCopyGrantInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteSnapshotCopyGrant", params, optFns, c.addOperationDeleteSnapshotCopyGrantMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteSnapshotCopyGrantOutput)
out.ResultMetadata = metadata
return out, nil
}
// The result of the DeleteSnapshotCopyGrant action.
type DeleteSnapshotCopyGrantInput struct {
// The name of the snapshot copy grant to delete.
//
// This member is required.
SnapshotCopyGrantName *string
noSmithyDocumentSerde
}
type DeleteSnapshotCopyGrantOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteSnapshotCopyGrantMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteSnapshotCopyGrant{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteSnapshotCopyGrant{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteSnapshotCopyGrantValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteSnapshotCopyGrant(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteSnapshotCopyGrant(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteSnapshotCopyGrant",
}
}
| 121 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a snapshot schedule.
func (c *Client) DeleteSnapshotSchedule(ctx context.Context, params *DeleteSnapshotScheduleInput, optFns ...func(*Options)) (*DeleteSnapshotScheduleOutput, error) {
if params == nil {
params = &DeleteSnapshotScheduleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteSnapshotSchedule", params, optFns, c.addOperationDeleteSnapshotScheduleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteSnapshotScheduleOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteSnapshotScheduleInput struct {
// A unique identifier of the snapshot schedule to delete.
//
// This member is required.
ScheduleIdentifier *string
noSmithyDocumentSerde
}
type DeleteSnapshotScheduleOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteSnapshotScheduleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteSnapshotSchedule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteSnapshotSchedule{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteSnapshotScheduleValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteSnapshotSchedule(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteSnapshotSchedule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteSnapshotSchedule",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes tags from a resource. You must provide the ARN of the resource from
// which you want to delete the tag or tags.
func (c *Client) DeleteTags(ctx context.Context, params *DeleteTagsInput, optFns ...func(*Options)) (*DeleteTagsOutput, error) {
if params == nil {
params = &DeleteTagsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteTags", params, optFns, c.addOperationDeleteTagsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteTagsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Contains the output from the DeleteTags action.
type DeleteTagsInput struct {
// The Amazon Resource Name (ARN) from which you want to remove the tag or tags.
// For example, arn:aws:redshift:us-east-2:123456789:cluster:t1 .
//
// This member is required.
ResourceName *string
// The tag key that you want to delete.
//
// This member is required.
TagKeys []string
noSmithyDocumentSerde
}
type DeleteTagsOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteTagsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteTags{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteTags{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteTagsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteTags(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteTags(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteTags",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a usage limit from a cluster.
func (c *Client) DeleteUsageLimit(ctx context.Context, params *DeleteUsageLimitInput, optFns ...func(*Options)) (*DeleteUsageLimitOutput, error) {
if params == nil {
params = &DeleteUsageLimitInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteUsageLimit", params, optFns, c.addOperationDeleteUsageLimitMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteUsageLimitOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteUsageLimitInput struct {
// The identifier of the usage limit to delete.
//
// This member is required.
UsageLimitId *string
noSmithyDocumentSerde
}
type DeleteUsageLimitOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteUsageLimitMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteUsageLimit{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteUsageLimit{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteUsageLimitValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteUsageLimit(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteUsageLimit(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DeleteUsageLimit",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of attributes attached to an account
func (c *Client) DescribeAccountAttributes(ctx context.Context, params *DescribeAccountAttributesInput, optFns ...func(*Options)) (*DescribeAccountAttributesOutput, error) {
if params == nil {
params = &DescribeAccountAttributesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeAccountAttributes", params, optFns, c.addOperationDescribeAccountAttributesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeAccountAttributesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeAccountAttributesInput struct {
// A list of attribute names.
AttributeNames []string
noSmithyDocumentSerde
}
type DescribeAccountAttributesOutput struct {
// A list of attributes assigned to an account.
AccountAttributes []types.AccountAttribute
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeAccountAttributesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeAccountAttributes{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeAccountAttributes{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAccountAttributes(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeAccountAttributes(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeAccountAttributes",
}
}
| 120 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Describes an authentication profile.
func (c *Client) DescribeAuthenticationProfiles(ctx context.Context, params *DescribeAuthenticationProfilesInput, optFns ...func(*Options)) (*DescribeAuthenticationProfilesOutput, error) {
if params == nil {
params = &DescribeAuthenticationProfilesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeAuthenticationProfiles", params, optFns, c.addOperationDescribeAuthenticationProfilesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeAuthenticationProfilesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeAuthenticationProfilesInput struct {
// The name of the authentication profile to describe. If not specified then all
// authentication profiles owned by the account are listed.
AuthenticationProfileName *string
noSmithyDocumentSerde
}
type DescribeAuthenticationProfilesOutput struct {
// The list of authentication profiles.
AuthenticationProfiles []types.AuthenticationProfile
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeAuthenticationProfilesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeAuthenticationProfiles{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeAuthenticationProfiles{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAuthenticationProfiles(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeAuthenticationProfiles(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeAuthenticationProfiles",
}
}
| 121 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns an array of ClusterDbRevision objects.
func (c *Client) DescribeClusterDbRevisions(ctx context.Context, params *DescribeClusterDbRevisionsInput, optFns ...func(*Options)) (*DescribeClusterDbRevisionsOutput, error) {
if params == nil {
params = &DescribeClusterDbRevisionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterDbRevisions", params, optFns, c.addOperationDescribeClusterDbRevisionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterDbRevisionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterDbRevisionsInput struct {
// A unique identifier for a cluster whose ClusterDbRevisions you are requesting.
// This parameter is case sensitive. All clusters defined for an account are
// returned by default.
ClusterIdentifier *string
// An optional parameter that specifies the starting point for returning a set of
// response records. When the results of a DescribeClusterDbRevisions request
// exceed the value specified in MaxRecords , Amazon Redshift returns a value in
// the marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the marker parameter and
// retrying the request. Constraints: You can specify either the ClusterIdentifier
// parameter, or the marker parameter, but not both.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in the marker field of the response. You can retrieve the next set of
// response records by providing the returned marker value in the marker parameter
// and retrying the request. Default: 100 Constraints: minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeClusterDbRevisionsOutput struct {
// A list of revisions.
ClusterDbRevisions []types.ClusterDbRevision
// A string representing the starting point for the next set of revisions. If a
// value is returned in a response, you can retrieve the next set of revisions by
// providing the value in the marker parameter and retrying the command. If the
// marker field is empty, all revisions have already been returned.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterDbRevisionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterDbRevisions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterDbRevisions{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterDbRevisions(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterDbRevisionsAPIClient is a client that implements the
// DescribeClusterDbRevisions operation.
type DescribeClusterDbRevisionsAPIClient interface {
DescribeClusterDbRevisions(context.Context, *DescribeClusterDbRevisionsInput, ...func(*Options)) (*DescribeClusterDbRevisionsOutput, error)
}
var _ DescribeClusterDbRevisionsAPIClient = (*Client)(nil)
// DescribeClusterDbRevisionsPaginatorOptions is the paginator options for
// DescribeClusterDbRevisions
type DescribeClusterDbRevisionsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in the marker field of the response. You can retrieve the next set of
// response records by providing the returned marker value in the marker parameter
// and retrying the request. Default: 100 Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterDbRevisionsPaginator is a paginator for
// DescribeClusterDbRevisions
type DescribeClusterDbRevisionsPaginator struct {
options DescribeClusterDbRevisionsPaginatorOptions
client DescribeClusterDbRevisionsAPIClient
params *DescribeClusterDbRevisionsInput
nextToken *string
firstPage bool
}
// NewDescribeClusterDbRevisionsPaginator returns a new
// DescribeClusterDbRevisionsPaginator
func NewDescribeClusterDbRevisionsPaginator(client DescribeClusterDbRevisionsAPIClient, params *DescribeClusterDbRevisionsInput, optFns ...func(*DescribeClusterDbRevisionsPaginatorOptions)) *DescribeClusterDbRevisionsPaginator {
if params == nil {
params = &DescribeClusterDbRevisionsInput{}
}
options := DescribeClusterDbRevisionsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterDbRevisionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterDbRevisionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterDbRevisions page.
func (p *DescribeClusterDbRevisionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterDbRevisionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterDbRevisions(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeClusterDbRevisions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterDbRevisions",
}
}
| 242 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of Amazon Redshift parameter groups, including parameter groups
// you created and the default parameter group. For each parameter group, the
// response includes the parameter group name, description, and parameter group
// family name. You can optionally specify a name to retrieve the description of a
// specific parameter group. For more information about parameters and parameter
// groups, go to Amazon Redshift Parameter Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html)
// in the Amazon Redshift Cluster Management Guide. If you specify both tag keys
// and tag values in the same request, Amazon Redshift returns all parameter groups
// that match any combination of the specified keys and values. For example, if you
// have owner and environment for tag keys, and admin and test for tag values, all
// parameter groups that have any combination of those values are returned. If both
// tag keys and values are omitted from the request, parameter groups are returned
// regardless of whether they have tag keys or values associated with them.
func (c *Client) DescribeClusterParameterGroups(ctx context.Context, params *DescribeClusterParameterGroupsInput, optFns ...func(*Options)) (*DescribeClusterParameterGroupsOutput, error) {
if params == nil {
params = &DescribeClusterParameterGroupsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterParameterGroups", params, optFns, c.addOperationDescribeClusterParameterGroupsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterParameterGroupsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterParameterGroupsInput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusterParameterGroups request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The name of a specific parameter group for which to return details. By default,
// details about all parameter groups and the default parameter group are returned.
ParameterGroupName *string
// A tag key or keys for which you want to return all matching cluster parameter
// groups that are associated with the specified key or keys. For example, suppose
// that you have parameter groups that are tagged with keys called owner and
// environment . If you specify both of these tag keys in the request, Amazon
// Redshift returns a response with the parameter groups that have either or both
// of these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching cluster
// parameter groups that are associated with the specified tag value or values. For
// example, suppose that you have parameter groups that are tagged with values
// called admin and test . If you specify both of these tag values in the request,
// Amazon Redshift returns a response with the parameter groups that have either or
// both of these tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
// Contains the output from the DescribeClusterParameterGroups action.
type DescribeClusterParameterGroupsOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// A list of ClusterParameterGroup instances. Each instance describes one cluster
// parameter group.
ParameterGroups []types.ClusterParameterGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterParameterGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterParameterGroups{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterParameterGroups{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterParameterGroups(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterParameterGroupsAPIClient is a client that implements the
// DescribeClusterParameterGroups operation.
type DescribeClusterParameterGroupsAPIClient interface {
DescribeClusterParameterGroups(context.Context, *DescribeClusterParameterGroupsInput, ...func(*Options)) (*DescribeClusterParameterGroupsOutput, error)
}
var _ DescribeClusterParameterGroupsAPIClient = (*Client)(nil)
// DescribeClusterParameterGroupsPaginatorOptions is the paginator options for
// DescribeClusterParameterGroups
type DescribeClusterParameterGroupsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterParameterGroupsPaginator is a paginator for
// DescribeClusterParameterGroups
type DescribeClusterParameterGroupsPaginator struct {
options DescribeClusterParameterGroupsPaginatorOptions
client DescribeClusterParameterGroupsAPIClient
params *DescribeClusterParameterGroupsInput
nextToken *string
firstPage bool
}
// NewDescribeClusterParameterGroupsPaginator returns a new
// DescribeClusterParameterGroupsPaginator
func NewDescribeClusterParameterGroupsPaginator(client DescribeClusterParameterGroupsAPIClient, params *DescribeClusterParameterGroupsInput, optFns ...func(*DescribeClusterParameterGroupsPaginatorOptions)) *DescribeClusterParameterGroupsPaginator {
if params == nil {
params = &DescribeClusterParameterGroupsInput{}
}
options := DescribeClusterParameterGroupsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterParameterGroupsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterParameterGroupsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterParameterGroups page.
func (p *DescribeClusterParameterGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterParameterGroupsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterParameterGroups(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeClusterParameterGroups(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterParameterGroups",
}
}
| 271 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a detailed list of parameters contained within the specified Amazon
// Redshift parameter group. For each parameter the response includes information
// such as parameter name, description, data type, value, whether the parameter
// value is modifiable, and so on. You can specify source filter to retrieve
// parameters of only specific type. For example, to retrieve parameters that were
// modified by a user action such as from ModifyClusterParameterGroup , you can
// specify source equal to user. For more information about parameters and
// parameter groups, go to Amazon Redshift Parameter Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DescribeClusterParameters(ctx context.Context, params *DescribeClusterParametersInput, optFns ...func(*Options)) (*DescribeClusterParametersOutput, error) {
if params == nil {
params = &DescribeClusterParametersInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterParameters", params, optFns, c.addOperationDescribeClusterParametersMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterParametersOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterParametersInput struct {
// The name of a cluster parameter group for which to return details.
//
// This member is required.
ParameterGroupName *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusterParameters request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The parameter types to return. Specify user to show parameters that are
// different form the default. Similarly, specify engine-default to show
// parameters that are the same as the default parameter group. Default: All
// parameter types returned. Valid Values: user | engine-default
Source *string
noSmithyDocumentSerde
}
// Contains the output from the DescribeClusterParameters action.
type DescribeClusterParametersOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// A list of Parameter instances. Each instance lists the parameters of one
// cluster parameter group.
Parameters []types.Parameter
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterParametersMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterParameters{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterParameters{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeClusterParametersValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterParameters(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterParametersAPIClient is a client that implements the
// DescribeClusterParameters operation.
type DescribeClusterParametersAPIClient interface {
DescribeClusterParameters(context.Context, *DescribeClusterParametersInput, ...func(*Options)) (*DescribeClusterParametersOutput, error)
}
var _ DescribeClusterParametersAPIClient = (*Client)(nil)
// DescribeClusterParametersPaginatorOptions is the paginator options for
// DescribeClusterParameters
type DescribeClusterParametersPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterParametersPaginator is a paginator for DescribeClusterParameters
type DescribeClusterParametersPaginator struct {
options DescribeClusterParametersPaginatorOptions
client DescribeClusterParametersAPIClient
params *DescribeClusterParametersInput
nextToken *string
firstPage bool
}
// NewDescribeClusterParametersPaginator returns a new
// DescribeClusterParametersPaginator
func NewDescribeClusterParametersPaginator(client DescribeClusterParametersAPIClient, params *DescribeClusterParametersInput, optFns ...func(*DescribeClusterParametersPaginatorOptions)) *DescribeClusterParametersPaginator {
if params == nil {
params = &DescribeClusterParametersInput{}
}
options := DescribeClusterParametersPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterParametersPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterParametersPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterParameters page.
func (p *DescribeClusterParametersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterParametersOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterParameters(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeClusterParameters(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterParameters",
}
}
| 260 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"errors"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
smithytime "github.com/aws/smithy-go/time"
smithyhttp "github.com/aws/smithy-go/transport/http"
smithywaiter "github.com/aws/smithy-go/waiter"
"github.com/jmespath/go-jmespath"
"time"
)
// Returns properties of provisioned clusters including general cluster
// properties, cluster database properties, maintenance and backup properties, and
// security and access properties. This operation supports pagination. For more
// information about managing clusters, go to Amazon Redshift Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html)
// in the Amazon Redshift Cluster Management Guide. If you specify both tag keys
// and tag values in the same request, Amazon Redshift returns all clusters that
// match any combination of the specified keys and values. For example, if you have
// owner and environment for tag keys, and admin and test for tag values, all
// clusters that have any combination of those values are returned. If both tag
// keys and values are omitted from the request, clusters are returned regardless
// of whether they have tag keys or values associated with them.
func (c *Client) DescribeClusters(ctx context.Context, params *DescribeClustersInput, optFns ...func(*Options)) (*DescribeClustersOutput, error) {
if params == nil {
params = &DescribeClustersInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusters", params, optFns, c.addOperationDescribeClustersMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClustersOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClustersInput struct {
// The unique identifier of a cluster whose properties you are requesting. This
// parameter is case sensitive. The default is that all clusters defined for an
// account are returned.
ClusterIdentifier *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusters request exceed the
// value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request. Constraints: You can specify either the ClusterIdentifier parameter or
// the Marker parameter, but not both.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// A tag key or keys for which you want to return all matching clusters that are
// associated with the specified key or keys. For example, suppose that you have
// clusters that are tagged with keys called owner and environment . If you specify
// both of these tag keys in the request, Amazon Redshift returns a response with
// the clusters that have either or both of these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching clusters that
// are associated with the specified tag value or values. For example, suppose that
// you have clusters that are tagged with values called admin and test . If you
// specify both of these tag values in the request, Amazon Redshift returns a
// response with the clusters that have either or both of these tag values
// associated with them.
TagValues []string
noSmithyDocumentSerde
}
// Contains the output from the DescribeClusters action.
type DescribeClustersOutput struct {
// A list of Cluster objects, where each object describes one cluster.
Clusters []types.Cluster
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClustersMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusters{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusters{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusters(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClustersAPIClient is a client that implements the DescribeClusters
// operation.
type DescribeClustersAPIClient interface {
DescribeClusters(context.Context, *DescribeClustersInput, ...func(*Options)) (*DescribeClustersOutput, error)
}
var _ DescribeClustersAPIClient = (*Client)(nil)
// DescribeClustersPaginatorOptions is the paginator options for DescribeClusters
type DescribeClustersPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClustersPaginator is a paginator for DescribeClusters
type DescribeClustersPaginator struct {
options DescribeClustersPaginatorOptions
client DescribeClustersAPIClient
params *DescribeClustersInput
nextToken *string
firstPage bool
}
// NewDescribeClustersPaginator returns a new DescribeClustersPaginator
func NewDescribeClustersPaginator(client DescribeClustersAPIClient, params *DescribeClustersInput, optFns ...func(*DescribeClustersPaginatorOptions)) *DescribeClustersPaginator {
if params == nil {
params = &DescribeClustersInput{}
}
options := DescribeClustersPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClustersPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClustersPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusters page.
func (p *DescribeClustersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClustersOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusters(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
// ClusterAvailableWaiterOptions are waiter options for ClusterAvailableWaiter
type ClusterAvailableWaiterOptions struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// MinDelay is the minimum amount of time to delay between retries. If unset,
// ClusterAvailableWaiter will use default minimum delay of 60 seconds. Note that
// MinDelay must resolve to a value lesser than or equal to the MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, ClusterAvailableWaiter will use default max delay of 120 seconds.
// Note that MaxDelay must resolve to value greater than or equal to the MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts
LogWaitAttempts bool
// Retryable is function that can be used to override the service defined
// waiter-behavior based on operation output, or returned error. This function is
// used by the waiter to decide if a state is retryable or a terminal state. By
// default service-modeled logic will populate this option. This option can thus be
// used to define a custom waiter state with fall-back to service-modeled waiter
// state mutators.The function returns an error in case of a failure state. In case
// of retry state, this function returns a bool value of true and nil error, while
// in case of success it returns a bool value of false and nil error.
Retryable func(context.Context, *DescribeClustersInput, *DescribeClustersOutput, error) (bool, error)
}
// ClusterAvailableWaiter defines the waiters for ClusterAvailable
type ClusterAvailableWaiter struct {
client DescribeClustersAPIClient
options ClusterAvailableWaiterOptions
}
// NewClusterAvailableWaiter constructs a ClusterAvailableWaiter.
func NewClusterAvailableWaiter(client DescribeClustersAPIClient, optFns ...func(*ClusterAvailableWaiterOptions)) *ClusterAvailableWaiter {
options := ClusterAvailableWaiterOptions{}
options.MinDelay = 60 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = clusterAvailableStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &ClusterAvailableWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for ClusterAvailable waiter. The maxWaitDur is
// the maximum wait duration the waiter will wait. The maxWaitDur is required and
// must be greater than zero.
func (w *ClusterAvailableWaiter) Wait(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterAvailableWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for ClusterAvailable waiter and returns
// the output of the successful operation. The maxWaitDur is the maximum wait
// duration the waiter will wait. The maxWaitDur is required and must be greater
// than zero.
func (w *ClusterAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterAvailableWaiterOptions)) (*DescribeClustersOutput, error) {
if maxWaitDur <= 0 {
return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero")
}
options := w.options
for _, fn := range optFns {
fn(&options)
}
if options.MaxDelay <= 0 {
options.MaxDelay = 120 * time.Second
}
if options.MinDelay > options.MaxDelay {
return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay)
}
ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur)
defer cancelFn()
logger := smithywaiter.Logger{}
remainingTime := maxWaitDur
var attempt int64
for {
attempt++
apiOptions := options.APIOptions
start := time.Now()
if options.LogWaitAttempts {
logger.Attempt = attempt
apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...)
apiOptions = append(apiOptions, logger.AddLogger)
}
out, err := w.client.DescribeClusters(ctx, params, func(o *Options) {
o.APIOptions = append(o.APIOptions, apiOptions...)
})
retryable, err := options.Retryable(ctx, params, out, err)
if err != nil {
return nil, err
}
if !retryable {
return out, nil
}
remainingTime -= time.Since(start)
if remainingTime < options.MinDelay || remainingTime <= 0 {
break
}
// compute exponential backoff between waiter retries
delay, err := smithywaiter.ComputeDelay(
attempt, options.MinDelay, options.MaxDelay, remainingTime,
)
if err != nil {
return nil, fmt.Errorf("error computing waiter delay, %w", err)
}
remainingTime -= delay
// sleep for the delay amount before invoking a request
if err := smithytime.SleepWithContext(ctx, delay); err != nil {
return nil, fmt.Errorf("request cancelled while waiting, %w", err)
}
}
return nil, fmt.Errorf("exceeded max wait time for ClusterAvailable waiter")
}
func clusterAvailableStateRetryable(ctx context.Context, input *DescribeClustersInput, output *DescribeClustersOutput, err error) (bool, error) {
if err == nil {
pathValue, err := jmespath.Search("Clusters[].ClusterStatus", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "available"
var match = true
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
if len(listOfValues) == 0 {
match = false
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) != expectedValue {
match = false
}
}
if match {
return false, nil
}
}
if err == nil {
pathValue, err := jmespath.Search("Clusters[].ClusterStatus", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "deleting"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
if err != nil {
var apiErr smithy.APIError
ok := errors.As(err, &apiErr)
if !ok {
return false, fmt.Errorf("expected err to be of type smithy.APIError, got %w", err)
}
if "ClusterNotFound" == apiErr.ErrorCode() {
return true, nil
}
}
return true, nil
}
// ClusterDeletedWaiterOptions are waiter options for ClusterDeletedWaiter
type ClusterDeletedWaiterOptions struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// MinDelay is the minimum amount of time to delay between retries. If unset,
// ClusterDeletedWaiter will use default minimum delay of 60 seconds. Note that
// MinDelay must resolve to a value lesser than or equal to the MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, ClusterDeletedWaiter will use default max delay of 120 seconds.
// Note that MaxDelay must resolve to value greater than or equal to the MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts
LogWaitAttempts bool
// Retryable is function that can be used to override the service defined
// waiter-behavior based on operation output, or returned error. This function is
// used by the waiter to decide if a state is retryable or a terminal state. By
// default service-modeled logic will populate this option. This option can thus be
// used to define a custom waiter state with fall-back to service-modeled waiter
// state mutators.The function returns an error in case of a failure state. In case
// of retry state, this function returns a bool value of true and nil error, while
// in case of success it returns a bool value of false and nil error.
Retryable func(context.Context, *DescribeClustersInput, *DescribeClustersOutput, error) (bool, error)
}
// ClusterDeletedWaiter defines the waiters for ClusterDeleted
type ClusterDeletedWaiter struct {
client DescribeClustersAPIClient
options ClusterDeletedWaiterOptions
}
// NewClusterDeletedWaiter constructs a ClusterDeletedWaiter.
func NewClusterDeletedWaiter(client DescribeClustersAPIClient, optFns ...func(*ClusterDeletedWaiterOptions)) *ClusterDeletedWaiter {
options := ClusterDeletedWaiterOptions{}
options.MinDelay = 60 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = clusterDeletedStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &ClusterDeletedWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for ClusterDeleted waiter. The maxWaitDur is the
// maximum wait duration the waiter will wait. The maxWaitDur is required and must
// be greater than zero.
func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for ClusterDeleted waiter and returns
// the output of the successful operation. The maxWaitDur is the maximum wait
// duration the waiter will wait. The maxWaitDur is required and must be greater
// than zero.
func (w *ClusterDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) (*DescribeClustersOutput, error) {
if maxWaitDur <= 0 {
return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero")
}
options := w.options
for _, fn := range optFns {
fn(&options)
}
if options.MaxDelay <= 0 {
options.MaxDelay = 120 * time.Second
}
if options.MinDelay > options.MaxDelay {
return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay)
}
ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur)
defer cancelFn()
logger := smithywaiter.Logger{}
remainingTime := maxWaitDur
var attempt int64
for {
attempt++
apiOptions := options.APIOptions
start := time.Now()
if options.LogWaitAttempts {
logger.Attempt = attempt
apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...)
apiOptions = append(apiOptions, logger.AddLogger)
}
out, err := w.client.DescribeClusters(ctx, params, func(o *Options) {
o.APIOptions = append(o.APIOptions, apiOptions...)
})
retryable, err := options.Retryable(ctx, params, out, err)
if err != nil {
return nil, err
}
if !retryable {
return out, nil
}
remainingTime -= time.Since(start)
if remainingTime < options.MinDelay || remainingTime <= 0 {
break
}
// compute exponential backoff between waiter retries
delay, err := smithywaiter.ComputeDelay(
attempt, options.MinDelay, options.MaxDelay, remainingTime,
)
if err != nil {
return nil, fmt.Errorf("error computing waiter delay, %w", err)
}
remainingTime -= delay
// sleep for the delay amount before invoking a request
if err := smithytime.SleepWithContext(ctx, delay); err != nil {
return nil, fmt.Errorf("request cancelled while waiting, %w", err)
}
}
return nil, fmt.Errorf("exceeded max wait time for ClusterDeleted waiter")
}
func clusterDeletedStateRetryable(ctx context.Context, input *DescribeClustersInput, output *DescribeClustersOutput, err error) (bool, error) {
if err != nil {
var apiErr smithy.APIError
ok := errors.As(err, &apiErr)
if !ok {
return false, fmt.Errorf("expected err to be of type smithy.APIError, got %w", err)
}
if "ClusterNotFound" == apiErr.ErrorCode() {
return false, nil
}
}
if err == nil {
pathValue, err := jmespath.Search("Clusters[].ClusterStatus", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "creating"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
if err == nil {
pathValue, err := jmespath.Search("Clusters[].ClusterStatus", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "modifying"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
return true, nil
}
// ClusterRestoredWaiterOptions are waiter options for ClusterRestoredWaiter
type ClusterRestoredWaiterOptions struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// MinDelay is the minimum amount of time to delay between retries. If unset,
// ClusterRestoredWaiter will use default minimum delay of 60 seconds. Note that
// MinDelay must resolve to a value lesser than or equal to the MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, ClusterRestoredWaiter will use default max delay of 120 seconds.
// Note that MaxDelay must resolve to value greater than or equal to the MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts
LogWaitAttempts bool
// Retryable is function that can be used to override the service defined
// waiter-behavior based on operation output, or returned error. This function is
// used by the waiter to decide if a state is retryable or a terminal state. By
// default service-modeled logic will populate this option. This option can thus be
// used to define a custom waiter state with fall-back to service-modeled waiter
// state mutators.The function returns an error in case of a failure state. In case
// of retry state, this function returns a bool value of true and nil error, while
// in case of success it returns a bool value of false and nil error.
Retryable func(context.Context, *DescribeClustersInput, *DescribeClustersOutput, error) (bool, error)
}
// ClusterRestoredWaiter defines the waiters for ClusterRestored
type ClusterRestoredWaiter struct {
client DescribeClustersAPIClient
options ClusterRestoredWaiterOptions
}
// NewClusterRestoredWaiter constructs a ClusterRestoredWaiter.
func NewClusterRestoredWaiter(client DescribeClustersAPIClient, optFns ...func(*ClusterRestoredWaiterOptions)) *ClusterRestoredWaiter {
options := ClusterRestoredWaiterOptions{}
options.MinDelay = 60 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = clusterRestoredStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &ClusterRestoredWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for ClusterRestored waiter. The maxWaitDur is
// the maximum wait duration the waiter will wait. The maxWaitDur is required and
// must be greater than zero.
func (w *ClusterRestoredWaiter) Wait(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterRestoredWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for ClusterRestored waiter and returns
// the output of the successful operation. The maxWaitDur is the maximum wait
// duration the waiter will wait. The maxWaitDur is required and must be greater
// than zero.
func (w *ClusterRestoredWaiter) WaitForOutput(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterRestoredWaiterOptions)) (*DescribeClustersOutput, error) {
if maxWaitDur <= 0 {
return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero")
}
options := w.options
for _, fn := range optFns {
fn(&options)
}
if options.MaxDelay <= 0 {
options.MaxDelay = 120 * time.Second
}
if options.MinDelay > options.MaxDelay {
return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay)
}
ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur)
defer cancelFn()
logger := smithywaiter.Logger{}
remainingTime := maxWaitDur
var attempt int64
for {
attempt++
apiOptions := options.APIOptions
start := time.Now()
if options.LogWaitAttempts {
logger.Attempt = attempt
apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...)
apiOptions = append(apiOptions, logger.AddLogger)
}
out, err := w.client.DescribeClusters(ctx, params, func(o *Options) {
o.APIOptions = append(o.APIOptions, apiOptions...)
})
retryable, err := options.Retryable(ctx, params, out, err)
if err != nil {
return nil, err
}
if !retryable {
return out, nil
}
remainingTime -= time.Since(start)
if remainingTime < options.MinDelay || remainingTime <= 0 {
break
}
// compute exponential backoff between waiter retries
delay, err := smithywaiter.ComputeDelay(
attempt, options.MinDelay, options.MaxDelay, remainingTime,
)
if err != nil {
return nil, fmt.Errorf("error computing waiter delay, %w", err)
}
remainingTime -= delay
// sleep for the delay amount before invoking a request
if err := smithytime.SleepWithContext(ctx, delay); err != nil {
return nil, fmt.Errorf("request cancelled while waiting, %w", err)
}
}
return nil, fmt.Errorf("exceeded max wait time for ClusterRestored waiter")
}
func clusterRestoredStateRetryable(ctx context.Context, input *DescribeClustersInput, output *DescribeClustersOutput, err error) (bool, error) {
if err == nil {
pathValue, err := jmespath.Search("Clusters[].RestoreStatus.Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "completed"
var match = true
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
if len(listOfValues) == 0 {
match = false
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) != expectedValue {
match = false
}
}
if match {
return false, nil
}
}
if err == nil {
pathValue, err := jmespath.Search("Clusters[].ClusterStatus", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "deleting"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
return true, nil
}
func newServiceMetadataMiddleware_opDescribeClusters(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusters",
}
}
| 885 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about Amazon Redshift security groups. If the name of a
// security group is specified, the response will contain only information about
// only that security group. For information about managing security groups, go to
// Amazon Redshift Cluster Security Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-security-groups.html)
// in the Amazon Redshift Cluster Management Guide. If you specify both tag keys
// and tag values in the same request, Amazon Redshift returns all security groups
// that match any combination of the specified keys and values. For example, if you
// have owner and environment for tag keys, and admin and test for tag values, all
// security groups that have any combination of those values are returned. If both
// tag keys and values are omitted from the request, security groups are returned
// regardless of whether they have tag keys or values associated with them.
func (c *Client) DescribeClusterSecurityGroups(ctx context.Context, params *DescribeClusterSecurityGroupsInput, optFns ...func(*Options)) (*DescribeClusterSecurityGroupsOutput, error) {
if params == nil {
params = &DescribeClusterSecurityGroupsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterSecurityGroups", params, optFns, c.addOperationDescribeClusterSecurityGroupsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterSecurityGroupsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterSecurityGroupsInput struct {
// The name of a cluster security group for which you are requesting details. You
// must specify either the Marker parameter or a ClusterSecurityGroupName
// parameter, but not both. Example: securitygroup1
ClusterSecurityGroupName *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusterSecurityGroups request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request. Constraints: You must specify either the
// ClusterSecurityGroupName parameter or the Marker parameter, but not both.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// A tag key or keys for which you want to return all matching cluster security
// groups that are associated with the specified key or keys. For example, suppose
// that you have security groups that are tagged with keys called owner and
// environment . If you specify both of these tag keys in the request, Amazon
// Redshift returns a response with the security groups that have either or both of
// these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching cluster
// security groups that are associated with the specified tag value or values. For
// example, suppose that you have security groups that are tagged with values
// called admin and test . If you specify both of these tag values in the request,
// Amazon Redshift returns a response with the security groups that have either or
// both of these tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
type DescribeClusterSecurityGroupsOutput struct {
// A list of ClusterSecurityGroup instances.
ClusterSecurityGroups []types.ClusterSecurityGroup
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterSecurityGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterSecurityGroups{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterSecurityGroups{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterSecurityGroups(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterSecurityGroupsAPIClient is a client that implements the
// DescribeClusterSecurityGroups operation.
type DescribeClusterSecurityGroupsAPIClient interface {
DescribeClusterSecurityGroups(context.Context, *DescribeClusterSecurityGroupsInput, ...func(*Options)) (*DescribeClusterSecurityGroupsOutput, error)
}
var _ DescribeClusterSecurityGroupsAPIClient = (*Client)(nil)
// DescribeClusterSecurityGroupsPaginatorOptions is the paginator options for
// DescribeClusterSecurityGroups
type DescribeClusterSecurityGroupsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterSecurityGroupsPaginator is a paginator for
// DescribeClusterSecurityGroups
type DescribeClusterSecurityGroupsPaginator struct {
options DescribeClusterSecurityGroupsPaginatorOptions
client DescribeClusterSecurityGroupsAPIClient
params *DescribeClusterSecurityGroupsInput
nextToken *string
firstPage bool
}
// NewDescribeClusterSecurityGroupsPaginator returns a new
// DescribeClusterSecurityGroupsPaginator
func NewDescribeClusterSecurityGroupsPaginator(client DescribeClusterSecurityGroupsAPIClient, params *DescribeClusterSecurityGroupsInput, optFns ...func(*DescribeClusterSecurityGroupsPaginatorOptions)) *DescribeClusterSecurityGroupsPaginator {
if params == nil {
params = &DescribeClusterSecurityGroupsInput{}
}
options := DescribeClusterSecurityGroupsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterSecurityGroupsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterSecurityGroupsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterSecurityGroups page.
func (p *DescribeClusterSecurityGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterSecurityGroupsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterSecurityGroups(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeClusterSecurityGroups(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterSecurityGroups",
}
}
| 269 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithytime "github.com/aws/smithy-go/time"
smithyhttp "github.com/aws/smithy-go/transport/http"
smithywaiter "github.com/aws/smithy-go/waiter"
"github.com/jmespath/go-jmespath"
"time"
)
// Returns one or more snapshot objects, which contain metadata about your cluster
// snapshots. By default, this operation returns information about all snapshots of
// all clusters that are owned by your Amazon Web Services account. No information
// is returned for snapshots owned by inactive Amazon Web Services accounts. If you
// specify both tag keys and tag values in the same request, Amazon Redshift
// returns all snapshots that match any combination of the specified keys and
// values. For example, if you have owner and environment for tag keys, and admin
// and test for tag values, all snapshots that have any combination of those
// values are returned. Only snapshots that you own are returned in the response;
// shared snapshots are not returned with the tag key and tag value request
// parameters. If both tag keys and values are omitted from the request, snapshots
// are returned regardless of whether they have tag keys or values associated with
// them.
func (c *Client) DescribeClusterSnapshots(ctx context.Context, params *DescribeClusterSnapshotsInput, optFns ...func(*Options)) (*DescribeClusterSnapshotsOutput, error) {
if params == nil {
params = &DescribeClusterSnapshotsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterSnapshots", params, optFns, c.addOperationDescribeClusterSnapshotsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterSnapshotsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterSnapshotsInput struct {
// A value that indicates whether to return snapshots only for an existing
// cluster. You can perform table-level restore only by using a snapshot of an
// existing cluster, that is, a cluster that has not been deleted. Values for this
// parameter work as follows:
// - If ClusterExists is set to true , ClusterIdentifier is required.
// - If ClusterExists is set to false and ClusterIdentifier isn't specified, all
// snapshots associated with deleted clusters (orphaned snapshots) are returned.
// - If ClusterExists is set to false and ClusterIdentifier is specified for a
// deleted cluster, snapshots associated with that cluster are returned.
// - If ClusterExists is set to false and ClusterIdentifier is specified for an
// existing cluster, no snapshots are returned.
ClusterExists *bool
// The identifier of the cluster which generated the requested snapshots.
ClusterIdentifier *string
// A time value that requests only snapshots created at or before the specified
// time. The time value is specified in ISO 8601 format. For more information about
// ISO 8601, go to the ISO8601 Wikipedia page. (http://en.wikipedia.org/wiki/ISO_8601)
// Example: 2012-07-16T18:00:00Z
EndTime *time.Time
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusterSnapshots request exceed
// the value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The Amazon Web Services account used to create or copy the snapshot. Use this
// field to filter the results to snapshots owned by a particular account. To
// describe snapshots you own, either specify your Amazon Web Services account, or
// do not specify the parameter.
OwnerAccount *string
// The Amazon Resource Name (ARN) of the snapshot associated with the message to
// describe cluster snapshots.
SnapshotArn *string
// The snapshot identifier of the snapshot about which to return information.
SnapshotIdentifier *string
// The type of snapshots for which you are requesting information. By default,
// snapshots of all types are returned. Valid Values: automated | manual
SnapshotType *string
//
SortingEntities []types.SnapshotSortingEntity
// A value that requests only snapshots created at or after the specified time.
// The time value is specified in ISO 8601 format. For more information about ISO
// 8601, go to the ISO8601 Wikipedia page. (http://en.wikipedia.org/wiki/ISO_8601)
// Example: 2012-07-16T18:00:00Z
StartTime *time.Time
// A tag key or keys for which you want to return all matching cluster snapshots
// that are associated with the specified key or keys. For example, suppose that
// you have snapshots that are tagged with keys called owner and environment . If
// you specify both of these tag keys in the request, Amazon Redshift returns a
// response with the snapshots that have either or both of these tag keys
// associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching cluster
// snapshots that are associated with the specified tag value or values. For
// example, suppose that you have snapshots that are tagged with values called
// admin and test . If you specify both of these tag values in the request, Amazon
// Redshift returns a response with the snapshots that have either or both of these
// tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
// Contains the output from the DescribeClusterSnapshots action.
type DescribeClusterSnapshotsOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// A list of Snapshot instances.
Snapshots []types.Snapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterSnapshotsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterSnapshots{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterSnapshots{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeClusterSnapshotsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterSnapshots(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterSnapshotsAPIClient is a client that implements the
// DescribeClusterSnapshots operation.
type DescribeClusterSnapshotsAPIClient interface {
DescribeClusterSnapshots(context.Context, *DescribeClusterSnapshotsInput, ...func(*Options)) (*DescribeClusterSnapshotsOutput, error)
}
var _ DescribeClusterSnapshotsAPIClient = (*Client)(nil)
// DescribeClusterSnapshotsPaginatorOptions is the paginator options for
// DescribeClusterSnapshots
type DescribeClusterSnapshotsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterSnapshotsPaginator is a paginator for DescribeClusterSnapshots
type DescribeClusterSnapshotsPaginator struct {
options DescribeClusterSnapshotsPaginatorOptions
client DescribeClusterSnapshotsAPIClient
params *DescribeClusterSnapshotsInput
nextToken *string
firstPage bool
}
// NewDescribeClusterSnapshotsPaginator returns a new
// DescribeClusterSnapshotsPaginator
func NewDescribeClusterSnapshotsPaginator(client DescribeClusterSnapshotsAPIClient, params *DescribeClusterSnapshotsInput, optFns ...func(*DescribeClusterSnapshotsPaginatorOptions)) *DescribeClusterSnapshotsPaginator {
if params == nil {
params = &DescribeClusterSnapshotsInput{}
}
options := DescribeClusterSnapshotsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterSnapshotsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterSnapshotsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterSnapshots page.
func (p *DescribeClusterSnapshotsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterSnapshotsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterSnapshots(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
// SnapshotAvailableWaiterOptions are waiter options for SnapshotAvailableWaiter
type SnapshotAvailableWaiterOptions struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// MinDelay is the minimum amount of time to delay between retries. If unset,
// SnapshotAvailableWaiter will use default minimum delay of 15 seconds. Note that
// MinDelay must resolve to a value lesser than or equal to the MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, SnapshotAvailableWaiter will use default max delay of 120 seconds.
// Note that MaxDelay must resolve to value greater than or equal to the MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts
LogWaitAttempts bool
// Retryable is function that can be used to override the service defined
// waiter-behavior based on operation output, or returned error. This function is
// used by the waiter to decide if a state is retryable or a terminal state. By
// default service-modeled logic will populate this option. This option can thus be
// used to define a custom waiter state with fall-back to service-modeled waiter
// state mutators.The function returns an error in case of a failure state. In case
// of retry state, this function returns a bool value of true and nil error, while
// in case of success it returns a bool value of false and nil error.
Retryable func(context.Context, *DescribeClusterSnapshotsInput, *DescribeClusterSnapshotsOutput, error) (bool, error)
}
// SnapshotAvailableWaiter defines the waiters for SnapshotAvailable
type SnapshotAvailableWaiter struct {
client DescribeClusterSnapshotsAPIClient
options SnapshotAvailableWaiterOptions
}
// NewSnapshotAvailableWaiter constructs a SnapshotAvailableWaiter.
func NewSnapshotAvailableWaiter(client DescribeClusterSnapshotsAPIClient, optFns ...func(*SnapshotAvailableWaiterOptions)) *SnapshotAvailableWaiter {
options := SnapshotAvailableWaiterOptions{}
options.MinDelay = 15 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = snapshotAvailableStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &SnapshotAvailableWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for SnapshotAvailable waiter. The maxWaitDur is
// the maximum wait duration the waiter will wait. The maxWaitDur is required and
// must be greater than zero.
func (w *SnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*SnapshotAvailableWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for SnapshotAvailable waiter and
// returns the output of the successful operation. The maxWaitDur is the maximum
// wait duration the waiter will wait. The maxWaitDur is required and must be
// greater than zero.
func (w *SnapshotAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*SnapshotAvailableWaiterOptions)) (*DescribeClusterSnapshotsOutput, error) {
if maxWaitDur <= 0 {
return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero")
}
options := w.options
for _, fn := range optFns {
fn(&options)
}
if options.MaxDelay <= 0 {
options.MaxDelay = 120 * time.Second
}
if options.MinDelay > options.MaxDelay {
return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay)
}
ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur)
defer cancelFn()
logger := smithywaiter.Logger{}
remainingTime := maxWaitDur
var attempt int64
for {
attempt++
apiOptions := options.APIOptions
start := time.Now()
if options.LogWaitAttempts {
logger.Attempt = attempt
apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...)
apiOptions = append(apiOptions, logger.AddLogger)
}
out, err := w.client.DescribeClusterSnapshots(ctx, params, func(o *Options) {
o.APIOptions = append(o.APIOptions, apiOptions...)
})
retryable, err := options.Retryable(ctx, params, out, err)
if err != nil {
return nil, err
}
if !retryable {
return out, nil
}
remainingTime -= time.Since(start)
if remainingTime < options.MinDelay || remainingTime <= 0 {
break
}
// compute exponential backoff between waiter retries
delay, err := smithywaiter.ComputeDelay(
attempt, options.MinDelay, options.MaxDelay, remainingTime,
)
if err != nil {
return nil, fmt.Errorf("error computing waiter delay, %w", err)
}
remainingTime -= delay
// sleep for the delay amount before invoking a request
if err := smithytime.SleepWithContext(ctx, delay); err != nil {
return nil, fmt.Errorf("request cancelled while waiting, %w", err)
}
}
return nil, fmt.Errorf("exceeded max wait time for SnapshotAvailable waiter")
}
func snapshotAvailableStateRetryable(ctx context.Context, input *DescribeClusterSnapshotsInput, output *DescribeClusterSnapshotsOutput, err error) (bool, error) {
if err == nil {
pathValue, err := jmespath.Search("Snapshots[].Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "available"
var match = true
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
if len(listOfValues) == 0 {
match = false
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) != expectedValue {
match = false
}
}
if match {
return false, nil
}
}
if err == nil {
pathValue, err := jmespath.Search("Snapshots[].Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "failed"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
if err == nil {
pathValue, err := jmespath.Search("Snapshots[].Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "deleted"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(*string)
if !ok {
return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue)
}
if string(*value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
return true, nil
}
func newServiceMetadataMiddleware_opDescribeClusterSnapshots(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterSnapshots",
}
}
| 543 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns one or more cluster subnet group objects, which contain metadata about
// your cluster subnet groups. By default, this operation returns information about
// all cluster subnet groups that are defined in your Amazon Web Services account.
// If you specify both tag keys and tag values in the same request, Amazon Redshift
// returns all subnet groups that match any combination of the specified keys and
// values. For example, if you have owner and environment for tag keys, and admin
// and test for tag values, all subnet groups that have any combination of those
// values are returned. If both tag keys and values are omitted from the request,
// subnet groups are returned regardless of whether they have tag keys or values
// associated with them.
func (c *Client) DescribeClusterSubnetGroups(ctx context.Context, params *DescribeClusterSubnetGroupsInput, optFns ...func(*Options)) (*DescribeClusterSubnetGroupsOutput, error) {
if params == nil {
params = &DescribeClusterSubnetGroupsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterSubnetGroups", params, optFns, c.addOperationDescribeClusterSubnetGroupsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterSubnetGroupsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterSubnetGroupsInput struct {
// The name of the cluster subnet group for which information is requested.
ClusterSubnetGroupName *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusterSubnetGroups request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// A tag key or keys for which you want to return all matching cluster subnet
// groups that are associated with the specified key or keys. For example, suppose
// that you have subnet groups that are tagged with keys called owner and
// environment . If you specify both of these tag keys in the request, Amazon
// Redshift returns a response with the subnet groups that have either or both of
// these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching cluster subnet
// groups that are associated with the specified tag value or values. For example,
// suppose that you have subnet groups that are tagged with values called admin
// and test . If you specify both of these tag values in the request, Amazon
// Redshift returns a response with the subnet groups that have either or both of
// these tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
// Contains the output from the DescribeClusterSubnetGroups action.
type DescribeClusterSubnetGroupsOutput struct {
// A list of ClusterSubnetGroup instances.
ClusterSubnetGroups []types.ClusterSubnetGroup
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterSubnetGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterSubnetGroups{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterSubnetGroups{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterSubnetGroups(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterSubnetGroupsAPIClient is a client that implements the
// DescribeClusterSubnetGroups operation.
type DescribeClusterSubnetGroupsAPIClient interface {
DescribeClusterSubnetGroups(context.Context, *DescribeClusterSubnetGroupsInput, ...func(*Options)) (*DescribeClusterSubnetGroupsOutput, error)
}
var _ DescribeClusterSubnetGroupsAPIClient = (*Client)(nil)
// DescribeClusterSubnetGroupsPaginatorOptions is the paginator options for
// DescribeClusterSubnetGroups
type DescribeClusterSubnetGroupsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterSubnetGroupsPaginator is a paginator for
// DescribeClusterSubnetGroups
type DescribeClusterSubnetGroupsPaginator struct {
options DescribeClusterSubnetGroupsPaginatorOptions
client DescribeClusterSubnetGroupsAPIClient
params *DescribeClusterSubnetGroupsInput
nextToken *string
firstPage bool
}
// NewDescribeClusterSubnetGroupsPaginator returns a new
// DescribeClusterSubnetGroupsPaginator
func NewDescribeClusterSubnetGroupsPaginator(client DescribeClusterSubnetGroupsAPIClient, params *DescribeClusterSubnetGroupsInput, optFns ...func(*DescribeClusterSubnetGroupsPaginatorOptions)) *DescribeClusterSubnetGroupsPaginator {
if params == nil {
params = &DescribeClusterSubnetGroupsInput{}
}
options := DescribeClusterSubnetGroupsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterSubnetGroupsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterSubnetGroupsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterSubnetGroups page.
func (p *DescribeClusterSubnetGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterSubnetGroupsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterSubnetGroups(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeClusterSubnetGroups(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterSubnetGroups",
}
}
| 266 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of all the available maintenance tracks.
func (c *Client) DescribeClusterTracks(ctx context.Context, params *DescribeClusterTracksInput, optFns ...func(*Options)) (*DescribeClusterTracksOutput, error) {
if params == nil {
params = &DescribeClusterTracksInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterTracks", params, optFns, c.addOperationDescribeClusterTracksMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterTracksOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterTracksInput struct {
// The name of the maintenance track.
MaintenanceTrackName *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusterTracks request exceed
// the value specified in MaxRecords , Amazon Redshift returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// An integer value for the maximum number of maintenance tracks to return.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeClusterTracksOutput struct {
// A list of maintenance tracks output by the DescribeClusterTracks operation.
MaintenanceTracks []types.MaintenanceTrack
// The starting point to return a set of response tracklist records. You can
// retrieve the next set of response records by providing the returned marker value
// in the Marker parameter and retrying the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterTracksMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterTracks{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterTracks{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterTracks(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterTracksAPIClient is a client that implements the
// DescribeClusterTracks operation.
type DescribeClusterTracksAPIClient interface {
DescribeClusterTracks(context.Context, *DescribeClusterTracksInput, ...func(*Options)) (*DescribeClusterTracksOutput, error)
}
var _ DescribeClusterTracksAPIClient = (*Client)(nil)
// DescribeClusterTracksPaginatorOptions is the paginator options for
// DescribeClusterTracks
type DescribeClusterTracksPaginatorOptions struct {
// An integer value for the maximum number of maintenance tracks to return.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterTracksPaginator is a paginator for DescribeClusterTracks
type DescribeClusterTracksPaginator struct {
options DescribeClusterTracksPaginatorOptions
client DescribeClusterTracksAPIClient
params *DescribeClusterTracksInput
nextToken *string
firstPage bool
}
// NewDescribeClusterTracksPaginator returns a new DescribeClusterTracksPaginator
func NewDescribeClusterTracksPaginator(client DescribeClusterTracksAPIClient, params *DescribeClusterTracksInput, optFns ...func(*DescribeClusterTracksPaginatorOptions)) *DescribeClusterTracksPaginator {
if params == nil {
params = &DescribeClusterTracksInput{}
}
options := DescribeClusterTracksPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterTracksPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterTracksPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterTracks page.
func (p *DescribeClusterTracksPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterTracksOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterTracks(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeClusterTracks(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterTracks",
}
}
| 228 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns descriptions of the available Amazon Redshift cluster versions. You can
// call this operation even before creating any clusters to learn more about the
// Amazon Redshift versions. For more information about managing clusters, go to
// Amazon Redshift Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DescribeClusterVersions(ctx context.Context, params *DescribeClusterVersionsInput, optFns ...func(*Options)) (*DescribeClusterVersionsOutput, error) {
if params == nil {
params = &DescribeClusterVersionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeClusterVersions", params, optFns, c.addOperationDescribeClusterVersionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeClusterVersionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeClusterVersionsInput struct {
// The name of a specific cluster parameter group family to return details for.
// Constraints:
// - Must be 1 to 255 alphanumeric characters
// - First character must be a letter
// - Cannot end with a hyphen or contain two consecutive hyphens
ClusterParameterGroupFamily *string
// The specific cluster version to return. Example: 1.0
ClusterVersion *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeClusterVersions request exceed
// the value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
// Contains the output from the DescribeClusterVersions action.
type DescribeClusterVersionsOutput struct {
// A list of Version elements.
ClusterVersions []types.ClusterVersion
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeClusterVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterVersions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterVersions{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterVersions(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeClusterVersionsAPIClient is a client that implements the
// DescribeClusterVersions operation.
type DescribeClusterVersionsAPIClient interface {
DescribeClusterVersions(context.Context, *DescribeClusterVersionsInput, ...func(*Options)) (*DescribeClusterVersionsOutput, error)
}
var _ DescribeClusterVersionsAPIClient = (*Client)(nil)
// DescribeClusterVersionsPaginatorOptions is the paginator options for
// DescribeClusterVersions
type DescribeClusterVersionsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeClusterVersionsPaginator is a paginator for DescribeClusterVersions
type DescribeClusterVersionsPaginator struct {
options DescribeClusterVersionsPaginatorOptions
client DescribeClusterVersionsAPIClient
params *DescribeClusterVersionsInput
nextToken *string
firstPage bool
}
// NewDescribeClusterVersionsPaginator returns a new
// DescribeClusterVersionsPaginator
func NewDescribeClusterVersionsPaginator(client DescribeClusterVersionsAPIClient, params *DescribeClusterVersionsInput, optFns ...func(*DescribeClusterVersionsPaginatorOptions)) *DescribeClusterVersionsPaginator {
if params == nil {
params = &DescribeClusterVersionsInput{}
}
options := DescribeClusterVersionsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeClusterVersionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeClusterVersionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeClusterVersions page.
func (p *DescribeClusterVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterVersionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeClusterVersions(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeClusterVersions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeClusterVersions",
}
}
| 251 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Contains information for custom domain associations for a cluster.
func (c *Client) DescribeCustomDomainAssociations(ctx context.Context, params *DescribeCustomDomainAssociationsInput, optFns ...func(*Options)) (*DescribeCustomDomainAssociationsOutput, error) {
if params == nil {
params = &DescribeCustomDomainAssociationsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeCustomDomainAssociations", params, optFns, c.addOperationDescribeCustomDomainAssociationsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeCustomDomainAssociationsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeCustomDomainAssociationsInput struct {
// The certificate Amazon Resource Name (ARN) for the custom domain association.
CustomDomainCertificateArn *string
// The custom domain name for the custom domain association.
CustomDomainName *string
// The marker for the custom domain association.
Marker *string
// The maximum records setting for the associated custom domain.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeCustomDomainAssociationsOutput struct {
// The associations for the custom domain.
Associations []types.Association
// The marker for the custom domain association.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeCustomDomainAssociationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeCustomDomainAssociations{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeCustomDomainAssociations{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeCustomDomainAssociations(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeCustomDomainAssociationsAPIClient is a client that implements the
// DescribeCustomDomainAssociations operation.
type DescribeCustomDomainAssociationsAPIClient interface {
DescribeCustomDomainAssociations(context.Context, *DescribeCustomDomainAssociationsInput, ...func(*Options)) (*DescribeCustomDomainAssociationsOutput, error)
}
var _ DescribeCustomDomainAssociationsAPIClient = (*Client)(nil)
// DescribeCustomDomainAssociationsPaginatorOptions is the paginator options for
// DescribeCustomDomainAssociations
type DescribeCustomDomainAssociationsPaginatorOptions struct {
// The maximum records setting for the associated custom domain.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeCustomDomainAssociationsPaginator is a paginator for
// DescribeCustomDomainAssociations
type DescribeCustomDomainAssociationsPaginator struct {
options DescribeCustomDomainAssociationsPaginatorOptions
client DescribeCustomDomainAssociationsAPIClient
params *DescribeCustomDomainAssociationsInput
nextToken *string
firstPage bool
}
// NewDescribeCustomDomainAssociationsPaginator returns a new
// DescribeCustomDomainAssociationsPaginator
func NewDescribeCustomDomainAssociationsPaginator(client DescribeCustomDomainAssociationsAPIClient, params *DescribeCustomDomainAssociationsInput, optFns ...func(*DescribeCustomDomainAssociationsPaginatorOptions)) *DescribeCustomDomainAssociationsPaginator {
if params == nil {
params = &DescribeCustomDomainAssociationsInput{}
}
options := DescribeCustomDomainAssociationsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeCustomDomainAssociationsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeCustomDomainAssociationsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeCustomDomainAssociations page.
func (p *DescribeCustomDomainAssociationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeCustomDomainAssociationsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeCustomDomainAssociations(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeCustomDomainAssociations(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeCustomDomainAssociations",
}
}
| 226 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Shows the status of any inbound or outbound datashares available in the
// specified account.
func (c *Client) DescribeDataShares(ctx context.Context, params *DescribeDataSharesInput, optFns ...func(*Options)) (*DescribeDataSharesOutput, error) {
if params == nil {
params = &DescribeDataSharesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDataShares", params, optFns, c.addOperationDescribeDataSharesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDataSharesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDataSharesInput struct {
// The identifier of the datashare to describe details of.
DataShareArn *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeDataShares request exceed the
// value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeDataSharesOutput struct {
// The results returned from describing datashares.
DataShares []types.DataShare
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeDataShares request exceed the
// value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDataSharesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDataShares{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDataShares{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDataShares(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeDataSharesAPIClient is a client that implements the DescribeDataShares
// operation.
type DescribeDataSharesAPIClient interface {
DescribeDataShares(context.Context, *DescribeDataSharesInput, ...func(*Options)) (*DescribeDataSharesOutput, error)
}
var _ DescribeDataSharesAPIClient = (*Client)(nil)
// DescribeDataSharesPaginatorOptions is the paginator options for
// DescribeDataShares
type DescribeDataSharesPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDataSharesPaginator is a paginator for DescribeDataShares
type DescribeDataSharesPaginator struct {
options DescribeDataSharesPaginatorOptions
client DescribeDataSharesAPIClient
params *DescribeDataSharesInput
nextToken *string
firstPage bool
}
// NewDescribeDataSharesPaginator returns a new DescribeDataSharesPaginator
func NewDescribeDataSharesPaginator(client DescribeDataSharesAPIClient, params *DescribeDataSharesInput, optFns ...func(*DescribeDataSharesPaginatorOptions)) *DescribeDataSharesPaginator {
if params == nil {
params = &DescribeDataSharesInput{}
}
options := DescribeDataSharesPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDataSharesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDataSharesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDataShares page.
func (p *DescribeDataSharesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDataSharesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeDataShares(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeDataShares(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeDataShares",
}
}
| 238 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of datashares where the account identifier being called is a
// consumer account identifier.
func (c *Client) DescribeDataSharesForConsumer(ctx context.Context, params *DescribeDataSharesForConsumerInput, optFns ...func(*Options)) (*DescribeDataSharesForConsumerOutput, error) {
if params == nil {
params = &DescribeDataSharesForConsumerInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDataSharesForConsumer", params, optFns, c.addOperationDescribeDataSharesForConsumerMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDataSharesForConsumerOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDataSharesForConsumerInput struct {
// The Amazon Resource Name (ARN) of the consumer that returns in the list of
// datashares.
ConsumerArn *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeDataSharesForConsumer request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
MaxRecords *int32
// An identifier giving the status of a datashare in the consumer cluster. If this
// field is specified, Amazon Redshift returns the list of datashares that have the
// specified status.
Status types.DataShareStatusForConsumer
noSmithyDocumentSerde
}
type DescribeDataSharesForConsumerOutput struct {
// Shows the results of datashares available for consumers.
DataShares []types.DataShare
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeDataSharesForConsumer request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDataSharesForConsumerMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDataSharesForConsumer{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDataSharesForConsumer{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDataSharesForConsumer(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeDataSharesForConsumerAPIClient is a client that implements the
// DescribeDataSharesForConsumer operation.
type DescribeDataSharesForConsumerAPIClient interface {
DescribeDataSharesForConsumer(context.Context, *DescribeDataSharesForConsumerInput, ...func(*Options)) (*DescribeDataSharesForConsumerOutput, error)
}
var _ DescribeDataSharesForConsumerAPIClient = (*Client)(nil)
// DescribeDataSharesForConsumerPaginatorOptions is the paginator options for
// DescribeDataSharesForConsumer
type DescribeDataSharesForConsumerPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDataSharesForConsumerPaginator is a paginator for
// DescribeDataSharesForConsumer
type DescribeDataSharesForConsumerPaginator struct {
options DescribeDataSharesForConsumerPaginatorOptions
client DescribeDataSharesForConsumerAPIClient
params *DescribeDataSharesForConsumerInput
nextToken *string
firstPage bool
}
// NewDescribeDataSharesForConsumerPaginator returns a new
// DescribeDataSharesForConsumerPaginator
func NewDescribeDataSharesForConsumerPaginator(client DescribeDataSharesForConsumerAPIClient, params *DescribeDataSharesForConsumerInput, optFns ...func(*DescribeDataSharesForConsumerPaginatorOptions)) *DescribeDataSharesForConsumerPaginator {
if params == nil {
params = &DescribeDataSharesForConsumerInput{}
}
options := DescribeDataSharesForConsumerPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDataSharesForConsumerPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDataSharesForConsumerPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDataSharesForConsumer page.
func (p *DescribeDataSharesForConsumerPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDataSharesForConsumerOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeDataSharesForConsumer(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeDataSharesForConsumer(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeDataSharesForConsumer",
}
}
| 246 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of datashares when the account identifier being called is a
// producer account identifier.
func (c *Client) DescribeDataSharesForProducer(ctx context.Context, params *DescribeDataSharesForProducerInput, optFns ...func(*Options)) (*DescribeDataSharesForProducerOutput, error) {
if params == nil {
params = &DescribeDataSharesForProducerInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDataSharesForProducer", params, optFns, c.addOperationDescribeDataSharesForProducerMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDataSharesForProducerOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDataSharesForProducerInput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeDataSharesForProducer request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
MaxRecords *int32
// The Amazon Resource Name (ARN) of the producer that returns in the list of
// datashares.
ProducerArn *string
// An identifier giving the status of a datashare in the producer. If this field
// is specified, Amazon Redshift returns the list of datashares that have the
// specified status.
Status types.DataShareStatusForProducer
noSmithyDocumentSerde
}
type DescribeDataSharesForProducerOutput struct {
// Shows the results of datashares available for producers.
DataShares []types.DataShare
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeDataSharesForProducer request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDataSharesForProducerMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDataSharesForProducer{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDataSharesForProducer{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDataSharesForProducer(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeDataSharesForProducerAPIClient is a client that implements the
// DescribeDataSharesForProducer operation.
type DescribeDataSharesForProducerAPIClient interface {
DescribeDataSharesForProducer(context.Context, *DescribeDataSharesForProducerInput, ...func(*Options)) (*DescribeDataSharesForProducerOutput, error)
}
var _ DescribeDataSharesForProducerAPIClient = (*Client)(nil)
// DescribeDataSharesForProducerPaginatorOptions is the paginator options for
// DescribeDataSharesForProducer
type DescribeDataSharesForProducerPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDataSharesForProducerPaginator is a paginator for
// DescribeDataSharesForProducer
type DescribeDataSharesForProducerPaginator struct {
options DescribeDataSharesForProducerPaginatorOptions
client DescribeDataSharesForProducerAPIClient
params *DescribeDataSharesForProducerInput
nextToken *string
firstPage bool
}
// NewDescribeDataSharesForProducerPaginator returns a new
// DescribeDataSharesForProducerPaginator
func NewDescribeDataSharesForProducerPaginator(client DescribeDataSharesForProducerAPIClient, params *DescribeDataSharesForProducerInput, optFns ...func(*DescribeDataSharesForProducerPaginatorOptions)) *DescribeDataSharesForProducerPaginator {
if params == nil {
params = &DescribeDataSharesForProducerInput{}
}
options := DescribeDataSharesForProducerPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDataSharesForProducerPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDataSharesForProducerPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDataSharesForProducer page.
func (p *DescribeDataSharesForProducerPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDataSharesForProducerOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeDataSharesForProducer(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeDataSharesForProducer(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeDataSharesForProducer",
}
}
| 246 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of parameter settings for the specified parameter group family.
// For more information about parameters and parameter groups, go to Amazon
// Redshift Parameter Groups (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DescribeDefaultClusterParameters(ctx context.Context, params *DescribeDefaultClusterParametersInput, optFns ...func(*Options)) (*DescribeDefaultClusterParametersOutput, error) {
if params == nil {
params = &DescribeDefaultClusterParametersInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDefaultClusterParameters", params, optFns, c.addOperationDescribeDefaultClusterParametersMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDefaultClusterParametersOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDefaultClusterParametersInput struct {
// The name of the cluster parameter group family.
//
// This member is required.
ParameterGroupFamily *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeDefaultClusterParameters
// request exceed the value specified in MaxRecords , Amazon Web Services returns a
// value in the Marker field of the response. You can retrieve the next set of
// response records by providing the returned marker value in the Marker parameter
// and retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeDefaultClusterParametersOutput struct {
// Describes the default cluster parameters for a parameter group family.
DefaultClusterParameters *types.DefaultClusterParameters
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDefaultClusterParametersMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDefaultClusterParameters{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDefaultClusterParameters{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeDefaultClusterParametersValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDefaultClusterParameters(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeDefaultClusterParametersAPIClient is a client that implements the
// DescribeDefaultClusterParameters operation.
type DescribeDefaultClusterParametersAPIClient interface {
DescribeDefaultClusterParameters(context.Context, *DescribeDefaultClusterParametersInput, ...func(*Options)) (*DescribeDefaultClusterParametersOutput, error)
}
var _ DescribeDefaultClusterParametersAPIClient = (*Client)(nil)
// DescribeDefaultClusterParametersPaginatorOptions is the paginator options for
// DescribeDefaultClusterParameters
type DescribeDefaultClusterParametersPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDefaultClusterParametersPaginator is a paginator for
// DescribeDefaultClusterParameters
type DescribeDefaultClusterParametersPaginator struct {
options DescribeDefaultClusterParametersPaginatorOptions
client DescribeDefaultClusterParametersAPIClient
params *DescribeDefaultClusterParametersInput
nextToken *string
firstPage bool
}
// NewDescribeDefaultClusterParametersPaginator returns a new
// DescribeDefaultClusterParametersPaginator
func NewDescribeDefaultClusterParametersPaginator(client DescribeDefaultClusterParametersAPIClient, params *DescribeDefaultClusterParametersInput, optFns ...func(*DescribeDefaultClusterParametersPaginatorOptions)) *DescribeDefaultClusterParametersPaginator {
if params == nil {
params = &DescribeDefaultClusterParametersInput{}
}
options := DescribeDefaultClusterParametersPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDefaultClusterParametersPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDefaultClusterParametersPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDefaultClusterParameters page.
func (p *DescribeDefaultClusterParametersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDefaultClusterParametersOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeDefaultClusterParameters(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = nil
if result.DefaultClusterParameters != nil {
p.nextToken = result.DefaultClusterParameters.Marker
}
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeDefaultClusterParameters(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeDefaultClusterParameters",
}
}
| 244 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Describes a Redshift-managed VPC endpoint.
func (c *Client) DescribeEndpointAccess(ctx context.Context, params *DescribeEndpointAccessInput, optFns ...func(*Options)) (*DescribeEndpointAccessOutput, error) {
if params == nil {
params = &DescribeEndpointAccessInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeEndpointAccess", params, optFns, c.addOperationDescribeEndpointAccessMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeEndpointAccessOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeEndpointAccessInput struct {
// The cluster identifier associated with the described endpoint.
ClusterIdentifier *string
// The name of the endpoint to be described.
EndpointName *string
// An optional pagination token provided by a previous DescribeEndpointAccess
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by the MaxRecords parameter.
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a Marker is
// included in the response so that the remaining results can be retrieved.
MaxRecords *int32
// The Amazon Web Services account ID of the owner of the cluster.
ResourceOwner *string
// The virtual private cloud (VPC) identifier with access to the cluster.
VpcId *string
noSmithyDocumentSerde
}
type DescribeEndpointAccessOutput struct {
// The list of endpoints with access to the cluster.
EndpointAccessList []types.EndpointAccess
// An optional pagination token provided by a previous DescribeEndpointAccess
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by the MaxRecords parameter.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeEndpointAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeEndpointAccess{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeEndpointAccess{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeEndpointAccess(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeEndpointAccessAPIClient is a client that implements the
// DescribeEndpointAccess operation.
type DescribeEndpointAccessAPIClient interface {
DescribeEndpointAccess(context.Context, *DescribeEndpointAccessInput, ...func(*Options)) (*DescribeEndpointAccessOutput, error)
}
var _ DescribeEndpointAccessAPIClient = (*Client)(nil)
// DescribeEndpointAccessPaginatorOptions is the paginator options for
// DescribeEndpointAccess
type DescribeEndpointAccessPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a Marker is
// included in the response so that the remaining results can be retrieved.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeEndpointAccessPaginator is a paginator for DescribeEndpointAccess
type DescribeEndpointAccessPaginator struct {
options DescribeEndpointAccessPaginatorOptions
client DescribeEndpointAccessAPIClient
params *DescribeEndpointAccessInput
nextToken *string
firstPage bool
}
// NewDescribeEndpointAccessPaginator returns a new DescribeEndpointAccessPaginator
func NewDescribeEndpointAccessPaginator(client DescribeEndpointAccessAPIClient, params *DescribeEndpointAccessInput, optFns ...func(*DescribeEndpointAccessPaginatorOptions)) *DescribeEndpointAccessPaginator {
if params == nil {
params = &DescribeEndpointAccessInput{}
}
options := DescribeEndpointAccessPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeEndpointAccessPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeEndpointAccessPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeEndpointAccess page.
func (p *DescribeEndpointAccessPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeEndpointAccessOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeEndpointAccess(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeEndpointAccess(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeEndpointAccess",
}
}
| 238 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Describes an endpoint authorization.
func (c *Client) DescribeEndpointAuthorization(ctx context.Context, params *DescribeEndpointAuthorizationInput, optFns ...func(*Options)) (*DescribeEndpointAuthorizationOutput, error) {
if params == nil {
params = &DescribeEndpointAuthorizationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeEndpointAuthorization", params, optFns, c.addOperationDescribeEndpointAuthorizationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeEndpointAuthorizationOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeEndpointAuthorizationInput struct {
// The Amazon Web Services account ID of either the cluster owner (grantor) or
// grantee. If Grantee parameter is true, then the Account value is of the grantor.
Account *string
// The cluster identifier of the cluster to access.
ClusterIdentifier *string
// Indicates whether to check authorization from a grantor or grantee point of
// view. If true, Amazon Redshift returns endpoint authorizations that you've been
// granted. If false (default), checks authorization from a grantor point of view.
Grantee *bool
// An optional pagination token provided by a previous
// DescribeEndpointAuthorization request. If this parameter is specified, the
// response includes only records beyond the marker, up to the value specified by
// the MaxRecords parameter.
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a Marker is
// included in the response so that the remaining results can be retrieved.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeEndpointAuthorizationOutput struct {
// The authorizations to an endpoint.
EndpointAuthorizationList []types.EndpointAuthorization
// An optional pagination token provided by a previous
// DescribeEndpointAuthorization request. If this parameter is specified, the
// response includes only records beyond the marker, up to the value specified by
// the MaxRecords parameter.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeEndpointAuthorizationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeEndpointAuthorization{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeEndpointAuthorization{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeEndpointAuthorization(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeEndpointAuthorizationAPIClient is a client that implements the
// DescribeEndpointAuthorization operation.
type DescribeEndpointAuthorizationAPIClient interface {
DescribeEndpointAuthorization(context.Context, *DescribeEndpointAuthorizationInput, ...func(*Options)) (*DescribeEndpointAuthorizationOutput, error)
}
var _ DescribeEndpointAuthorizationAPIClient = (*Client)(nil)
// DescribeEndpointAuthorizationPaginatorOptions is the paginator options for
// DescribeEndpointAuthorization
type DescribeEndpointAuthorizationPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a Marker is
// included in the response so that the remaining results can be retrieved.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeEndpointAuthorizationPaginator is a paginator for
// DescribeEndpointAuthorization
type DescribeEndpointAuthorizationPaginator struct {
options DescribeEndpointAuthorizationPaginatorOptions
client DescribeEndpointAuthorizationAPIClient
params *DescribeEndpointAuthorizationInput
nextToken *string
firstPage bool
}
// NewDescribeEndpointAuthorizationPaginator returns a new
// DescribeEndpointAuthorizationPaginator
func NewDescribeEndpointAuthorizationPaginator(client DescribeEndpointAuthorizationAPIClient, params *DescribeEndpointAuthorizationInput, optFns ...func(*DescribeEndpointAuthorizationPaginatorOptions)) *DescribeEndpointAuthorizationPaginator {
if params == nil {
params = &DescribeEndpointAuthorizationInput{}
}
options := DescribeEndpointAuthorizationPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeEndpointAuthorizationPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeEndpointAuthorizationPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeEndpointAuthorization page.
func (p *DescribeEndpointAuthorizationPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeEndpointAuthorizationOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeEndpointAuthorization(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeEndpointAuthorization(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeEndpointAuthorization",
}
}
| 242 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Displays a list of event categories for all event source types, or for a
// specified source type. For a list of the event categories and source types, go
// to Amazon Redshift Event Notifications (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-event-notifications.html)
// .
func (c *Client) DescribeEventCategories(ctx context.Context, params *DescribeEventCategoriesInput, optFns ...func(*Options)) (*DescribeEventCategoriesOutput, error) {
if params == nil {
params = &DescribeEventCategoriesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeEventCategories", params, optFns, c.addOperationDescribeEventCategoriesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeEventCategoriesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeEventCategoriesInput struct {
// The source type, such as cluster or parameter group, to which the described
// event categories apply. Valid values: cluster, cluster-snapshot,
// cluster-parameter-group, cluster-security-group, and scheduled-action.
SourceType *string
noSmithyDocumentSerde
}
type DescribeEventCategoriesOutput struct {
// A list of event categories descriptions.
EventCategoriesMapList []types.EventCategoriesMap
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeEventCategoriesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeEventCategories{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeEventCategories{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeEventCategories(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeEventCategories(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeEventCategories",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Returns events related to clusters, security groups, snapshots, and parameter
// groups for the past 14 days. Events specific to a particular cluster, security
// group, snapshot or parameter group can be obtained by providing the name as a
// parameter. By default, the past hour of events are returned.
func (c *Client) DescribeEvents(ctx context.Context, params *DescribeEventsInput, optFns ...func(*Options)) (*DescribeEventsOutput, error) {
if params == nil {
params = &DescribeEventsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeEvents", params, optFns, c.addOperationDescribeEventsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeEventsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeEventsInput struct {
// The number of minutes prior to the time of the request for which to retrieve
// events. For example, if the request is sent at 18:00 and you specify a duration
// of 60, then only events which have occurred after 17:00 will be returned.
// Default: 60
Duration *int32
// The end of the time interval for which to retrieve events, specified in ISO
// 8601 format. For more information about ISO 8601, go to the ISO8601 Wikipedia
// page. (http://en.wikipedia.org/wiki/ISO_8601) Example: 2009-07-08T18:00Z
EndTime *time.Time
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeEvents request exceed the value
// specified in MaxRecords , Amazon Web Services returns a value in the Marker
// field of the response. You can retrieve the next set of response records by
// providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The identifier of the event source for which events will be returned. If this
// parameter is not specified, then all sources are included in the response.
// Constraints: If SourceIdentifier is supplied, SourceType must also be provided.
// - Specify a cluster identifier when SourceType is cluster .
// - Specify a cluster security group name when SourceType is
// cluster-security-group .
// - Specify a cluster parameter group name when SourceType is
// cluster-parameter-group .
// - Specify a cluster snapshot identifier when SourceType is cluster-snapshot .
SourceIdentifier *string
// The event source to retrieve events for. If no value is specified, all events
// are returned. Constraints: If SourceType is supplied, SourceIdentifier must also
// be provided.
// - Specify cluster when SourceIdentifier is a cluster identifier.
// - Specify cluster-security-group when SourceIdentifier is a cluster security
// group name.
// - Specify cluster-parameter-group when SourceIdentifier is a cluster parameter
// group name.
// - Specify cluster-snapshot when SourceIdentifier is a cluster snapshot
// identifier.
SourceType types.SourceType
// The beginning of the time interval to retrieve events for, specified in ISO
// 8601 format. For more information about ISO 8601, go to the ISO8601 Wikipedia
// page. (http://en.wikipedia.org/wiki/ISO_8601) Example: 2009-07-08T18:00Z
StartTime *time.Time
noSmithyDocumentSerde
}
type DescribeEventsOutput struct {
// A list of Event instances.
Events []types.Event
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeEventsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeEvents{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeEvents{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeEvents(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeEventsAPIClient is a client that implements the DescribeEvents
// operation.
type DescribeEventsAPIClient interface {
DescribeEvents(context.Context, *DescribeEventsInput, ...func(*Options)) (*DescribeEventsOutput, error)
}
var _ DescribeEventsAPIClient = (*Client)(nil)
// DescribeEventsPaginatorOptions is the paginator options for DescribeEvents
type DescribeEventsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeEventsPaginator is a paginator for DescribeEvents
type DescribeEventsPaginator struct {
options DescribeEventsPaginatorOptions
client DescribeEventsAPIClient
params *DescribeEventsInput
nextToken *string
firstPage bool
}
// NewDescribeEventsPaginator returns a new DescribeEventsPaginator
func NewDescribeEventsPaginator(client DescribeEventsAPIClient, params *DescribeEventsInput, optFns ...func(*DescribeEventsPaginatorOptions)) *DescribeEventsPaginator {
if params == nil {
params = &DescribeEventsInput{}
}
options := DescribeEventsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeEventsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeEventsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeEvents page.
func (p *DescribeEventsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeEventsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeEvents(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeEvents(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeEvents",
}
}
| 277 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists descriptions of all the Amazon Redshift event notification subscriptions
// for a customer account. If you specify a subscription name, lists the
// description for that subscription. If you specify both tag keys and tag values
// in the same request, Amazon Redshift returns all event notification
// subscriptions that match any combination of the specified keys and values. For
// example, if you have owner and environment for tag keys, and admin and test for
// tag values, all subscriptions that have any combination of those values are
// returned. If both tag keys and values are omitted from the request,
// subscriptions are returned regardless of whether they have tag keys or values
// associated with them.
func (c *Client) DescribeEventSubscriptions(ctx context.Context, params *DescribeEventSubscriptionsInput, optFns ...func(*Options)) (*DescribeEventSubscriptionsOutput, error) {
if params == nil {
params = &DescribeEventSubscriptionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeEventSubscriptions", params, optFns, c.addOperationDescribeEventSubscriptionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeEventSubscriptionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeEventSubscriptionsInput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeEventSubscriptions request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The name of the Amazon Redshift event notification subscription to be described.
SubscriptionName *string
// A tag key or keys for which you want to return all matching event notification
// subscriptions that are associated with the specified key or keys. For example,
// suppose that you have subscriptions that are tagged with keys called owner and
// environment . If you specify both of these tag keys in the request, Amazon
// Redshift returns a response with the subscriptions that have either or both of
// these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching event
// notification subscriptions that are associated with the specified tag value or
// values. For example, suppose that you have subscriptions that are tagged with
// values called admin and test . If you specify both of these tag values in the
// request, Amazon Redshift returns a response with the subscriptions that have
// either or both of these tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
type DescribeEventSubscriptionsOutput struct {
// A list of event subscriptions.
EventSubscriptionsList []types.EventSubscription
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeEventSubscriptionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeEventSubscriptions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeEventSubscriptions{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeEventSubscriptions(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeEventSubscriptionsAPIClient is a client that implements the
// DescribeEventSubscriptions operation.
type DescribeEventSubscriptionsAPIClient interface {
DescribeEventSubscriptions(context.Context, *DescribeEventSubscriptionsInput, ...func(*Options)) (*DescribeEventSubscriptionsOutput, error)
}
var _ DescribeEventSubscriptionsAPIClient = (*Client)(nil)
// DescribeEventSubscriptionsPaginatorOptions is the paginator options for
// DescribeEventSubscriptions
type DescribeEventSubscriptionsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeEventSubscriptionsPaginator is a paginator for
// DescribeEventSubscriptions
type DescribeEventSubscriptionsPaginator struct {
options DescribeEventSubscriptionsPaginatorOptions
client DescribeEventSubscriptionsAPIClient
params *DescribeEventSubscriptionsInput
nextToken *string
firstPage bool
}
// NewDescribeEventSubscriptionsPaginator returns a new
// DescribeEventSubscriptionsPaginator
func NewDescribeEventSubscriptionsPaginator(client DescribeEventSubscriptionsAPIClient, params *DescribeEventSubscriptionsInput, optFns ...func(*DescribeEventSubscriptionsPaginatorOptions)) *DescribeEventSubscriptionsPaginator {
if params == nil {
params = &DescribeEventSubscriptionsInput{}
}
options := DescribeEventSubscriptionsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeEventSubscriptionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeEventSubscriptionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeEventSubscriptions page.
func (p *DescribeEventSubscriptionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeEventSubscriptionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeEventSubscriptions(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeEventSubscriptions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeEventSubscriptions",
}
}
| 265 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about the specified HSM client certificate. If no
// certificate ID is specified, returns information about all the HSM certificates
// owned by your Amazon Web Services account. If you specify both tag keys and tag
// values in the same request, Amazon Redshift returns all HSM client certificates
// that match any combination of the specified keys and values. For example, if you
// have owner and environment for tag keys, and admin and test for tag values, all
// HSM client certificates that have any combination of those values are returned.
// If both tag keys and values are omitted from the request, HSM client
// certificates are returned regardless of whether they have tag keys or values
// associated with them.
func (c *Client) DescribeHsmClientCertificates(ctx context.Context, params *DescribeHsmClientCertificatesInput, optFns ...func(*Options)) (*DescribeHsmClientCertificatesOutput, error) {
if params == nil {
params = &DescribeHsmClientCertificatesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeHsmClientCertificates", params, optFns, c.addOperationDescribeHsmClientCertificatesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeHsmClientCertificatesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeHsmClientCertificatesInput struct {
// The identifier of a specific HSM client certificate for which you want
// information. If no identifier is specified, information is returned for all HSM
// client certificates owned by your Amazon Web Services account.
HsmClientCertificateIdentifier *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeHsmClientCertificates request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// A tag key or keys for which you want to return all matching HSM client
// certificates that are associated with the specified key or keys. For example,
// suppose that you have HSM client certificates that are tagged with keys called
// owner and environment . If you specify both of these tag keys in the request,
// Amazon Redshift returns a response with the HSM client certificates that have
// either or both of these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching HSM client
// certificates that are associated with the specified tag value or values. For
// example, suppose that you have HSM client certificates that are tagged with
// values called admin and test . If you specify both of these tag values in the
// request, Amazon Redshift returns a response with the HSM client certificates
// that have either or both of these tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
type DescribeHsmClientCertificatesOutput struct {
// A list of the identifiers for one or more HSM client certificates used by
// Amazon Redshift clusters to store and retrieve database encryption keys in an
// HSM.
HsmClientCertificates []types.HsmClientCertificate
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeHsmClientCertificatesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeHsmClientCertificates{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeHsmClientCertificates{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeHsmClientCertificates(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeHsmClientCertificatesAPIClient is a client that implements the
// DescribeHsmClientCertificates operation.
type DescribeHsmClientCertificatesAPIClient interface {
DescribeHsmClientCertificates(context.Context, *DescribeHsmClientCertificatesInput, ...func(*Options)) (*DescribeHsmClientCertificatesOutput, error)
}
var _ DescribeHsmClientCertificatesAPIClient = (*Client)(nil)
// DescribeHsmClientCertificatesPaginatorOptions is the paginator options for
// DescribeHsmClientCertificates
type DescribeHsmClientCertificatesPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeHsmClientCertificatesPaginator is a paginator for
// DescribeHsmClientCertificates
type DescribeHsmClientCertificatesPaginator struct {
options DescribeHsmClientCertificatesPaginatorOptions
client DescribeHsmClientCertificatesAPIClient
params *DescribeHsmClientCertificatesInput
nextToken *string
firstPage bool
}
// NewDescribeHsmClientCertificatesPaginator returns a new
// DescribeHsmClientCertificatesPaginator
func NewDescribeHsmClientCertificatesPaginator(client DescribeHsmClientCertificatesAPIClient, params *DescribeHsmClientCertificatesInput, optFns ...func(*DescribeHsmClientCertificatesPaginatorOptions)) *DescribeHsmClientCertificatesPaginator {
if params == nil {
params = &DescribeHsmClientCertificatesInput{}
}
options := DescribeHsmClientCertificatesPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeHsmClientCertificatesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeHsmClientCertificatesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeHsmClientCertificates page.
func (p *DescribeHsmClientCertificatesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeHsmClientCertificatesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeHsmClientCertificates(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeHsmClientCertificates(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeHsmClientCertificates",
}
}
| 269 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about the specified Amazon Redshift HSM configuration. If
// no configuration ID is specified, returns information about all the HSM
// configurations owned by your Amazon Web Services account. If you specify both
// tag keys and tag values in the same request, Amazon Redshift returns all HSM
// connections that match any combination of the specified keys and values. For
// example, if you have owner and environment for tag keys, and admin and test for
// tag values, all HSM connections that have any combination of those values are
// returned. If both tag keys and values are omitted from the request, HSM
// connections are returned regardless of whether they have tag keys or values
// associated with them.
func (c *Client) DescribeHsmConfigurations(ctx context.Context, params *DescribeHsmConfigurationsInput, optFns ...func(*Options)) (*DescribeHsmConfigurationsOutput, error) {
if params == nil {
params = &DescribeHsmConfigurationsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeHsmConfigurations", params, optFns, c.addOperationDescribeHsmConfigurationsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeHsmConfigurationsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeHsmConfigurationsInput struct {
// The identifier of a specific Amazon Redshift HSM configuration to be described.
// If no identifier is specified, information is returned for all HSM
// configurations owned by your Amazon Web Services account.
HsmConfigurationIdentifier *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeHsmConfigurations request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// A tag key or keys for which you want to return all matching HSM configurations
// that are associated with the specified key or keys. For example, suppose that
// you have HSM configurations that are tagged with keys called owner and
// environment . If you specify both of these tag keys in the request, Amazon
// Redshift returns a response with the HSM configurations that have either or both
// of these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching HSM
// configurations that are associated with the specified tag value or values. For
// example, suppose that you have HSM configurations that are tagged with values
// called admin and test . If you specify both of these tag values in the request,
// Amazon Redshift returns a response with the HSM configurations that have either
// or both of these tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
type DescribeHsmConfigurationsOutput struct {
// A list of HsmConfiguration objects.
HsmConfigurations []types.HsmConfiguration
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeHsmConfigurationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeHsmConfigurations{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeHsmConfigurations{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeHsmConfigurations(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeHsmConfigurationsAPIClient is a client that implements the
// DescribeHsmConfigurations operation.
type DescribeHsmConfigurationsAPIClient interface {
DescribeHsmConfigurations(context.Context, *DescribeHsmConfigurationsInput, ...func(*Options)) (*DescribeHsmConfigurationsOutput, error)
}
var _ DescribeHsmConfigurationsAPIClient = (*Client)(nil)
// DescribeHsmConfigurationsPaginatorOptions is the paginator options for
// DescribeHsmConfigurations
type DescribeHsmConfigurationsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeHsmConfigurationsPaginator is a paginator for DescribeHsmConfigurations
type DescribeHsmConfigurationsPaginator struct {
options DescribeHsmConfigurationsPaginatorOptions
client DescribeHsmConfigurationsAPIClient
params *DescribeHsmConfigurationsInput
nextToken *string
firstPage bool
}
// NewDescribeHsmConfigurationsPaginator returns a new
// DescribeHsmConfigurationsPaginator
func NewDescribeHsmConfigurationsPaginator(client DescribeHsmConfigurationsAPIClient, params *DescribeHsmConfigurationsInput, optFns ...func(*DescribeHsmConfigurationsPaginatorOptions)) *DescribeHsmConfigurationsPaginator {
if params == nil {
params = &DescribeHsmConfigurationsInput{}
}
options := DescribeHsmConfigurationsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeHsmConfigurationsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeHsmConfigurationsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeHsmConfigurations page.
func (p *DescribeHsmConfigurationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeHsmConfigurationsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeHsmConfigurations(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeHsmConfigurations(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeHsmConfigurations",
}
}
| 266 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Describes whether information, such as queries and connection attempts, is
// being logged for the specified Amazon Redshift cluster.
func (c *Client) DescribeLoggingStatus(ctx context.Context, params *DescribeLoggingStatusInput, optFns ...func(*Options)) (*DescribeLoggingStatusOutput, error) {
if params == nil {
params = &DescribeLoggingStatusInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeLoggingStatus", params, optFns, c.addOperationDescribeLoggingStatusMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeLoggingStatusOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeLoggingStatusInput struct {
// The identifier of the cluster from which to get the logging status. Example:
// examplecluster
//
// This member is required.
ClusterIdentifier *string
noSmithyDocumentSerde
}
// Describes the status of logging for a cluster.
type DescribeLoggingStatusOutput struct {
// The name of the S3 bucket where the log files are stored.
BucketName *string
// The message indicating that logs failed to be delivered.
LastFailureMessage *string
// The last time when logs failed to be delivered.
LastFailureTime *time.Time
// The last time that logs were delivered.
LastSuccessfulDeliveryTime *time.Time
// The log destination type. An enum with possible values of s3 and cloudwatch .
LogDestinationType types.LogDestinationType
// The collection of exported log types. Possible values are connectionlog ,
// useractivitylog , and userlog .
LogExports []string
// true if logging is on, false if logging is off.
LoggingEnabled bool
// The prefix applied to the log file names.
S3KeyPrefix *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeLoggingStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeLoggingStatus{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeLoggingStatus{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeLoggingStatusValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeLoggingStatus(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeLoggingStatus(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeLoggingStatus",
}
}
| 151 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns properties of possible node configurations such as node type, number of
// nodes, and disk usage for the specified action type.
func (c *Client) DescribeNodeConfigurationOptions(ctx context.Context, params *DescribeNodeConfigurationOptionsInput, optFns ...func(*Options)) (*DescribeNodeConfigurationOptionsOutput, error) {
if params == nil {
params = &DescribeNodeConfigurationOptionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeNodeConfigurationOptions", params, optFns, c.addOperationDescribeNodeConfigurationOptionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeNodeConfigurationOptionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeNodeConfigurationOptionsInput struct {
// The action type to evaluate for possible node configurations. Specify
// "restore-cluster" to get configuration combinations based on an existing
// snapshot. Specify "recommend-node-config" to get configuration recommendations
// based on an existing cluster or snapshot. Specify "resize-cluster" to get
// configuration combinations for elastic resize based on an existing cluster.
//
// This member is required.
ActionType types.ActionType
// The identifier of the cluster to evaluate for possible node configurations.
ClusterIdentifier *string
// A set of name, operator, and value items to filter the results.
Filters []types.NodeConfigurationOptionsFilter
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeNodeConfigurationOptions
// request exceed the value specified in MaxRecords , Amazon Web Services returns a
// value in the Marker field of the response. You can retrieve the next set of
// response records by providing the returned marker value in the Marker parameter
// and retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 500
// Constraints: minimum 100, maximum 500.
MaxRecords *int32
// The Amazon Web Services account used to create or copy the snapshot. Required
// if you are restoring a snapshot you do not own, optional if you own the
// snapshot.
OwnerAccount *string
// The Amazon Resource Name (ARN) of the snapshot associated with the message to
// describe node configuration.
SnapshotArn *string
// The identifier of the snapshot to evaluate for possible node configurations.
SnapshotIdentifier *string
noSmithyDocumentSerde
}
type DescribeNodeConfigurationOptionsOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// A list of valid node configurations.
NodeConfigurationOptionList []types.NodeConfigurationOption
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeNodeConfigurationOptionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeNodeConfigurationOptions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeNodeConfigurationOptions{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeNodeConfigurationOptionsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeNodeConfigurationOptions(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeNodeConfigurationOptionsAPIClient is a client that implements the
// DescribeNodeConfigurationOptions operation.
type DescribeNodeConfigurationOptionsAPIClient interface {
DescribeNodeConfigurationOptions(context.Context, *DescribeNodeConfigurationOptionsInput, ...func(*Options)) (*DescribeNodeConfigurationOptionsOutput, error)
}
var _ DescribeNodeConfigurationOptionsAPIClient = (*Client)(nil)
// DescribeNodeConfigurationOptionsPaginatorOptions is the paginator options for
// DescribeNodeConfigurationOptions
type DescribeNodeConfigurationOptionsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 500
// Constraints: minimum 100, maximum 500.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeNodeConfigurationOptionsPaginator is a paginator for
// DescribeNodeConfigurationOptions
type DescribeNodeConfigurationOptionsPaginator struct {
options DescribeNodeConfigurationOptionsPaginatorOptions
client DescribeNodeConfigurationOptionsAPIClient
params *DescribeNodeConfigurationOptionsInput
nextToken *string
firstPage bool
}
// NewDescribeNodeConfigurationOptionsPaginator returns a new
// DescribeNodeConfigurationOptionsPaginator
func NewDescribeNodeConfigurationOptionsPaginator(client DescribeNodeConfigurationOptionsAPIClient, params *DescribeNodeConfigurationOptionsInput, optFns ...func(*DescribeNodeConfigurationOptionsPaginatorOptions)) *DescribeNodeConfigurationOptionsPaginator {
if params == nil {
params = &DescribeNodeConfigurationOptionsInput{}
}
options := DescribeNodeConfigurationOptionsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeNodeConfigurationOptionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeNodeConfigurationOptionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeNodeConfigurationOptions page.
func (p *DescribeNodeConfigurationOptionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeNodeConfigurationOptionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeNodeConfigurationOptions(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeNodeConfigurationOptions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeNodeConfigurationOptions",
}
}
| 268 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of orderable cluster options. Before you create a new cluster
// you can use this operation to find what options are available, such as the EC2
// Availability Zones (AZ) in the specific Amazon Web Services Region that you can
// specify, and the node types you can request. The node types differ by available
// storage, memory, CPU and price. With the cost involved you might want to obtain
// a list of cluster options in the specific region and specify values when
// creating a cluster. For more information about managing clusters, go to Amazon
// Redshift Clusters (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DescribeOrderableClusterOptions(ctx context.Context, params *DescribeOrderableClusterOptionsInput, optFns ...func(*Options)) (*DescribeOrderableClusterOptionsOutput, error) {
if params == nil {
params = &DescribeOrderableClusterOptionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeOrderableClusterOptions", params, optFns, c.addOperationDescribeOrderableClusterOptionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeOrderableClusterOptionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeOrderableClusterOptionsInput struct {
// The version filter value. Specify this parameter to show only the available
// offerings matching the specified version. Default: All versions. Constraints:
// Must be one of the version returned from DescribeClusterVersions .
ClusterVersion *string
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeOrderableClusterOptions request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The node type filter value. Specify this parameter to show only the available
// offerings matching the specified node type.
NodeType *string
noSmithyDocumentSerde
}
// Contains the output from the DescribeOrderableClusterOptions action.
type DescribeOrderableClusterOptionsOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// An OrderableClusterOption structure containing information about orderable
// options for the cluster.
OrderableClusterOptions []types.OrderableClusterOption
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeOrderableClusterOptionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeOrderableClusterOptions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeOrderableClusterOptions{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeOrderableClusterOptions(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeOrderableClusterOptionsAPIClient is a client that implements the
// DescribeOrderableClusterOptions operation.
type DescribeOrderableClusterOptionsAPIClient interface {
DescribeOrderableClusterOptions(context.Context, *DescribeOrderableClusterOptionsInput, ...func(*Options)) (*DescribeOrderableClusterOptionsOutput, error)
}
var _ DescribeOrderableClusterOptionsAPIClient = (*Client)(nil)
// DescribeOrderableClusterOptionsPaginatorOptions is the paginator options for
// DescribeOrderableClusterOptions
type DescribeOrderableClusterOptionsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeOrderableClusterOptionsPaginator is a paginator for
// DescribeOrderableClusterOptions
type DescribeOrderableClusterOptionsPaginator struct {
options DescribeOrderableClusterOptionsPaginatorOptions
client DescribeOrderableClusterOptionsAPIClient
params *DescribeOrderableClusterOptionsInput
nextToken *string
firstPage bool
}
// NewDescribeOrderableClusterOptionsPaginator returns a new
// DescribeOrderableClusterOptionsPaginator
func NewDescribeOrderableClusterOptionsPaginator(client DescribeOrderableClusterOptionsAPIClient, params *DescribeOrderableClusterOptionsInput, optFns ...func(*DescribeOrderableClusterOptionsPaginatorOptions)) *DescribeOrderableClusterOptionsPaginator {
if params == nil {
params = &DescribeOrderableClusterOptionsInput{}
}
options := DescribeOrderableClusterOptionsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeOrderableClusterOptionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeOrderableClusterOptionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeOrderableClusterOptions page.
func (p *DescribeOrderableClusterOptionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeOrderableClusterOptionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeOrderableClusterOptions(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeOrderableClusterOptions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeOrderableClusterOptions",
}
}
| 256 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about the partner integrations defined for a cluster.
func (c *Client) DescribePartners(ctx context.Context, params *DescribePartnersInput, optFns ...func(*Options)) (*DescribePartnersOutput, error) {
if params == nil {
params = &DescribePartnersInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribePartners", params, optFns, c.addOperationDescribePartnersMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribePartnersOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribePartnersInput struct {
// The Amazon Web Services account ID that owns the cluster.
//
// This member is required.
AccountId *string
// The cluster identifier of the cluster whose partner integration is being
// described.
//
// This member is required.
ClusterIdentifier *string
// The name of the database whose partner integration is being described. If
// database name is not specified, then all databases in the cluster are described.
DatabaseName *string
// The name of the partner that is being described. If partner name is not
// specified, then all partner integrations are described.
PartnerName *string
noSmithyDocumentSerde
}
type DescribePartnersOutput struct {
// A list of partner integrations.
PartnerIntegrationInfoList []types.PartnerIntegrationInfo
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribePartnersMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribePartners{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribePartners{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribePartnersValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribePartners(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribePartners(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribePartners",
}
}
| 139 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns exchange status details and associated metadata for a reserved-node
// exchange. Statuses include such values as in progress and requested.
func (c *Client) DescribeReservedNodeExchangeStatus(ctx context.Context, params *DescribeReservedNodeExchangeStatusInput, optFns ...func(*Options)) (*DescribeReservedNodeExchangeStatusOutput, error) {
if params == nil {
params = &DescribeReservedNodeExchangeStatusInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeReservedNodeExchangeStatus", params, optFns, c.addOperationDescribeReservedNodeExchangeStatusMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeReservedNodeExchangeStatusOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeReservedNodeExchangeStatusInput struct {
// An optional pagination token provided by a previous
// DescribeReservedNodeExchangeStatus request. If this parameter is specified, the
// response includes only records beyond the marker, up to the value specified by
// the MaxRecords parameter. You can retrieve the next set of response records by
// providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a Marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
MaxRecords *int32
// The identifier of the reserved-node exchange request.
ReservedNodeExchangeRequestId *string
// The identifier of the source reserved node in a reserved-node exchange request.
ReservedNodeId *string
noSmithyDocumentSerde
}
type DescribeReservedNodeExchangeStatusOutput struct {
// A pagination token provided by a previous DescribeReservedNodeExchangeStatus
// request.
Marker *string
// The details of the reserved-node exchange request, including the status,
// request time, source reserved-node identifier, and additional details.
ReservedNodeExchangeStatusDetails []types.ReservedNodeExchangeStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeReservedNodeExchangeStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeReservedNodeExchangeStatus{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeReservedNodeExchangeStatus{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeReservedNodeExchangeStatus(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeReservedNodeExchangeStatusAPIClient is a client that implements the
// DescribeReservedNodeExchangeStatus operation.
type DescribeReservedNodeExchangeStatusAPIClient interface {
DescribeReservedNodeExchangeStatus(context.Context, *DescribeReservedNodeExchangeStatusInput, ...func(*Options)) (*DescribeReservedNodeExchangeStatusOutput, error)
}
var _ DescribeReservedNodeExchangeStatusAPIClient = (*Client)(nil)
// DescribeReservedNodeExchangeStatusPaginatorOptions is the paginator options for
// DescribeReservedNodeExchangeStatus
type DescribeReservedNodeExchangeStatusPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a Marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeReservedNodeExchangeStatusPaginator is a paginator for
// DescribeReservedNodeExchangeStatus
type DescribeReservedNodeExchangeStatusPaginator struct {
options DescribeReservedNodeExchangeStatusPaginatorOptions
client DescribeReservedNodeExchangeStatusAPIClient
params *DescribeReservedNodeExchangeStatusInput
nextToken *string
firstPage bool
}
// NewDescribeReservedNodeExchangeStatusPaginator returns a new
// DescribeReservedNodeExchangeStatusPaginator
func NewDescribeReservedNodeExchangeStatusPaginator(client DescribeReservedNodeExchangeStatusAPIClient, params *DescribeReservedNodeExchangeStatusInput, optFns ...func(*DescribeReservedNodeExchangeStatusPaginatorOptions)) *DescribeReservedNodeExchangeStatusPaginator {
if params == nil {
params = &DescribeReservedNodeExchangeStatusInput{}
}
options := DescribeReservedNodeExchangeStatusPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeReservedNodeExchangeStatusPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeReservedNodeExchangeStatusPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeReservedNodeExchangeStatus page.
func (p *DescribeReservedNodeExchangeStatusPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeReservedNodeExchangeStatusOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeReservedNodeExchangeStatus(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeReservedNodeExchangeStatus(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeReservedNodeExchangeStatus",
}
}
| 240 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of the available reserved node offerings by Amazon Redshift with
// their descriptions including the node type, the fixed and recurring costs of
// reserving the node and duration the node will be reserved for you. These
// descriptions help you determine which reserve node offering you want to
// purchase. You then use the unique offering ID in you call to
// PurchaseReservedNodeOffering to reserve one or more nodes for your Amazon
// Redshift cluster. For more information about reserved node offerings, go to
// Purchasing Reserved Nodes (https://docs.aws.amazon.com/redshift/latest/mgmt/purchase-reserved-node-instance.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DescribeReservedNodeOfferings(ctx context.Context, params *DescribeReservedNodeOfferingsInput, optFns ...func(*Options)) (*DescribeReservedNodeOfferingsOutput, error) {
if params == nil {
params = &DescribeReservedNodeOfferingsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeReservedNodeOfferings", params, optFns, c.addOperationDescribeReservedNodeOfferingsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeReservedNodeOfferingsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeReservedNodeOfferingsInput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeReservedNodeOfferings request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The unique identifier for the offering.
ReservedNodeOfferingId *string
noSmithyDocumentSerde
}
type DescribeReservedNodeOfferingsOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// A list of ReservedNodeOffering objects.
ReservedNodeOfferings []types.ReservedNodeOffering
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeReservedNodeOfferingsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeReservedNodeOfferings{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeReservedNodeOfferings{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeReservedNodeOfferings(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeReservedNodeOfferingsAPIClient is a client that implements the
// DescribeReservedNodeOfferings operation.
type DescribeReservedNodeOfferingsAPIClient interface {
DescribeReservedNodeOfferings(context.Context, *DescribeReservedNodeOfferingsInput, ...func(*Options)) (*DescribeReservedNodeOfferingsOutput, error)
}
var _ DescribeReservedNodeOfferingsAPIClient = (*Client)(nil)
// DescribeReservedNodeOfferingsPaginatorOptions is the paginator options for
// DescribeReservedNodeOfferings
type DescribeReservedNodeOfferingsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeReservedNodeOfferingsPaginator is a paginator for
// DescribeReservedNodeOfferings
type DescribeReservedNodeOfferingsPaginator struct {
options DescribeReservedNodeOfferingsPaginatorOptions
client DescribeReservedNodeOfferingsAPIClient
params *DescribeReservedNodeOfferingsInput
nextToken *string
firstPage bool
}
// NewDescribeReservedNodeOfferingsPaginator returns a new
// DescribeReservedNodeOfferingsPaginator
func NewDescribeReservedNodeOfferingsPaginator(client DescribeReservedNodeOfferingsAPIClient, params *DescribeReservedNodeOfferingsInput, optFns ...func(*DescribeReservedNodeOfferingsPaginatorOptions)) *DescribeReservedNodeOfferingsPaginator {
if params == nil {
params = &DescribeReservedNodeOfferingsInput{}
}
options := DescribeReservedNodeOfferingsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeReservedNodeOfferingsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeReservedNodeOfferingsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeReservedNodeOfferings page.
func (p *DescribeReservedNodeOfferingsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeReservedNodeOfferingsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeReservedNodeOfferings(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeReservedNodeOfferings(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeReservedNodeOfferings",
}
}
| 248 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns the descriptions of the reserved nodes.
func (c *Client) DescribeReservedNodes(ctx context.Context, params *DescribeReservedNodesInput, optFns ...func(*Options)) (*DescribeReservedNodesOutput, error) {
if params == nil {
params = &DescribeReservedNodesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeReservedNodes", params, optFns, c.addOperationDescribeReservedNodesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeReservedNodesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeReservedNodesInput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeReservedNodes request exceed
// the value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// Identifier for the node reservation.
ReservedNodeId *string
noSmithyDocumentSerde
}
type DescribeReservedNodesOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the Marker
// parameter and retrying the command. If the Marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// The list of ReservedNode objects.
ReservedNodes []types.ReservedNode
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeReservedNodesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeReservedNodes{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeReservedNodes{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeReservedNodes(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeReservedNodesAPIClient is a client that implements the
// DescribeReservedNodes operation.
type DescribeReservedNodesAPIClient interface {
DescribeReservedNodes(context.Context, *DescribeReservedNodesInput, ...func(*Options)) (*DescribeReservedNodesOutput, error)
}
var _ DescribeReservedNodesAPIClient = (*Client)(nil)
// DescribeReservedNodesPaginatorOptions is the paginator options for
// DescribeReservedNodes
type DescribeReservedNodesPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeReservedNodesPaginator is a paginator for DescribeReservedNodes
type DescribeReservedNodesPaginator struct {
options DescribeReservedNodesPaginatorOptions
client DescribeReservedNodesAPIClient
params *DescribeReservedNodesInput
nextToken *string
firstPage bool
}
// NewDescribeReservedNodesPaginator returns a new DescribeReservedNodesPaginator
func NewDescribeReservedNodesPaginator(client DescribeReservedNodesAPIClient, params *DescribeReservedNodesInput, optFns ...func(*DescribeReservedNodesPaginatorOptions)) *DescribeReservedNodesPaginator {
if params == nil {
params = &DescribeReservedNodesInput{}
}
options := DescribeReservedNodesPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeReservedNodesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeReservedNodesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeReservedNodes page.
func (p *DescribeReservedNodesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeReservedNodesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeReservedNodes(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeReservedNodes(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeReservedNodes",
}
}
| 238 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about the last resize operation for the specified cluster.
// If no resize operation has ever been initiated for the specified cluster, a
// HTTP 404 error is returned. If a resize operation was initiated and completed,
// the status of the resize remains as SUCCEEDED until the next resize. A resize
// operation can be requested using ModifyCluster and specifying a different
// number or type of nodes for the cluster.
func (c *Client) DescribeResize(ctx context.Context, params *DescribeResizeInput, optFns ...func(*Options)) (*DescribeResizeOutput, error) {
if params == nil {
params = &DescribeResizeInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeResize", params, optFns, c.addOperationDescribeResizeMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeResizeOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeResizeInput struct {
// The unique identifier of a cluster whose resize progress you are requesting.
// This parameter is case-sensitive. By default, resize operations for all clusters
// defined for an Amazon Web Services account are returned.
//
// This member is required.
ClusterIdentifier *string
noSmithyDocumentSerde
}
// Describes the result of a cluster resize operation.
type DescribeResizeOutput struct {
// The average rate of the resize operation over the last few minutes, measured in
// megabytes per second. After the resize operation completes, this value shows the
// average rate of the entire resize operation.
AvgResizeRateInMegaBytesPerSecond *float64
// The percent of data transferred from source cluster to target cluster.
DataTransferProgressPercent *float64
// The amount of seconds that have elapsed since the resize operation began. After
// the resize operation completes, this value shows the total actual time, in
// seconds, for the resize operation.
ElapsedTimeInSeconds *int64
// The estimated time remaining, in seconds, until the resize operation is
// complete. This value is calculated based on the average resize rate and the
// estimated amount of data remaining to be processed. Once the resize operation is
// complete, this value will be 0.
EstimatedTimeToCompletionInSeconds *int64
// The names of tables that have been completely imported . Valid Values: List of
// table names.
ImportTablesCompleted []string
// The names of tables that are being currently imported. Valid Values: List of
// table names.
ImportTablesInProgress []string
// The names of tables that have not been yet imported. Valid Values: List of
// table names
ImportTablesNotStarted []string
// An optional string to provide additional details about the resize action.
Message *string
// While the resize operation is in progress, this value shows the current amount
// of data, in megabytes, that has been processed so far. When the resize operation
// is complete, this value shows the total amount of data, in megabytes, on the
// cluster, which may be more or less than TotalResizeDataInMegaBytes (the
// estimated total amount of data before resize).
ProgressInMegaBytes *int64
// An enum with possible values of ClassicResize and ElasticResize . These values
// describe the type of resize operation being performed.
ResizeType *string
// The status of the resize operation. Valid Values: NONE | IN_PROGRESS | FAILED |
// SUCCEEDED | CANCELLING
Status *string
// The cluster type after the resize operation is complete. Valid Values:
// multi-node | single-node
TargetClusterType *string
// The type of encryption for the cluster after the resize is complete. Possible
// values are KMS and None .
TargetEncryptionType *string
// The node type that the cluster will have after the resize operation is complete.
TargetNodeType *string
// The number of nodes that the cluster will have after the resize operation is
// complete.
TargetNumberOfNodes *int32
// The estimated total amount of data, in megabytes, on the cluster before the
// resize operation began.
TotalResizeDataInMegaBytes *int64
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeResizeMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeResize{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeResize{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeResizeValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeResize(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeResize(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeResize",
}
}
| 197 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Describes properties of scheduled actions.
func (c *Client) DescribeScheduledActions(ctx context.Context, params *DescribeScheduledActionsInput, optFns ...func(*Options)) (*DescribeScheduledActionsOutput, error) {
if params == nil {
params = &DescribeScheduledActionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeScheduledActions", params, optFns, c.addOperationDescribeScheduledActionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeScheduledActionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeScheduledActionsInput struct {
// If true, retrieve only active scheduled actions. If false, retrieve only
// disabled scheduled actions.
Active *bool
// The end time in UTC of the scheduled action to retrieve. Only active scheduled
// actions that have invocations before this time are retrieved.
EndTime *time.Time
// List of scheduled action filters.
Filters []types.ScheduledActionFilter
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeScheduledActions request exceed
// the value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The name of the scheduled action to retrieve.
ScheduledActionName *string
// The start time in UTC of the scheduled actions to retrieve. Only active
// scheduled actions that have invocations after this time are retrieved.
StartTime *time.Time
// The type of the scheduled actions to retrieve.
TargetActionType types.ScheduledActionTypeValues
noSmithyDocumentSerde
}
type DescribeScheduledActionsOutput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeScheduledActions request exceed
// the value specified in MaxRecords , Amazon Web Services returns a value in the
// Marker field of the response. You can retrieve the next set of response records
// by providing the returned marker value in the Marker parameter and retrying the
// request.
Marker *string
// List of retrieved scheduled actions.
ScheduledActions []types.ScheduledAction
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeScheduledActionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeScheduledActions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeScheduledActions{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeScheduledActionsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeScheduledActions(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeScheduledActionsAPIClient is a client that implements the
// DescribeScheduledActions operation.
type DescribeScheduledActionsAPIClient interface {
DescribeScheduledActions(context.Context, *DescribeScheduledActionsInput, ...func(*Options)) (*DescribeScheduledActionsOutput, error)
}
var _ DescribeScheduledActionsAPIClient = (*Client)(nil)
// DescribeScheduledActionsPaginatorOptions is the paginator options for
// DescribeScheduledActions
type DescribeScheduledActionsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeScheduledActionsPaginator is a paginator for DescribeScheduledActions
type DescribeScheduledActionsPaginator struct {
options DescribeScheduledActionsPaginatorOptions
client DescribeScheduledActionsAPIClient
params *DescribeScheduledActionsInput
nextToken *string
firstPage bool
}
// NewDescribeScheduledActionsPaginator returns a new
// DescribeScheduledActionsPaginator
func NewDescribeScheduledActionsPaginator(client DescribeScheduledActionsAPIClient, params *DescribeScheduledActionsInput, optFns ...func(*DescribeScheduledActionsPaginatorOptions)) *DescribeScheduledActionsPaginator {
if params == nil {
params = &DescribeScheduledActionsInput{}
}
options := DescribeScheduledActionsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeScheduledActionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeScheduledActionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeScheduledActions page.
func (p *DescribeScheduledActionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeScheduledActionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeScheduledActions(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeScheduledActions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeScheduledActions",
}
}
| 262 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of snapshot copy grants owned by the Amazon Web Services account
// in the destination region. For more information about managing snapshot copy
// grants, go to Amazon Redshift Database Encryption (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-db-encryption.html)
// in the Amazon Redshift Cluster Management Guide.
func (c *Client) DescribeSnapshotCopyGrants(ctx context.Context, params *DescribeSnapshotCopyGrantsInput, optFns ...func(*Options)) (*DescribeSnapshotCopyGrantsOutput, error) {
if params == nil {
params = &DescribeSnapshotCopyGrantsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeSnapshotCopyGrants", params, optFns, c.addOperationDescribeSnapshotCopyGrantsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeSnapshotCopyGrantsOutput)
out.ResultMetadata = metadata
return out, nil
}
// The result of the DescribeSnapshotCopyGrants action.
type DescribeSnapshotCopyGrantsInput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeSnapshotCopyGrant request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request. Constraints: You can specify either the
// SnapshotCopyGrantName parameter or the Marker parameter, but not both.
Marker *string
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
MaxRecords *int32
// The name of the snapshot copy grant.
SnapshotCopyGrantName *string
// A tag key or keys for which you want to return all matching resources that are
// associated with the specified key or keys. For example, suppose that you have
// resources tagged with keys called owner and environment . If you specify both of
// these tag keys in the request, Amazon Redshift returns a response with all
// resources that have either or both of these tag keys associated with them.
TagKeys []string
// A tag value or values for which you want to return all matching resources that
// are associated with the specified value or values. For example, suppose that you
// have resources tagged with values called admin and test . If you specify both of
// these tag values in the request, Amazon Redshift returns a response with all
// resources that have either or both of these tag values associated with them.
TagValues []string
noSmithyDocumentSerde
}
type DescribeSnapshotCopyGrantsOutput struct {
// An optional parameter that specifies the starting point to return a set of
// response records. When the results of a DescribeSnapshotCopyGrant request
// exceed the value specified in MaxRecords , Amazon Web Services returns a value
// in the Marker field of the response. You can retrieve the next set of response
// records by providing the returned marker value in the Marker parameter and
// retrying the request. Constraints: You can specify either the
// SnapshotCopyGrantName parameter or the Marker parameter, but not both.
Marker *string
// The list of SnapshotCopyGrant objects.
SnapshotCopyGrants []types.SnapshotCopyGrant
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeSnapshotCopyGrantsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeSnapshotCopyGrants{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeSnapshotCopyGrants{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeSnapshotCopyGrants(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeSnapshotCopyGrantsAPIClient is a client that implements the
// DescribeSnapshotCopyGrants operation.
type DescribeSnapshotCopyGrantsAPIClient interface {
DescribeSnapshotCopyGrants(context.Context, *DescribeSnapshotCopyGrantsInput, ...func(*Options)) (*DescribeSnapshotCopyGrantsOutput, error)
}
var _ DescribeSnapshotCopyGrantsAPIClient = (*Client)(nil)
// DescribeSnapshotCopyGrantsPaginatorOptions is the paginator options for
// DescribeSnapshotCopyGrants
type DescribeSnapshotCopyGrantsPaginatorOptions struct {
// The maximum number of response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value. Default: 100
// Constraints: minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeSnapshotCopyGrantsPaginator is a paginator for
// DescribeSnapshotCopyGrants
type DescribeSnapshotCopyGrantsPaginator struct {
options DescribeSnapshotCopyGrantsPaginatorOptions
client DescribeSnapshotCopyGrantsAPIClient
params *DescribeSnapshotCopyGrantsInput
nextToken *string
firstPage bool
}
// NewDescribeSnapshotCopyGrantsPaginator returns a new
// DescribeSnapshotCopyGrantsPaginator
func NewDescribeSnapshotCopyGrantsPaginator(client DescribeSnapshotCopyGrantsAPIClient, params *DescribeSnapshotCopyGrantsInput, optFns ...func(*DescribeSnapshotCopyGrantsPaginatorOptions)) *DescribeSnapshotCopyGrantsPaginator {
if params == nil {
params = &DescribeSnapshotCopyGrantsInput{}
}
options := DescribeSnapshotCopyGrantsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeSnapshotCopyGrantsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeSnapshotCopyGrantsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeSnapshotCopyGrants page.
func (p *DescribeSnapshotCopyGrantsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeSnapshotCopyGrantsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeSnapshotCopyGrants(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeSnapshotCopyGrants(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeSnapshotCopyGrants",
}
}
| 261 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of snapshot schedules.
func (c *Client) DescribeSnapshotSchedules(ctx context.Context, params *DescribeSnapshotSchedulesInput, optFns ...func(*Options)) (*DescribeSnapshotSchedulesOutput, error) {
if params == nil {
params = &DescribeSnapshotSchedulesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeSnapshotSchedules", params, optFns, c.addOperationDescribeSnapshotSchedulesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeSnapshotSchedulesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeSnapshotSchedulesInput struct {
// The unique identifier for the cluster whose snapshot schedules you want to view.
ClusterIdentifier *string
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the marker
// parameter and retrying the command. If the marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// The maximum number or response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
MaxRecords *int32
// A unique identifier for a snapshot schedule.
ScheduleIdentifier *string
// The key value for a snapshot schedule tag.
TagKeys []string
// The value corresponding to the key of the snapshot schedule tag.
TagValues []string
noSmithyDocumentSerde
}
type DescribeSnapshotSchedulesOutput struct {
// A value that indicates the starting point for the next set of response records
// in a subsequent request. If a value is returned in a response, you can retrieve
// the next set of records by providing this returned marker value in the marker
// parameter and retrying the command. If the marker field is empty, all response
// records have been retrieved for the request.
Marker *string
// A list of SnapshotSchedules.
SnapshotSchedules []types.SnapshotSchedule
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeSnapshotSchedulesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeSnapshotSchedules{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeSnapshotSchedules{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeSnapshotSchedules(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeSnapshotSchedulesAPIClient is a client that implements the
// DescribeSnapshotSchedules operation.
type DescribeSnapshotSchedulesAPIClient interface {
DescribeSnapshotSchedules(context.Context, *DescribeSnapshotSchedulesInput, ...func(*Options)) (*DescribeSnapshotSchedulesOutput, error)
}
var _ DescribeSnapshotSchedulesAPIClient = (*Client)(nil)
// DescribeSnapshotSchedulesPaginatorOptions is the paginator options for
// DescribeSnapshotSchedules
type DescribeSnapshotSchedulesPaginatorOptions struct {
// The maximum number or response records to return in each call. If the number of
// remaining response records exceeds the specified MaxRecords value, a value is
// returned in a marker field of the response. You can retrieve the next set of
// records by retrying the command with the returned marker value.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeSnapshotSchedulesPaginator is a paginator for DescribeSnapshotSchedules
type DescribeSnapshotSchedulesPaginator struct {
options DescribeSnapshotSchedulesPaginatorOptions
client DescribeSnapshotSchedulesAPIClient
params *DescribeSnapshotSchedulesInput
nextToken *string
firstPage bool
}
// NewDescribeSnapshotSchedulesPaginator returns a new
// DescribeSnapshotSchedulesPaginator
func NewDescribeSnapshotSchedulesPaginator(client DescribeSnapshotSchedulesAPIClient, params *DescribeSnapshotSchedulesInput, optFns ...func(*DescribeSnapshotSchedulesPaginatorOptions)) *DescribeSnapshotSchedulesPaginator {
if params == nil {
params = &DescribeSnapshotSchedulesInput{}
}
options := DescribeSnapshotSchedulesPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeSnapshotSchedulesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeSnapshotSchedulesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeSnapshotSchedules page.
func (p *DescribeSnapshotSchedulesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeSnapshotSchedulesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeSnapshotSchedules(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeSnapshotSchedules(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeSnapshotSchedules",
}
}
| 245 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns account level backups storage size and provisional storage.
func (c *Client) DescribeStorage(ctx context.Context, params *DescribeStorageInput, optFns ...func(*Options)) (*DescribeStorageOutput, error) {
if params == nil {
params = &DescribeStorageInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeStorage", params, optFns, c.addOperationDescribeStorageMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeStorageOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeStorageInput struct {
noSmithyDocumentSerde
}
type DescribeStorageOutput struct {
// The total amount of storage currently used for snapshots.
TotalBackupSizeInMegaBytes float64
// The total amount of storage currently provisioned.
TotalProvisionedStorageInMegaBytes float64
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeStorageMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeStorage{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeStorage{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeStorage(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeStorage(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeStorage",
}
}
| 118 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshift
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshift/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the status of one or more table restore requests made using the
// RestoreTableFromClusterSnapshot API action. If you don't specify a value for the
// TableRestoreRequestId parameter, then DescribeTableRestoreStatus returns the
// status of all table restore requests ordered by the date and time of the request
// in ascending order. Otherwise DescribeTableRestoreStatus returns the status of
// the table specified by TableRestoreRequestId .
func (c *Client) DescribeTableRestoreStatus(ctx context.Context, params *DescribeTableRestoreStatusInput, optFns ...func(*Options)) (*DescribeTableRestoreStatusOutput, error) {
if params == nil {
params = &DescribeTableRestoreStatusInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeTableRestoreStatus", params, optFns, c.addOperationDescribeTableRestoreStatusMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeTableRestoreStatusOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeTableRestoreStatusInput struct {
// The Amazon Redshift cluster that the table is being restored to.
ClusterIdentifier *string
// An optional pagination token provided by a previous DescribeTableRestoreStatus
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by the MaxRecords parameter.
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so that the remaining results can be retrieved.
MaxRecords *int32
// The identifier of the table restore request to return status for. If you don't
// specify a TableRestoreRequestId value, then DescribeTableRestoreStatus returns
// the status of all in-progress table restore requests.
TableRestoreRequestId *string
noSmithyDocumentSerde
}
type DescribeTableRestoreStatusOutput struct {
// A pagination token that can be used in a subsequent DescribeTableRestoreStatus
// request.
Marker *string
// A list of status details for one or more table restore requests.
TableRestoreStatusDetails []types.TableRestoreStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeTableRestoreStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeTableRestoreStatus{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeTableRestoreStatus{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeTableRestoreStatus(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeTableRestoreStatusAPIClient is a client that implements the
// DescribeTableRestoreStatus operation.
type DescribeTableRestoreStatusAPIClient interface {
DescribeTableRestoreStatus(context.Context, *DescribeTableRestoreStatusInput, ...func(*Options)) (*DescribeTableRestoreStatusOutput, error)
}
var _ DescribeTableRestoreStatusAPIClient = (*Client)(nil)
// DescribeTableRestoreStatusPaginatorOptions is the paginator options for
// DescribeTableRestoreStatus
type DescribeTableRestoreStatusPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so that the remaining results can be retrieved.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeTableRestoreStatusPaginator is a paginator for
// DescribeTableRestoreStatus
type DescribeTableRestoreStatusPaginator struct {
options DescribeTableRestoreStatusPaginatorOptions
client DescribeTableRestoreStatusAPIClient
params *DescribeTableRestoreStatusInput
nextToken *string
firstPage bool
}
// NewDescribeTableRestoreStatusPaginator returns a new
// DescribeTableRestoreStatusPaginator
func NewDescribeTableRestoreStatusPaginator(client DescribeTableRestoreStatusAPIClient, params *DescribeTableRestoreStatusInput, optFns ...func(*DescribeTableRestoreStatusPaginatorOptions)) *DescribeTableRestoreStatusPaginator {
if params == nil {
params = &DescribeTableRestoreStatusInput{}
}
options := DescribeTableRestoreStatusPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeTableRestoreStatusPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeTableRestoreStatusPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeTableRestoreStatus page.
func (p *DescribeTableRestoreStatusPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeTableRestoreStatusOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxRecords = limit
result, err := p.client.DescribeTableRestoreStatus(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeTableRestoreStatus(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift",
OperationName: "DescribeTableRestoreStatus",
}
}
| 240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.