/
api_op_UpdateTable.go
200 lines (181 loc) · 6.89 KB
/
api_op_UpdateTable.go
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
191
192
193
194
195
196
197
198
199
200
// Code generated by smithy-go-codegen DO NOT EDIT.
package dynamodb
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/dynamodb/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Modifies the provisioned throughput settings, global secondary indexes, or
// DynamoDB Streams settings for a given table. You can only perform one of the
// following operations at once:
//
// * Modify the provisioned throughput settings of
// the table.
//
// * Enable or disable DynamoDB Streams on the table.
//
// * Remove a
// global secondary index from the table.
//
// * Create a new global secondary index on
// the table. After the index begins backfilling, you can use UpdateTable to
// perform other operations.
//
// UpdateTable is an asynchronous operation; while it is
// executing, the table status changes from ACTIVE to UPDATING. While it is
// UPDATING, you cannot issue another UpdateTable request. When the table returns
// to the ACTIVE state, the UpdateTable operation is complete.
func (c *Client) UpdateTable(ctx context.Context, params *UpdateTableInput, optFns ...func(*Options)) (*UpdateTableOutput, error) {
if params == nil {
params = &UpdateTableInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateTable", params, optFns, addOperationUpdateTableMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateTableOutput)
out.ResultMetadata = metadata
return out, nil
}
// Represents the input of an UpdateTable operation.
type UpdateTableInput struct {
// The name of the table to be updated.
//
// This member is required.
TableName *string
// An array of attributes that describe the key schema for the table and indexes.
// If you are adding a new global secondary index to the table,
// AttributeDefinitions must include the key element(s) of the new index.
AttributeDefinitions []types.AttributeDefinition
// Controls how you are charged for read and write throughput and how you manage
// capacity. When switching from pay-per-request to provisioned capacity, initial
// provisioned capacity values must be set. The initial provisioned capacity values
// are estimated based on the consumed read and write capacity of your table and
// global secondary indexes over the past 30 minutes.
//
// * PROVISIONED - We recommend
// using PROVISIONED for predictable workloads. PROVISIONED sets the billing mode
// to Provisioned Mode
// (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.ProvisionedThroughput.Manual).
//
// *
// PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for unpredictable
// workloads. PAY_PER_REQUEST sets the billing mode to On-Demand Mode
// (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.OnDemand).
BillingMode types.BillingMode
// An array of one or more global secondary indexes for the table. For each index
// in the array, you can request one action:
//
// * Create - add a new global secondary
// index to the table.
//
// * Update - modify the provisioned throughput settings of an
// existing global secondary index.
//
// * Delete - remove a global secondary index
// from the table.
//
// You can create or delete only one global secondary index per
// UpdateTable operation. For more information, see Managing Global Secondary
// Indexes
// (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html)
// in the Amazon DynamoDB Developer Guide.
GlobalSecondaryIndexUpdates []types.GlobalSecondaryIndexUpdate
// The new provisioned throughput settings for the specified table or index.
ProvisionedThroughput *types.ProvisionedThroughput
// A list of replica update actions (create, delete, or update) for the table. This
// property only applies to Version 2019.11.21
// (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html)
// of global tables.
ReplicaUpdates []types.ReplicationGroupUpdate
// The new server-side encryption settings for the specified table.
SSESpecification *types.SSESpecification
// Represents the DynamoDB Streams configuration for the table. You receive a
// ResourceInUseException if you try to enable a stream on a table that already has
// a stream, or if you try to disable a stream on a table that doesn't have a
// stream.
StreamSpecification *types.StreamSpecification
}
// Represents the output of an UpdateTable operation.
type UpdateTableOutput struct {
// Represents the properties of the table.
TableDescription *types.TableDescription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
}
func addOperationUpdateTableMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson10_serializeOpUpdateTable{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpUpdateTable{}, 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.AddAttemptClockSkewMiddleware(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 = addOpUpdateTableValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateTable(options.Region), middleware.Before); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addValidateResponseChecksum(stack, options); err != nil {
return err
}
if err = addAcceptEncodingGzip(stack, options); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opUpdateTable(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "dynamodb",
OperationName: "UpdateTable",
}
}