aws-sdk-dynamodb 1.0.0.rc1 → 1.0.0.rc2

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