1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
// Code generated by smithy-go-codegen DO NOT EDIT.
package rdsdata
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/rdsdata/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Runs a batch SQL statement over an array of data. You can run bulk update and
// insert operations for multiple records using a DML statement with different
// parameter sets. Bulk operations can provide a significant performance
// improvement over individual insert and update operations. 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. There isn't a
// fixed upper limit on the number of parameter sets. However, the maximum size of
// the HTTP request submitted through the Data API is 4 MiB. If the request exceeds
// this limit, the Data API returns an error and doesn't process the request. This
// 4-MiB limit includes the size of the HTTP headers and the JSON notation in the
// request. Thus, the number of parameter sets that you can include depends on a
// combination of factors, such as the size of the SQL statement and the size of
// each parameter set. The response size limit is 1 MiB. If the call returns more
// than 1 MiB of response data, the call is terminated.
func (c *Client) BatchExecuteStatement(ctx context.Context, params *BatchExecuteStatementInput, optFns ...func(*Options)) (*BatchExecuteStatementOutput, error) {
if params == nil {
params = &BatchExecuteStatementInput{}
}
result, metadata, err := c.invokeOperation(ctx, "BatchExecuteStatement", params, optFns, c.addOperationBatchExecuteStatementMiddlewares)
if err != nil {
return nil, err
}
out := result.(*BatchExecuteStatementOutput)
out.ResultMetadata = metadata
return out, nil
}
// The request parameters represent the input of a SQL statement over an array of
// data.
type BatchExecuteStatementInput 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. Don't include a semicolon (;) at the end of the SQL
// statement.
//
// This member is required.
Sql *string
// The name of the database.
Database *string
// The parameter set for the batch operation. The SQL statement is executed as
// many times as the number of parameter sets provided. To execute a SQL statement
// with no parameters, use one of the following options:
// - Specify one or more empty parameter sets.
// - Use the ExecuteStatement operation instead of the BatchExecuteStatement
// operation.
// Array parameters are not supported.
ParameterSets [][]types.SqlParameter
// 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 SQL statement over an array of
// data.
type BatchExecuteStatementOutput struct {
// The execution results of each batch entry.
UpdateResults []types.UpdateResult
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationBatchExecuteStatementMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchExecuteStatement{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchExecuteStatement{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "BatchExecuteStatement"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); 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 = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpBatchExecuteStatementValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchExecuteStatement(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
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opBatchExecuteStatement(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "BatchExecuteStatement",
}
}
|