aws-sdk-dynamodb 1.0.0.rc1

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.
@@ -0,0 +1,3159 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module DynamoDB
10
+ class Table
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(name, options = {})
15
+ # @param [String] name
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :name
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @name = extract_name(args, options)
23
+ @data = options.delete(:data)
24
+ @client = options.delete(:client) || Client.new(options)
25
+ end
26
+
27
+ # @!group Read-Only Attributes
28
+
29
+ # @return [String]
30
+ def name
31
+ @name
32
+ end
33
+ alias :table_name :name
34
+
35
+ # An array of *AttributeDefinition* objects. Each of these objects
36
+ # describes one attribute in the table and index key schema.
37
+ #
38
+ # Each *AttributeDefinition* object in this array is composed of:
39
+ #
40
+ # * *AttributeName* - The name of the attribute.
41
+ #
42
+ # * *AttributeType* - The data type for the attribute.
43
+ # @return [Array<Types::AttributeDefinition>]
44
+ def attribute_definitions
45
+ data.attribute_definitions
46
+ end
47
+
48
+ # The primary key structure for the table. Each *KeySchemaElement*
49
+ # consists of:
50
+ #
51
+ # * *AttributeName* - The name of the attribute.
52
+ #
53
+ # * *KeyType* - The role of the attribute:
54
+ #
55
+ # * `HASH` - partition key
56
+ #
57
+ # * `RANGE` - sort key
58
+ #
59
+ # <note markdown="1"> The partition key of an item is also known as its *hash attribute*.
60
+ # The term "hash attribute" derives from DynamoDB' usage of an
61
+ # internal hash function to evenly distribute data items across
62
+ # partitions, based on their partition key values.
63
+ #
64
+ # The sort key of an item is also known as its *range attribute*. The
65
+ # term "range attribute" derives from the way DynamoDB stores items
66
+ # with the same partition key physically close together, in sorted
67
+ # order by the sort key value.
68
+ #
69
+ # </note>
70
+ #
71
+ # For more information about primary keys, see [Primary Key][1] in the
72
+ # *Amazon DynamoDB Developer Guide*.
73
+ #
74
+ #
75
+ #
76
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModelPrimaryKey
77
+ # @return [Array<Types::KeySchemaElement>]
78
+ def key_schema
79
+ data.key_schema
80
+ end
81
+
82
+ # The current state of the table:
83
+ #
84
+ # * *CREATING* - The table is being created.
85
+ #
86
+ # * *UPDATING* - The table is being updated.
87
+ #
88
+ # * *DELETING* - The table is being deleted.
89
+ #
90
+ # * *ACTIVE* - The table is ready for use.
91
+ # @return [String]
92
+ def table_status
93
+ data.table_status
94
+ end
95
+
96
+ # The date and time when the table was created, in [UNIX epoch time][1]
97
+ # format.
98
+ #
99
+ #
100
+ #
101
+ # [1]: http://www.epochconverter.com/
102
+ # @return [Time]
103
+ def creation_date_time
104
+ data.creation_date_time
105
+ end
106
+
107
+ # The provisioned throughput settings for the table, consisting of read
108
+ # and write capacity units, along with data about increases and
109
+ # decreases.
110
+ # @return [Types::ProvisionedThroughputDescription]
111
+ def provisioned_throughput
112
+ data.provisioned_throughput
113
+ end
114
+
115
+ # The total size of the specified table, in bytes. DynamoDB updates this
116
+ # value approximately every six hours. Recent changes might not be
117
+ # reflected in this value.
118
+ # @return [Integer]
119
+ def table_size_bytes
120
+ data.table_size_bytes
121
+ end
122
+
123
+ # The number of items in the specified table. DynamoDB updates this
124
+ # value approximately every six hours. Recent changes might not be
125
+ # reflected in this value.
126
+ # @return [Integer]
127
+ def item_count
128
+ data.item_count
129
+ end
130
+
131
+ # The Amazon Resource Name (ARN) that uniquely identifies the table.
132
+ # @return [String]
133
+ def table_arn
134
+ data.table_arn
135
+ end
136
+
137
+ # Represents one or more local secondary indexes on the table. Each
138
+ # index is scoped to a given partition key value. Tables with one or
139
+ # more local secondary indexes are subject to an item collection size
140
+ # limit, where the amount of data within a given item collection cannot
141
+ # exceed 10 GB. Each element is composed of:
142
+ #
143
+ # * *IndexName* - The name of the local secondary index.
144
+ #
145
+ # * *KeySchema* - Specifies the complete index key schema. The attribute
146
+ # names in the key schema must be between 1 and 255 characters
147
+ # (inclusive). The key schema must begin with the same partition key
148
+ # as the table.
149
+ #
150
+ # * *Projection* - Specifies attributes that are copied (projected) from
151
+ # the table into the index. These are in addition to the primary key
152
+ # attributes and index key attributes, which are automatically
153
+ # projected. Each attribute specification is composed of:
154
+ #
155
+ # * *ProjectionType* - One of the following:
156
+ #
157
+ # * `KEYS_ONLY` - Only the index and primary keys are projected into
158
+ # the index.
159
+ #
160
+ # * `INCLUDE` - Only the specified table attributes are projected
161
+ # into the index. The list of projected attributes are in
162
+ # *NonKeyAttributes*.
163
+ #
164
+ # * `ALL` - All of the table attributes are projected into the
165
+ # index.
166
+ #
167
+ # * *NonKeyAttributes* - A list of one or more non-key attribute names
168
+ # that are projected into the secondary index. The total count of
169
+ # attributes provided in *NonKeyAttributes*, summed across all of
170
+ # the secondary indexes, must not exceed 20. If you project the same
171
+ # attribute into two different indexes, this counts as two distinct
172
+ # attributes when determining the total.
173
+ #
174
+ # * *IndexSizeBytes* - Represents the total size of the index, in bytes.
175
+ # DynamoDB updates this value approximately every six hours. Recent
176
+ # changes might not be reflected in this value.
177
+ #
178
+ # * *ItemCount* - Represents the number of items in the index. DynamoDB
179
+ # updates this value approximately every six hours. Recent changes
180
+ # might not be reflected in this value.
181
+ #
182
+ # If the table is in the `DELETING` state, no information about indexes
183
+ # will be returned.
184
+ # @return [Array<Types::LocalSecondaryIndexDescription>]
185
+ def local_secondary_indexes
186
+ data.local_secondary_indexes
187
+ end
188
+
189
+ # The global secondary indexes, if any, on the table. Each index is
190
+ # scoped to a given partition key value. Each element is composed of:
191
+ #
192
+ # * *Backfilling* - If true, then the index is currently in the
193
+ # backfilling phase. Backfilling occurs only when a new global
194
+ # secondary index is added to the table; it is the process by which
195
+ # DynamoDB populates the new index with data from the table. (This
196
+ # attribute does not appear for indexes that were created during a
197
+ # *CreateTable* operation.)
198
+ #
199
+ # * *IndexName* - The name of the global secondary index.
200
+ #
201
+ # * *IndexSizeBytes* - The total size of the global secondary index, in
202
+ # bytes. DynamoDB updates this value approximately every six hours.
203
+ # Recent changes might not be reflected in this value.
204
+ #
205
+ # * *IndexStatus* - The current status of the global secondary index:
206
+ #
207
+ # * *CREATING* - The index is being created.
208
+ #
209
+ # * *UPDATING* - The index is being updated.
210
+ #
211
+ # * *DELETING* - The index is being deleted.
212
+ #
213
+ # * *ACTIVE* - The index is ready for use.
214
+ #
215
+ # * *ItemCount* - The number of items in the global secondary index.
216
+ # DynamoDB updates this value approximately every six hours. Recent
217
+ # changes might not be reflected in this value.
218
+ #
219
+ # * *KeySchema* - Specifies the complete index key schema. The attribute
220
+ # names in the key schema must be between 1 and 255 characters
221
+ # (inclusive). The key schema must begin with the same partition key
222
+ # as the table.
223
+ #
224
+ # * *Projection* - Specifies attributes that are copied (projected) from
225
+ # the table into the index. These are in addition to the primary key
226
+ # attributes and index key attributes, which are automatically
227
+ # projected. Each attribute specification is composed of:
228
+ #
229
+ # * *ProjectionType* - One of the following:
230
+ #
231
+ # * `KEYS_ONLY` - Only the index and primary keys are projected into
232
+ # the index.
233
+ #
234
+ # * `INCLUDE` - Only the specified table attributes are projected
235
+ # into the index. The list of projected attributes are in
236
+ # *NonKeyAttributes*.
237
+ #
238
+ # * `ALL` - All of the table attributes are projected into the
239
+ # index.
240
+ #
241
+ # * *NonKeyAttributes* - A list of one or more non-key attribute names
242
+ # that are projected into the secondary index. The total count of
243
+ # attributes provided in *NonKeyAttributes*, summed across all of
244
+ # the secondary indexes, must not exceed 20. If you project the same
245
+ # attribute into two different indexes, this counts as two distinct
246
+ # attributes when determining the total.
247
+ #
248
+ # * *ProvisionedThroughput* - The provisioned throughput settings for
249
+ # the global secondary index, consisting of read and write capacity
250
+ # units, along with data about increases and decreases.
251
+ #
252
+ # If the table is in the `DELETING` state, no information about indexes
253
+ # will be returned.
254
+ # @return [Array<Types::GlobalSecondaryIndexDescription>]
255
+ def global_secondary_indexes
256
+ data.global_secondary_indexes
257
+ end
258
+
259
+ # The current DynamoDB Streams configuration for the table.
260
+ # @return [Types::StreamSpecification]
261
+ def stream_specification
262
+ data.stream_specification
263
+ end
264
+
265
+ # A timestamp, in ISO 8601 format, for this stream.
266
+ #
267
+ # Note that *LatestStreamLabel* is not a unique identifier for the
268
+ # stream, because it is possible that a stream from another table might
269
+ # have the same timestamp. However, the combination of the following
270
+ # three elements is guaranteed to be unique:
271
+ #
272
+ # * the AWS customer ID.
273
+ #
274
+ # * the table name.
275
+ #
276
+ # * the *StreamLabel*.
277
+ # @return [String]
278
+ def latest_stream_label
279
+ data.latest_stream_label
280
+ end
281
+
282
+ # The Amazon Resource Name (ARN) that uniquely identifies the latest
283
+ # stream for this table.
284
+ # @return [String]
285
+ def latest_stream_arn
286
+ data.latest_stream_arn
287
+ end
288
+
289
+ # @!endgroup
290
+
291
+ # @return [Client]
292
+ def client
293
+ @client
294
+ end
295
+
296
+ # Loads, or reloads {#data} for the current {Table}.
297
+ # Returns `self` making it possible to chain methods.
298
+ #
299
+ # table.reload.data
300
+ #
301
+ # @return [self]
302
+ def load
303
+ resp = @client.describe_table(table_name: @name)
304
+ @data = resp.table
305
+ self
306
+ end
307
+ alias :reload :load
308
+
309
+ # @return [Types::TableDescription]
310
+ # Returns the data for this {Table}. Calls
311
+ # {Client#describe_table} if {#data_loaded?} is `false`.
312
+ def data
313
+ load unless @data
314
+ @data
315
+ end
316
+
317
+ # @return [Boolean]
318
+ # Returns `true` if this resource is loaded. Accessing attributes or
319
+ # {#data} on an unloaded resource will trigger a call to {#load}.
320
+ def data_loaded?
321
+ !!@data
322
+ end
323
+
324
+ # @!group Actions
325
+
326
+ # @example Request syntax with placeholder values
327
+ #
328
+ # table.delete()
329
+ # @param [Hash] options ({})
330
+ # @return [Types::DeleteTableOutput]
331
+ def delete(options = {})
332
+ options = options.merge(table_name: @name)
333
+ resp = @client.delete_table(options)
334
+ resp.data
335
+ end
336
+
337
+ # @example Request syntax with placeholder values
338
+ #
339
+ # table.delete_item({
340
+ # key: { # required
341
+ # "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
342
+ # },
343
+ # expected: {
344
+ # "AttributeName" => {
345
+ # value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
346
+ # exists: false,
347
+ # comparison_operator: "EQ", # accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
348
+ # attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
349
+ # },
350
+ # },
351
+ # conditional_operator: "AND", # accepts AND, OR
352
+ # return_values: "NONE", # accepts NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW
353
+ # return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
354
+ # return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
355
+ # condition_expression: "ConditionExpression",
356
+ # expression_attribute_names: {
357
+ # "ExpressionAttributeNameVariable" => "AttributeName",
358
+ # },
359
+ # expression_attribute_values: {
360
+ # "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
361
+ # },
362
+ # })
363
+ # @param [Hash] options ({})
364
+ # @option options [required, Hash<String,Types::AttributeValue>] :key
365
+ # A map of attribute names to *AttributeValue* objects, representing the
366
+ # primary key of the item to delete.
367
+ #
368
+ # For the primary key, you must provide all of the attributes. For
369
+ # example, with a simple primary key, you only need to provide a value
370
+ # for the partition key. For a composite primary key, you must provide
371
+ # values for both the partition key and the sort key.
372
+ # @option options [Hash<String,Types::ExpectedAttributeValue>] :expected
373
+ # This is a legacy parameter, for backward compatibility. New
374
+ # applications should use *ConditionExpression* instead. Do not combine
375
+ # legacy parameters and expression parameters in a single API call;
376
+ # otherwise, DynamoDB will return a *ValidationException* exception.
377
+ #
378
+ # A map of attribute/condition pairs. *Expected* provides a conditional
379
+ # block for the *DeleteItem* operation.
380
+ #
381
+ # Each element of *Expected* consists of an attribute name, a comparison
382
+ # operator, and one or more values. DynamoDB compares the attribute with
383
+ # the value(s) you supplied, using the comparison operator. For each
384
+ # *Expected* element, the result of the evaluation is either true or
385
+ # false.
386
+ #
387
+ # If you specify more than one element in the *Expected* map, then by
388
+ # default all of the conditions must evaluate to true. In other words,
389
+ # the conditions are ANDed together. (You can use the
390
+ # *ConditionalOperator* parameter to OR the conditions instead. If you
391
+ # do this, then at least one of the conditions must evaluate to true,
392
+ # rather than all of them.)
393
+ #
394
+ # If the *Expected* map evaluates to true, then the conditional
395
+ # operation succeeds; otherwise, it fails.
396
+ #
397
+ # *Expected* contains the following:
398
+ #
399
+ # * *AttributeValueList* - One or more values to evaluate against the
400
+ # supplied attribute. The number of values in the list depends on the
401
+ # *ComparisonOperator* being used.
402
+ #
403
+ # For type Number, value comparisons are numeric.
404
+ #
405
+ # String value comparisons for greater than, equals, or less than are
406
+ # based on ASCII character code values. For example, `a` is greater
407
+ # than `A`, and `a` is greater than `B`. For a list of code values,
408
+ # see
409
+ # [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
410
+ #
411
+ # For type Binary, DynamoDB treats each byte of the binary data as
412
+ # unsigned when it compares binary values.
413
+ #
414
+ # * *ComparisonOperator* - A comparator for evaluating attributes in the
415
+ # *AttributeValueList*. When performing the comparison, DynamoDB uses
416
+ # strongly consistent reads.
417
+ #
418
+ # The following comparison operators are available:
419
+ #
420
+ # `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
421
+ # NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
422
+ #
423
+ # The following are descriptions of each comparison operator.
424
+ #
425
+ # * `EQ`\: Equal. `EQ` is supported for all datatypes, including lists
426
+ # and maps.
427
+ #
428
+ # *AttributeValueList* can contain only one *AttributeValue* element
429
+ # of type String, Number, Binary, String Set, Number Set, or Binary
430
+ # Set. If an item contains an *AttributeValue* element of a
431
+ # different type than the one provided in the request, the value
432
+ # does not match. For example, `\{"S":"6"\}` does not equal
433
+ # `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not equal `\{"NS":["6",
434
+ # "2", "1"]\}`.
435
+ #
436
+ #
437
+ #
438
+ # * `NE`\: Not equal. `NE` is supported for all datatypes, including
439
+ # lists and maps.
440
+ #
441
+ # *AttributeValueList* can contain only one *AttributeValue* of type
442
+ # String, Number, Binary, String Set, Number Set, or Binary Set. If
443
+ # an item contains an *AttributeValue* of a different type than the
444
+ # one provided in the request, the value does not match. For
445
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
446
+ # `\{"N":"6"\}` does not equal `\{"NS":["6", "2", "1"]\}`.
447
+ #
448
+ #
449
+ #
450
+ # * `LE`\: Less than or equal.
451
+ #
452
+ # *AttributeValueList* can contain only one *AttributeValue* element
453
+ # of type String, Number, or Binary (not a set type). If an item
454
+ # contains an *AttributeValue* element of a different type than the
455
+ # one provided in the request, the value does not match. For
456
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
457
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
458
+ #
459
+ #
460
+ #
461
+ # * `LT`\: Less than.
462
+ #
463
+ # *AttributeValueList* can contain only one *AttributeValue* of type
464
+ # String, Number, or Binary (not a set type). If an item contains an
465
+ # *AttributeValue* element of a different type than the one provided
466
+ # in the request, the value does not match. For example,
467
+ # `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
468
+ # does not compare to `\{"NS":["6", "2", "1"]\}`.
469
+ #
470
+ #
471
+ #
472
+ # * `GE`\: Greater than or equal.
473
+ #
474
+ # *AttributeValueList* can contain only one *AttributeValue* element
475
+ # of type String, Number, or Binary (not a set type). If an item
476
+ # contains an *AttributeValue* element of a different type than the
477
+ # one provided in the request, the value does not match. For
478
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
479
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
480
+ #
481
+ #
482
+ #
483
+ # * `GT`\: Greater than.
484
+ #
485
+ # *AttributeValueList* can contain only one *AttributeValue* element
486
+ # of type String, Number, or Binary (not a set type). If an item
487
+ # contains an *AttributeValue* element of a different type than the
488
+ # one provided in the request, the value does not match. For
489
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
490
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
491
+ #
492
+ #
493
+ #
494
+ # * `NOT_NULL`\: The attribute exists. `NOT_NULL` is supported for all
495
+ # datatypes, including lists and maps.
496
+ #
497
+ # <note markdown="1"> This operator tests for the existence of an attribute, not its
498
+ # data type. If the data type of attribute "`a`" is null, and you
499
+ # evaluate it using `NOT_NULL`, the result is a Boolean *true*. This
500
+ # result is because the attribute "`a`" exists; its data type is
501
+ # not relevant to the `NOT_NULL` comparison operator.
502
+ #
503
+ # </note>
504
+ #
505
+ # * `NULL`\: The attribute does not exist. `NULL` is supported for all
506
+ # datatypes, including lists and maps.
507
+ #
508
+ # <note markdown="1"> This operator tests for the nonexistence of an attribute, not its
509
+ # data type. If the data type of attribute "`a`" is null, and you
510
+ # evaluate it using `NULL`, the result is a Boolean *false*. This is
511
+ # because the attribute "`a`" exists; its data type is not
512
+ # relevant to the `NULL` comparison operator.
513
+ #
514
+ # </note>
515
+ #
516
+ # * `CONTAINS`\: Checks for a subsequence, or value in a set.
517
+ #
518
+ # *AttributeValueList* can contain only one *AttributeValue* element
519
+ # of type String, Number, or Binary (not a set type). If the target
520
+ # attribute of the comparison is of type String, then the operator
521
+ # checks for a substring match. If the target attribute of the
522
+ # comparison is of type Binary, then the operator looks for a
523
+ # subsequence of the target that matches the input. If the target
524
+ # attribute of the comparison is a set ("`SS`", "`NS`", or
525
+ # "`BS`"), then the operator evaluates to true if it finds an
526
+ # exact match with any member of the set.
527
+ #
528
+ # CONTAINS is supported for lists: When evaluating "`a CONTAINS
529
+ # b`", "`a`" can be a list; however, "`b`" cannot be a set, a
530
+ # map, or a list.
531
+ #
532
+ # * `NOT_CONTAINS`\: Checks for absence of a subsequence, or absence
533
+ # of a value in a set.
534
+ #
535
+ # *AttributeValueList* can contain only one *AttributeValue* element
536
+ # of type String, Number, or Binary (not a set type). If the target
537
+ # attribute of the comparison is a String, then the operator checks
538
+ # for the absence of a substring match. If the target attribute of
539
+ # the comparison is Binary, then the operator checks for the absence
540
+ # of a subsequence of the target that matches the input. If the
541
+ # target attribute of the comparison is a set ("`SS`", "`NS`",
542
+ # or "`BS`"), then the operator evaluates to true if it *does not*
543
+ # find an exact match with any member of the set.
544
+ #
545
+ # NOT\_CONTAINS is supported for lists: When evaluating "`a NOT
546
+ # CONTAINS b`", "`a`" can be a list; however, "`b`" cannot be a
547
+ # set, a map, or a list.
548
+ #
549
+ # * `BEGINS_WITH`\: Checks for a prefix.
550
+ #
551
+ # *AttributeValueList* can contain only one *AttributeValue* of type
552
+ # String or Binary (not a Number or a set type). The target
553
+ # attribute of the comparison must be of type String or Binary (not
554
+ # a Number or a set type).
555
+ #
556
+ #
557
+ #
558
+ # * `IN`\: Checks for matching elements within two sets.
559
+ #
560
+ # *AttributeValueList* can contain one or more *AttributeValue*
561
+ # elements of type String, Number, or Binary (not a set type). These
562
+ # attributes are compared against an existing set type attribute of
563
+ # an item. If any elements of the input set are present in the item
564
+ # attribute, the expression evaluates to true.
565
+ #
566
+ # * `BETWEEN`\: Greater than or equal to the first value, and less
567
+ # than or equal to the second value.
568
+ #
569
+ # *AttributeValueList* must contain two *AttributeValue* elements of
570
+ # the same type, either String, Number, or Binary (not a set type).
571
+ # A target attribute matches if the target value is greater than, or
572
+ # equal to, the first element and less than, or equal to, the second
573
+ # element. If an item contains an *AttributeValue* element of a
574
+ # different type than the one provided in the request, the value
575
+ # does not match. For example, `\{"S":"6"\}` does not compare to
576
+ # `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
577
+ # `\{"NS":["6", "2", "1"]\}`
578
+ #
579
+ # For usage examples of *AttributeValueList* and *ComparisonOperator*,
580
+ # see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
581
+ # Developer Guide*.
582
+ #
583
+ # For backward compatibility with previous DynamoDB releases, the
584
+ # following parameters can be used instead of *AttributeValueList* and
585
+ # *ComparisonOperator*\:
586
+ #
587
+ # * *Value* - A value for DynamoDB to compare with an attribute.
588
+ #
589
+ # * *Exists* - A Boolean value that causes DynamoDB to evaluate the
590
+ # value before attempting the conditional operation:
591
+ #
592
+ # * If *Exists* is `true`, DynamoDB will check to see if that
593
+ # attribute value already exists in the table. If it is found, then
594
+ # the condition evaluates to true; otherwise the condition evaluate
595
+ # to false.
596
+ #
597
+ # * If *Exists* is `false`, DynamoDB assumes that the attribute value
598
+ # does *not* exist in the table. If in fact the value does not
599
+ # exist, then the assumption is valid and the condition evaluates to
600
+ # true. If the value is found, despite the assumption that it does
601
+ # not exist, the condition evaluates to false.
602
+ #
603
+ # Note that the default value for *Exists* is `true`.
604
+ #
605
+ # The *Value* and *Exists* parameters are incompatible with
606
+ # *AttributeValueList* and *ComparisonOperator*. Note that if you use
607
+ # both sets of parameters at once, DynamoDB will return a
608
+ # *ValidationException* exception.
609
+ #
610
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
611
+ #
612
+ # </note>
613
+ #
614
+ #
615
+ #
616
+ # [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
617
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
618
+ # @option options [String] :conditional_operator
619
+ # This is a legacy parameter, for backward compatibility. New
620
+ # applications should use *ConditionExpression* instead. Do not combine
621
+ # legacy parameters and expression parameters in a single API call;
622
+ # otherwise, DynamoDB will return a *ValidationException* exception.
623
+ #
624
+ # A logical operator to apply to the conditions in the *Expected* map:
625
+ #
626
+ # * `AND` - If all of the conditions evaluate to true, then the entire
627
+ # map evaluates to true.
628
+ #
629
+ # * `OR` - If at least one of the conditions evaluate to true, then the
630
+ # entire map evaluates to true.
631
+ #
632
+ # If you omit *ConditionalOperator*, then `AND` is the default.
633
+ #
634
+ # The operation will succeed only if the entire map evaluates to true.
635
+ #
636
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
637
+ #
638
+ # </note>
639
+ # @option options [String] :return_values
640
+ # Use *ReturnValues* if you want to get the item attributes as they
641
+ # appeared before they were deleted. For *DeleteItem*, the valid values
642
+ # are:
643
+ #
644
+ # * `NONE` - If *ReturnValues* is not specified, or if its value is
645
+ # `NONE`, then nothing is returned. (This setting is the default for
646
+ # *ReturnValues*.)
647
+ #
648
+ # * `ALL_OLD` - The content of the old item is returned.
649
+ #
650
+ # <note markdown="1"> The *ReturnValues* parameter is used by several DynamoDB operations;
651
+ # however, *DeleteItem* does not recognize any values other than `NONE`
652
+ # or `ALL_OLD`.
653
+ #
654
+ # </note>
655
+ # @option options [String] :return_consumed_capacity
656
+ # Determines the level of detail about provisioned throughput
657
+ # consumption that is returned in the response:
658
+ #
659
+ # * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
660
+ # for the operation, together with *ConsumedCapacity* for each table
661
+ # and secondary index that was accessed.
662
+ #
663
+ # Note that some operations, such as *GetItem* and *BatchGetItem*, do
664
+ # not access any indexes at all. In these cases, specifying *INDEXES*
665
+ # will only return *ConsumedCapacity* information for table(s).
666
+ #
667
+ # * *TOTAL* - The response includes only the aggregate
668
+ # *ConsumedCapacity* for the operation.
669
+ #
670
+ # * *NONE* - No *ConsumedCapacity* details are included in the response.
671
+ # @option options [String] :return_item_collection_metrics
672
+ # Determines whether item collection metrics are returned. If set to
673
+ # `SIZE`, the response includes statistics about item collections, if
674
+ # any, that were modified during the operation are returned in the
675
+ # response. If set to `NONE` (the default), no statistics are returned.
676
+ # @option options [String] :condition_expression
677
+ # A condition that must be satisfied in order for a conditional
678
+ # *DeleteItem* to succeed.
679
+ #
680
+ # An expression can contain any of the following:
681
+ #
682
+ # * Functions: `attribute_exists | attribute_not_exists | attribute_type
683
+ # | contains | begins_with | size`
684
+ #
685
+ # These function names are case-sensitive.
686
+ #
687
+ # * Comparison operators: ` = | &#x3C;&#x3E; | &#x3C; | &#x3E; | &#x3C;=
688
+ # | &#x3E;= | BETWEEN | IN`
689
+ #
690
+ # * Logical operators: `AND | OR | NOT`
691
+ #
692
+ # For more information on condition expressions, see [Specifying
693
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
694
+ #
695
+ # <note markdown="1"> *ConditionExpression* replaces the legacy *ConditionalOperator* and
696
+ # *Expected* parameters.
697
+ #
698
+ # </note>
699
+ #
700
+ #
701
+ #
702
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
703
+ # @option options [Hash<String,String>] :expression_attribute_names
704
+ # One or more substitution tokens for attribute names in an expression.
705
+ # The following are some use cases for using
706
+ # *ExpressionAttributeNames*\:
707
+ #
708
+ # * To access an attribute whose name conflicts with a DynamoDB reserved
709
+ # word.
710
+ #
711
+ # * To create a placeholder for repeating occurrences of an attribute
712
+ # name in an expression.
713
+ #
714
+ # * To prevent special characters in an attribute name from being
715
+ # misinterpreted in an expression.
716
+ #
717
+ # Use the **#** character in an expression to dereference an attribute
718
+ # name. For example, consider the following attribute name:
719
+ #
720
+ # * `Percentile`
721
+ #
722
+ # ^
723
+ #
724
+ # The name of this attribute conflicts with a reserved word, so it
725
+ # cannot be used directly in an expression. (For the complete list of
726
+ # reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
727
+ # Developer Guide*). To work around this, you could specify the
728
+ # following for *ExpressionAttributeNames*\:
729
+ #
730
+ # * `\{"#P":"Percentile"\}`
731
+ #
732
+ # ^
733
+ #
734
+ # You could then use this substitution in an expression, as in this
735
+ # example:
736
+ #
737
+ # * `#P = :val`
738
+ #
739
+ # ^
740
+ #
741
+ # <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
742
+ # values*, which are placeholders for the actual value at runtime.
743
+ #
744
+ # </note>
745
+ #
746
+ # For more information on expression attribute names, see [Accessing
747
+ # Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
748
+ #
749
+ #
750
+ #
751
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
752
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
753
+ # @option options [Hash<String,Types::AttributeValue>] :expression_attribute_values
754
+ # One or more values that can be substituted in an expression.
755
+ #
756
+ # Use the **\:** (colon) character in an expression to dereference an
757
+ # attribute value. For example, suppose that you wanted to check whether
758
+ # the value of the *ProductStatus* attribute was one of the following:
759
+ #
760
+ # `Available | Backordered | Discontinued`
761
+ #
762
+ # You would first need to specify *ExpressionAttributeValues* as
763
+ # follows:
764
+ #
765
+ # `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
766
+ # ":disc":\{"S":"Discontinued"\} \}`
767
+ #
768
+ # You could then use these values in an expression, such as this:
769
+ #
770
+ # `ProductStatus IN (:avail, :back, :disc)`
771
+ #
772
+ # For more information on expression attribute values, see [Specifying
773
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
774
+ #
775
+ #
776
+ #
777
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
778
+ # @return [Types::DeleteItemOutput]
779
+ def delete_item(options = {})
780
+ options = options.merge(table_name: @name)
781
+ resp = @client.delete_item(options)
782
+ resp.data
783
+ end
784
+
785
+ # @example Request syntax with placeholder values
786
+ #
787
+ # table.get_item({
788
+ # key: { # required
789
+ # "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
790
+ # },
791
+ # attributes_to_get: ["AttributeName"],
792
+ # consistent_read: false,
793
+ # return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
794
+ # projection_expression: "ProjectionExpression",
795
+ # expression_attribute_names: {
796
+ # "ExpressionAttributeNameVariable" => "AttributeName",
797
+ # },
798
+ # })
799
+ # @param [Hash] options ({})
800
+ # @option options [required, Hash<String,Types::AttributeValue>] :key
801
+ # A map of attribute names to *AttributeValue* objects, representing the
802
+ # primary key of the item to retrieve.
803
+ #
804
+ # For the primary key, you must provide all of the attributes. For
805
+ # example, with a simple primary key, you only need to provide a value
806
+ # for the partition key. For a composite primary key, you must provide
807
+ # values for both the partition key and the sort key.
808
+ # @option options [Array<String>] :attributes_to_get
809
+ # This is a legacy parameter, for backward compatibility. New
810
+ # applications should use *ProjectionExpression* instead. Do not combine
811
+ # legacy parameters and expression parameters in a single API call;
812
+ # otherwise, DynamoDB will return a *ValidationException* exception.
813
+ #
814
+ # This parameter allows you to retrieve attributes of type List or Map;
815
+ # however, it cannot retrieve individual elements within a List or a
816
+ # Map.
817
+ #
818
+ # The names of one or more attributes to retrieve. If no attribute names
819
+ # are provided, then all attributes will be returned. If any of the
820
+ # requested attributes are not found, they will not appear in the
821
+ # result.
822
+ #
823
+ # Note that *AttributesToGet* has no effect on provisioned throughput
824
+ # consumption. DynamoDB determines capacity units consumed based on item
825
+ # size, not on the amount of data that is returned to an application.
826
+ # @option options [Boolean] :consistent_read
827
+ # Determines the read consistency model: If set to `true`, then the
828
+ # operation uses strongly consistent reads; otherwise, the operation
829
+ # uses eventually consistent reads.
830
+ # @option options [String] :return_consumed_capacity
831
+ # Determines the level of detail about provisioned throughput
832
+ # consumption that is returned in the response:
833
+ #
834
+ # * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
835
+ # for the operation, together with *ConsumedCapacity* for each table
836
+ # and secondary index that was accessed.
837
+ #
838
+ # Note that some operations, such as *GetItem* and *BatchGetItem*, do
839
+ # not access any indexes at all. In these cases, specifying *INDEXES*
840
+ # will only return *ConsumedCapacity* information for table(s).
841
+ #
842
+ # * *TOTAL* - The response includes only the aggregate
843
+ # *ConsumedCapacity* for the operation.
844
+ #
845
+ # * *NONE* - No *ConsumedCapacity* details are included in the response.
846
+ # @option options [String] :projection_expression
847
+ # A string that identifies one or more attributes to retrieve from the
848
+ # table. These attributes can include scalars, sets, or elements of a
849
+ # JSON document. The attributes in the expression must be separated by
850
+ # commas.
851
+ #
852
+ # If no attribute names are specified, then all attributes will be
853
+ # returned. If any of the requested attributes are not found, they will
854
+ # not appear in the result.
855
+ #
856
+ # For more information, see [Accessing Item Attributes][1] in the
857
+ # *Amazon DynamoDB Developer Guide*.
858
+ #
859
+ # <note markdown="1"> *ProjectionExpression* replaces the legacy *AttributesToGet*
860
+ # parameter.
861
+ #
862
+ # </note>
863
+ #
864
+ #
865
+ #
866
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
867
+ # @option options [Hash<String,String>] :expression_attribute_names
868
+ # One or more substitution tokens for attribute names in an expression.
869
+ # The following are some use cases for using
870
+ # *ExpressionAttributeNames*\:
871
+ #
872
+ # * To access an attribute whose name conflicts with a DynamoDB reserved
873
+ # word.
874
+ #
875
+ # * To create a placeholder for repeating occurrences of an attribute
876
+ # name in an expression.
877
+ #
878
+ # * To prevent special characters in an attribute name from being
879
+ # misinterpreted in an expression.
880
+ #
881
+ # Use the **#** character in an expression to dereference an attribute
882
+ # name. For example, consider the following attribute name:
883
+ #
884
+ # * `Percentile`
885
+ #
886
+ # ^
887
+ #
888
+ # The name of this attribute conflicts with a reserved word, so it
889
+ # cannot be used directly in an expression. (For the complete list of
890
+ # reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
891
+ # Developer Guide*). To work around this, you could specify the
892
+ # following for *ExpressionAttributeNames*\:
893
+ #
894
+ # * `\{"#P":"Percentile"\}`
895
+ #
896
+ # ^
897
+ #
898
+ # You could then use this substitution in an expression, as in this
899
+ # example:
900
+ #
901
+ # * `#P = :val`
902
+ #
903
+ # ^
904
+ #
905
+ # <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
906
+ # values*, which are placeholders for the actual value at runtime.
907
+ #
908
+ # </note>
909
+ #
910
+ # For more information on expression attribute names, see [Accessing
911
+ # Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
912
+ #
913
+ #
914
+ #
915
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
916
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
917
+ # @return [Types::GetItemOutput]
918
+ def get_item(options = {})
919
+ options = options.merge(table_name: @name)
920
+ resp = @client.get_item(options)
921
+ resp.data
922
+ end
923
+
924
+ # @example Request syntax with placeholder values
925
+ #
926
+ # table.put_item({
927
+ # item: { # required
928
+ # "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
929
+ # },
930
+ # expected: {
931
+ # "AttributeName" => {
932
+ # value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
933
+ # exists: false,
934
+ # comparison_operator: "EQ", # accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
935
+ # attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
936
+ # },
937
+ # },
938
+ # return_values: "NONE", # accepts NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW
939
+ # return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
940
+ # return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
941
+ # conditional_operator: "AND", # accepts AND, OR
942
+ # condition_expression: "ConditionExpression",
943
+ # expression_attribute_names: {
944
+ # "ExpressionAttributeNameVariable" => "AttributeName",
945
+ # },
946
+ # expression_attribute_values: {
947
+ # "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
948
+ # },
949
+ # })
950
+ # @param [Hash] options ({})
951
+ # @option options [required, Hash<String,Types::AttributeValue>] :item
952
+ # A map of attribute name/value pairs, one for each attribute. Only the
953
+ # primary key attributes are required; you can optionally provide other
954
+ # attribute name-value pairs for the item.
955
+ #
956
+ # You must provide all of the attributes for the primary key. For
957
+ # example, with a simple primary key, you only need to provide a value
958
+ # for the partition key. For a composite primary key, you must provide
959
+ # both values for both the partition key and the sort key.
960
+ #
961
+ # If you specify any attributes that are part of an index key, then the
962
+ # data types for those attributes must match those of the schema in the
963
+ # table's attribute definition.
964
+ #
965
+ # For more information about primary keys, see [Primary Key][1] in the
966
+ # *Amazon DynamoDB Developer Guide*.
967
+ #
968
+ # Each element in the *Item* map is an *AttributeValue* object.
969
+ #
970
+ #
971
+ #
972
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModelPrimaryKey
973
+ # @option options [Hash<String,Types::ExpectedAttributeValue>] :expected
974
+ # This is a legacy parameter, for backward compatibility. New
975
+ # applications should use *ConditionExpression* instead. Do not combine
976
+ # legacy parameters and expression parameters in a single API call;
977
+ # otherwise, DynamoDB will return a *ValidationException* exception.
978
+ #
979
+ # A map of attribute/condition pairs. *Expected* provides a conditional
980
+ # block for the *PutItem* operation.
981
+ #
982
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
983
+ #
984
+ # </note>
985
+ #
986
+ # Each element of *Expected* consists of an attribute name, a comparison
987
+ # operator, and one or more values. DynamoDB compares the attribute with
988
+ # the value(s) you supplied, using the comparison operator. For each
989
+ # *Expected* element, the result of the evaluation is either true or
990
+ # false.
991
+ #
992
+ # If you specify more than one element in the *Expected* map, then by
993
+ # default all of the conditions must evaluate to true. In other words,
994
+ # the conditions are ANDed together. (You can use the
995
+ # *ConditionalOperator* parameter to OR the conditions instead. If you
996
+ # do this, then at least one of the conditions must evaluate to true,
997
+ # rather than all of them.)
998
+ #
999
+ # If the *Expected* map evaluates to true, then the conditional
1000
+ # operation succeeds; otherwise, it fails.
1001
+ #
1002
+ # *Expected* contains the following:
1003
+ #
1004
+ # * *AttributeValueList* - One or more values to evaluate against the
1005
+ # supplied attribute. The number of values in the list depends on the
1006
+ # *ComparisonOperator* being used.
1007
+ #
1008
+ # For type Number, value comparisons are numeric.
1009
+ #
1010
+ # String value comparisons for greater than, equals, or less than are
1011
+ # based on ASCII character code values. For example, `a` is greater
1012
+ # than `A`, and `a` is greater than `B`. For a list of code values,
1013
+ # see
1014
+ # [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
1015
+ #
1016
+ # For type Binary, DynamoDB treats each byte of the binary data as
1017
+ # unsigned when it compares binary values.
1018
+ #
1019
+ # * *ComparisonOperator* - A comparator for evaluating attributes in the
1020
+ # *AttributeValueList*. When performing the comparison, DynamoDB uses
1021
+ # strongly consistent reads.
1022
+ #
1023
+ # The following comparison operators are available:
1024
+ #
1025
+ # `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
1026
+ # NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
1027
+ #
1028
+ # The following are descriptions of each comparison operator.
1029
+ #
1030
+ # * `EQ`\: Equal. `EQ` is supported for all datatypes, including lists
1031
+ # and maps.
1032
+ #
1033
+ # *AttributeValueList* can contain only one *AttributeValue* element
1034
+ # of type String, Number, Binary, String Set, Number Set, or Binary
1035
+ # Set. If an item contains an *AttributeValue* element of a
1036
+ # different type than the one provided in the request, the value
1037
+ # does not match. For example, `\{"S":"6"\}` does not equal
1038
+ # `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not equal `\{"NS":["6",
1039
+ # "2", "1"]\}`.
1040
+ #
1041
+ #
1042
+ #
1043
+ # * `NE`\: Not equal. `NE` is supported for all datatypes, including
1044
+ # lists and maps.
1045
+ #
1046
+ # *AttributeValueList* can contain only one *AttributeValue* of type
1047
+ # String, Number, Binary, String Set, Number Set, or Binary Set. If
1048
+ # an item contains an *AttributeValue* of a different type than the
1049
+ # one provided in the request, the value does not match. For
1050
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
1051
+ # `\{"N":"6"\}` does not equal `\{"NS":["6", "2", "1"]\}`.
1052
+ #
1053
+ #
1054
+ #
1055
+ # * `LE`\: Less than or equal.
1056
+ #
1057
+ # *AttributeValueList* can contain only one *AttributeValue* element
1058
+ # of type String, Number, or Binary (not a set type). If an item
1059
+ # contains an *AttributeValue* element of a different type than the
1060
+ # one provided in the request, the value does not match. For
1061
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
1062
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
1063
+ #
1064
+ #
1065
+ #
1066
+ # * `LT`\: Less than.
1067
+ #
1068
+ # *AttributeValueList* can contain only one *AttributeValue* of type
1069
+ # String, Number, or Binary (not a set type). If an item contains an
1070
+ # *AttributeValue* element of a different type than the one provided
1071
+ # in the request, the value does not match. For example,
1072
+ # `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
1073
+ # does not compare to `\{"NS":["6", "2", "1"]\}`.
1074
+ #
1075
+ #
1076
+ #
1077
+ # * `GE`\: Greater than or equal.
1078
+ #
1079
+ # *AttributeValueList* can contain only one *AttributeValue* element
1080
+ # of type String, Number, or Binary (not a set type). If an item
1081
+ # contains an *AttributeValue* element of a different type than the
1082
+ # one provided in the request, the value does not match. For
1083
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
1084
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
1085
+ #
1086
+ #
1087
+ #
1088
+ # * `GT`\: Greater than.
1089
+ #
1090
+ # *AttributeValueList* can contain only one *AttributeValue* element
1091
+ # of type String, Number, or Binary (not a set type). If an item
1092
+ # contains an *AttributeValue* element of a different type than the
1093
+ # one provided in the request, the value does not match. For
1094
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
1095
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
1096
+ #
1097
+ #
1098
+ #
1099
+ # * `NOT_NULL`\: The attribute exists. `NOT_NULL` is supported for all
1100
+ # datatypes, including lists and maps.
1101
+ #
1102
+ # <note markdown="1"> This operator tests for the existence of an attribute, not its
1103
+ # data type. If the data type of attribute "`a`" is null, and you
1104
+ # evaluate it using `NOT_NULL`, the result is a Boolean *true*. This
1105
+ # result is because the attribute "`a`" exists; its data type is
1106
+ # not relevant to the `NOT_NULL` comparison operator.
1107
+ #
1108
+ # </note>
1109
+ #
1110
+ # * `NULL`\: The attribute does not exist. `NULL` is supported for all
1111
+ # datatypes, including lists and maps.
1112
+ #
1113
+ # <note markdown="1"> This operator tests for the nonexistence of an attribute, not its
1114
+ # data type. If the data type of attribute "`a`" is null, and you
1115
+ # evaluate it using `NULL`, the result is a Boolean *false*. This is
1116
+ # because the attribute "`a`" exists; its data type is not
1117
+ # relevant to the `NULL` comparison operator.
1118
+ #
1119
+ # </note>
1120
+ #
1121
+ # * `CONTAINS`\: Checks for a subsequence, or value in a set.
1122
+ #
1123
+ # *AttributeValueList* can contain only one *AttributeValue* element
1124
+ # of type String, Number, or Binary (not a set type). If the target
1125
+ # attribute of the comparison is of type String, then the operator
1126
+ # checks for a substring match. If the target attribute of the
1127
+ # comparison is of type Binary, then the operator looks for a
1128
+ # subsequence of the target that matches the input. If the target
1129
+ # attribute of the comparison is a set ("`SS`", "`NS`", or
1130
+ # "`BS`"), then the operator evaluates to true if it finds an
1131
+ # exact match with any member of the set.
1132
+ #
1133
+ # CONTAINS is supported for lists: When evaluating "`a CONTAINS
1134
+ # b`", "`a`" can be a list; however, "`b`" cannot be a set, a
1135
+ # map, or a list.
1136
+ #
1137
+ # * `NOT_CONTAINS`\: Checks for absence of a subsequence, or absence
1138
+ # of a value in a set.
1139
+ #
1140
+ # *AttributeValueList* can contain only one *AttributeValue* element
1141
+ # of type String, Number, or Binary (not a set type). If the target
1142
+ # attribute of the comparison is a String, then the operator checks
1143
+ # for the absence of a substring match. If the target attribute of
1144
+ # the comparison is Binary, then the operator checks for the absence
1145
+ # of a subsequence of the target that matches the input. If the
1146
+ # target attribute of the comparison is a set ("`SS`", "`NS`",
1147
+ # or "`BS`"), then the operator evaluates to true if it *does not*
1148
+ # find an exact match with any member of the set.
1149
+ #
1150
+ # NOT\_CONTAINS is supported for lists: When evaluating "`a NOT
1151
+ # CONTAINS b`", "`a`" can be a list; however, "`b`" cannot be a
1152
+ # set, a map, or a list.
1153
+ #
1154
+ # * `BEGINS_WITH`\: Checks for a prefix.
1155
+ #
1156
+ # *AttributeValueList* can contain only one *AttributeValue* of type
1157
+ # String or Binary (not a Number or a set type). The target
1158
+ # attribute of the comparison must be of type String or Binary (not
1159
+ # a Number or a set type).
1160
+ #
1161
+ #
1162
+ #
1163
+ # * `IN`\: Checks for matching elements within two sets.
1164
+ #
1165
+ # *AttributeValueList* can contain one or more *AttributeValue*
1166
+ # elements of type String, Number, or Binary (not a set type). These
1167
+ # attributes are compared against an existing set type attribute of
1168
+ # an item. If any elements of the input set are present in the item
1169
+ # attribute, the expression evaluates to true.
1170
+ #
1171
+ # * `BETWEEN`\: Greater than or equal to the first value, and less
1172
+ # than or equal to the second value.
1173
+ #
1174
+ # *AttributeValueList* must contain two *AttributeValue* elements of
1175
+ # the same type, either String, Number, or Binary (not a set type).
1176
+ # A target attribute matches if the target value is greater than, or
1177
+ # equal to, the first element and less than, or equal to, the second
1178
+ # element. If an item contains an *AttributeValue* element of a
1179
+ # different type than the one provided in the request, the value
1180
+ # does not match. For example, `\{"S":"6"\}` does not compare to
1181
+ # `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
1182
+ # `\{"NS":["6", "2", "1"]\}`
1183
+ #
1184
+ # For usage examples of *AttributeValueList* and *ComparisonOperator*,
1185
+ # see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
1186
+ # Developer Guide*.
1187
+ #
1188
+ # For backward compatibility with previous DynamoDB releases, the
1189
+ # following parameters can be used instead of *AttributeValueList* and
1190
+ # *ComparisonOperator*\:
1191
+ #
1192
+ # * *Value* - A value for DynamoDB to compare with an attribute.
1193
+ #
1194
+ # * *Exists* - A Boolean value that causes DynamoDB to evaluate the
1195
+ # value before attempting the conditional operation:
1196
+ #
1197
+ # * If *Exists* is `true`, DynamoDB will check to see if that
1198
+ # attribute value already exists in the table. If it is found, then
1199
+ # the condition evaluates to true; otherwise the condition evaluate
1200
+ # to false.
1201
+ #
1202
+ # * If *Exists* is `false`, DynamoDB assumes that the attribute value
1203
+ # does *not* exist in the table. If in fact the value does not
1204
+ # exist, then the assumption is valid and the condition evaluates to
1205
+ # true. If the value is found, despite the assumption that it does
1206
+ # not exist, the condition evaluates to false.
1207
+ #
1208
+ # Note that the default value for *Exists* is `true`.
1209
+ #
1210
+ # The *Value* and *Exists* parameters are incompatible with
1211
+ # *AttributeValueList* and *ComparisonOperator*. Note that if you use
1212
+ # both sets of parameters at once, DynamoDB will return a
1213
+ # *ValidationException* exception.
1214
+ #
1215
+ #
1216
+ #
1217
+ # [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
1218
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
1219
+ # @option options [String] :return_values
1220
+ # Use *ReturnValues* if you want to get the item attributes as they
1221
+ # appeared before they were updated with the *PutItem* request. For
1222
+ # *PutItem*, the valid values are:
1223
+ #
1224
+ # * `NONE` - If *ReturnValues* is not specified, or if its value is
1225
+ # `NONE`, then nothing is returned. (This setting is the default for
1226
+ # *ReturnValues*.)
1227
+ #
1228
+ # * `ALL_OLD` - If *PutItem* overwrote an attribute name-value pair,
1229
+ # then the content of the old item is returned.
1230
+ #
1231
+ # <note markdown="1"> The *ReturnValues* parameter is used by several DynamoDB operations;
1232
+ # however, *PutItem* does not recognize any values other than `NONE` or
1233
+ # `ALL_OLD`.
1234
+ #
1235
+ # </note>
1236
+ # @option options [String] :return_consumed_capacity
1237
+ # Determines the level of detail about provisioned throughput
1238
+ # consumption that is returned in the response:
1239
+ #
1240
+ # * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
1241
+ # for the operation, together with *ConsumedCapacity* for each table
1242
+ # and secondary index that was accessed.
1243
+ #
1244
+ # Note that some operations, such as *GetItem* and *BatchGetItem*, do
1245
+ # not access any indexes at all. In these cases, specifying *INDEXES*
1246
+ # will only return *ConsumedCapacity* information for table(s).
1247
+ #
1248
+ # * *TOTAL* - The response includes only the aggregate
1249
+ # *ConsumedCapacity* for the operation.
1250
+ #
1251
+ # * *NONE* - No *ConsumedCapacity* details are included in the response.
1252
+ # @option options [String] :return_item_collection_metrics
1253
+ # Determines whether item collection metrics are returned. If set to
1254
+ # `SIZE`, the response includes statistics about item collections, if
1255
+ # any, that were modified during the operation are returned in the
1256
+ # response. If set to `NONE` (the default), no statistics are returned.
1257
+ # @option options [String] :conditional_operator
1258
+ # This is a legacy parameter, for backward compatibility. New
1259
+ # applications should use *ConditionExpression* instead. Do not combine
1260
+ # legacy parameters and expression parameters in a single API call;
1261
+ # otherwise, DynamoDB will return a *ValidationException* exception.
1262
+ #
1263
+ # A logical operator to apply to the conditions in the *Expected* map:
1264
+ #
1265
+ # * `AND` - If all of the conditions evaluate to true, then the entire
1266
+ # map evaluates to true.
1267
+ #
1268
+ # * `OR` - If at least one of the conditions evaluate to true, then the
1269
+ # entire map evaluates to true.
1270
+ #
1271
+ # If you omit *ConditionalOperator*, then `AND` is the default.
1272
+ #
1273
+ # The operation will succeed only if the entire map evaluates to true.
1274
+ #
1275
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
1276
+ #
1277
+ # </note>
1278
+ # @option options [String] :condition_expression
1279
+ # A condition that must be satisfied in order for a conditional
1280
+ # *PutItem* operation to succeed.
1281
+ #
1282
+ # An expression can contain any of the following:
1283
+ #
1284
+ # * Functions: `attribute_exists | attribute_not_exists | attribute_type
1285
+ # | contains | begins_with | size`
1286
+ #
1287
+ # These function names are case-sensitive.
1288
+ #
1289
+ # * Comparison operators: ` = | &#x3C;&#x3E; | &#x3C; | &#x3E; | &#x3C;=
1290
+ # | &#x3E;= | BETWEEN | IN`
1291
+ #
1292
+ # * Logical operators: `AND | OR | NOT`
1293
+ #
1294
+ # For more information on condition expressions, see [Specifying
1295
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
1296
+ #
1297
+ # <note markdown="1"> *ConditionExpression* replaces the legacy *ConditionalOperator* and
1298
+ # *Expected* parameters.
1299
+ #
1300
+ # </note>
1301
+ #
1302
+ #
1303
+ #
1304
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
1305
+ # @option options [Hash<String,String>] :expression_attribute_names
1306
+ # One or more substitution tokens for attribute names in an expression.
1307
+ # The following are some use cases for using
1308
+ # *ExpressionAttributeNames*\:
1309
+ #
1310
+ # * To access an attribute whose name conflicts with a DynamoDB reserved
1311
+ # word.
1312
+ #
1313
+ # * To create a placeholder for repeating occurrences of an attribute
1314
+ # name in an expression.
1315
+ #
1316
+ # * To prevent special characters in an attribute name from being
1317
+ # misinterpreted in an expression.
1318
+ #
1319
+ # Use the **#** character in an expression to dereference an attribute
1320
+ # name. For example, consider the following attribute name:
1321
+ #
1322
+ # * `Percentile`
1323
+ #
1324
+ # ^
1325
+ #
1326
+ # The name of this attribute conflicts with a reserved word, so it
1327
+ # cannot be used directly in an expression. (For the complete list of
1328
+ # reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
1329
+ # Developer Guide*). To work around this, you could specify the
1330
+ # following for *ExpressionAttributeNames*\:
1331
+ #
1332
+ # * `\{"#P":"Percentile"\}`
1333
+ #
1334
+ # ^
1335
+ #
1336
+ # You could then use this substitution in an expression, as in this
1337
+ # example:
1338
+ #
1339
+ # * `#P = :val`
1340
+ #
1341
+ # ^
1342
+ #
1343
+ # <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
1344
+ # values*, which are placeholders for the actual value at runtime.
1345
+ #
1346
+ # </note>
1347
+ #
1348
+ # For more information on expression attribute names, see [Accessing
1349
+ # Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
1350
+ #
1351
+ #
1352
+ #
1353
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
1354
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
1355
+ # @option options [Hash<String,Types::AttributeValue>] :expression_attribute_values
1356
+ # One or more values that can be substituted in an expression.
1357
+ #
1358
+ # Use the **\:** (colon) character in an expression to dereference an
1359
+ # attribute value. For example, suppose that you wanted to check whether
1360
+ # the value of the *ProductStatus* attribute was one of the following:
1361
+ #
1362
+ # `Available | Backordered | Discontinued`
1363
+ #
1364
+ # You would first need to specify *ExpressionAttributeValues* as
1365
+ # follows:
1366
+ #
1367
+ # `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
1368
+ # ":disc":\{"S":"Discontinued"\} \}`
1369
+ #
1370
+ # You could then use these values in an expression, such as this:
1371
+ #
1372
+ # `ProductStatus IN (:avail, :back, :disc)`
1373
+ #
1374
+ # For more information on expression attribute values, see [Specifying
1375
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
1376
+ #
1377
+ #
1378
+ #
1379
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
1380
+ # @return [Types::PutItemOutput]
1381
+ def put_item(options = {})
1382
+ options = options.merge(table_name: @name)
1383
+ resp = @client.put_item(options)
1384
+ resp.data
1385
+ end
1386
+
1387
+ # @example Request syntax with placeholder values
1388
+ #
1389
+ # table.query({
1390
+ # index_name: "IndexName",
1391
+ # select: "ALL_ATTRIBUTES", # accepts ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT
1392
+ # attributes_to_get: ["AttributeName"],
1393
+ # limit: 1,
1394
+ # consistent_read: false,
1395
+ # key_conditions: {
1396
+ # "AttributeName" => {
1397
+ # attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
1398
+ # comparison_operator: "EQ", # required, accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
1399
+ # },
1400
+ # },
1401
+ # query_filter: {
1402
+ # "AttributeName" => {
1403
+ # attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
1404
+ # comparison_operator: "EQ", # required, accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
1405
+ # },
1406
+ # },
1407
+ # conditional_operator: "AND", # accepts AND, OR
1408
+ # scan_index_forward: false,
1409
+ # exclusive_start_key: {
1410
+ # "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
1411
+ # },
1412
+ # return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
1413
+ # projection_expression: "ProjectionExpression",
1414
+ # filter_expression: "ConditionExpression",
1415
+ # key_condition_expression: "KeyExpression",
1416
+ # expression_attribute_names: {
1417
+ # "ExpressionAttributeNameVariable" => "AttributeName",
1418
+ # },
1419
+ # expression_attribute_values: {
1420
+ # "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
1421
+ # },
1422
+ # })
1423
+ # @param [Hash] options ({})
1424
+ # @option options [String] :index_name
1425
+ # The name of an index to query. This index can be any local secondary
1426
+ # index or global secondary index on the table. Note that if you use the
1427
+ # *IndexName* parameter, you must also provide *TableName.*
1428
+ # @option options [String] :select
1429
+ # The attributes to be returned in the result. You can retrieve all item
1430
+ # attributes, specific item attributes, the count of matching items, or
1431
+ # in the case of an index, some or all of the attributes projected into
1432
+ # the index.
1433
+ #
1434
+ # * `ALL_ATTRIBUTES` - Returns all of the item attributes from the
1435
+ # specified table or index. If you query a local secondary index, then
1436
+ # for each matching item in the index DynamoDB will fetch the entire
1437
+ # item from the parent table. If the index is configured to project
1438
+ # all item attributes, then all of the data can be obtained from the
1439
+ # local secondary index, and no fetching is required.
1440
+ #
1441
+ # * `ALL_PROJECTED_ATTRIBUTES` - Allowed only when querying an index.
1442
+ # Retrieves all attributes that have been projected into the index. If
1443
+ # the index is configured to project all attributes, this return value
1444
+ # is equivalent to specifying `ALL_ATTRIBUTES`.
1445
+ #
1446
+ # * `COUNT` - Returns the number of matching items, rather than the
1447
+ # matching items themselves.
1448
+ #
1449
+ # * `SPECIFIC_ATTRIBUTES` - Returns only the attributes listed in
1450
+ # *AttributesToGet*. This return value is equivalent to specifying
1451
+ # *AttributesToGet* without specifying any value for *Select*.
1452
+ #
1453
+ # If you query a local secondary index and request only attributes
1454
+ # that are projected into that index, the operation will read only the
1455
+ # index and not the table. If any of the requested attributes are not
1456
+ # projected into the local secondary index, DynamoDB will fetch each
1457
+ # of these attributes from the parent table. This extra fetching
1458
+ # incurs additional throughput cost and latency.
1459
+ #
1460
+ # If you query a global secondary index, you can only request
1461
+ # attributes that are projected into the index. Global secondary index
1462
+ # queries cannot fetch attributes from the parent table.
1463
+ #
1464
+ # If neither *Select* nor *AttributesToGet* are specified, DynamoDB
1465
+ # defaults to `ALL_ATTRIBUTES` when accessing a table, and
1466
+ # `ALL_PROJECTED_ATTRIBUTES` when accessing an index. You cannot use
1467
+ # both *Select* and *AttributesToGet* together in a single request,
1468
+ # unless the value for *Select* is `SPECIFIC_ATTRIBUTES`. (This usage is
1469
+ # equivalent to specifying *AttributesToGet* without any value for
1470
+ # *Select*.)
1471
+ #
1472
+ # <note markdown="1"> If you use the *ProjectionExpression* parameter, then the value for
1473
+ # *Select* can only be `SPECIFIC_ATTRIBUTES`. Any other value for
1474
+ # *Select* will return an error.
1475
+ #
1476
+ # </note>
1477
+ # @option options [Array<String>] :attributes_to_get
1478
+ # This is a legacy parameter, for backward compatibility. New
1479
+ # applications should use *ProjectionExpression* instead. Do not combine
1480
+ # legacy parameters and expression parameters in a single API call;
1481
+ # otherwise, DynamoDB will return a *ValidationException* exception.
1482
+ #
1483
+ # This parameter allows you to retrieve attributes of type List or Map;
1484
+ # however, it cannot retrieve individual elements within a List or a
1485
+ # Map.
1486
+ #
1487
+ # The names of one or more attributes to retrieve. If no attribute names
1488
+ # are provided, then all attributes will be returned. If any of the
1489
+ # requested attributes are not found, they will not appear in the
1490
+ # result.
1491
+ #
1492
+ # Note that *AttributesToGet* has no effect on provisioned throughput
1493
+ # consumption. DynamoDB determines capacity units consumed based on item
1494
+ # size, not on the amount of data that is returned to an application.
1495
+ #
1496
+ # You cannot use both *AttributesToGet* and *Select* together in a
1497
+ # *Query* request, *unless* the value for *Select* is
1498
+ # `SPECIFIC_ATTRIBUTES`. (This usage is equivalent to specifying
1499
+ # *AttributesToGet* without any value for *Select*.)
1500
+ #
1501
+ # If you query a local secondary index and request only attributes that
1502
+ # are projected into that index, the operation will read only the index
1503
+ # and not the table. If any of the requested attributes are not
1504
+ # projected into the local secondary index, DynamoDB will fetch each of
1505
+ # these attributes from the parent table. This extra fetching incurs
1506
+ # additional throughput cost and latency.
1507
+ #
1508
+ # If you query a global secondary index, you can only request attributes
1509
+ # that are projected into the index. Global secondary index queries
1510
+ # cannot fetch attributes from the parent table.
1511
+ # @option options [Integer] :limit
1512
+ # The maximum number of items to evaluate (not necessarily the number of
1513
+ # matching items). If DynamoDB processes the number of items up to the
1514
+ # limit while processing the results, it stops the operation and returns
1515
+ # the matching values up to that point, and a key in *LastEvaluatedKey*
1516
+ # to apply in a subsequent operation, so that you can pick up where you
1517
+ # left off. Also, if the processed data set size exceeds 1 MB before
1518
+ # DynamoDB reaches this limit, it stops the operation and returns the
1519
+ # matching values up to the limit, and a key in *LastEvaluatedKey* to
1520
+ # apply in a subsequent operation to continue the operation. For more
1521
+ # information, see [Query and Scan][1] in the *Amazon DynamoDB Developer
1522
+ # Guide*.
1523
+ #
1524
+ #
1525
+ #
1526
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html
1527
+ # @option options [Boolean] :consistent_read
1528
+ # Determines the read consistency model: If set to `true`, then the
1529
+ # operation uses strongly consistent reads; otherwise, the operation
1530
+ # uses eventually consistent reads.
1531
+ #
1532
+ # Strongly consistent reads are not supported on global secondary
1533
+ # indexes. If you query a global secondary index with *ConsistentRead*
1534
+ # set to `true`, you will receive a *ValidationException*.
1535
+ # @option options [Hash<String,Types::Condition>] :key_conditions
1536
+ # This is a legacy parameter, for backward compatibility. New
1537
+ # applications should use *KeyConditionExpression* instead. Do not
1538
+ # combine legacy parameters and expression parameters in a single API
1539
+ # call; otherwise, DynamoDB will return a *ValidationException*
1540
+ # exception.
1541
+ #
1542
+ # The selection criteria for the query. For a query on a table, you can
1543
+ # have conditions only on the table primary key attributes. You must
1544
+ # provide the partition key name and value as an `EQ` condition. You can
1545
+ # optionally provide a second condition, referring to the sort key.
1546
+ #
1547
+ # <note markdown="1"> If you don't provide a sort key condition, all of the items that
1548
+ # match the partition key will be retrieved. If a *FilterExpression* or
1549
+ # *QueryFilter* is present, it will be applied after the items are
1550
+ # retrieved.
1551
+ #
1552
+ # </note>
1553
+ #
1554
+ # For a query on an index, you can have conditions only on the index key
1555
+ # attributes. You must provide the index partition key name and value as
1556
+ # an `EQ` condition. You can optionally provide a second condition,
1557
+ # referring to the index sort key.
1558
+ #
1559
+ # Each *KeyConditions* element consists of an attribute name to compare,
1560
+ # along with the following:
1561
+ #
1562
+ # * *AttributeValueList* - One or more values to evaluate against the
1563
+ # supplied attribute. The number of values in the list depends on the
1564
+ # *ComparisonOperator* being used.
1565
+ #
1566
+ # For type Number, value comparisons are numeric.
1567
+ #
1568
+ # String value comparisons for greater than, equals, or less than are
1569
+ # based on ASCII character code values. For example, `a` is greater
1570
+ # than `A`, and `a` is greater than `B`. For a list of code values,
1571
+ # see
1572
+ # [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
1573
+ #
1574
+ # For Binary, DynamoDB treats each byte of the binary data as unsigned
1575
+ # when it compares binary values.
1576
+ #
1577
+ # * *ComparisonOperator* - A comparator for evaluating attributes, for
1578
+ # example, equals, greater than, less than, and so on.
1579
+ #
1580
+ # For *KeyConditions*, only the following comparison operators are
1581
+ # supported:
1582
+ #
1583
+ # `EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN`
1584
+ #
1585
+ # The following are descriptions of these comparison operators.
1586
+ #
1587
+ # * `EQ`\: Equal.
1588
+ #
1589
+ # *AttributeValueList* can contain only one *AttributeValue* of type
1590
+ # String, Number, or Binary (not a set type). If an item contains an
1591
+ # *AttributeValue* element of a different type than the one
1592
+ # specified in the request, the value does not match. For example,
1593
+ # `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
1594
+ # does not equal `\{"NS":["6", "2", "1"]\}`.
1595
+ #
1596
+ #
1597
+ #
1598
+ # * `LE`\: Less than or equal.
1599
+ #
1600
+ # *AttributeValueList* can contain only one *AttributeValue* element
1601
+ # of type String, Number, or Binary (not a set type). If an item
1602
+ # contains an *AttributeValue* element of a different type than the
1603
+ # one provided in the request, the value does not match. For
1604
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
1605
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
1606
+ #
1607
+ #
1608
+ #
1609
+ # * `LT`\: Less than.
1610
+ #
1611
+ # *AttributeValueList* can contain only one *AttributeValue* of type
1612
+ # String, Number, or Binary (not a set type). If an item contains an
1613
+ # *AttributeValue* element of a different type than the one provided
1614
+ # in the request, the value does not match. For example,
1615
+ # `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
1616
+ # does not compare to `\{"NS":["6", "2", "1"]\}`.
1617
+ #
1618
+ #
1619
+ #
1620
+ # * `GE`\: Greater than or equal.
1621
+ #
1622
+ # *AttributeValueList* can contain only one *AttributeValue* element
1623
+ # of type String, Number, or Binary (not a set type). If an item
1624
+ # contains an *AttributeValue* element of a different type than the
1625
+ # one provided in the request, the value does not match. For
1626
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
1627
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
1628
+ #
1629
+ #
1630
+ #
1631
+ # * `GT`\: Greater than.
1632
+ #
1633
+ # *AttributeValueList* can contain only one *AttributeValue* element
1634
+ # of type String, Number, or Binary (not a set type). If an item
1635
+ # contains an *AttributeValue* element of a different type than the
1636
+ # one provided in the request, the value does not match. For
1637
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
1638
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
1639
+ #
1640
+ #
1641
+ #
1642
+ # * `BEGINS_WITH`\: Checks for a prefix.
1643
+ #
1644
+ # *AttributeValueList* can contain only one *AttributeValue* of type
1645
+ # String or Binary (not a Number or a set type). The target
1646
+ # attribute of the comparison must be of type String or Binary (not
1647
+ # a Number or a set type).
1648
+ #
1649
+ #
1650
+ #
1651
+ # * `BETWEEN`\: Greater than or equal to the first value, and less
1652
+ # than or equal to the second value.
1653
+ #
1654
+ # *AttributeValueList* must contain two *AttributeValue* elements of
1655
+ # the same type, either String, Number, or Binary (not a set type).
1656
+ # A target attribute matches if the target value is greater than, or
1657
+ # equal to, the first element and less than, or equal to, the second
1658
+ # element. If an item contains an *AttributeValue* element of a
1659
+ # different type than the one provided in the request, the value
1660
+ # does not match. For example, `\{"S":"6"\}` does not compare to
1661
+ # `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
1662
+ # `\{"NS":["6", "2", "1"]\}`
1663
+ #
1664
+ # For usage examples of *AttributeValueList* and *ComparisonOperator*,
1665
+ # see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
1666
+ # Developer Guide*.
1667
+ #
1668
+ #
1669
+ #
1670
+ # [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
1671
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
1672
+ # @option options [Hash<String,Types::Condition>] :query_filter
1673
+ # This is a legacy parameter, for backward compatibility. New
1674
+ # applications should use *FilterExpression* instead. Do not combine
1675
+ # legacy parameters and expression parameters in a single API call;
1676
+ # otherwise, DynamoDB will return a *ValidationException* exception.
1677
+ #
1678
+ # A condition that evaluates the query results after the items are read
1679
+ # and returns only the desired values.
1680
+ #
1681
+ # This parameter does not support attributes of type List or Map.
1682
+ #
1683
+ # <note markdown="1"> A *QueryFilter* is applied after the items have already been read; the
1684
+ # process of filtering does not consume any additional read capacity
1685
+ # units.
1686
+ #
1687
+ # </note>
1688
+ #
1689
+ # If you provide more than one condition in the *QueryFilter* map, then
1690
+ # by default all of the conditions must evaluate to true. In other
1691
+ # words, the conditions are ANDed together. (You can use the
1692
+ # *ConditionalOperator* parameter to OR the conditions instead. If you
1693
+ # do this, then at least one of the conditions must evaluate to true,
1694
+ # rather than all of them.)
1695
+ #
1696
+ # Note that *QueryFilter* does not allow key attributes. You cannot
1697
+ # define a filter condition on a partition key or a sort key.
1698
+ #
1699
+ # Each *QueryFilter* element consists of an attribute name to compare,
1700
+ # along with the following:
1701
+ #
1702
+ # * *AttributeValueList* - One or more values to evaluate against the
1703
+ # supplied attribute. The number of values in the list depends on the
1704
+ # operator specified in *ComparisonOperator*.
1705
+ #
1706
+ # For type Number, value comparisons are numeric.
1707
+ #
1708
+ # String value comparisons for greater than, equals, or less than are
1709
+ # based on ASCII character code values. For example, `a` is greater
1710
+ # than `A`, and `a` is greater than `B`. For a list of code values,
1711
+ # see
1712
+ # [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
1713
+ #
1714
+ # For type Binary, DynamoDB treats each byte of the binary data as
1715
+ # unsigned when it compares binary values.
1716
+ #
1717
+ # For information on specifying data types in JSON, see [JSON Data
1718
+ # Format][2] in the *Amazon DynamoDB Developer Guide*.
1719
+ #
1720
+ # * *ComparisonOperator* - A comparator for evaluating attributes. For
1721
+ # example, equals, greater than, less than, etc.
1722
+ #
1723
+ # The following comparison operators are available:
1724
+ #
1725
+ # `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
1726
+ # NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
1727
+ #
1728
+ # For complete descriptions of all comparison operators, see the
1729
+ # [Condition][3] data type.
1730
+ #
1731
+ #
1732
+ #
1733
+ # [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
1734
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html
1735
+ # [3]: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html
1736
+ # @option options [String] :conditional_operator
1737
+ # This is a legacy parameter, for backward compatibility. New
1738
+ # applications should use *FilterExpression* instead. Do not combine
1739
+ # legacy parameters and expression parameters in a single API call;
1740
+ # otherwise, DynamoDB will return a *ValidationException* exception.
1741
+ #
1742
+ # A logical operator to apply to the conditions in a *QueryFilter* map:
1743
+ #
1744
+ # * `AND` - If all of the conditions evaluate to true, then the entire
1745
+ # map evaluates to true.
1746
+ #
1747
+ # * `OR` - If at least one of the conditions evaluate to true, then the
1748
+ # entire map evaluates to true.
1749
+ #
1750
+ # If you omit *ConditionalOperator*, then `AND` is the default.
1751
+ #
1752
+ # The operation will succeed only if the entire map evaluates to true.
1753
+ #
1754
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
1755
+ #
1756
+ # </note>
1757
+ # @option options [Boolean] :scan_index_forward
1758
+ # Specifies the order for index traversal: If `true` (default), the
1759
+ # traversal is performed in ascending order; if `false`, the traversal
1760
+ # is performed in descending order.
1761
+ #
1762
+ # Items with the same partition key value are stored in sorted order by
1763
+ # sort key. If the sort key data type is Number, the results are stored
1764
+ # in numeric order. For type String, the results are stored in order of
1765
+ # ASCII character code values. For type Binary, DynamoDB treats each
1766
+ # byte of the binary data as unsigned.
1767
+ #
1768
+ # If *ScanIndexForward* is `true`, DynamoDB returns the results in the
1769
+ # order in which they are stored (by sort key value). This is the
1770
+ # default behavior. If *ScanIndexForward* is `false`, DynamoDB reads the
1771
+ # results in reverse order by sort key value, and then returns the
1772
+ # results to the client.
1773
+ # @option options [Hash<String,Types::AttributeValue>] :exclusive_start_key
1774
+ # The primary key of the first item that this operation will evaluate.
1775
+ # Use the value that was returned for *LastEvaluatedKey* in the previous
1776
+ # operation.
1777
+ #
1778
+ # The data type for *ExclusiveStartKey* must be String, Number or
1779
+ # Binary. No set data types are allowed.
1780
+ # @option options [String] :return_consumed_capacity
1781
+ # Determines the level of detail about provisioned throughput
1782
+ # consumption that is returned in the response:
1783
+ #
1784
+ # * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
1785
+ # for the operation, together with *ConsumedCapacity* for each table
1786
+ # and secondary index that was accessed.
1787
+ #
1788
+ # Note that some operations, such as *GetItem* and *BatchGetItem*, do
1789
+ # not access any indexes at all. In these cases, specifying *INDEXES*
1790
+ # will only return *ConsumedCapacity* information for table(s).
1791
+ #
1792
+ # * *TOTAL* - The response includes only the aggregate
1793
+ # *ConsumedCapacity* for the operation.
1794
+ #
1795
+ # * *NONE* - No *ConsumedCapacity* details are included in the response.
1796
+ # @option options [String] :projection_expression
1797
+ # A string that identifies one or more attributes to retrieve from the
1798
+ # table. These attributes can include scalars, sets, or elements of a
1799
+ # JSON document. The attributes in the expression must be separated by
1800
+ # commas.
1801
+ #
1802
+ # If no attribute names are specified, then all attributes will be
1803
+ # returned. If any of the requested attributes are not found, they will
1804
+ # not appear in the result.
1805
+ #
1806
+ # For more information, see [Accessing Item Attributes][1] in the
1807
+ # *Amazon DynamoDB Developer Guide*.
1808
+ #
1809
+ # <note markdown="1"> *ProjectionExpression* replaces the legacy *AttributesToGet*
1810
+ # parameter.
1811
+ #
1812
+ # </note>
1813
+ #
1814
+ #
1815
+ #
1816
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
1817
+ # @option options [String] :filter_expression
1818
+ # A string that contains conditions that DynamoDB applies after the
1819
+ # *Query* operation, but before the data is returned to you. Items that
1820
+ # do not satisfy the *FilterExpression* criteria are not returned.
1821
+ #
1822
+ # <note markdown="1"> A *FilterExpression* is applied after the items have already been
1823
+ # read; the process of filtering does not consume any additional read
1824
+ # capacity units.
1825
+ #
1826
+ # </note>
1827
+ #
1828
+ # For more information, see [Filter Expressions][1] in the *Amazon
1829
+ # DynamoDB Developer Guide*.
1830
+ #
1831
+ # <note markdown="1"> *FilterExpression* replaces the legacy *QueryFilter* and
1832
+ # *ConditionalOperator* parameters.
1833
+ #
1834
+ # </note>
1835
+ #
1836
+ #
1837
+ #
1838
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#FilteringResults
1839
+ # @option options [String] :key_condition_expression
1840
+ # The condition that specifies the key value(s) for items to be
1841
+ # retrieved by the *Query* action.
1842
+ #
1843
+ # The condition must perform an equality test on a single partition key
1844
+ # value. The condition can also perform one of several comparison tests
1845
+ # on a single sort key value. *Query* can use *KeyConditionExpression*
1846
+ # to retrieve one item with a given partition key value and sort key
1847
+ # value, or several items that have the same partition key value but
1848
+ # different sort key values.
1849
+ #
1850
+ # The partition key equality test is required, and must be specified in
1851
+ # the following format:
1852
+ #
1853
+ # `partitionKeyName` *=* `:partitionkeyval`
1854
+ #
1855
+ # If you also want to provide a condition for the sort key, it must be
1856
+ # combined using *AND* with the condition for the sort key. Following is
1857
+ # an example, using the **=** comparison operator for the sort key:
1858
+ #
1859
+ # `partitionKeyName` *=* `:partitionkeyval` *AND* `sortKeyName` *=*
1860
+ # `:sortkeyval`
1861
+ #
1862
+ # Valid comparisons for the sort key condition are as follows:
1863
+ #
1864
+ # * `sortKeyName` *=* `:sortkeyval` - true if the sort key value is
1865
+ # equal to `:sortkeyval`.
1866
+ #
1867
+ # * `sortKeyName` *&lt;* `:sortkeyval` - true if the sort key value is
1868
+ # less than `:sortkeyval`.
1869
+ #
1870
+ # * `sortKeyName` *&lt;=* `:sortkeyval` - true if the sort key value is
1871
+ # less than or equal to `:sortkeyval`.
1872
+ #
1873
+ # * `sortKeyName` *&gt;* `:sortkeyval` - true if the sort key value is
1874
+ # greater than `:sortkeyval`.
1875
+ #
1876
+ # * `sortKeyName` <i>&gt;= </i> `:sortkeyval` - true if the sort key
1877
+ # value is greater than or equal to `:sortkeyval`.
1878
+ #
1879
+ # * `sortKeyName` *BETWEEN* `:sortkeyval1` *AND* `:sortkeyval2` - true
1880
+ # if the sort key value is greater than or equal to `:sortkeyval1`,
1881
+ # and less than or equal to `:sortkeyval2`.
1882
+ #
1883
+ # * *begins\_with (* `sortKeyName`, `:sortkeyval` *)* - true if the sort
1884
+ # key value begins with a particular operand. (You cannot use this
1885
+ # function with a sort key that is of type Number.) Note that the
1886
+ # function name `begins_with` is case-sensitive.
1887
+ #
1888
+ # Use the *ExpressionAttributeValues* parameter to replace tokens such
1889
+ # as `:partitionval` and `:sortval` with actual values at runtime.
1890
+ #
1891
+ # You can optionally use the *ExpressionAttributeNames* parameter to
1892
+ # replace the names of the partition key and sort key with placeholder
1893
+ # tokens. This option might be necessary if an attribute name conflicts
1894
+ # with a DynamoDB reserved word. For example, the following
1895
+ # *KeyConditionExpression* parameter causes an error because *Size* is a
1896
+ # reserved word:
1897
+ #
1898
+ # * `Size = :myval`
1899
+ #
1900
+ # ^
1901
+ #
1902
+ # To work around this, define a placeholder (such a `#S`) to represent
1903
+ # the attribute name *Size*. *KeyConditionExpression* then is as
1904
+ # follows:
1905
+ #
1906
+ # * `#S = :myval`
1907
+ #
1908
+ # ^
1909
+ #
1910
+ # For a list of reserved words, see [Reserved Words][1] in the *Amazon
1911
+ # DynamoDB Developer Guide*.
1912
+ #
1913
+ # For more information on *ExpressionAttributeNames* and
1914
+ # *ExpressionAttributeValues*, see [Using Placeholders for Attribute
1915
+ # Names and Values][2] in the *Amazon DynamoDB Developer Guide*.
1916
+ #
1917
+ # <note markdown="1"> *KeyConditionExpression* replaces the legacy *KeyConditions*
1918
+ # parameter.
1919
+ #
1920
+ # </note>
1921
+ #
1922
+ #
1923
+ #
1924
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
1925
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ExpressionPlaceholders.html
1926
+ # @option options [Hash<String,String>] :expression_attribute_names
1927
+ # One or more substitution tokens for attribute names in an expression.
1928
+ # The following are some use cases for using
1929
+ # *ExpressionAttributeNames*\:
1930
+ #
1931
+ # * To access an attribute whose name conflicts with a DynamoDB reserved
1932
+ # word.
1933
+ #
1934
+ # * To create a placeholder for repeating occurrences of an attribute
1935
+ # name in an expression.
1936
+ #
1937
+ # * To prevent special characters in an attribute name from being
1938
+ # misinterpreted in an expression.
1939
+ #
1940
+ # Use the **#** character in an expression to dereference an attribute
1941
+ # name. For example, consider the following attribute name:
1942
+ #
1943
+ # * `Percentile`
1944
+ #
1945
+ # ^
1946
+ #
1947
+ # The name of this attribute conflicts with a reserved word, so it
1948
+ # cannot be used directly in an expression. (For the complete list of
1949
+ # reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
1950
+ # Developer Guide*). To work around this, you could specify the
1951
+ # following for *ExpressionAttributeNames*\:
1952
+ #
1953
+ # * `\{"#P":"Percentile"\}`
1954
+ #
1955
+ # ^
1956
+ #
1957
+ # You could then use this substitution in an expression, as in this
1958
+ # example:
1959
+ #
1960
+ # * `#P = :val`
1961
+ #
1962
+ # ^
1963
+ #
1964
+ # <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
1965
+ # values*, which are placeholders for the actual value at runtime.
1966
+ #
1967
+ # </note>
1968
+ #
1969
+ # For more information on expression attribute names, see [Accessing
1970
+ # Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
1971
+ #
1972
+ #
1973
+ #
1974
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
1975
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
1976
+ # @option options [Hash<String,Types::AttributeValue>] :expression_attribute_values
1977
+ # One or more values that can be substituted in an expression.
1978
+ #
1979
+ # Use the **\:** (colon) character in an expression to dereference an
1980
+ # attribute value. For example, suppose that you wanted to check whether
1981
+ # the value of the *ProductStatus* attribute was one of the following:
1982
+ #
1983
+ # `Available | Backordered | Discontinued`
1984
+ #
1985
+ # You would first need to specify *ExpressionAttributeValues* as
1986
+ # follows:
1987
+ #
1988
+ # `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
1989
+ # ":disc":\{"S":"Discontinued"\} \}`
1990
+ #
1991
+ # You could then use these values in an expression, such as this:
1992
+ #
1993
+ # `ProductStatus IN (:avail, :back, :disc)`
1994
+ #
1995
+ # For more information on expression attribute values, see [Specifying
1996
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
1997
+ #
1998
+ #
1999
+ #
2000
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
2001
+ # @return [Types::QueryOutput]
2002
+ def query(options = {})
2003
+ options = options.merge(table_name: @name)
2004
+ resp = @client.query(options)
2005
+ resp.data
2006
+ end
2007
+
2008
+ # @example Request syntax with placeholder values
2009
+ #
2010
+ # table.scan({
2011
+ # index_name: "IndexName",
2012
+ # attributes_to_get: ["AttributeName"],
2013
+ # limit: 1,
2014
+ # select: "ALL_ATTRIBUTES", # accepts ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT
2015
+ # scan_filter: {
2016
+ # "AttributeName" => {
2017
+ # attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2018
+ # comparison_operator: "EQ", # required, accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
2019
+ # },
2020
+ # },
2021
+ # conditional_operator: "AND", # accepts AND, OR
2022
+ # exclusive_start_key: {
2023
+ # "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2024
+ # },
2025
+ # return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
2026
+ # total_segments: 1,
2027
+ # segment: 1,
2028
+ # projection_expression: "ProjectionExpression",
2029
+ # filter_expression: "ConditionExpression",
2030
+ # expression_attribute_names: {
2031
+ # "ExpressionAttributeNameVariable" => "AttributeName",
2032
+ # },
2033
+ # expression_attribute_values: {
2034
+ # "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2035
+ # },
2036
+ # consistent_read: false,
2037
+ # })
2038
+ # @param [Hash] options ({})
2039
+ # @option options [String] :index_name
2040
+ # The name of a secondary index to scan. This index can be any local
2041
+ # secondary index or global secondary index. Note that if you use the
2042
+ # `IndexName` parameter, you must also provide `TableName`.
2043
+ # @option options [Array<String>] :attributes_to_get
2044
+ # This is a legacy parameter, for backward compatibility. New
2045
+ # applications should use *ProjectionExpression* instead. Do not combine
2046
+ # legacy parameters and expression parameters in a single API call;
2047
+ # otherwise, DynamoDB will return a *ValidationException* exception.
2048
+ #
2049
+ # This parameter allows you to retrieve attributes of type List or Map;
2050
+ # however, it cannot retrieve individual elements within a List or a
2051
+ # Map.
2052
+ #
2053
+ # The names of one or more attributes to retrieve. If no attribute names
2054
+ # are provided, then all attributes will be returned. If any of the
2055
+ # requested attributes are not found, they will not appear in the
2056
+ # result.
2057
+ #
2058
+ # Note that *AttributesToGet* has no effect on provisioned throughput
2059
+ # consumption. DynamoDB determines capacity units consumed based on item
2060
+ # size, not on the amount of data that is returned to an application.
2061
+ # @option options [Integer] :limit
2062
+ # The maximum number of items to evaluate (not necessarily the number of
2063
+ # matching items). If DynamoDB processes the number of items up to the
2064
+ # limit while processing the results, it stops the operation and returns
2065
+ # the matching values up to that point, and a key in *LastEvaluatedKey*
2066
+ # to apply in a subsequent operation, so that you can pick up where you
2067
+ # left off. Also, if the processed data set size exceeds 1 MB before
2068
+ # DynamoDB reaches this limit, it stops the operation and returns the
2069
+ # matching values up to the limit, and a key in *LastEvaluatedKey* to
2070
+ # apply in a subsequent operation to continue the operation. For more
2071
+ # information, see [Query and Scan][1] in the *Amazon DynamoDB Developer
2072
+ # Guide*.
2073
+ #
2074
+ #
2075
+ #
2076
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html
2077
+ # @option options [String] :select
2078
+ # The attributes to be returned in the result. You can retrieve all item
2079
+ # attributes, specific item attributes, or the count of matching items.
2080
+ #
2081
+ # * `ALL_ATTRIBUTES` - Returns all of the item attributes.
2082
+ #
2083
+ # * `ALL_PROJECTED_ATTRIBUTES` - Allowed only when querying an index.
2084
+ # Retrieves all attributes that have been projected into the index. If
2085
+ # the index is configured to project all attributes, this return value
2086
+ # is equivalent to specifying `ALL_ATTRIBUTES`.
2087
+ #
2088
+ # * `COUNT` - Returns the number of matching items, rather than the
2089
+ # matching items themselves.
2090
+ #
2091
+ # * `SPECIFIC_ATTRIBUTES` - Returns only the attributes listed in
2092
+ # *AttributesToGet*. This return value is equivalent to specifying
2093
+ # *AttributesToGet* without specifying any value for *Select*.
2094
+ #
2095
+ # If neither *Select* nor *AttributesToGet* are specified, DynamoDB
2096
+ # defaults to `ALL_ATTRIBUTES`. You cannot use both *AttributesToGet*
2097
+ # and *Select* together in a single request, unless the value for
2098
+ # *Select* is `SPECIFIC_ATTRIBUTES`. (This usage is equivalent to
2099
+ # specifying *AttributesToGet* without any value for *Select*.)
2100
+ # @option options [Hash<String,Types::Condition>] :scan_filter
2101
+ # This is a legacy parameter, for backward compatibility. New
2102
+ # applications should use *FilterExpression* instead. Do not combine
2103
+ # legacy parameters and expression parameters in a single API call;
2104
+ # otherwise, DynamoDB will return a *ValidationException* exception.
2105
+ #
2106
+ # A condition that evaluates the scan results and returns only the
2107
+ # desired values.
2108
+ #
2109
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
2110
+ #
2111
+ # </note>
2112
+ #
2113
+ # If you specify more than one condition in the *ScanFilter* map, then
2114
+ # by default all of the conditions must evaluate to true. In other
2115
+ # words, the conditions are ANDed together. (You can use the
2116
+ # *ConditionalOperator* parameter to OR the conditions instead. If you
2117
+ # do this, then at least one of the conditions must evaluate to true,
2118
+ # rather than all of them.)
2119
+ #
2120
+ # Each *ScanFilter* element consists of an attribute name to compare,
2121
+ # along with the following:
2122
+ #
2123
+ # * *AttributeValueList* - One or more values to evaluate against the
2124
+ # supplied attribute. The number of values in the list depends on the
2125
+ # operator specified in *ComparisonOperator* .
2126
+ #
2127
+ # For type Number, value comparisons are numeric.
2128
+ #
2129
+ # String value comparisons for greater than, equals, or less than are
2130
+ # based on ASCII character code values. For example, `a` is greater
2131
+ # than `A`, and `a` is greater than `B`. For a list of code values,
2132
+ # see
2133
+ # [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
2134
+ #
2135
+ # For Binary, DynamoDB treats each byte of the binary data as unsigned
2136
+ # when it compares binary values.
2137
+ #
2138
+ # For information on specifying data types in JSON, see [JSON Data
2139
+ # Format][2] in the *Amazon DynamoDB Developer Guide*.
2140
+ #
2141
+ # * *ComparisonOperator* - A comparator for evaluating attributes. For
2142
+ # example, equals, greater than, less than, etc.
2143
+ #
2144
+ # The following comparison operators are available:
2145
+ #
2146
+ # `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
2147
+ # NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
2148
+ #
2149
+ # For complete descriptions of all comparison operators, see
2150
+ # [Condition][3].
2151
+ #
2152
+ #
2153
+ #
2154
+ # [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
2155
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html
2156
+ # [3]: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html
2157
+ # @option options [String] :conditional_operator
2158
+ # This is a legacy parameter, for backward compatibility. New
2159
+ # applications should use *FilterExpression* instead. Do not combine
2160
+ # legacy parameters and expression parameters in a single API call;
2161
+ # otherwise, DynamoDB will return a *ValidationException* exception.
2162
+ #
2163
+ # A logical operator to apply to the conditions in a *ScanFilter* map:
2164
+ #
2165
+ # * `AND` - If all of the conditions evaluate to true, then the entire
2166
+ # map evaluates to true.
2167
+ #
2168
+ # * `OR` - If at least one of the conditions evaluate to true, then the
2169
+ # entire map evaluates to true.
2170
+ #
2171
+ # If you omit *ConditionalOperator*, then `AND` is the default.
2172
+ #
2173
+ # The operation will succeed only if the entire map evaluates to true.
2174
+ #
2175
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
2176
+ #
2177
+ # </note>
2178
+ # @option options [Hash<String,Types::AttributeValue>] :exclusive_start_key
2179
+ # The primary key of the first item that this operation will evaluate.
2180
+ # Use the value that was returned for *LastEvaluatedKey* in the previous
2181
+ # operation.
2182
+ #
2183
+ # The data type for *ExclusiveStartKey* must be String, Number or
2184
+ # Binary. No set data types are allowed.
2185
+ #
2186
+ # In a parallel scan, a *Scan* request that includes *ExclusiveStartKey*
2187
+ # must specify the same segment whose previous *Scan* returned the
2188
+ # corresponding value of *LastEvaluatedKey*.
2189
+ # @option options [String] :return_consumed_capacity
2190
+ # Determines the level of detail about provisioned throughput
2191
+ # consumption that is returned in the response:
2192
+ #
2193
+ # * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
2194
+ # for the operation, together with *ConsumedCapacity* for each table
2195
+ # and secondary index that was accessed.
2196
+ #
2197
+ # Note that some operations, such as *GetItem* and *BatchGetItem*, do
2198
+ # not access any indexes at all. In these cases, specifying *INDEXES*
2199
+ # will only return *ConsumedCapacity* information for table(s).
2200
+ #
2201
+ # * *TOTAL* - The response includes only the aggregate
2202
+ # *ConsumedCapacity* for the operation.
2203
+ #
2204
+ # * *NONE* - No *ConsumedCapacity* details are included in the response.
2205
+ # @option options [Integer] :total_segments
2206
+ # For a parallel *Scan* request, *TotalSegments* represents the total
2207
+ # number of segments into which the *Scan* operation will be divided.
2208
+ # The value of *TotalSegments* corresponds to the number of application
2209
+ # workers that will perform the parallel scan. For example, if you want
2210
+ # to use four application threads to scan a table or an index, specify a
2211
+ # *TotalSegments* value of 4.
2212
+ #
2213
+ # The value for *TotalSegments* must be greater than or equal to 1, and
2214
+ # less than or equal to 1000000. If you specify a *TotalSegments* value
2215
+ # of 1, the *Scan* operation will be sequential rather than parallel.
2216
+ #
2217
+ # If you specify *TotalSegments*, you must also specify *Segment*.
2218
+ # @option options [Integer] :segment
2219
+ # For a parallel *Scan* request, *Segment* identifies an individual
2220
+ # segment to be scanned by an application worker.
2221
+ #
2222
+ # Segment IDs are zero-based, so the first segment is always 0. For
2223
+ # example, if you want to use four application threads to scan a table
2224
+ # or an index, then the first thread specifies a *Segment* value of 0,
2225
+ # the second thread specifies 1, and so on.
2226
+ #
2227
+ # The value of *LastEvaluatedKey* returned from a parallel *Scan*
2228
+ # request must be used as *ExclusiveStartKey* with the same segment ID
2229
+ # in a subsequent *Scan* operation.
2230
+ #
2231
+ # The value for *Segment* must be greater than or equal to 0, and less
2232
+ # than the value provided for *TotalSegments*.
2233
+ #
2234
+ # If you provide *Segment*, you must also provide *TotalSegments*.
2235
+ # @option options [String] :projection_expression
2236
+ # A string that identifies one or more attributes to retrieve from the
2237
+ # specified table or index. These attributes can include scalars, sets,
2238
+ # or elements of a JSON document. The attributes in the expression must
2239
+ # be separated by commas.
2240
+ #
2241
+ # If no attribute names are specified, then all attributes will be
2242
+ # returned. If any of the requested attributes are not found, they will
2243
+ # not appear in the result.
2244
+ #
2245
+ # For more information, see [Accessing Item Attributes][1] in the
2246
+ # *Amazon DynamoDB Developer Guide*.
2247
+ #
2248
+ # <note markdown="1"> *ProjectionExpression* replaces the legacy *AttributesToGet*
2249
+ # parameter.
2250
+ #
2251
+ # </note>
2252
+ #
2253
+ #
2254
+ #
2255
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
2256
+ # @option options [String] :filter_expression
2257
+ # A string that contains conditions that DynamoDB applies after the
2258
+ # *Scan* operation, but before the data is returned to you. Items that
2259
+ # do not satisfy the *FilterExpression* criteria are not returned.
2260
+ #
2261
+ # <note markdown="1"> A *FilterExpression* is applied after the items have already been
2262
+ # read; the process of filtering does not consume any additional read
2263
+ # capacity units.
2264
+ #
2265
+ # </note>
2266
+ #
2267
+ # For more information, see [Filter Expressions][1] in the *Amazon
2268
+ # DynamoDB Developer Guide*.
2269
+ #
2270
+ # <note markdown="1"> *FilterExpression* replaces the legacy *ScanFilter* and
2271
+ # *ConditionalOperator* parameters.
2272
+ #
2273
+ # </note>
2274
+ #
2275
+ #
2276
+ #
2277
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#FilteringResults
2278
+ # @option options [Hash<String,String>] :expression_attribute_names
2279
+ # One or more substitution tokens for attribute names in an expression.
2280
+ # The following are some use cases for using
2281
+ # *ExpressionAttributeNames*\:
2282
+ #
2283
+ # * To access an attribute whose name conflicts with a DynamoDB reserved
2284
+ # word.
2285
+ #
2286
+ # * To create a placeholder for repeating occurrences of an attribute
2287
+ # name in an expression.
2288
+ #
2289
+ # * To prevent special characters in an attribute name from being
2290
+ # misinterpreted in an expression.
2291
+ #
2292
+ # Use the **#** character in an expression to dereference an attribute
2293
+ # name. For example, consider the following attribute name:
2294
+ #
2295
+ # * `Percentile`
2296
+ #
2297
+ # ^
2298
+ #
2299
+ # The name of this attribute conflicts with a reserved word, so it
2300
+ # cannot be used directly in an expression. (For the complete list of
2301
+ # reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
2302
+ # Developer Guide*). To work around this, you could specify the
2303
+ # following for *ExpressionAttributeNames*\:
2304
+ #
2305
+ # * `\{"#P":"Percentile"\}`
2306
+ #
2307
+ # ^
2308
+ #
2309
+ # You could then use this substitution in an expression, as in this
2310
+ # example:
2311
+ #
2312
+ # * `#P = :val`
2313
+ #
2314
+ # ^
2315
+ #
2316
+ # <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
2317
+ # values*, which are placeholders for the actual value at runtime.
2318
+ #
2319
+ # </note>
2320
+ #
2321
+ # For more information on expression attribute names, see [Accessing
2322
+ # Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
2323
+ #
2324
+ #
2325
+ #
2326
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
2327
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
2328
+ # @option options [Hash<String,Types::AttributeValue>] :expression_attribute_values
2329
+ # One or more values that can be substituted in an expression.
2330
+ #
2331
+ # Use the **\:** (colon) character in an expression to dereference an
2332
+ # attribute value. For example, suppose that you wanted to check whether
2333
+ # the value of the *ProductStatus* attribute was one of the following:
2334
+ #
2335
+ # `Available | Backordered | Discontinued`
2336
+ #
2337
+ # You would first need to specify *ExpressionAttributeValues* as
2338
+ # follows:
2339
+ #
2340
+ # `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
2341
+ # ":disc":\{"S":"Discontinued"\} \}`
2342
+ #
2343
+ # You could then use these values in an expression, such as this:
2344
+ #
2345
+ # `ProductStatus IN (:avail, :back, :disc)`
2346
+ #
2347
+ # For more information on expression attribute values, see [Specifying
2348
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
2349
+ #
2350
+ #
2351
+ #
2352
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
2353
+ # @option options [Boolean] :consistent_read
2354
+ # A Boolean value that determines the read consistency model during the
2355
+ # scan:
2356
+ #
2357
+ # * If *ConsistentRead* is `false`, then the data returned from *Scan*
2358
+ # might not contain the results from other recently completed write
2359
+ # operations (PutItem, UpdateItem or DeleteItem).
2360
+ #
2361
+ # * If *ConsistentRead* is `true`, then all of the write operations that
2362
+ # completed before the *Scan* began are guaranteed to be contained in
2363
+ # the *Scan* response.
2364
+ #
2365
+ # The default setting for *ConsistentRead* is `false`.
2366
+ #
2367
+ # The *ConsistentRead* parameter is not supported on global secondary
2368
+ # indexes. If you scan a global secondary index with *ConsistentRead*
2369
+ # set to true, you will receive a *ValidationException*.
2370
+ # @return [Types::ScanOutput]
2371
+ def scan(options = {})
2372
+ options = options.merge(table_name: @name)
2373
+ resp = @client.scan(options)
2374
+ resp.data
2375
+ end
2376
+
2377
+ # @example Request syntax with placeholder values
2378
+ #
2379
+ # table = table.update({
2380
+ # attribute_definitions: [
2381
+ # {
2382
+ # attribute_name: "KeySchemaAttributeName", # required
2383
+ # attribute_type: "S", # required, accepts S, N, B
2384
+ # },
2385
+ # ],
2386
+ # provisioned_throughput: {
2387
+ # read_capacity_units: 1, # required
2388
+ # write_capacity_units: 1, # required
2389
+ # },
2390
+ # global_secondary_index_updates: [
2391
+ # {
2392
+ # update: {
2393
+ # index_name: "IndexName", # required
2394
+ # provisioned_throughput: { # required
2395
+ # read_capacity_units: 1, # required
2396
+ # write_capacity_units: 1, # required
2397
+ # },
2398
+ # },
2399
+ # create: {
2400
+ # index_name: "IndexName", # required
2401
+ # key_schema: [ # required
2402
+ # {
2403
+ # attribute_name: "KeySchemaAttributeName", # required
2404
+ # key_type: "HASH", # required, accepts HASH, RANGE
2405
+ # },
2406
+ # ],
2407
+ # projection: { # required
2408
+ # projection_type: "ALL", # accepts ALL, KEYS_ONLY, INCLUDE
2409
+ # non_key_attributes: ["NonKeyAttributeName"],
2410
+ # },
2411
+ # provisioned_throughput: { # required
2412
+ # read_capacity_units: 1, # required
2413
+ # write_capacity_units: 1, # required
2414
+ # },
2415
+ # },
2416
+ # delete: {
2417
+ # index_name: "IndexName", # required
2418
+ # },
2419
+ # },
2420
+ # ],
2421
+ # stream_specification: {
2422
+ # stream_enabled: false,
2423
+ # stream_view_type: "NEW_IMAGE", # accepts NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES, KEYS_ONLY
2424
+ # },
2425
+ # })
2426
+ # @param [Hash] options ({})
2427
+ # @option options [Array<Types::AttributeDefinition>] :attribute_definitions
2428
+ # An array of attributes that describe the key schema for the table and
2429
+ # indexes. If you are adding a new global secondary index to the table,
2430
+ # *AttributeDefinitions* must include the key element(s) of the new
2431
+ # index.
2432
+ # @option options [Types::ProvisionedThroughput] :provisioned_throughput
2433
+ # Represents the provisioned throughput settings for a specified table
2434
+ # or index. The settings can be modified using the *UpdateTable*
2435
+ # operation.
2436
+ #
2437
+ # For current minimum and maximum provisioned throughput values, see
2438
+ # [Limits][1] in the *Amazon DynamoDB Developer Guide*.
2439
+ #
2440
+ #
2441
+ #
2442
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html
2443
+ # @option options [Array<Types::GlobalSecondaryIndexUpdate>] :global_secondary_index_updates
2444
+ # An array of one or more global secondary indexes for the table. For
2445
+ # each index in the array, you can request one action:
2446
+ #
2447
+ # * *Create* - add a new global secondary index to the table.
2448
+ #
2449
+ # * *Update* - modify the provisioned throughput settings of an existing
2450
+ # global secondary index.
2451
+ #
2452
+ # * *Delete* - remove a global secondary index from the table.
2453
+ #
2454
+ # For more information, see [Managing Global Secondary Indexes][1] in
2455
+ # the *Amazon DynamoDB Developer Guide*.
2456
+ #
2457
+ #
2458
+ #
2459
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html
2460
+ # @option options [Types::StreamSpecification] :stream_specification
2461
+ # Represents the DynamoDB Streams configuration for the table.
2462
+ #
2463
+ # <note markdown="1"> You will receive a *ResourceInUseException* if you attempt to enable a
2464
+ # stream on a table that already has a stream, or if you attempt to
2465
+ # disable a stream on a table which does not have a stream.
2466
+ #
2467
+ # </note>
2468
+ # @return [Table]
2469
+ def update(options = {})
2470
+ options = options.merge(table_name: @name)
2471
+ resp = @client.update_table(options)
2472
+ Table.new(
2473
+ name: @name,
2474
+ data: resp.data.table_description,
2475
+ client: @client
2476
+ )
2477
+ end
2478
+
2479
+ # @example Request syntax with placeholder values
2480
+ #
2481
+ # table.update_item({
2482
+ # key: { # required
2483
+ # "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2484
+ # },
2485
+ # attribute_updates: {
2486
+ # "AttributeName" => {
2487
+ # value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2488
+ # action: "ADD", # accepts ADD, PUT, DELETE
2489
+ # },
2490
+ # },
2491
+ # expected: {
2492
+ # "AttributeName" => {
2493
+ # value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2494
+ # exists: false,
2495
+ # comparison_operator: "EQ", # accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
2496
+ # attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2497
+ # },
2498
+ # },
2499
+ # conditional_operator: "AND", # accepts AND, OR
2500
+ # return_values: "NONE", # accepts NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW
2501
+ # return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
2502
+ # return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
2503
+ # update_expression: "UpdateExpression",
2504
+ # condition_expression: "ConditionExpression",
2505
+ # expression_attribute_names: {
2506
+ # "ExpressionAttributeNameVariable" => "AttributeName",
2507
+ # },
2508
+ # expression_attribute_values: {
2509
+ # "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
2510
+ # },
2511
+ # })
2512
+ # @param [Hash] options ({})
2513
+ # @option options [required, Hash<String,Types::AttributeValue>] :key
2514
+ # The primary key of the item to be updated. Each element consists of an
2515
+ # attribute name and a value for that attribute.
2516
+ #
2517
+ # For the primary key, you must provide all of the attributes. For
2518
+ # example, with a simple primary key, you only need to provide a value
2519
+ # for the partition key. For a composite primary key, you must provide
2520
+ # values for both the partition key and the sort key.
2521
+ # @option options [Hash<String,Types::AttributeValueUpdate>] :attribute_updates
2522
+ # This is a legacy parameter, for backward compatibility. New
2523
+ # applications should use *UpdateExpression* instead. Do not combine
2524
+ # legacy parameters and expression parameters in a single API call;
2525
+ # otherwise, DynamoDB will return a *ValidationException* exception.
2526
+ #
2527
+ # This parameter can be used for modifying top-level attributes;
2528
+ # however, it does not support individual list or map elements.
2529
+ #
2530
+ # The names of attributes to be modified, the action to perform on each,
2531
+ # and the new value for each. If you are updating an attribute that is
2532
+ # an index key attribute for any indexes on that table, the attribute
2533
+ # type must match the index key type defined in the
2534
+ # *AttributesDefinition* of the table description. You can use
2535
+ # *UpdateItem* to update any non-key attributes.
2536
+ #
2537
+ # Attribute values cannot be null. String and Binary type attributes
2538
+ # must have lengths greater than zero. Set type attributes must not be
2539
+ # empty. Requests with empty values will be rejected with a
2540
+ # *ValidationException* exception.
2541
+ #
2542
+ # Each *AttributeUpdates* element consists of an attribute name to
2543
+ # modify, along with the following:
2544
+ #
2545
+ # * *Value* - The new value, if applicable, for this attribute.
2546
+ #
2547
+ # * *Action* - A value that specifies how to perform the update. This
2548
+ # action is only valid for an existing attribute whose data type is
2549
+ # Number or is a set; do not use `ADD` for other data types.
2550
+ #
2551
+ # If an item with the specified primary key is found in the table, the
2552
+ # following values perform the following actions:
2553
+ #
2554
+ # * `PUT` - Adds the specified attribute to the item. If the attribute
2555
+ # already exists, it is replaced by the new value.
2556
+ #
2557
+ # * `DELETE` - Removes the attribute and its value, if no value is
2558
+ # specified for `DELETE`. The data type of the specified value must
2559
+ # match the existing value's data type.
2560
+ #
2561
+ # If a set of values is specified, then those values are subtracted
2562
+ # from the old set. For example, if the attribute value was the set
2563
+ # `[a,b,c]` and the `DELETE` action specifies `[a,c]`, then the
2564
+ # final attribute value is `[b]`. Specifying an empty set is an
2565
+ # error.
2566
+ #
2567
+ # * `ADD` - Adds the specified value to the item, if the attribute
2568
+ # does not already exist. If the attribute does exist, then the
2569
+ # behavior of `ADD` depends on the data type of the attribute:
2570
+ #
2571
+ # * If the existing attribute is a number, and if *Value* is also a
2572
+ # number, then *Value* is mathematically added to the existing
2573
+ # attribute. If *Value* is a negative number, then it is
2574
+ # subtracted from the existing attribute.
2575
+ #
2576
+ # <note markdown="1"> If you use `ADD` to increment or decrement a number value for an
2577
+ # item that doesn't exist before the update, DynamoDB uses 0 as
2578
+ # the initial value.
2579
+ #
2580
+ # Similarly, if you use `ADD` for an existing item to increment or
2581
+ # decrement an attribute value that doesn't exist before the
2582
+ # update, DynamoDB uses `0` as the initial value. For example,
2583
+ # suppose that the item you want to update doesn't have an
2584
+ # attribute named *itemcount*, but you decide to `ADD` the number
2585
+ # `3` to this attribute anyway. DynamoDB will create the
2586
+ # *itemcount* attribute, set its initial value to `0`, and finally
2587
+ # add `3` to it. The result will be a new *itemcount* attribute,
2588
+ # with a value of `3`.
2589
+ #
2590
+ # </note>
2591
+ #
2592
+ # * If the existing data type is a set, and if *Value* is also a
2593
+ # set, then *Value* is appended to the existing set. For example,
2594
+ # if the attribute value is the set `[1,2]`, and the `ADD` action
2595
+ # specified `[3]`, then the final attribute value is `[1,2,3]`. An
2596
+ # error occurs if an `ADD` action is specified for a set attribute
2597
+ # and the attribute type specified does not match the existing set
2598
+ # type.
2599
+ #
2600
+ # Both sets must have the same primitive data type. For example,
2601
+ # if the existing data type is a set of strings, *Value* must also
2602
+ # be a set of strings.
2603
+ #
2604
+ # If no item with the specified key is found in the table, the
2605
+ # following values perform the following actions:
2606
+ #
2607
+ # * `PUT` - Causes DynamoDB to create a new item with the specified
2608
+ # primary key, and then adds the attribute.
2609
+ #
2610
+ # * `DELETE` - Nothing happens, because attributes cannot be deleted
2611
+ # from a nonexistent item. The operation succeeds, but DynamoDB does
2612
+ # not create a new item.
2613
+ #
2614
+ # * `ADD` - Causes DynamoDB to create an item with the supplied
2615
+ # primary key and number (or set of numbers) for the attribute
2616
+ # value. The only data types allowed are Number and Number Set.
2617
+ #
2618
+ # If you provide any attributes that are part of an index key, then the
2619
+ # data types for those attributes must match those of the schema in the
2620
+ # table's attribute definition.
2621
+ # @option options [Hash<String,Types::ExpectedAttributeValue>] :expected
2622
+ # This is a legacy parameter, for backward compatibility. New
2623
+ # applications should use <i> ConditionExpression </i> instead. Do not
2624
+ # combine legacy parameters and expression parameters in a single API
2625
+ # call; otherwise, DynamoDB will return a *ValidationException*
2626
+ # exception.
2627
+ #
2628
+ # A map of attribute/condition pairs. *Expected* provides a conditional
2629
+ # block for the *UpdateItem* operation.
2630
+ #
2631
+ # Each element of *Expected* consists of an attribute name, a comparison
2632
+ # operator, and one or more values. DynamoDB compares the attribute with
2633
+ # the value(s) you supplied, using the comparison operator. For each
2634
+ # *Expected* element, the result of the evaluation is either true or
2635
+ # false.
2636
+ #
2637
+ # If you specify more than one element in the *Expected* map, then by
2638
+ # default all of the conditions must evaluate to true. In other words,
2639
+ # the conditions are ANDed together. (You can use the
2640
+ # *ConditionalOperator* parameter to OR the conditions instead. If you
2641
+ # do this, then at least one of the conditions must evaluate to true,
2642
+ # rather than all of them.)
2643
+ #
2644
+ # If the *Expected* map evaluates to true, then the conditional
2645
+ # operation succeeds; otherwise, it fails.
2646
+ #
2647
+ # *Expected* contains the following:
2648
+ #
2649
+ # * *AttributeValueList* - One or more values to evaluate against the
2650
+ # supplied attribute. The number of values in the list depends on the
2651
+ # *ComparisonOperator* being used.
2652
+ #
2653
+ # For type Number, value comparisons are numeric.
2654
+ #
2655
+ # String value comparisons for greater than, equals, or less than are
2656
+ # based on ASCII character code values. For example, `a` is greater
2657
+ # than `A`, and `a` is greater than `B`. For a list of code values,
2658
+ # see
2659
+ # [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
2660
+ #
2661
+ # For type Binary, DynamoDB treats each byte of the binary data as
2662
+ # unsigned when it compares binary values.
2663
+ #
2664
+ # * *ComparisonOperator* - A comparator for evaluating attributes in the
2665
+ # *AttributeValueList*. When performing the comparison, DynamoDB uses
2666
+ # strongly consistent reads.
2667
+ #
2668
+ # The following comparison operators are available:
2669
+ #
2670
+ # `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
2671
+ # NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
2672
+ #
2673
+ # The following are descriptions of each comparison operator.
2674
+ #
2675
+ # * `EQ`\: Equal. `EQ` is supported for all datatypes, including lists
2676
+ # and maps.
2677
+ #
2678
+ # *AttributeValueList* can contain only one *AttributeValue* element
2679
+ # of type String, Number, Binary, String Set, Number Set, or Binary
2680
+ # Set. If an item contains an *AttributeValue* element of a
2681
+ # different type than the one provided in the request, the value
2682
+ # does not match. For example, `\{"S":"6"\}` does not equal
2683
+ # `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not equal `\{"NS":["6",
2684
+ # "2", "1"]\}`.
2685
+ #
2686
+ #
2687
+ #
2688
+ # * `NE`\: Not equal. `NE` is supported for all datatypes, including
2689
+ # lists and maps.
2690
+ #
2691
+ # *AttributeValueList* can contain only one *AttributeValue* of type
2692
+ # String, Number, Binary, String Set, Number Set, or Binary Set. If
2693
+ # an item contains an *AttributeValue* of a different type than the
2694
+ # one provided in the request, the value does not match. For
2695
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
2696
+ # `\{"N":"6"\}` does not equal `\{"NS":["6", "2", "1"]\}`.
2697
+ #
2698
+ #
2699
+ #
2700
+ # * `LE`\: Less than or equal.
2701
+ #
2702
+ # *AttributeValueList* can contain only one *AttributeValue* element
2703
+ # of type String, Number, or Binary (not a set type). If an item
2704
+ # contains an *AttributeValue* element of a different type than the
2705
+ # one provided in the request, the value does not match. For
2706
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
2707
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
2708
+ #
2709
+ #
2710
+ #
2711
+ # * `LT`\: Less than.
2712
+ #
2713
+ # *AttributeValueList* can contain only one *AttributeValue* of type
2714
+ # String, Number, or Binary (not a set type). If an item contains an
2715
+ # *AttributeValue* element of a different type than the one provided
2716
+ # in the request, the value does not match. For example,
2717
+ # `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
2718
+ # does not compare to `\{"NS":["6", "2", "1"]\}`.
2719
+ #
2720
+ #
2721
+ #
2722
+ # * `GE`\: Greater than or equal.
2723
+ #
2724
+ # *AttributeValueList* can contain only one *AttributeValue* element
2725
+ # of type String, Number, or Binary (not a set type). If an item
2726
+ # contains an *AttributeValue* element of a different type than the
2727
+ # one provided in the request, the value does not match. For
2728
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
2729
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
2730
+ #
2731
+ #
2732
+ #
2733
+ # * `GT`\: Greater than.
2734
+ #
2735
+ # *AttributeValueList* can contain only one *AttributeValue* element
2736
+ # of type String, Number, or Binary (not a set type). If an item
2737
+ # contains an *AttributeValue* element of a different type than the
2738
+ # one provided in the request, the value does not match. For
2739
+ # example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
2740
+ # `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
2741
+ #
2742
+ #
2743
+ #
2744
+ # * `NOT_NULL`\: The attribute exists. `NOT_NULL` is supported for all
2745
+ # datatypes, including lists and maps.
2746
+ #
2747
+ # <note markdown="1"> This operator tests for the existence of an attribute, not its
2748
+ # data type. If the data type of attribute "`a`" is null, and you
2749
+ # evaluate it using `NOT_NULL`, the result is a Boolean *true*. This
2750
+ # result is because the attribute "`a`" exists; its data type is
2751
+ # not relevant to the `NOT_NULL` comparison operator.
2752
+ #
2753
+ # </note>
2754
+ #
2755
+ # * `NULL`\: The attribute does not exist. `NULL` is supported for all
2756
+ # datatypes, including lists and maps.
2757
+ #
2758
+ # <note markdown="1"> This operator tests for the nonexistence of an attribute, not its
2759
+ # data type. If the data type of attribute "`a`" is null, and you
2760
+ # evaluate it using `NULL`, the result is a Boolean *false*. This is
2761
+ # because the attribute "`a`" exists; its data type is not
2762
+ # relevant to the `NULL` comparison operator.
2763
+ #
2764
+ # </note>
2765
+ #
2766
+ # * `CONTAINS`\: Checks for a subsequence, or value in a set.
2767
+ #
2768
+ # *AttributeValueList* can contain only one *AttributeValue* element
2769
+ # of type String, Number, or Binary (not a set type). If the target
2770
+ # attribute of the comparison is of type String, then the operator
2771
+ # checks for a substring match. If the target attribute of the
2772
+ # comparison is of type Binary, then the operator looks for a
2773
+ # subsequence of the target that matches the input. If the target
2774
+ # attribute of the comparison is a set ("`SS`", "`NS`", or
2775
+ # "`BS`"), then the operator evaluates to true if it finds an
2776
+ # exact match with any member of the set.
2777
+ #
2778
+ # CONTAINS is supported for lists: When evaluating "`a CONTAINS
2779
+ # b`", "`a`" can be a list; however, "`b`" cannot be a set, a
2780
+ # map, or a list.
2781
+ #
2782
+ # * `NOT_CONTAINS`\: Checks for absence of a subsequence, or absence
2783
+ # of a value in a set.
2784
+ #
2785
+ # *AttributeValueList* can contain only one *AttributeValue* element
2786
+ # of type String, Number, or Binary (not a set type). If the target
2787
+ # attribute of the comparison is a String, then the operator checks
2788
+ # for the absence of a substring match. If the target attribute of
2789
+ # the comparison is Binary, then the operator checks for the absence
2790
+ # of a subsequence of the target that matches the input. If the
2791
+ # target attribute of the comparison is a set ("`SS`", "`NS`",
2792
+ # or "`BS`"), then the operator evaluates to true if it *does not*
2793
+ # find an exact match with any member of the set.
2794
+ #
2795
+ # NOT\_CONTAINS is supported for lists: When evaluating "`a NOT
2796
+ # CONTAINS b`", "`a`" can be a list; however, "`b`" cannot be a
2797
+ # set, a map, or a list.
2798
+ #
2799
+ # * `BEGINS_WITH`\: Checks for a prefix.
2800
+ #
2801
+ # *AttributeValueList* can contain only one *AttributeValue* of type
2802
+ # String or Binary (not a Number or a set type). The target
2803
+ # attribute of the comparison must be of type String or Binary (not
2804
+ # a Number or a set type).
2805
+ #
2806
+ #
2807
+ #
2808
+ # * `IN`\: Checks for matching elements within two sets.
2809
+ #
2810
+ # *AttributeValueList* can contain one or more *AttributeValue*
2811
+ # elements of type String, Number, or Binary (not a set type). These
2812
+ # attributes are compared against an existing set type attribute of
2813
+ # an item. If any elements of the input set are present in the item
2814
+ # attribute, the expression evaluates to true.
2815
+ #
2816
+ # * `BETWEEN`\: Greater than or equal to the first value, and less
2817
+ # than or equal to the second value.
2818
+ #
2819
+ # *AttributeValueList* must contain two *AttributeValue* elements of
2820
+ # the same type, either String, Number, or Binary (not a set type).
2821
+ # A target attribute matches if the target value is greater than, or
2822
+ # equal to, the first element and less than, or equal to, the second
2823
+ # element. If an item contains an *AttributeValue* element of a
2824
+ # different type than the one provided in the request, the value
2825
+ # does not match. For example, `\{"S":"6"\}` does not compare to
2826
+ # `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
2827
+ # `\{"NS":["6", "2", "1"]\}`
2828
+ #
2829
+ # For usage examples of *AttributeValueList* and *ComparisonOperator*,
2830
+ # see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
2831
+ # Developer Guide*.
2832
+ #
2833
+ # For backward compatibility with previous DynamoDB releases, the
2834
+ # following parameters can be used instead of *AttributeValueList* and
2835
+ # *ComparisonOperator*\:
2836
+ #
2837
+ # * *Value* - A value for DynamoDB to compare with an attribute.
2838
+ #
2839
+ # * *Exists* - A Boolean value that causes DynamoDB to evaluate the
2840
+ # value before attempting the conditional operation:
2841
+ #
2842
+ # * If *Exists* is `true`, DynamoDB will check to see if that
2843
+ # attribute value already exists in the table. If it is found, then
2844
+ # the condition evaluates to true; otherwise the condition evaluate
2845
+ # to false.
2846
+ #
2847
+ # * If *Exists* is `false`, DynamoDB assumes that the attribute value
2848
+ # does *not* exist in the table. If in fact the value does not
2849
+ # exist, then the assumption is valid and the condition evaluates to
2850
+ # true. If the value is found, despite the assumption that it does
2851
+ # not exist, the condition evaluates to false.
2852
+ #
2853
+ # Note that the default value for *Exists* is `true`.
2854
+ #
2855
+ # The *Value* and *Exists* parameters are incompatible with
2856
+ # *AttributeValueList* and *ComparisonOperator*. Note that if you use
2857
+ # both sets of parameters at once, DynamoDB will return a
2858
+ # *ValidationException* exception.
2859
+ #
2860
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
2861
+ #
2862
+ # </note>
2863
+ #
2864
+ #
2865
+ #
2866
+ # [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
2867
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
2868
+ # @option options [String] :conditional_operator
2869
+ # This is a legacy parameter, for backward compatibility. New
2870
+ # applications should use *ConditionExpression* instead. Do not combine
2871
+ # legacy parameters and expression parameters in a single API call;
2872
+ # otherwise, DynamoDB will return a *ValidationException* exception.
2873
+ #
2874
+ # A logical operator to apply to the conditions in the *Expected* map:
2875
+ #
2876
+ # * `AND` - If all of the conditions evaluate to true, then the entire
2877
+ # map evaluates to true.
2878
+ #
2879
+ # * `OR` - If at least one of the conditions evaluate to true, then the
2880
+ # entire map evaluates to true.
2881
+ #
2882
+ # If you omit *ConditionalOperator*, then `AND` is the default.
2883
+ #
2884
+ # The operation will succeed only if the entire map evaluates to true.
2885
+ #
2886
+ # <note markdown="1"> This parameter does not support attributes of type List or Map.
2887
+ #
2888
+ # </note>
2889
+ # @option options [String] :return_values
2890
+ # Use *ReturnValues* if you want to get the item attributes as they
2891
+ # appeared either before or after they were updated. For *UpdateItem*,
2892
+ # the valid values are:
2893
+ #
2894
+ # * `NONE` - If *ReturnValues* is not specified, or if its value is
2895
+ # `NONE`, then nothing is returned. (This setting is the default for
2896
+ # *ReturnValues*.)
2897
+ #
2898
+ # * `ALL_OLD` - If *UpdateItem* overwrote an attribute name-value pair,
2899
+ # then the content of the old item is returned.
2900
+ #
2901
+ # * `UPDATED_OLD` - The old versions of only the updated attributes are
2902
+ # returned.
2903
+ #
2904
+ # * `ALL_NEW` - All of the attributes of the new version of the item are
2905
+ # returned.
2906
+ #
2907
+ # * `UPDATED_NEW` - The new versions of only the updated attributes are
2908
+ # returned.
2909
+ #
2910
+ # There is no additional cost associated with requesting a return value
2911
+ # aside from the small network and processing overhead of receiving a
2912
+ # larger response. No Read Capacity Units are consumed.
2913
+ #
2914
+ # Values returned are strongly consistent
2915
+ # @option options [String] :return_consumed_capacity
2916
+ # Determines the level of detail about provisioned throughput
2917
+ # consumption that is returned in the response:
2918
+ #
2919
+ # * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
2920
+ # for the operation, together with *ConsumedCapacity* for each table
2921
+ # and secondary index that was accessed.
2922
+ #
2923
+ # Note that some operations, such as *GetItem* and *BatchGetItem*, do
2924
+ # not access any indexes at all. In these cases, specifying *INDEXES*
2925
+ # will only return *ConsumedCapacity* information for table(s).
2926
+ #
2927
+ # * *TOTAL* - The response includes only the aggregate
2928
+ # *ConsumedCapacity* for the operation.
2929
+ #
2930
+ # * *NONE* - No *ConsumedCapacity* details are included in the response.
2931
+ # @option options [String] :return_item_collection_metrics
2932
+ # Determines whether item collection metrics are returned. If set to
2933
+ # `SIZE`, the response includes statistics about item collections, if
2934
+ # any, that were modified during the operation are returned in the
2935
+ # response. If set to `NONE` (the default), no statistics are returned.
2936
+ # @option options [String] :update_expression
2937
+ # An expression that defines one or more attributes to be updated, the
2938
+ # action to be performed on them, and new value(s) for them.
2939
+ #
2940
+ # The following action values are available for *UpdateExpression*.
2941
+ #
2942
+ # * `SET` - Adds one or more attributes and values to an item. If any of
2943
+ # these attribute already exist, they are replaced by the new values.
2944
+ # You can also use `SET` to add or subtract from an attribute that is
2945
+ # of type Number. For example: `SET myNum = myNum + :val`
2946
+ #
2947
+ # `SET` supports the following functions:
2948
+ #
2949
+ # * `if_not_exists (path, operand)` - if the item does not contain an
2950
+ # attribute at the specified path, then `if_not_exists` evaluates to
2951
+ # operand; otherwise, it evaluates to path. You can use this
2952
+ # function to avoid overwriting an attribute that may already be
2953
+ # present in the item.
2954
+ #
2955
+ # * `list_append (operand, operand)` - evaluates to a list with a new
2956
+ # element added to it. You can append the new element to the start
2957
+ # or the end of the list by reversing the order of the operands.
2958
+ #
2959
+ # These function names are case-sensitive.
2960
+ #
2961
+ # * `REMOVE` - Removes one or more attributes from an item.
2962
+ #
2963
+ # * `ADD` - Adds the specified value to the item, if the attribute does
2964
+ # not already exist. If the attribute does exist, then the behavior of
2965
+ # `ADD` depends on the data type of the attribute:
2966
+ #
2967
+ # * If the existing attribute is a number, and if *Value* is also a
2968
+ # number, then *Value* is mathematically added to the existing
2969
+ # attribute. If *Value* is a negative number, then it is subtracted
2970
+ # from the existing attribute.
2971
+ #
2972
+ # <note markdown="1"> If you use `ADD` to increment or decrement a number value for an
2973
+ # item that doesn't exist before the update, DynamoDB uses `0` as
2974
+ # the initial value.
2975
+ #
2976
+ # Similarly, if you use `ADD` for an existing item to increment or
2977
+ # decrement an attribute value that doesn't exist before the
2978
+ # update, DynamoDB uses `0` as the initial value. For example,
2979
+ # suppose that the item you want to update doesn't have an
2980
+ # attribute named *itemcount*, but you decide to `ADD` the number
2981
+ # `3` to this attribute anyway. DynamoDB will create the *itemcount*
2982
+ # attribute, set its initial value to `0`, and finally add `3` to
2983
+ # it. The result will be a new *itemcount* attribute in the item,
2984
+ # with a value of `3`.
2985
+ #
2986
+ # </note>
2987
+ #
2988
+ # * If the existing data type is a set and if *Value* is also a set,
2989
+ # then *Value* is added to the existing set. For example, if the
2990
+ # attribute value is the set `[1,2]`, and the `ADD` action specified
2991
+ # `[3]`, then the final attribute value is `[1,2,3]`. An error
2992
+ # occurs if an `ADD` action is specified for a set attribute and the
2993
+ # attribute type specified does not match the existing set type.
2994
+ #
2995
+ # Both sets must have the same primitive data type. For example, if
2996
+ # the existing data type is a set of strings, the *Value* must also
2997
+ # be a set of strings.
2998
+ #
2999
+ # The `ADD` action only supports Number and set data types. In
3000
+ # addition, `ADD` can only be used on top-level attributes, not nested
3001
+ # attributes.
3002
+ #
3003
+ # * `DELETE` - Deletes an element from a set.
3004
+ #
3005
+ # If a set of values is specified, then those values are subtracted
3006
+ # from the old set. For example, if the attribute value was the set
3007
+ # `[a,b,c]` and the `DELETE` action specifies `[a,c]`, then the final
3008
+ # attribute value is `[b]`. Specifying an empty set is an error.
3009
+ #
3010
+ # The `DELETE` action only supports set data types. In addition,
3011
+ # `DELETE` can only be used on top-level attributes, not nested
3012
+ # attributes.
3013
+ #
3014
+ # You can have many actions in a single expression, such as the
3015
+ # following: `SET a=:value1, b=:value2 DELETE :value3, :value4, :value5`
3016
+ #
3017
+ # For more information on update expressions, see [Modifying Items and
3018
+ # Attributes][1] in the *Amazon DynamoDB Developer Guide*.
3019
+ #
3020
+ # <note markdown="1"> *UpdateExpression* replaces the legacy *AttributeUpdates* parameter.
3021
+ #
3022
+ # </note>
3023
+ #
3024
+ #
3025
+ #
3026
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html
3027
+ # @option options [String] :condition_expression
3028
+ # A condition that must be satisfied in order for a conditional update
3029
+ # to succeed.
3030
+ #
3031
+ # An expression can contain any of the following:
3032
+ #
3033
+ # * Functions: `attribute_exists | attribute_not_exists | attribute_type
3034
+ # | contains | begins_with | size`
3035
+ #
3036
+ # These function names are case-sensitive.
3037
+ #
3038
+ # * Comparison operators: ` = | &#x3C;&#x3E; | &#x3C; | &#x3E; | &#x3C;=
3039
+ # | &#x3E;= | BETWEEN | IN`
3040
+ #
3041
+ # * Logical operators: `AND | OR | NOT`
3042
+ #
3043
+ # For more information on condition expressions, see [Specifying
3044
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
3045
+ #
3046
+ # <note markdown="1"> *ConditionExpression* replaces the legacy *ConditionalOperator* and
3047
+ # *Expected* parameters.
3048
+ #
3049
+ # </note>
3050
+ #
3051
+ #
3052
+ #
3053
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
3054
+ # @option options [Hash<String,String>] :expression_attribute_names
3055
+ # One or more substitution tokens for attribute names in an expression.
3056
+ # The following are some use cases for using
3057
+ # *ExpressionAttributeNames*\:
3058
+ #
3059
+ # * To access an attribute whose name conflicts with a DynamoDB reserved
3060
+ # word.
3061
+ #
3062
+ # * To create a placeholder for repeating occurrences of an attribute
3063
+ # name in an expression.
3064
+ #
3065
+ # * To prevent special characters in an attribute name from being
3066
+ # misinterpreted in an expression.
3067
+ #
3068
+ # Use the **#** character in an expression to dereference an attribute
3069
+ # name. For example, consider the following attribute name:
3070
+ #
3071
+ # * `Percentile`
3072
+ #
3073
+ # ^
3074
+ #
3075
+ # The name of this attribute conflicts with a reserved word, so it
3076
+ # cannot be used directly in an expression. (For the complete list of
3077
+ # reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
3078
+ # Developer Guide*). To work around this, you could specify the
3079
+ # following for *ExpressionAttributeNames*\:
3080
+ #
3081
+ # * `\{"#P":"Percentile"\}`
3082
+ #
3083
+ # ^
3084
+ #
3085
+ # You could then use this substitution in an expression, as in this
3086
+ # example:
3087
+ #
3088
+ # * `#P = :val`
3089
+ #
3090
+ # ^
3091
+ #
3092
+ # <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
3093
+ # values*, which are placeholders for the actual value at runtime.
3094
+ #
3095
+ # </note>
3096
+ #
3097
+ # For more information on expression attribute names, see [Accessing
3098
+ # Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
3099
+ #
3100
+ #
3101
+ #
3102
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
3103
+ # [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
3104
+ # @option options [Hash<String,Types::AttributeValue>] :expression_attribute_values
3105
+ # One or more values that can be substituted in an expression.
3106
+ #
3107
+ # Use the **\:** (colon) character in an expression to dereference an
3108
+ # attribute value. For example, suppose that you wanted to check whether
3109
+ # the value of the *ProductStatus* attribute was one of the following:
3110
+ #
3111
+ # `Available | Backordered | Discontinued`
3112
+ #
3113
+ # You would first need to specify *ExpressionAttributeValues* as
3114
+ # follows:
3115
+ #
3116
+ # `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
3117
+ # ":disc":\{"S":"Discontinued"\} \}`
3118
+ #
3119
+ # You could then use these values in an expression, such as this:
3120
+ #
3121
+ # `ProductStatus IN (:avail, :back, :disc)`
3122
+ #
3123
+ # For more information on expression attribute values, see [Specifying
3124
+ # Conditions][1] in the *Amazon DynamoDB Developer Guide*.
3125
+ #
3126
+ #
3127
+ #
3128
+ # [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
3129
+ # @return [Types::UpdateItemOutput]
3130
+ def update_item(options = {})
3131
+ options = options.merge(table_name: @name)
3132
+ resp = @client.update_item(options)
3133
+ resp.data
3134
+ end
3135
+
3136
+ # @deprecated
3137
+ # @api private
3138
+ def identifiers
3139
+ { name: @name }
3140
+ end
3141
+ deprecated(:identifiers)
3142
+
3143
+ private
3144
+
3145
+ def extract_name(args, options)
3146
+ value = args[0] || options.delete(:name)
3147
+ case value
3148
+ when String then value
3149
+ when nil then raise ArgumentError, "missing required option :name"
3150
+ else
3151
+ msg = "expected :name to be a String, got #{value.class}"
3152
+ raise ArgumentError, msg
3153
+ end
3154
+ end
3155
+
3156
+ class Collection < Aws::Resources::Collection; end
3157
+ end
3158
+ end
3159
+ end