1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package redshiftdata 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/smithy-go/middleware" 10 smithyhttp "github.com/aws/smithy-go/transport/http" 11 "time" 12) 13 14// Runs one or more SQL statements, which can be data manipulation language (DML) 15// or data definition language (DDL). Depending on the authorization method, use 16// one of the following combinations of request parameters: 17// 18// * Secrets Manager - 19// specify the Amazon Resource Name (ARN) of the secret, the database name, and the 20// cluster identifier that matches the cluster in the secret. 21// 22// * Temporary 23// credentials - specify the cluster identifier, the database name, and the 24// database user name. Permission to call the redshift:GetClusterCredentials 25// operation is required to use this method. 26func (c *Client) BatchExecuteStatement(ctx context.Context, params *BatchExecuteStatementInput, optFns ...func(*Options)) (*BatchExecuteStatementOutput, error) { 27 if params == nil { 28 params = &BatchExecuteStatementInput{} 29 } 30 31 result, metadata, err := c.invokeOperation(ctx, "BatchExecuteStatement", params, optFns, c.addOperationBatchExecuteStatementMiddlewares) 32 if err != nil { 33 return nil, err 34 } 35 36 out := result.(*BatchExecuteStatementOutput) 37 out.ResultMetadata = metadata 38 return out, nil 39} 40 41type BatchExecuteStatementInput struct { 42 43 // The cluster identifier. This parameter is required when authenticating using 44 // either Secrets Manager or temporary credentials. 45 // 46 // This member is required. 47 ClusterIdentifier *string 48 49 // The name of the database. This parameter is required when authenticating using 50 // either Secrets Manager or temporary credentials. 51 // 52 // This member is required. 53 Database *string 54 55 // One or more SQL statements to run. 56 // 57 // This member is required. 58 Sqls []string 59 60 // The database user name. This parameter is required when authenticating using 61 // temporary credentials. 62 DbUser *string 63 64 // The name or ARN of the secret that enables access to the database. This 65 // parameter is required when authenticating using Secrets Manager. 66 SecretArn *string 67 68 // The name of the SQL statements. You can name the SQL statements when you create 69 // them to identify the query. 70 StatementName *string 71 72 // A value that indicates whether to send an event to the Amazon EventBridge event 73 // bus after the SQL statements run. 74 WithEvent *bool 75 76 noSmithyDocumentSerde 77} 78 79type BatchExecuteStatementOutput struct { 80 81 // The cluster identifier. 82 ClusterIdentifier *string 83 84 // The date and time (UTC) the statement was created. 85 CreatedAt *time.Time 86 87 // The name of the database. 88 Database *string 89 90 // The database user name. 91 DbUser *string 92 93 // The identifier of the SQL statement whose results are to be fetched. This value 94 // is a universally unique identifier (UUID) generated by Amazon Redshift Data API. 95 // This identifier is returned by BatchExecuteStatment. 96 Id *string 97 98 // The name or ARN of the secret that enables access to the database. 99 SecretArn *string 100 101 // Metadata pertaining to the operation's result. 102 ResultMetadata middleware.Metadata 103 104 noSmithyDocumentSerde 105} 106 107func (c *Client) addOperationBatchExecuteStatementMiddlewares(stack *middleware.Stack, options Options) (err error) { 108 err = stack.Serialize.Add(&awsAwsjson11_serializeOpBatchExecuteStatement{}, middleware.After) 109 if err != nil { 110 return err 111 } 112 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpBatchExecuteStatement{}, middleware.After) 113 if err != nil { 114 return err 115 } 116 if err = addSetLoggerMiddleware(stack, options); err != nil { 117 return err 118 } 119 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 120 return err 121 } 122 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 123 return err 124 } 125 if err = addResolveEndpointMiddleware(stack, options); err != nil { 126 return err 127 } 128 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 129 return err 130 } 131 if err = addRetryMiddlewares(stack, options); err != nil { 132 return err 133 } 134 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 135 return err 136 } 137 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 138 return err 139 } 140 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 141 return err 142 } 143 if err = addClientUserAgent(stack); err != nil { 144 return err 145 } 146 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 147 return err 148 } 149 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addOpBatchExecuteStatementValidationMiddleware(stack); err != nil { 153 return err 154 } 155 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchExecuteStatement(options.Region), middleware.Before); err != nil { 156 return err 157 } 158 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addResponseErrorMiddleware(stack); err != nil { 162 return err 163 } 164 if err = addRequestResponseLogging(stack, options); err != nil { 165 return err 166 } 167 return nil 168} 169 170func newServiceMetadataMiddleware_opBatchExecuteStatement(region string) *awsmiddleware.RegisterServiceMetadata { 171 return &awsmiddleware.RegisterServiceMetadata{ 172 Region: region, 173 ServiceID: ServiceID, 174 SigningName: "redshift-data", 175 OperationName: "BatchExecuteStatement", 176 } 177} 178