aws-sdk-dynamodb 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-dynamodb.rb +1 -1
- data/lib/aws-sdk-dynamodb/client.rb +3482 -4404
- data/lib/aws-sdk-dynamodb/client_api.rb +822 -755
- data/lib/aws-sdk-dynamodb/errors.rb +4 -13
- data/lib/aws-sdk-dynamodb/resource.rb +477 -496
- data/lib/aws-sdk-dynamodb/table.rb +1930 -3115
- data/lib/aws-sdk-dynamodb/types.rb +5133 -6007
- data/lib/aws-sdk-dynamodb/waiters.rb +70 -71
- metadata +2 -2
@@ -1,23 +1,14 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
4
|
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
5
|
#
|
6
6
|
# WARNING ABOUT GENERATED CODE
|
7
7
|
|
8
|
-
module Aws
|
9
|
-
module
|
10
|
-
module Errors
|
8
|
+
module Aws::DynamoDB
|
9
|
+
module Errors
|
11
10
|
|
12
|
-
|
11
|
+
extend Aws::Errors::DynamicErrors
|
13
12
|
|
14
|
-
# Raised when calling #load or #data on a resource class that can not be
|
15
|
-
# loaded. This can happen when:
|
16
|
-
#
|
17
|
-
# * A resource class has identifiers, but no data attributes.
|
18
|
-
# * Resource data is only available when making an API call that
|
19
|
-
# enumerates all resources of that type.
|
20
|
-
class ResourceNotLoadable < RuntimeError; end
|
21
|
-
end
|
22
13
|
end
|
23
14
|
end
|
@@ -1,517 +1,498 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
4
|
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
5
|
#
|
6
6
|
# WARNING ABOUT GENERATED CODE
|
7
7
|
|
8
|
-
module Aws
|
9
|
-
|
10
|
-
class Resource
|
8
|
+
module Aws::DynamoDB
|
9
|
+
class Resource
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
# @param options ({})
|
12
|
+
# @option options [Client] :client
|
13
|
+
def initialize(options = {})
|
14
|
+
@client = options[:client] || Client.new(options)
|
15
|
+
end
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
# @return [Client]
|
18
|
+
def client
|
19
|
+
@client
|
20
|
+
end
|
22
21
|
|
23
|
-
|
22
|
+
# @!group Actions
|
24
23
|
|
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
|
-
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
153
|
-
# for the operation, together with *ConsumedCapacity* for each table
|
154
|
-
# and secondary index that was accessed.
|
155
|
-
#
|
156
|
-
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
157
|
-
# not access any indexes at all. In these cases, specifying *INDEXES*
|
158
|
-
# will only return *ConsumedCapacity* information for table(s).
|
159
|
-
#
|
160
|
-
# * *TOTAL* - The response includes only the aggregate
|
161
|
-
# *ConsumedCapacity* for the operation.
|
162
|
-
#
|
163
|
-
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
164
|
-
# @return [Types::BatchGetItemOutput]
|
165
|
-
def batch_get_item(options = {})
|
166
|
-
resp = @client.batch_get_item(options)
|
167
|
-
resp.data
|
168
|
-
end
|
24
|
+
# @example Request syntax with placeholder values
|
25
|
+
#
|
26
|
+
# dynamo_db.batch_get_item({
|
27
|
+
# request_items: { # required
|
28
|
+
# "TableName" => {
|
29
|
+
# keys: [ # required
|
30
|
+
# {
|
31
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
32
|
+
# },
|
33
|
+
# ],
|
34
|
+
# attributes_to_get: ["AttributeName"],
|
35
|
+
# consistent_read: false,
|
36
|
+
# projection_expression: "ProjectionExpression",
|
37
|
+
# expression_attribute_names: {
|
38
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
39
|
+
# },
|
40
|
+
# },
|
41
|
+
# },
|
42
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
43
|
+
# })
|
44
|
+
# @param [Hash] options ({})
|
45
|
+
# @option options [required, Hash<String,Types::KeysAndAttributes>] :request_items
|
46
|
+
# A map of one or more table names and, for each table, a map that
|
47
|
+
# describes one or more items to retrieve from that table. Each table
|
48
|
+
# name can be used only once per `BatchGetItem` request.
|
49
|
+
#
|
50
|
+
# Each element in the map of items to retrieve consists of the
|
51
|
+
# following:
|
52
|
+
#
|
53
|
+
# * `ConsistentRead` - If `true`, a strongly consistent read is used; if
|
54
|
+
# `false` (the default), an eventually consistent read is used.
|
55
|
+
#
|
56
|
+
# * `ExpressionAttributeNames` - One or more substitution tokens for
|
57
|
+
# attribute names in the `ProjectionExpression` parameter. The
|
58
|
+
# following are some use cases for using `ExpressionAttributeNames`\:
|
59
|
+
#
|
60
|
+
# * To access an attribute whose name conflicts with a DynamoDB
|
61
|
+
# reserved word.
|
62
|
+
#
|
63
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
64
|
+
# name in an expression.
|
65
|
+
#
|
66
|
+
# * To prevent special characters in an attribute name from being
|
67
|
+
# misinterpreted in an expression.
|
68
|
+
#
|
69
|
+
# Use the **#** character in an expression to dereference an attribute
|
70
|
+
# name. For example, consider the following attribute name:
|
71
|
+
#
|
72
|
+
# * `Percentile`
|
73
|
+
#
|
74
|
+
# ^
|
75
|
+
#
|
76
|
+
# The name of this attribute conflicts with a reserved word, so it
|
77
|
+
# cannot be used directly in an expression. (For the complete list of
|
78
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
79
|
+
# Developer Guide*). To work around this, you could specify the
|
80
|
+
# following for `ExpressionAttributeNames`\:
|
81
|
+
#
|
82
|
+
# * `\{"#P":"Percentile"\}`
|
83
|
+
#
|
84
|
+
# ^
|
85
|
+
#
|
86
|
+
# You could then use this substitution in an expression, as in this
|
87
|
+
# example:
|
88
|
+
#
|
89
|
+
# * `#P = :val`
|
90
|
+
#
|
91
|
+
# ^
|
92
|
+
#
|
93
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression
|
94
|
+
# attribute values*, which are placeholders for the actual value at
|
95
|
+
# runtime.
|
96
|
+
#
|
97
|
+
# </note>
|
98
|
+
#
|
99
|
+
# For more information on expression attribute names, see [Accessing
|
100
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
101
|
+
#
|
102
|
+
# * `Keys` - An array of primary key attribute values that define
|
103
|
+
# specific items in the table. For each primary key, you must provide
|
104
|
+
# *all* of the key attributes. For example, with a simple primary key,
|
105
|
+
# you only need to provide the partition key value. For a composite
|
106
|
+
# key, you must provide *both* the partition key value and the sort
|
107
|
+
# key value.
|
108
|
+
#
|
109
|
+
# * `ProjectionExpression` - A string that identifies one or more
|
110
|
+
# attributes to retrieve from the table. These attributes can include
|
111
|
+
# scalars, sets, or elements of a JSON document. The attributes in the
|
112
|
+
# expression must be separated by commas.
|
113
|
+
#
|
114
|
+
# If no attribute names are specified, then all attributes will be
|
115
|
+
# returned. If any of the requested attributes are not found, they
|
116
|
+
# will not appear in the result.
|
117
|
+
#
|
118
|
+
# For more information, see [Accessing Item Attributes][2] in the
|
119
|
+
# *Amazon DynamoDB Developer Guide*.
|
120
|
+
#
|
121
|
+
# * `AttributesToGet` - This is a legacy parameter. Use
|
122
|
+
# `ProjectionExpression` instead. For more information, see
|
123
|
+
# [AttributesToGet][3] in the *Amazon DynamoDB Developer Guide*.
|
124
|
+
#
|
125
|
+
#
|
126
|
+
#
|
127
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
128
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
129
|
+
# [3]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html
|
130
|
+
# @option options [String] :return_consumed_capacity
|
131
|
+
# Determines the level of detail about provisioned throughput
|
132
|
+
# consumption that is returned in the response:
|
133
|
+
#
|
134
|
+
# * `INDEXES` - The response includes the aggregate `ConsumedCapacity`
|
135
|
+
# for the operation, together with `ConsumedCapacity` for each table
|
136
|
+
# and secondary index that was accessed.
|
137
|
+
#
|
138
|
+
# Note that some operations, such as `GetItem` and `BatchGetItem`, do
|
139
|
+
# not access any indexes at all. In these cases, specifying `INDEXES`
|
140
|
+
# will only return `ConsumedCapacity` information for table(s).
|
141
|
+
#
|
142
|
+
# * `TOTAL` - The response includes only the aggregate
|
143
|
+
# `ConsumedCapacity` for the operation.
|
144
|
+
#
|
145
|
+
# * `NONE` - No `ConsumedCapacity` details are included in the response.
|
146
|
+
# @return [Types::BatchGetItemOutput]
|
147
|
+
def batch_get_item(options = {})
|
148
|
+
resp = @client.batch_get_item(options)
|
149
|
+
resp.data
|
150
|
+
end
|
169
151
|
|
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
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
152
|
+
# @example Request syntax with placeholder values
|
153
|
+
#
|
154
|
+
# dynamo_db.batch_write_item({
|
155
|
+
# request_items: { # required
|
156
|
+
# "TableName" => [
|
157
|
+
# {
|
158
|
+
# put_request: {
|
159
|
+
# item: { # required
|
160
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
161
|
+
# },
|
162
|
+
# },
|
163
|
+
# delete_request: {
|
164
|
+
# key: { # required
|
165
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
166
|
+
# },
|
167
|
+
# },
|
168
|
+
# },
|
169
|
+
# ],
|
170
|
+
# },
|
171
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
172
|
+
# return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
|
173
|
+
# })
|
174
|
+
# @param [Hash] options ({})
|
175
|
+
# @option options [required, Hash<String,Array>] :request_items
|
176
|
+
# A map of one or more table names and, for each table, a list of
|
177
|
+
# operations to be performed (`DeleteRequest` or `PutRequest`). Each
|
178
|
+
# element in the map consists of the following:
|
179
|
+
#
|
180
|
+
# * `DeleteRequest` - Perform a `DeleteItem` operation on the specified
|
181
|
+
# item. The item to be deleted is identified by a `Key` subelement:
|
182
|
+
#
|
183
|
+
# * `Key` - A map of primary key attribute values that uniquely
|
184
|
+
# identify the ! item. Each entry in this map consists of an
|
185
|
+
# attribute name and an attribute value. For each primary key, you
|
186
|
+
# must provide *all* of the key attributes. For example, with a
|
187
|
+
# simple primary key, you only need to provide a value for the
|
188
|
+
# partition key. For a composite primary key, you must provide
|
189
|
+
# values for *both* the partition key and the sort key.
|
190
|
+
#
|
191
|
+
# ^
|
192
|
+
#
|
193
|
+
# * `PutRequest` - Perform a `PutItem` operation on the specified item.
|
194
|
+
# The item to be put is identified by an `Item` subelement:
|
195
|
+
#
|
196
|
+
# * `Item` - A map of attributes and their values. Each entry in this
|
197
|
+
# map consists of an attribute name and an attribute value.
|
198
|
+
# Attribute values must not be null; string and binary type
|
199
|
+
# attributes must have lengths greater than zero; and set type
|
200
|
+
# attributes must not be empty. Requests that contain empty values
|
201
|
+
# will be rejected with a `ValidationException` exception.
|
202
|
+
#
|
203
|
+
# If you specify any attributes that are part of an index key, then
|
204
|
+
# the data types for those attributes must match those of the schema
|
205
|
+
# in the table's attribute definition.
|
206
|
+
# @option options [String] :return_consumed_capacity
|
207
|
+
# Determines the level of detail about provisioned throughput
|
208
|
+
# consumption that is returned in the response:
|
209
|
+
#
|
210
|
+
# * `INDEXES` - The response includes the aggregate `ConsumedCapacity`
|
211
|
+
# for the operation, together with `ConsumedCapacity` for each table
|
212
|
+
# and secondary index that was accessed.
|
213
|
+
#
|
214
|
+
# Note that some operations, such as `GetItem` and `BatchGetItem`, do
|
215
|
+
# not access any indexes at all. In these cases, specifying `INDEXES`
|
216
|
+
# will only return `ConsumedCapacity` information for table(s).
|
217
|
+
#
|
218
|
+
# * `TOTAL` - The response includes only the aggregate
|
219
|
+
# `ConsumedCapacity` for the operation.
|
220
|
+
#
|
221
|
+
# * `NONE` - No `ConsumedCapacity` details are included in the response.
|
222
|
+
# @option options [String] :return_item_collection_metrics
|
223
|
+
# Determines whether item collection metrics are returned. If set to
|
224
|
+
# `SIZE`, the response includes statistics about item collections, if
|
225
|
+
# any, that were modified during the operation are returned in the
|
226
|
+
# response. If set to `NONE` (the default), no statistics are returned.
|
227
|
+
# @return [Types::BatchWriteItemOutput]
|
228
|
+
def batch_write_item(options = {})
|
229
|
+
resp = @client.batch_write_item(options)
|
230
|
+
resp.data
|
231
|
+
end
|
250
232
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
233
|
+
# @example Request syntax with placeholder values
|
234
|
+
#
|
235
|
+
# table = dynamo_db.create_table({
|
236
|
+
# attribute_definitions: [ # required
|
237
|
+
# {
|
238
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
239
|
+
# attribute_type: "S", # required, accepts S, N, B
|
240
|
+
# },
|
241
|
+
# ],
|
242
|
+
# table_name: "TableName", # required
|
243
|
+
# key_schema: [ # required
|
244
|
+
# {
|
245
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
246
|
+
# key_type: "HASH", # required, accepts HASH, RANGE
|
247
|
+
# },
|
248
|
+
# ],
|
249
|
+
# local_secondary_indexes: [
|
250
|
+
# {
|
251
|
+
# index_name: "IndexName", # required
|
252
|
+
# key_schema: [ # required
|
253
|
+
# {
|
254
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
255
|
+
# key_type: "HASH", # required, accepts HASH, RANGE
|
256
|
+
# },
|
257
|
+
# ],
|
258
|
+
# projection: { # required
|
259
|
+
# projection_type: "ALL", # accepts ALL, KEYS_ONLY, INCLUDE
|
260
|
+
# non_key_attributes: ["NonKeyAttributeName"],
|
261
|
+
# },
|
262
|
+
# },
|
263
|
+
# ],
|
264
|
+
# global_secondary_indexes: [
|
265
|
+
# {
|
266
|
+
# index_name: "IndexName", # required
|
267
|
+
# key_schema: [ # required
|
268
|
+
# {
|
269
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
270
|
+
# key_type: "HASH", # required, accepts HASH, RANGE
|
271
|
+
# },
|
272
|
+
# ],
|
273
|
+
# projection: { # required
|
274
|
+
# projection_type: "ALL", # accepts ALL, KEYS_ONLY, INCLUDE
|
275
|
+
# non_key_attributes: ["NonKeyAttributeName"],
|
276
|
+
# },
|
277
|
+
# provisioned_throughput: { # required
|
278
|
+
# read_capacity_units: 1, # required
|
279
|
+
# write_capacity_units: 1, # required
|
280
|
+
# },
|
281
|
+
# },
|
282
|
+
# ],
|
283
|
+
# provisioned_throughput: { # required
|
284
|
+
# read_capacity_units: 1, # required
|
285
|
+
# write_capacity_units: 1, # required
|
286
|
+
# },
|
287
|
+
# stream_specification: {
|
288
|
+
# stream_enabled: false,
|
289
|
+
# stream_view_type: "NEW_IMAGE", # accepts NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES, KEYS_ONLY
|
290
|
+
# },
|
291
|
+
# })
|
292
|
+
# @param [Hash] options ({})
|
293
|
+
# @option options [required, Array<Types::AttributeDefinition>] :attribute_definitions
|
294
|
+
# An array of attributes that describe the key schema for the table and
|
295
|
+
# indexes.
|
296
|
+
# @option options [required, String] :table_name
|
297
|
+
# The name of the table to create.
|
298
|
+
# @option options [required, Array<Types::KeySchemaElement>] :key_schema
|
299
|
+
# Specifies the attributes that make up the primary key for a table or
|
300
|
+
# an index. The attributes in `KeySchema` must also be defined in the
|
301
|
+
# `AttributeDefinitions` array. For more information, see [Data
|
302
|
+
# Model][1] in the *Amazon DynamoDB Developer Guide*.
|
303
|
+
#
|
304
|
+
# Each `KeySchemaElement` in the array is composed of:
|
305
|
+
#
|
306
|
+
# * `AttributeName` - The name of this key attribute.
|
307
|
+
#
|
308
|
+
# * `KeyType` - The role that the key attribute will assume:
|
309
|
+
#
|
310
|
+
# * `HASH` - partition key
|
311
|
+
#
|
312
|
+
# * `RANGE` - sort key
|
313
|
+
#
|
314
|
+
# <note markdown="1"> The partition key of an item is also known as its *hash attribute*.
|
315
|
+
# The term "hash attribute" derives from DynamoDB' usage of an
|
316
|
+
# internal hash function to evenly distribute data items across
|
317
|
+
# partitions, based on their partition key values.
|
318
|
+
#
|
319
|
+
# The sort key of an item is also known as its *range attribute*. The
|
320
|
+
# term "range attribute" derives from the way DynamoDB stores items
|
321
|
+
# with the same partition key physically close together, in sorted order
|
322
|
+
# by the sort key value.
|
323
|
+
#
|
324
|
+
# </note>
|
325
|
+
#
|
326
|
+
# For a simple primary key (partition key), you must provide exactly one
|
327
|
+
# element with a `KeyType` of `HASH`.
|
328
|
+
#
|
329
|
+
# For a composite primary key (partition key and sort key), you must
|
330
|
+
# provide exactly two elements, in this order: The first element must
|
331
|
+
# have a `KeyType` of `HASH`, and the second element must have a
|
332
|
+
# `KeyType` of `RANGE`.
|
333
|
+
#
|
334
|
+
# For more information, see [Specifying the Primary Key][2] in the
|
335
|
+
# *Amazon DynamoDB Developer Guide*.
|
336
|
+
#
|
337
|
+
#
|
338
|
+
#
|
339
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html
|
340
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#WorkingWithTables.primary.key
|
341
|
+
# @option options [Array<Types::LocalSecondaryIndex>] :local_secondary_indexes
|
342
|
+
# One or more local secondary indexes (the maximum is five) to be
|
343
|
+
# created on the table. Each index is scoped to a given partition key
|
344
|
+
# value. There is a 10 GB size limit per partition key value; otherwise,
|
345
|
+
# the size of a local secondary index is unconstrained.
|
346
|
+
#
|
347
|
+
# Each local secondary index in the array includes the following:
|
348
|
+
#
|
349
|
+
# * `IndexName` - The name of the local secondary index. Must be unique
|
350
|
+
# only for this table.
|
351
|
+
#
|
352
|
+
#
|
353
|
+
#
|
354
|
+
# * `KeySchema` - Specifies the key schema for the local secondary
|
355
|
+
# index. The key schema must begin with the same partition key as the
|
356
|
+
# table.
|
357
|
+
#
|
358
|
+
# * `Projection` - Specifies attributes that are copied (projected) from
|
359
|
+
# the table into the index. These are in addition to the primary key
|
360
|
+
# attributes and index key attributes, which are automatically
|
361
|
+
# projected. Each attribute specification is composed of:
|
362
|
+
#
|
363
|
+
# * `ProjectionType` - One of the following:
|
364
|
+
#
|
365
|
+
# * `KEYS_ONLY` - Only the index and primary keys are projected into
|
366
|
+
# the index.
|
367
|
+
#
|
368
|
+
# * `INCLUDE` - Only the specified table attributes are projected
|
369
|
+
# into the index. The list of projected attributes are in
|
370
|
+
# `NonKeyAttributes`.
|
371
|
+
#
|
372
|
+
# * `ALL` - All of the table attributes are projected into the
|
373
|
+
# index.
|
374
|
+
#
|
375
|
+
# * `NonKeyAttributes` - A list of one or more non-key attribute names
|
376
|
+
# that are projected into the secondary index. The total count of
|
377
|
+
# attributes provided in `NonKeyAttributes`, summed across all of
|
378
|
+
# the secondary indexes, must not exceed 20. If you project the same
|
379
|
+
# attribute into two different indexes, this counts as two distinct
|
380
|
+
# attributes when determining the total.
|
381
|
+
# @option options [Array<Types::GlobalSecondaryIndex>] :global_secondary_indexes
|
382
|
+
# One or more global secondary indexes (the maximum is five) to be
|
383
|
+
# created on the table. Each global secondary index in the array
|
384
|
+
# includes the following:
|
385
|
+
#
|
386
|
+
# * `IndexName` - The name of the global secondary index. Must be unique
|
387
|
+
# only for this table.
|
388
|
+
#
|
389
|
+
#
|
390
|
+
#
|
391
|
+
# * `KeySchema` - Specifies the key schema for the global secondary
|
392
|
+
# index.
|
393
|
+
#
|
394
|
+
# * `Projection` - Specifies attributes that are copied (projected) from
|
395
|
+
# the table into the index. These are in addition to the primary key
|
396
|
+
# attributes and index key attributes, which are automatically
|
397
|
+
# projected. Each attribute specification is composed of:
|
398
|
+
#
|
399
|
+
# * `ProjectionType` - One of the following:
|
400
|
+
#
|
401
|
+
# * `KEYS_ONLY` - Only the index and primary keys are projected into
|
402
|
+
# the index.
|
403
|
+
#
|
404
|
+
# * `INCLUDE` - Only the specified table attributes are projected
|
405
|
+
# into the index. The list of projected attributes are in
|
406
|
+
# `NonKeyAttributes`.
|
407
|
+
#
|
408
|
+
# * `ALL` - All of the table attributes are projected into the
|
409
|
+
# index.
|
410
|
+
#
|
411
|
+
# * `NonKeyAttributes` - A list of one or more non-key attribute names
|
412
|
+
# that are projected into the secondary index. The total count of
|
413
|
+
# attributes provided in `NonKeyAttributes`, summed across all of
|
414
|
+
# the secondary indexes, must not exceed 20. If you project the same
|
415
|
+
# attribute into two different indexes, this counts as two distinct
|
416
|
+
# attributes when determining the total.
|
417
|
+
#
|
418
|
+
# * `ProvisionedThroughput` - The provisioned throughput settings for
|
419
|
+
# the global secondary index, consisting of read and write capacity
|
420
|
+
# units.
|
421
|
+
# @option options [required, Types::ProvisionedThroughput] :provisioned_throughput
|
422
|
+
# Represents the provisioned throughput settings for a specified table
|
423
|
+
# or index. The settings can be modified using the `UpdateTable`
|
424
|
+
# operation.
|
425
|
+
#
|
426
|
+
# For current minimum and maximum provisioned throughput values, see
|
427
|
+
# [Limits][1] in the *Amazon DynamoDB Developer Guide*.
|
428
|
+
#
|
429
|
+
#
|
430
|
+
#
|
431
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html
|
432
|
+
# @option options [Types::StreamSpecification] :stream_specification
|
433
|
+
# The settings for DynamoDB Streams on the table. These settings consist
|
434
|
+
# of:
|
435
|
+
#
|
436
|
+
# * `StreamEnabled` - Indicates whether Streams is to be enabled (true)
|
437
|
+
# or disabled (false).
|
438
|
+
#
|
439
|
+
# * `StreamViewType` - When an item in the table is modified,
|
440
|
+
# `StreamViewType` determines what information is written to the
|
441
|
+
# table's stream. Valid values for `StreamViewType` are:
|
442
|
+
#
|
443
|
+
# * `KEYS_ONLY` - Only the key attributes of the modified item are
|
444
|
+
# written to the stream.
|
445
|
+
#
|
446
|
+
# * `NEW_IMAGE` - The entire item, as it appears after it was
|
447
|
+
# modified, is written to the stream.
|
448
|
+
#
|
449
|
+
# * `OLD_IMAGE` - The entire item, as it appeared before it was
|
450
|
+
# modified, is written to the stream.
|
451
|
+
#
|
452
|
+
# * `NEW_AND_OLD_IMAGES` - Both the new and the old item images of the
|
453
|
+
# item are written to the stream.
|
454
|
+
# @return [Table]
|
455
|
+
def create_table(options = {})
|
456
|
+
resp = @client.create_table(options)
|
457
|
+
Table.new(
|
458
|
+
name: resp.data.table_description.table_name,
|
459
|
+
data: resp.data.table_description,
|
460
|
+
client: @client
|
461
|
+
)
|
462
|
+
end
|
481
463
|
|
482
|
-
|
464
|
+
# @!group Associations
|
483
465
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
466
|
+
# @param [String] name
|
467
|
+
# @return [Table]
|
468
|
+
def table(name)
|
469
|
+
Table.new(
|
470
|
+
name: name,
|
471
|
+
client: @client
|
472
|
+
)
|
473
|
+
end
|
492
474
|
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
end
|
509
|
-
y.yield(batch)
|
475
|
+
# @example Request syntax with placeholder values
|
476
|
+
#
|
477
|
+
# dynamo_db.tables()
|
478
|
+
# @param [Hash] options ({})
|
479
|
+
# @return [Table::Collection]
|
480
|
+
def tables(options = {})
|
481
|
+
batches = Enumerator.new do |y|
|
482
|
+
resp = @client.list_tables(options)
|
483
|
+
resp.each_page do |page|
|
484
|
+
batch = []
|
485
|
+
page.data.table_names.each do |t|
|
486
|
+
batch << Table.new(
|
487
|
+
name: t,
|
488
|
+
client: @client
|
489
|
+
)
|
510
490
|
end
|
491
|
+
y.yield(batch)
|
511
492
|
end
|
512
|
-
Table::Collection.new(batches)
|
513
493
|
end
|
514
|
-
|
494
|
+
Table::Collection.new(batches)
|
515
495
|
end
|
496
|
+
|
516
497
|
end
|
517
498
|
end
|