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.
- checksums.yaml +7 -0
- data/lib/aws-sdk-dynamodb.rb +49 -0
- data/lib/aws-sdk-dynamodb/attribute_value.rb +108 -0
- data/lib/aws-sdk-dynamodb/client.rb +4467 -0
- data/lib/aws-sdk-dynamodb/client_api.rb +783 -0
- data/lib/aws-sdk-dynamodb/customizations.rb +5 -0
- data/lib/aws-sdk-dynamodb/customizations/client.rb +31 -0
- data/lib/aws-sdk-dynamodb/errors.rb +23 -0
- data/lib/aws-sdk-dynamodb/plugins/crc32_validation.rb +56 -0
- data/lib/aws-sdk-dynamodb/plugins/extended_retries.rb +27 -0
- data/lib/aws-sdk-dynamodb/plugins/simple_attributes.rb +215 -0
- data/lib/aws-sdk-dynamodb/resource.rb +517 -0
- data/lib/aws-sdk-dynamodb/table.rb +3159 -0
- data/lib/aws-sdk-dynamodb/types.rb +6071 -0
- data/lib/aws-sdk-dynamodb/waiters.rb +92 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f95265c3a54cc59778e34414c01a8fb401cbd1ad
|
4
|
+
data.tar.gz: 3a14b56b0e7f2e4d552b5378f0a1d2a1c77107f0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 31b3209fe57a6e852e0a1cf109093cb88aff9c169a6d8eae6cc6aa76802a43bfb6339a833c1363d8c7c755c86ece23412390ee9158653eccc9376f0b0a9e0445
|
7
|
+
data.tar.gz: 5d5fd93e5967bd355568ba79f7e83068dee217a6931a3a73450ae073ae82369ecb0e8ee38c9922ea9a340c27bbf752a4bf88c51f1333631577678af626504726
|
@@ -0,0 +1,49 @@
|
|
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
|
+
require 'aws-sdk-core'
|
9
|
+
require 'aws-sigv4'
|
10
|
+
|
11
|
+
require_relative 'aws-sdk-dynamodb/types'
|
12
|
+
require_relative 'aws-sdk-dynamodb/client_api'
|
13
|
+
require_relative 'aws-sdk-dynamodb/client'
|
14
|
+
require_relative 'aws-sdk-dynamodb/errors'
|
15
|
+
require_relative 'aws-sdk-dynamodb/waiters'
|
16
|
+
require_relative 'aws-sdk-dynamodb/resource'
|
17
|
+
require_relative 'aws-sdk-dynamodb/table'
|
18
|
+
require_relative 'aws-sdk-dynamodb/customizations'
|
19
|
+
|
20
|
+
# This module provides support for Amazon DynamoDB. This module is available in the
|
21
|
+
# `aws-sdk-dynamodb` gem.
|
22
|
+
#
|
23
|
+
# # Client
|
24
|
+
#
|
25
|
+
# The {Client} class provides one method for each API operation. Operation
|
26
|
+
# methods each accept a hash of request parameters and return a response
|
27
|
+
# structure.
|
28
|
+
#
|
29
|
+
# See {Client} for more information.
|
30
|
+
#
|
31
|
+
# # Errors
|
32
|
+
#
|
33
|
+
# Errors returned from Amazon DynamoDB all
|
34
|
+
# extend {Errors::ServiceError}.
|
35
|
+
#
|
36
|
+
# begin
|
37
|
+
# # do stuff
|
38
|
+
# rescue Aws::DynamoDB::Errors::ServiceError
|
39
|
+
# # rescues all service API errors
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# See {Errors} for more information.
|
43
|
+
#
|
44
|
+
# @service
|
45
|
+
module Aws::DynamoDB
|
46
|
+
|
47
|
+
GEM_VERSION = '1.0.0.rc1'
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'bigdecimal'
|
2
|
+
require 'stringio'
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
module Aws
|
6
|
+
module DynamoDB
|
7
|
+
# @api private
|
8
|
+
class AttributeValue
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@marshaler = Marshaler.new
|
12
|
+
@unmarshaler = Unmarshaler.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def marshal(value)
|
16
|
+
@marshaler.format(value)
|
17
|
+
end
|
18
|
+
|
19
|
+
def unmarshal(value)
|
20
|
+
@unmarshaler.format(value)
|
21
|
+
end
|
22
|
+
|
23
|
+
class Marshaler
|
24
|
+
STRINGY_TEST = lambda { |val| val.respond_to?(:to_str) }
|
25
|
+
|
26
|
+
def format(obj)
|
27
|
+
case obj
|
28
|
+
when Hash
|
29
|
+
obj.each.with_object(m:{}) do |(key, value), map|
|
30
|
+
map[:m][key.to_s] = format(value)
|
31
|
+
end
|
32
|
+
when Array
|
33
|
+
obj.each.with_object(l:[]) do |value, list|
|
34
|
+
list[:l] << format(value)
|
35
|
+
end
|
36
|
+
when String then { s: obj }
|
37
|
+
when Symbol then { s: obj.to_s }
|
38
|
+
when STRINGY_TEST then { s: obj.to_str }
|
39
|
+
when Numeric then { n: obj.to_s }
|
40
|
+
when StringIO, IO then { b: obj }
|
41
|
+
when Set then format_set(obj)
|
42
|
+
when true, false then { bool: obj }
|
43
|
+
when nil then { null: true }
|
44
|
+
else
|
45
|
+
msg = "unsupported type, expected Hash, Array, Set, String, Numeric, "
|
46
|
+
msg << "IO, true, false, or nil, got #{obj.class.name}"
|
47
|
+
raise ArgumentError, msg
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def format_set(set)
|
54
|
+
case set.first
|
55
|
+
when String, Symbol then { ss: set.map(&:to_s) }
|
56
|
+
when STRINGY_TEST then { ss: set.map(&:to_str) }
|
57
|
+
when Numeric then { ns: set.map(&:to_s) }
|
58
|
+
when StringIO, IO then { bs: set.to_a }
|
59
|
+
else
|
60
|
+
msg = "set types only support String, Numeric, or IO objects"
|
61
|
+
raise ArgumentError, msg
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
class Unmarshaler
|
68
|
+
|
69
|
+
def format(obj)
|
70
|
+
type, value = extract_type_and_value(obj)
|
71
|
+
case type
|
72
|
+
when :m
|
73
|
+
value.each.with_object({}) do |(k, v), map|
|
74
|
+
map[k] = format(v)
|
75
|
+
end
|
76
|
+
when :l then value.map { |v| format(v) }
|
77
|
+
when :s then value
|
78
|
+
when :n then BigDecimal.new(value)
|
79
|
+
when :b then StringIO.new(value)
|
80
|
+
when :null then nil
|
81
|
+
when :bool then value
|
82
|
+
when :ss then Set.new(value)
|
83
|
+
when :ns then Set.new(value.map { |n| BigDecimal.new(n) })
|
84
|
+
when :bs then Set.new(value.map { |b| StringIO.new(b) })
|
85
|
+
else
|
86
|
+
raise ArgumentError, "unhandled type #{type.inspect}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def extract_type_and_value(obj)
|
93
|
+
case obj
|
94
|
+
when Hash then obj.to_a.first
|
95
|
+
when Struct
|
96
|
+
obj.members.each do |key|
|
97
|
+
value = obj[key]
|
98
|
+
return [key, value] unless value.nil?
|
99
|
+
end
|
100
|
+
else
|
101
|
+
raise ArgumentError, "unhandled type #{obj.inspect}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,4467 @@
|
|
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
|
+
require 'seahorse/client/plugins/content_length.rb'
|
9
|
+
require 'aws-sdk-core/plugins/credentials_configuration.rb'
|
10
|
+
require 'aws-sdk-core/plugins/logging.rb'
|
11
|
+
require 'aws-sdk-core/plugins/param_converter.rb'
|
12
|
+
require 'aws-sdk-core/plugins/param_validator.rb'
|
13
|
+
require 'aws-sdk-core/plugins/user_agent.rb'
|
14
|
+
require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
|
15
|
+
require 'aws-sdk-core/plugins/retry_errors.rb'
|
16
|
+
require 'aws-sdk-core/plugins/global_configuration.rb'
|
17
|
+
require 'aws-sdk-core/plugins/regional_endpoint.rb'
|
18
|
+
require 'aws-sdk-core/plugins/response_paging.rb'
|
19
|
+
require 'aws-sdk-core/plugins/stub_responses.rb'
|
20
|
+
require 'aws-sdk-core/plugins/idempotency_token.rb'
|
21
|
+
require 'aws-sdk-core/plugins/signature_v4.rb'
|
22
|
+
require 'aws-sdk-core/plugins/protocols/json_rpc.rb'
|
23
|
+
require 'aws-sdk-dynamodb/plugins/extended_retries.rb'
|
24
|
+
require 'aws-sdk-dynamodb/plugins/simple_attributes.rb'
|
25
|
+
require 'aws-sdk-dynamodb/plugins/crc32_validation.rb'
|
26
|
+
|
27
|
+
Aws::Plugins::GlobalConfiguration.add_identifier(:dynamodb)
|
28
|
+
|
29
|
+
module Aws
|
30
|
+
module DynamoDB
|
31
|
+
class Client < Seahorse::Client::Base
|
32
|
+
|
33
|
+
include Aws::ClientStubs
|
34
|
+
|
35
|
+
@identifier = :dynamodb
|
36
|
+
|
37
|
+
set_api(ClientApi::API)
|
38
|
+
|
39
|
+
add_plugin(Seahorse::Client::Plugins::ContentLength)
|
40
|
+
add_plugin(Aws::Plugins::CredentialsConfiguration)
|
41
|
+
add_plugin(Aws::Plugins::Logging)
|
42
|
+
add_plugin(Aws::Plugins::ParamConverter)
|
43
|
+
add_plugin(Aws::Plugins::ParamValidator)
|
44
|
+
add_plugin(Aws::Plugins::UserAgent)
|
45
|
+
add_plugin(Aws::Plugins::HelpfulSocketErrors)
|
46
|
+
add_plugin(Aws::Plugins::RetryErrors)
|
47
|
+
add_plugin(Aws::Plugins::GlobalConfiguration)
|
48
|
+
add_plugin(Aws::Plugins::RegionalEndpoint)
|
49
|
+
add_plugin(Aws::Plugins::ResponsePaging)
|
50
|
+
add_plugin(Aws::Plugins::StubResponses)
|
51
|
+
add_plugin(Aws::Plugins::IdempotencyToken)
|
52
|
+
add_plugin(Aws::Plugins::SignatureV4)
|
53
|
+
add_plugin(Aws::Plugins::Protocols::JsonRpc)
|
54
|
+
add_plugin(Aws::DynamoDB::Plugins::ExtendedRetries)
|
55
|
+
add_plugin(Aws::DynamoDB::Plugins::SimpleAttributes)
|
56
|
+
add_plugin(Aws::DynamoDB::Plugins::CRC32Validation)
|
57
|
+
|
58
|
+
# @option options [required, Aws::CredentialProvider] :credentials
|
59
|
+
# Your AWS credentials. This can be an instance of any one of the
|
60
|
+
# following classes:
|
61
|
+
#
|
62
|
+
# * `Aws::Credentials` - Used for configuring static, non-refreshing
|
63
|
+
# credentials.
|
64
|
+
#
|
65
|
+
# * `Aws::InstanceProfileCredentials` - Used for loading credentials
|
66
|
+
# from an EC2 IMDS on an EC2 instance.
|
67
|
+
#
|
68
|
+
# * `Aws::SharedCredentials` - Used for loading credentials from a
|
69
|
+
# shared file, such as `~/.aws/config`.
|
70
|
+
#
|
71
|
+
# * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
|
72
|
+
#
|
73
|
+
# When `:credentials` are not configured directly, the following
|
74
|
+
# locations will be searched for credentials:
|
75
|
+
#
|
76
|
+
# * `Aws.config[:credentials]`
|
77
|
+
# * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
|
78
|
+
# * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
|
79
|
+
# * `~/.aws/credentials`
|
80
|
+
# * `~/.aws/config`
|
81
|
+
# * EC2 IMDS instance profile - When used by default, the timeouts are
|
82
|
+
# very aggressive. Construct and pass an instance of
|
83
|
+
# `Aws::InstanceProfileCredentails` to enable retries and extended
|
84
|
+
# timeouts.
|
85
|
+
# @option options [required, String] :region
|
86
|
+
# The AWS region to connect to. The configured `:region` is
|
87
|
+
# used to determine the service `:endpoint`. When not passed,
|
88
|
+
# a default `:region` is search for in the following locations:
|
89
|
+
#
|
90
|
+
# * `Aws.config[:region]`
|
91
|
+
# * `ENV['AWS_REGION']`
|
92
|
+
# * `ENV['AMAZON_REGION']`
|
93
|
+
# * `ENV['AWS_DEFAULT_REGION']`
|
94
|
+
# * `~/.aws/credentials`
|
95
|
+
# * `~/.aws/config`
|
96
|
+
# @option options [String] :access_key_id
|
97
|
+
# @option options [Boolean] :compute_checksums (true)
|
98
|
+
# When `true`, a CRC32 checksum is computed of every HTTP
|
99
|
+
# response body and compared against the `X-Amz-Crc32` header.
|
100
|
+
# If the checksums do not match, the request is re-sent.
|
101
|
+
# Failures can be retried up to `:retry_limit` times.
|
102
|
+
# @option options [Boolean] :convert_params (true)
|
103
|
+
# When `true`, an attempt is made to coerce request parameters into
|
104
|
+
# the required types.
|
105
|
+
# @option options [String] :endpoint
|
106
|
+
# The client endpoint is normally constructed from the `:region`
|
107
|
+
# option. You should only configure an `:endpoint` when connecting
|
108
|
+
# to test endpoints. This should be avalid HTTP(S) URI.
|
109
|
+
# @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
|
110
|
+
# The log formatter.
|
111
|
+
# @option options [Symbol] :log_level (:info)
|
112
|
+
# The log level to send messages to the `:logger` at.
|
113
|
+
# @option options [Logger] :logger
|
114
|
+
# The Logger instance to send log messages to. If this option
|
115
|
+
# is not set, logging will be disabled.
|
116
|
+
# @option options [String] :profile ("default")
|
117
|
+
# Used when loading credentials from the shared credentials file
|
118
|
+
# at HOME/.aws/credentials. When not specified, 'default' is used.
|
119
|
+
# @option options [Integer] :retry_limit (3)
|
120
|
+
# The maximum number of times to retry failed requests. Only
|
121
|
+
# ~ 500 level server errors and certain ~ 400 level client errors
|
122
|
+
# are retried. Generally, these are throttling errors, data
|
123
|
+
# checksum errors, networking errors, timeout errors and auth
|
124
|
+
# errors from expired credentials.
|
125
|
+
# @option options [Integer] :retry_limit (10)
|
126
|
+
# The maximum number of times to retry failed requests. Only
|
127
|
+
# ~ 500 level server errors and certain ~ 400 level client errors
|
128
|
+
# are retried. Generally, these are throttling errors, data
|
129
|
+
# checksum errors, networking errors, timeout errors and auth
|
130
|
+
# errors from expired credentials.
|
131
|
+
# @option options [String] :secret_access_key
|
132
|
+
# @option options [String] :session_token
|
133
|
+
# @option options [Boolean] :simple_attributes (true)
|
134
|
+
# Enables working with DynamoDB attribute values using
|
135
|
+
# hashes, arrays, sets, integers, floats, booleans, and nil.
|
136
|
+
#
|
137
|
+
# Disabling this option requires that all attribute values have
|
138
|
+
# their types specified, e.g. `{ s: 'abc' }` instead of simply
|
139
|
+
# `'abc'`.
|
140
|
+
# @option options [Boolean] :simple_json (false)
|
141
|
+
# Disables request parameter conversion, validation, and formatting.
|
142
|
+
# Also disable response data type conversions. This option is useful
|
143
|
+
# when you want to ensure the highest level of performance by
|
144
|
+
# avoiding overhead of walking request parameters and response data
|
145
|
+
# structures.
|
146
|
+
#
|
147
|
+
# When `:simple_json` is enabled, the request parameters hash must
|
148
|
+
# be formatted exactly as the DynamoDB API expects.
|
149
|
+
# @option options [Boolean] :stub_responses (false)
|
150
|
+
# Causes the client to return stubbed responses. By default
|
151
|
+
# fake responses are generated and returned. You can specify
|
152
|
+
# the response data to return or errors to raise by calling
|
153
|
+
# {ClientStubs#stub_responses}. See {ClientStubs} for more information.
|
154
|
+
#
|
155
|
+
# ** Please note ** When response stubbing is enabled, no HTTP
|
156
|
+
# requests are made, and retries are disabled.
|
157
|
+
# @option options [Boolean] :validate_params (true)
|
158
|
+
# When `true`, request parameters are validated before
|
159
|
+
# sending the request.
|
160
|
+
def initialize(*args)
|
161
|
+
super
|
162
|
+
end
|
163
|
+
|
164
|
+
# @!group API Operations
|
165
|
+
|
166
|
+
# The *BatchGetItem* operation returns the attributes of one or more
|
167
|
+
# items from one or more tables. You identify requested items by primary
|
168
|
+
# key.
|
169
|
+
#
|
170
|
+
# A single operation can retrieve up to 16 MB of data, which can contain
|
171
|
+
# as many as 100 items. *BatchGetItem* will return a partial result if
|
172
|
+
# the response size limit is exceeded, the table's provisioned
|
173
|
+
# throughput is exceeded, or an internal processing failure occurs. If a
|
174
|
+
# partial result is returned, the operation returns a value for
|
175
|
+
# *UnprocessedKeys*. You can use this value to retry the operation
|
176
|
+
# starting with the next item to get.
|
177
|
+
#
|
178
|
+
# If you request more than 100 items *BatchGetItem* will return a
|
179
|
+
# *ValidationException* with the message "Too many items requested for
|
180
|
+
# the BatchGetItem call".
|
181
|
+
#
|
182
|
+
# For example, if you ask to retrieve 100 items, but each individual
|
183
|
+
# item is 300 KB in size, the system returns 52 items (so as not to
|
184
|
+
# exceed the 16 MB limit). It also returns an appropriate
|
185
|
+
# *UnprocessedKeys* value so you can get the next page of results. If
|
186
|
+
# desired, your application can include its own logic to assemble the
|
187
|
+
# pages of results into one data set.
|
188
|
+
#
|
189
|
+
# If *none* of the items can be processed due to insufficient
|
190
|
+
# provisioned throughput on all of the tables in the request, then
|
191
|
+
# *BatchGetItem* will return a *ProvisionedThroughputExceededException*.
|
192
|
+
# If *at least one* of the items is successfully processed, then
|
193
|
+
# *BatchGetItem* completes successfully, while returning the keys of the
|
194
|
+
# unread items in *UnprocessedKeys*.
|
195
|
+
#
|
196
|
+
# If DynamoDB returns any unprocessed items, you should retry the batch
|
197
|
+
# operation on those items. However, *we strongly recommend that you use
|
198
|
+
# an exponential backoff algorithm*. If you retry the batch operation
|
199
|
+
# immediately, the underlying read or write requests can still fail due
|
200
|
+
# to throttling on the individual tables. If you delay the batch
|
201
|
+
# operation using exponential backoff, the individual requests in the
|
202
|
+
# batch are much more likely to succeed.
|
203
|
+
#
|
204
|
+
# For more information, see [Batch Operations and Error Handling][1] in
|
205
|
+
# the *Amazon DynamoDB Developer Guide*.
|
206
|
+
#
|
207
|
+
# By default, *BatchGetItem* performs eventually consistent reads on
|
208
|
+
# every table in the request. If you want strongly consistent reads
|
209
|
+
# instead, you can set *ConsistentRead* to `true` for any or all tables.
|
210
|
+
#
|
211
|
+
# In order to minimize response latency, *BatchGetItem* retrieves items
|
212
|
+
# in parallel.
|
213
|
+
#
|
214
|
+
# When designing your application, keep in mind that DynamoDB does not
|
215
|
+
# return items in any particular order. To help parse the response by
|
216
|
+
# item, include the primary key values for the items in your request in
|
217
|
+
# the *AttributesToGet* parameter.
|
218
|
+
#
|
219
|
+
# If a requested item does not exist, it is not returned in the result.
|
220
|
+
# Requests for nonexistent items consume the minimum read capacity units
|
221
|
+
# according to the type of read. For more information, see [Capacity
|
222
|
+
# Units Calculations][2] in the *Amazon DynamoDB Developer Guide*.
|
223
|
+
#
|
224
|
+
#
|
225
|
+
#
|
226
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ErrorHandling.html#BatchOperations
|
227
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#CapacityUnitCalculations
|
228
|
+
# @option params [required, Hash<String,Types::KeysAndAttributes>] :request_items
|
229
|
+
# A map of one or more table names and, for each table, a map that
|
230
|
+
# describes one or more items to retrieve from that table. Each table
|
231
|
+
# name can be used only once per *BatchGetItem* request.
|
232
|
+
#
|
233
|
+
# Each element in the map of items to retrieve consists of the
|
234
|
+
# following:
|
235
|
+
#
|
236
|
+
# * *ConsistentRead* - If `true`, a strongly consistent read is used; if
|
237
|
+
# `false` (the default), an eventually consistent read is used.
|
238
|
+
#
|
239
|
+
# * *ExpressionAttributeNames* - One or more substitution tokens for
|
240
|
+
# attribute names in the *ProjectionExpression* parameter. The
|
241
|
+
# following are some use cases for using *ExpressionAttributeNames*\:
|
242
|
+
#
|
243
|
+
# * To access an attribute whose name conflicts with a DynamoDB
|
244
|
+
# reserved word.
|
245
|
+
#
|
246
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
247
|
+
# name in an expression.
|
248
|
+
#
|
249
|
+
# * To prevent special characters in an attribute name from being
|
250
|
+
# misinterpreted in an expression.
|
251
|
+
#
|
252
|
+
# Use the **#** character in an expression to dereference an attribute
|
253
|
+
# name. For example, consider the following attribute name:
|
254
|
+
#
|
255
|
+
# * `Percentile`
|
256
|
+
#
|
257
|
+
# ^
|
258
|
+
#
|
259
|
+
# The name of this attribute conflicts with a reserved word, so it
|
260
|
+
# cannot be used directly in an expression. (For the complete list of
|
261
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
262
|
+
# Developer Guide*). To work around this, you could specify the
|
263
|
+
# following for *ExpressionAttributeNames*\:
|
264
|
+
#
|
265
|
+
# * `\{"#P":"Percentile"\}`
|
266
|
+
#
|
267
|
+
# ^
|
268
|
+
#
|
269
|
+
# You could then use this substitution in an expression, as in this
|
270
|
+
# example:
|
271
|
+
#
|
272
|
+
# * `#P = :val`
|
273
|
+
#
|
274
|
+
# ^
|
275
|
+
#
|
276
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression
|
277
|
+
# attribute values*, which are placeholders for the actual value at
|
278
|
+
# runtime.
|
279
|
+
#
|
280
|
+
# </note>
|
281
|
+
#
|
282
|
+
# For more information on expression attribute names, see [Accessing
|
283
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
284
|
+
#
|
285
|
+
# * *Keys* - An array of primary key attribute values that define
|
286
|
+
# specific items in the table. For each primary key, you must provide
|
287
|
+
# *all* of the key attributes. For example, with a simple primary key,
|
288
|
+
# you only need to provide the partition key value. For a composite
|
289
|
+
# key, you must provide *both* the partition key value and the sort
|
290
|
+
# key value.
|
291
|
+
#
|
292
|
+
# * *ProjectionExpression* - A string that identifies one or more
|
293
|
+
# attributes to retrieve from the table. These attributes can include
|
294
|
+
# scalars, sets, or elements of a JSON document. The attributes in the
|
295
|
+
# expression must be separated by commas.
|
296
|
+
#
|
297
|
+
# If no attribute names are specified, then all attributes will be
|
298
|
+
# returned. If any of the requested attributes are not found, they
|
299
|
+
# will not appear in the result.
|
300
|
+
#
|
301
|
+
# For more information, see [Accessing Item Attributes][2] in the
|
302
|
+
# *Amazon DynamoDB Developer Guide*.
|
303
|
+
#
|
304
|
+
# * *AttributesToGet* -
|
305
|
+
#
|
306
|
+
# This is a legacy parameter, for backward compatibility. New
|
307
|
+
# applications should use *ProjectionExpression* instead. Do not
|
308
|
+
# combine legacy parameters and expression parameters in a single API
|
309
|
+
# call; otherwise, DynamoDB will return a *ValidationException*
|
310
|
+
# exception.
|
311
|
+
#
|
312
|
+
# This parameter allows you to retrieve attributes of type List or
|
313
|
+
# Map; however, it cannot retrieve individual elements within a List
|
314
|
+
# or a Map.
|
315
|
+
#
|
316
|
+
# The names of one or more attributes to retrieve. If no attribute
|
317
|
+
# names are provided, then all attributes will be returned. If any of
|
318
|
+
# the requested attributes are not found, they will not appear in the
|
319
|
+
# result.
|
320
|
+
#
|
321
|
+
# Note that *AttributesToGet* has no effect on provisioned throughput
|
322
|
+
# consumption. DynamoDB determines capacity units consumed based on
|
323
|
+
# item size, not on the amount of data that is returned to an
|
324
|
+
# application.
|
325
|
+
#
|
326
|
+
#
|
327
|
+
#
|
328
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
329
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
330
|
+
# @option params [String] :return_consumed_capacity
|
331
|
+
# Determines the level of detail about provisioned throughput
|
332
|
+
# consumption that is returned in the response:
|
333
|
+
#
|
334
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
335
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
336
|
+
# and secondary index that was accessed.
|
337
|
+
#
|
338
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
339
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
340
|
+
# will only return *ConsumedCapacity* information for table(s).
|
341
|
+
#
|
342
|
+
# * *TOTAL* - The response includes only the aggregate
|
343
|
+
# *ConsumedCapacity* for the operation.
|
344
|
+
#
|
345
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
346
|
+
# @return [Types::BatchGetItemOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
347
|
+
#
|
348
|
+
# * {Types::BatchGetItemOutput#responses #Responses} => Hash<String,Array<Hash<String,Types::AttributeValue>>>
|
349
|
+
# * {Types::BatchGetItemOutput#unprocessed_keys #UnprocessedKeys} => Hash<String,Types::KeysAndAttributes>
|
350
|
+
# * {Types::BatchGetItemOutput#consumed_capacity #ConsumedCapacity} => Array<Types::ConsumedCapacity>
|
351
|
+
#
|
352
|
+
# @example Request syntax with placeholder values
|
353
|
+
# resp = client.batch_get_item({
|
354
|
+
# request_items: { # required
|
355
|
+
# "TableName" => {
|
356
|
+
# keys: [ # required
|
357
|
+
# {
|
358
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
359
|
+
# },
|
360
|
+
# ],
|
361
|
+
# attributes_to_get: ["AttributeName"],
|
362
|
+
# consistent_read: false,
|
363
|
+
# projection_expression: "ProjectionExpression",
|
364
|
+
# expression_attribute_names: {
|
365
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
366
|
+
# },
|
367
|
+
# },
|
368
|
+
# },
|
369
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
370
|
+
# })
|
371
|
+
#
|
372
|
+
# @example Response structure
|
373
|
+
# resp.responses #=> Hash
|
374
|
+
# resp.responses["TableName"] #=> Array
|
375
|
+
# resp.responses["TableName"][0] #=> Hash
|
376
|
+
# resp.responses["TableName"][0]["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
377
|
+
# resp.unprocessed_keys #=> Hash
|
378
|
+
# resp.unprocessed_keys["TableName"].keys #=> Array
|
379
|
+
# resp.unprocessed_keys["TableName"].keys[0] #=> Hash
|
380
|
+
# resp.unprocessed_keys["TableName"].keys[0]["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
381
|
+
# resp.unprocessed_keys["TableName"].attributes_to_get #=> Array
|
382
|
+
# resp.unprocessed_keys["TableName"].attributes_to_get[0] #=> String
|
383
|
+
# resp.unprocessed_keys["TableName"].consistent_read #=> Boolean
|
384
|
+
# resp.unprocessed_keys["TableName"].projection_expression #=> String
|
385
|
+
# resp.unprocessed_keys["TableName"].expression_attribute_names #=> Hash
|
386
|
+
# resp.unprocessed_keys["TableName"].expression_attribute_names["ExpressionAttributeNameVariable"] #=> String
|
387
|
+
# resp.consumed_capacity #=> Array
|
388
|
+
# resp.consumed_capacity[0].table_name #=> String
|
389
|
+
# resp.consumed_capacity[0].capacity_units #=> Float
|
390
|
+
# resp.consumed_capacity[0].table.capacity_units #=> Float
|
391
|
+
# resp.consumed_capacity[0].local_secondary_indexes #=> Hash
|
392
|
+
# resp.consumed_capacity[0].local_secondary_indexes["IndexName"].capacity_units #=> Float
|
393
|
+
# resp.consumed_capacity[0].global_secondary_indexes #=> Hash
|
394
|
+
# resp.consumed_capacity[0].global_secondary_indexes["IndexName"].capacity_units #=> Float
|
395
|
+
# @overload batch_get_item(params = {})
|
396
|
+
# @param [Hash] params ({})
|
397
|
+
def batch_get_item(params = {}, options = {})
|
398
|
+
req = build_request(:batch_get_item, params)
|
399
|
+
req.send_request(options)
|
400
|
+
end
|
401
|
+
|
402
|
+
# The *BatchWriteItem* operation puts or deletes multiple items in one
|
403
|
+
# or more tables. A single call to *BatchWriteItem* can write up to 16
|
404
|
+
# MB of data, which can comprise as many as 25 put or delete requests.
|
405
|
+
# Individual items to be written can be as large as 400 KB.
|
406
|
+
#
|
407
|
+
# <note markdown="1"> *BatchWriteItem* cannot update items. To update items, use the
|
408
|
+
# *UpdateItem* API.
|
409
|
+
#
|
410
|
+
# </note>
|
411
|
+
#
|
412
|
+
# The individual *PutItem* and *DeleteItem* operations specified in
|
413
|
+
# *BatchWriteItem* are atomic; however *BatchWriteItem* as a whole is
|
414
|
+
# not. If any requested operations fail because the table's provisioned
|
415
|
+
# throughput is exceeded or an internal processing failure occurs, the
|
416
|
+
# failed operations are returned in the *UnprocessedItems* response
|
417
|
+
# parameter. You can investigate and optionally resend the requests.
|
418
|
+
# Typically, you would call *BatchWriteItem* in a loop. Each iteration
|
419
|
+
# would check for unprocessed items and submit a new *BatchWriteItem*
|
420
|
+
# request with those unprocessed items until all items have been
|
421
|
+
# processed.
|
422
|
+
#
|
423
|
+
# Note that if *none* of the items can be processed due to insufficient
|
424
|
+
# provisioned throughput on all of the tables in the request, then
|
425
|
+
# *BatchWriteItem* will return a
|
426
|
+
# *ProvisionedThroughputExceededException*.
|
427
|
+
#
|
428
|
+
# If DynamoDB returns any unprocessed items, you should retry the batch
|
429
|
+
# operation on those items. However, *we strongly recommend that you use
|
430
|
+
# an exponential backoff algorithm*. If you retry the batch operation
|
431
|
+
# immediately, the underlying read or write requests can still fail due
|
432
|
+
# to throttling on the individual tables. If you delay the batch
|
433
|
+
# operation using exponential backoff, the individual requests in the
|
434
|
+
# batch are much more likely to succeed.
|
435
|
+
#
|
436
|
+
# For more information, see [Batch Operations and Error Handling][1] in
|
437
|
+
# the *Amazon DynamoDB Developer Guide*.
|
438
|
+
#
|
439
|
+
# With *BatchWriteItem*, you can efficiently write or delete large
|
440
|
+
# amounts of data, such as from Amazon Elastic MapReduce (EMR), or copy
|
441
|
+
# data from another database into DynamoDB. In order to improve
|
442
|
+
# performance with these large-scale operations, *BatchWriteItem* does
|
443
|
+
# not behave in the same way as individual *PutItem* and *DeleteItem*
|
444
|
+
# calls would. For example, you cannot specify conditions on individual
|
445
|
+
# put and delete requests, and *BatchWriteItem* does not return deleted
|
446
|
+
# items in the response.
|
447
|
+
#
|
448
|
+
# If you use a programming language that supports concurrency, you can
|
449
|
+
# use threads to write items in parallel. Your application must include
|
450
|
+
# the necessary logic to manage the threads. With languages that don't
|
451
|
+
# support threading, you must update or delete the specified items one
|
452
|
+
# at a time. In both situations, *BatchWriteItem* provides an
|
453
|
+
# alternative where the API performs the specified put and delete
|
454
|
+
# operations in parallel, giving you the power of the thread pool
|
455
|
+
# approach without having to introduce complexity into your application.
|
456
|
+
#
|
457
|
+
# Parallel processing reduces latency, but each specified put and delete
|
458
|
+
# request consumes the same number of write capacity units whether it is
|
459
|
+
# processed in parallel or not. Delete operations on nonexistent items
|
460
|
+
# consume one write capacity unit.
|
461
|
+
#
|
462
|
+
# If one or more of the following is true, DynamoDB rejects the entire
|
463
|
+
# batch write operation:
|
464
|
+
#
|
465
|
+
# * One or more tables specified in the *BatchWriteItem* request does
|
466
|
+
# not exist.
|
467
|
+
#
|
468
|
+
# * Primary key attributes specified on an item in the request do not
|
469
|
+
# match those in the corresponding table's primary key schema.
|
470
|
+
#
|
471
|
+
# * You try to perform multiple operations on the same item in the same
|
472
|
+
# *BatchWriteItem* request. For example, you cannot put and delete the
|
473
|
+
# same item in the same *BatchWriteItem* request.
|
474
|
+
#
|
475
|
+
# * There are more than 25 requests in the batch.
|
476
|
+
#
|
477
|
+
# * Any individual item in a batch exceeds 400 KB.
|
478
|
+
#
|
479
|
+
# * The total request size exceeds 16 MB.
|
480
|
+
#
|
481
|
+
#
|
482
|
+
#
|
483
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ErrorHandling.html#BatchOperations
|
484
|
+
# @option params [required, Hash<String,Array>] :request_items
|
485
|
+
# A map of one or more table names and, for each table, a list of
|
486
|
+
# operations to be performed (*DeleteRequest* or *PutRequest*). Each
|
487
|
+
# element in the map consists of the following:
|
488
|
+
#
|
489
|
+
# * *DeleteRequest* - Perform a *DeleteItem* operation on the specified
|
490
|
+
# item. The item to be deleted is identified by a *Key* subelement:
|
491
|
+
#
|
492
|
+
# * *Key* - A map of primary key attribute values that uniquely
|
493
|
+
# identify the ! item. Each entry in this map consists of an
|
494
|
+
# attribute name and an attribute value. For each primary key, you
|
495
|
+
# must provide *all* of the key attributes. For example, with a
|
496
|
+
# simple primary key, you only need to provide a value for the
|
497
|
+
# partition key. For a composite primary key, you must provide
|
498
|
+
# values for *both* the partition key and the sort key.
|
499
|
+
#
|
500
|
+
# ^
|
501
|
+
#
|
502
|
+
# * *PutRequest* - Perform a *PutItem* operation on the specified item.
|
503
|
+
# The item to be put is identified by an *Item* subelement:
|
504
|
+
#
|
505
|
+
# * *Item* - A map of attributes and their values. Each entry in this
|
506
|
+
# map consists of an attribute name and an attribute value.
|
507
|
+
# Attribute values must not be null; string and binary type
|
508
|
+
# attributes must have lengths greater than zero; and set type
|
509
|
+
# attributes must not be empty. Requests that contain empty values
|
510
|
+
# will be rejected with a *ValidationException* exception.
|
511
|
+
#
|
512
|
+
# If you specify any attributes that are part of an index key, then
|
513
|
+
# the data types for those attributes must match those of the schema
|
514
|
+
# in the table's attribute definition.
|
515
|
+
# @option params [String] :return_consumed_capacity
|
516
|
+
# Determines the level of detail about provisioned throughput
|
517
|
+
# consumption that is returned in the response:
|
518
|
+
#
|
519
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
520
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
521
|
+
# and secondary index that was accessed.
|
522
|
+
#
|
523
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
524
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
525
|
+
# will only return *ConsumedCapacity* information for table(s).
|
526
|
+
#
|
527
|
+
# * *TOTAL* - The response includes only the aggregate
|
528
|
+
# *ConsumedCapacity* for the operation.
|
529
|
+
#
|
530
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
531
|
+
# @option params [String] :return_item_collection_metrics
|
532
|
+
# Determines whether item collection metrics are returned. If set to
|
533
|
+
# `SIZE`, the response includes statistics about item collections, if
|
534
|
+
# any, that were modified during the operation are returned in the
|
535
|
+
# response. If set to `NONE` (the default), no statistics are returned.
|
536
|
+
# @return [Types::BatchWriteItemOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
537
|
+
#
|
538
|
+
# * {Types::BatchWriteItemOutput#unprocessed_items #UnprocessedItems} => Hash<String,Array<Types::WriteRequest>>
|
539
|
+
# * {Types::BatchWriteItemOutput#item_collection_metrics #ItemCollectionMetrics} => Hash<String,Array<Types::ItemCollectionMetrics>>
|
540
|
+
# * {Types::BatchWriteItemOutput#consumed_capacity #ConsumedCapacity} => Array<Types::ConsumedCapacity>
|
541
|
+
#
|
542
|
+
# @example Request syntax with placeholder values
|
543
|
+
# resp = client.batch_write_item({
|
544
|
+
# request_items: { # required
|
545
|
+
# "TableName" => [
|
546
|
+
# {
|
547
|
+
# put_request: {
|
548
|
+
# item: { # required
|
549
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
550
|
+
# },
|
551
|
+
# },
|
552
|
+
# delete_request: {
|
553
|
+
# key: { # required
|
554
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
555
|
+
# },
|
556
|
+
# },
|
557
|
+
# },
|
558
|
+
# ],
|
559
|
+
# },
|
560
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
561
|
+
# return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
|
562
|
+
# })
|
563
|
+
#
|
564
|
+
# @example Response structure
|
565
|
+
# resp.unprocessed_items #=> Hash
|
566
|
+
# resp.unprocessed_items["TableName"] #=> Array
|
567
|
+
# resp.unprocessed_items["TableName"][0].put_request.item #=> Hash
|
568
|
+
# resp.unprocessed_items["TableName"][0].put_request.item["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
569
|
+
# resp.unprocessed_items["TableName"][0].delete_request.key #=> Hash
|
570
|
+
# resp.unprocessed_items["TableName"][0].delete_request.key["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
571
|
+
# resp.item_collection_metrics #=> Hash
|
572
|
+
# resp.item_collection_metrics["TableName"] #=> Array
|
573
|
+
# resp.item_collection_metrics["TableName"][0].item_collection_key #=> Hash
|
574
|
+
# resp.item_collection_metrics["TableName"][0].item_collection_key["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
575
|
+
# resp.item_collection_metrics["TableName"][0].size_estimate_range_gb #=> Array
|
576
|
+
# resp.item_collection_metrics["TableName"][0].size_estimate_range_gb[0] #=> Float
|
577
|
+
# resp.consumed_capacity #=> Array
|
578
|
+
# resp.consumed_capacity[0].table_name #=> String
|
579
|
+
# resp.consumed_capacity[0].capacity_units #=> Float
|
580
|
+
# resp.consumed_capacity[0].table.capacity_units #=> Float
|
581
|
+
# resp.consumed_capacity[0].local_secondary_indexes #=> Hash
|
582
|
+
# resp.consumed_capacity[0].local_secondary_indexes["IndexName"].capacity_units #=> Float
|
583
|
+
# resp.consumed_capacity[0].global_secondary_indexes #=> Hash
|
584
|
+
# resp.consumed_capacity[0].global_secondary_indexes["IndexName"].capacity_units #=> Float
|
585
|
+
# @overload batch_write_item(params = {})
|
586
|
+
# @param [Hash] params ({})
|
587
|
+
def batch_write_item(params = {}, options = {})
|
588
|
+
req = build_request(:batch_write_item, params)
|
589
|
+
req.send_request(options)
|
590
|
+
end
|
591
|
+
|
592
|
+
# The *CreateTable* operation adds a new table to your account. In an
|
593
|
+
# AWS account, table names must be unique within each region. That is,
|
594
|
+
# you can have two tables with same name if you create the tables in
|
595
|
+
# different regions.
|
596
|
+
#
|
597
|
+
# *CreateTable* is an asynchronous operation. Upon receiving a
|
598
|
+
# *CreateTable* request, DynamoDB immediately returns a response with a
|
599
|
+
# *TableStatus* of `CREATING`. After the table is created, DynamoDB sets
|
600
|
+
# the *TableStatus* to `ACTIVE`. You can perform read and write
|
601
|
+
# operations only on an `ACTIVE` table.
|
602
|
+
#
|
603
|
+
# You can optionally define secondary indexes on the new table, as part
|
604
|
+
# of the *CreateTable* operation. If you want to create multiple tables
|
605
|
+
# with secondary indexes on them, you must create the tables
|
606
|
+
# sequentially. Only one table with secondary indexes can be in the
|
607
|
+
# `CREATING` state at any given time.
|
608
|
+
#
|
609
|
+
# You can use the *DescribeTable* API to check the table status.
|
610
|
+
# @option params [required, Array<Types::AttributeDefinition>] :attribute_definitions
|
611
|
+
# An array of attributes that describe the key schema for the table and
|
612
|
+
# indexes.
|
613
|
+
# @option params [required, String] :table_name
|
614
|
+
# The name of the table to create.
|
615
|
+
# @option params [required, Array<Types::KeySchemaElement>] :key_schema
|
616
|
+
# Specifies the attributes that make up the primary key for a table or
|
617
|
+
# an index. The attributes in *KeySchema* must also be defined in the
|
618
|
+
# *AttributeDefinitions* array. For more information, see [Data
|
619
|
+
# Model][1] in the *Amazon DynamoDB Developer Guide*.
|
620
|
+
#
|
621
|
+
# Each *KeySchemaElement* in the array is composed of:
|
622
|
+
#
|
623
|
+
# * *AttributeName* - The name of this key attribute.
|
624
|
+
#
|
625
|
+
# * *KeyType* - The role that the key attribute will assume:
|
626
|
+
#
|
627
|
+
# * `HASH` - partition key
|
628
|
+
#
|
629
|
+
# * `RANGE` - sort key
|
630
|
+
#
|
631
|
+
# <note markdown="1"> The partition key of an item is also known as its *hash attribute*.
|
632
|
+
# The term "hash attribute" derives from DynamoDB' usage of an
|
633
|
+
# internal hash function to evenly distribute data items across
|
634
|
+
# partitions, based on their partition key values.
|
635
|
+
#
|
636
|
+
# The sort key of an item is also known as its *range attribute*. The
|
637
|
+
# term "range attribute" derives from the way DynamoDB stores items
|
638
|
+
# with the same partition key physically close together, in sorted order
|
639
|
+
# by the sort key value.
|
640
|
+
#
|
641
|
+
# </note>
|
642
|
+
#
|
643
|
+
# For a simple primary key (partition key), you must provide exactly one
|
644
|
+
# element with a *KeyType* of `HASH`.
|
645
|
+
#
|
646
|
+
# For a composite primary key (partition key and sort key), you must
|
647
|
+
# provide exactly two elements, in this order: The first element must
|
648
|
+
# have a *KeyType* of `HASH`, and the second element must have a
|
649
|
+
# *KeyType* of `RANGE`.
|
650
|
+
#
|
651
|
+
# For more information, see [Specifying the Primary Key][2] in the
|
652
|
+
# *Amazon DynamoDB Developer Guide*.
|
653
|
+
#
|
654
|
+
#
|
655
|
+
#
|
656
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html
|
657
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#WorkingWithTables.primary.key
|
658
|
+
# @option params [Array<Types::LocalSecondaryIndex>] :local_secondary_indexes
|
659
|
+
# One or more local secondary indexes (the maximum is five) to be
|
660
|
+
# created on the table. Each index is scoped to a given partition key
|
661
|
+
# value. There is a 10 GB size limit per partition key value; otherwise,
|
662
|
+
# the size of a local secondary index is unconstrained.
|
663
|
+
#
|
664
|
+
# Each local secondary index in the array includes the following:
|
665
|
+
#
|
666
|
+
# * *IndexName* - The name of the local secondary index. Must be unique
|
667
|
+
# only for this table.
|
668
|
+
#
|
669
|
+
#
|
670
|
+
#
|
671
|
+
# * *KeySchema* - Specifies the key schema for the local secondary
|
672
|
+
# index. The key schema must begin with the same partition key as the
|
673
|
+
# table.
|
674
|
+
#
|
675
|
+
# * *Projection* - Specifies attributes that are copied (projected) from
|
676
|
+
# the table into the index. These are in addition to the primary key
|
677
|
+
# attributes and index key attributes, which are automatically
|
678
|
+
# projected. Each attribute specification is composed of:
|
679
|
+
#
|
680
|
+
# * *ProjectionType* - One of the following:
|
681
|
+
#
|
682
|
+
# * `KEYS_ONLY` - Only the index and primary keys are projected into
|
683
|
+
# the index.
|
684
|
+
#
|
685
|
+
# * `INCLUDE` - Only the specified table attributes are projected
|
686
|
+
# into the index. The list of projected attributes are in
|
687
|
+
# *NonKeyAttributes*.
|
688
|
+
#
|
689
|
+
# * `ALL` - All of the table attributes are projected into the
|
690
|
+
# index.
|
691
|
+
#
|
692
|
+
# * *NonKeyAttributes* - A list of one or more non-key attribute names
|
693
|
+
# that are projected into the secondary index. The total count of
|
694
|
+
# attributes provided in *NonKeyAttributes*, summed across all of
|
695
|
+
# the secondary indexes, must not exceed 20. If you project the same
|
696
|
+
# attribute into two different indexes, this counts as two distinct
|
697
|
+
# attributes when determining the total.
|
698
|
+
# @option params [Array<Types::GlobalSecondaryIndex>] :global_secondary_indexes
|
699
|
+
# One or more global secondary indexes (the maximum is five) to be
|
700
|
+
# created on the table. Each global secondary index in the array
|
701
|
+
# includes the following:
|
702
|
+
#
|
703
|
+
# * *IndexName* - The name of the global secondary index. Must be unique
|
704
|
+
# only for this table.
|
705
|
+
#
|
706
|
+
#
|
707
|
+
#
|
708
|
+
# * *KeySchema* - Specifies the key schema for the global secondary
|
709
|
+
# index.
|
710
|
+
#
|
711
|
+
# * *Projection* - Specifies attributes that are copied (projected) from
|
712
|
+
# the table into the index. These are in addition to the primary key
|
713
|
+
# attributes and index key attributes, which are automatically
|
714
|
+
# projected. Each attribute specification is composed of:
|
715
|
+
#
|
716
|
+
# * *ProjectionType* - One of the following:
|
717
|
+
#
|
718
|
+
# * `KEYS_ONLY` - Only the index and primary keys are projected into
|
719
|
+
# the index.
|
720
|
+
#
|
721
|
+
# * `INCLUDE` - Only the specified table attributes are projected
|
722
|
+
# into the index. The list of projected attributes are in
|
723
|
+
# *NonKeyAttributes*.
|
724
|
+
#
|
725
|
+
# * `ALL` - All of the table attributes are projected into the
|
726
|
+
# index.
|
727
|
+
#
|
728
|
+
# * *NonKeyAttributes* - A list of one or more non-key attribute names
|
729
|
+
# that are projected into the secondary index. The total count of
|
730
|
+
# attributes provided in *NonKeyAttributes*, summed across all of
|
731
|
+
# the secondary indexes, must not exceed 20. If you project the same
|
732
|
+
# attribute into two different indexes, this counts as two distinct
|
733
|
+
# attributes when determining the total.
|
734
|
+
#
|
735
|
+
# * *ProvisionedThroughput* - The provisioned throughput settings for
|
736
|
+
# the global secondary index, consisting of read and write capacity
|
737
|
+
# units.
|
738
|
+
# @option params [required, Types::ProvisionedThroughput] :provisioned_throughput
|
739
|
+
# Represents the provisioned throughput settings for a specified table
|
740
|
+
# or index. The settings can be modified using the *UpdateTable*
|
741
|
+
# operation.
|
742
|
+
#
|
743
|
+
# For current minimum and maximum provisioned throughput values, see
|
744
|
+
# [Limits][1] in the *Amazon DynamoDB Developer Guide*.
|
745
|
+
#
|
746
|
+
#
|
747
|
+
#
|
748
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html
|
749
|
+
# @option params [Types::StreamSpecification] :stream_specification
|
750
|
+
# The settings for DynamoDB Streams on the table. These settings consist
|
751
|
+
# of:
|
752
|
+
#
|
753
|
+
# * *StreamEnabled* - Indicates whether Streams is to be enabled (true)
|
754
|
+
# or disabled (false).
|
755
|
+
#
|
756
|
+
# * *StreamViewType* - When an item in the table is modified,
|
757
|
+
# *StreamViewType* determines what information is written to the
|
758
|
+
# table's stream. Valid values for *StreamViewType* are:
|
759
|
+
#
|
760
|
+
# * *KEYS\_ONLY* - Only the key attributes of the modified item are
|
761
|
+
# written to the stream.
|
762
|
+
#
|
763
|
+
# * *NEW\_IMAGE* - The entire item, as it appears after it was
|
764
|
+
# modified, is written to the stream.
|
765
|
+
#
|
766
|
+
# * *OLD\_IMAGE* - The entire item, as it appeared before it was
|
767
|
+
# modified, is written to the stream.
|
768
|
+
#
|
769
|
+
# * *NEW\_AND\_OLD\_IMAGES* - Both the new and the old item images of
|
770
|
+
# the item are written to the stream.
|
771
|
+
# @return [Types::CreateTableOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
772
|
+
#
|
773
|
+
# * {Types::CreateTableOutput#table_description #TableDescription} => Types::TableDescription
|
774
|
+
#
|
775
|
+
# @example Request syntax with placeholder values
|
776
|
+
# resp = client.create_table({
|
777
|
+
# attribute_definitions: [ # required
|
778
|
+
# {
|
779
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
780
|
+
# attribute_type: "S", # required, accepts S, N, B
|
781
|
+
# },
|
782
|
+
# ],
|
783
|
+
# table_name: "TableName", # required
|
784
|
+
# key_schema: [ # required
|
785
|
+
# {
|
786
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
787
|
+
# key_type: "HASH", # required, accepts HASH, RANGE
|
788
|
+
# },
|
789
|
+
# ],
|
790
|
+
# local_secondary_indexes: [
|
791
|
+
# {
|
792
|
+
# index_name: "IndexName", # required
|
793
|
+
# key_schema: [ # required
|
794
|
+
# {
|
795
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
796
|
+
# key_type: "HASH", # required, accepts HASH, RANGE
|
797
|
+
# },
|
798
|
+
# ],
|
799
|
+
# projection: { # required
|
800
|
+
# projection_type: "ALL", # accepts ALL, KEYS_ONLY, INCLUDE
|
801
|
+
# non_key_attributes: ["NonKeyAttributeName"],
|
802
|
+
# },
|
803
|
+
# },
|
804
|
+
# ],
|
805
|
+
# global_secondary_indexes: [
|
806
|
+
# {
|
807
|
+
# index_name: "IndexName", # required
|
808
|
+
# key_schema: [ # required
|
809
|
+
# {
|
810
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
811
|
+
# key_type: "HASH", # required, accepts HASH, RANGE
|
812
|
+
# },
|
813
|
+
# ],
|
814
|
+
# projection: { # required
|
815
|
+
# projection_type: "ALL", # accepts ALL, KEYS_ONLY, INCLUDE
|
816
|
+
# non_key_attributes: ["NonKeyAttributeName"],
|
817
|
+
# },
|
818
|
+
# provisioned_throughput: { # required
|
819
|
+
# read_capacity_units: 1, # required
|
820
|
+
# write_capacity_units: 1, # required
|
821
|
+
# },
|
822
|
+
# },
|
823
|
+
# ],
|
824
|
+
# provisioned_throughput: { # required
|
825
|
+
# read_capacity_units: 1, # required
|
826
|
+
# write_capacity_units: 1, # required
|
827
|
+
# },
|
828
|
+
# stream_specification: {
|
829
|
+
# stream_enabled: false,
|
830
|
+
# stream_view_type: "NEW_IMAGE", # accepts NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES, KEYS_ONLY
|
831
|
+
# },
|
832
|
+
# })
|
833
|
+
#
|
834
|
+
# @example Response structure
|
835
|
+
# resp.table_description.attribute_definitions #=> Array
|
836
|
+
# resp.table_description.attribute_definitions[0].attribute_name #=> String
|
837
|
+
# resp.table_description.attribute_definitions[0].attribute_type #=> String, one of "S", "N", "B"
|
838
|
+
# resp.table_description.table_name #=> String
|
839
|
+
# resp.table_description.key_schema #=> Array
|
840
|
+
# resp.table_description.key_schema[0].attribute_name #=> String
|
841
|
+
# resp.table_description.key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
842
|
+
# resp.table_description.table_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
843
|
+
# resp.table_description.creation_date_time #=> Time
|
844
|
+
# resp.table_description.provisioned_throughput.last_increase_date_time #=> Time
|
845
|
+
# resp.table_description.provisioned_throughput.last_decrease_date_time #=> Time
|
846
|
+
# resp.table_description.provisioned_throughput.number_of_decreases_today #=> Integer
|
847
|
+
# resp.table_description.provisioned_throughput.read_capacity_units #=> Integer
|
848
|
+
# resp.table_description.provisioned_throughput.write_capacity_units #=> Integer
|
849
|
+
# resp.table_description.table_size_bytes #=> Integer
|
850
|
+
# resp.table_description.item_count #=> Integer
|
851
|
+
# resp.table_description.table_arn #=> String
|
852
|
+
# resp.table_description.local_secondary_indexes #=> Array
|
853
|
+
# resp.table_description.local_secondary_indexes[0].index_name #=> String
|
854
|
+
# resp.table_description.local_secondary_indexes[0].key_schema #=> Array
|
855
|
+
# resp.table_description.local_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
856
|
+
# resp.table_description.local_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
857
|
+
# resp.table_description.local_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
858
|
+
# resp.table_description.local_secondary_indexes[0].projection.non_key_attributes #=> Array
|
859
|
+
# resp.table_description.local_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
860
|
+
# resp.table_description.local_secondary_indexes[0].index_size_bytes #=> Integer
|
861
|
+
# resp.table_description.local_secondary_indexes[0].item_count #=> Integer
|
862
|
+
# resp.table_description.local_secondary_indexes[0].index_arn #=> String
|
863
|
+
# resp.table_description.global_secondary_indexes #=> Array
|
864
|
+
# resp.table_description.global_secondary_indexes[0].index_name #=> String
|
865
|
+
# resp.table_description.global_secondary_indexes[0].key_schema #=> Array
|
866
|
+
# resp.table_description.global_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
867
|
+
# resp.table_description.global_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
868
|
+
# resp.table_description.global_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
869
|
+
# resp.table_description.global_secondary_indexes[0].projection.non_key_attributes #=> Array
|
870
|
+
# resp.table_description.global_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
871
|
+
# resp.table_description.global_secondary_indexes[0].index_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
872
|
+
# resp.table_description.global_secondary_indexes[0].backfilling #=> Boolean
|
873
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.last_increase_date_time #=> Time
|
874
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.last_decrease_date_time #=> Time
|
875
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.number_of_decreases_today #=> Integer
|
876
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.read_capacity_units #=> Integer
|
877
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.write_capacity_units #=> Integer
|
878
|
+
# resp.table_description.global_secondary_indexes[0].index_size_bytes #=> Integer
|
879
|
+
# resp.table_description.global_secondary_indexes[0].item_count #=> Integer
|
880
|
+
# resp.table_description.global_secondary_indexes[0].index_arn #=> String
|
881
|
+
# resp.table_description.stream_specification.stream_enabled #=> Boolean
|
882
|
+
# resp.table_description.stream_specification.stream_view_type #=> String, one of "NEW_IMAGE", "OLD_IMAGE", "NEW_AND_OLD_IMAGES", "KEYS_ONLY"
|
883
|
+
# resp.table_description.latest_stream_label #=> String
|
884
|
+
# resp.table_description.latest_stream_arn #=> String
|
885
|
+
# @overload create_table(params = {})
|
886
|
+
# @param [Hash] params ({})
|
887
|
+
def create_table(params = {}, options = {})
|
888
|
+
req = build_request(:create_table, params)
|
889
|
+
req.send_request(options)
|
890
|
+
end
|
891
|
+
|
892
|
+
# Deletes a single item in a table by primary key. You can perform a
|
893
|
+
# conditional delete operation that deletes the item if it exists, or if
|
894
|
+
# it has an expected attribute value.
|
895
|
+
#
|
896
|
+
# In addition to deleting an item, you can also return the item's
|
897
|
+
# attribute values in the same operation, using the *ReturnValues*
|
898
|
+
# parameter.
|
899
|
+
#
|
900
|
+
# Unless you specify conditions, the *DeleteItem* is an idempotent
|
901
|
+
# operation; running it multiple times on the same item or attribute
|
902
|
+
# does *not* result in an error response.
|
903
|
+
#
|
904
|
+
# Conditional deletes are useful for deleting items only if specific
|
905
|
+
# conditions are met. If those conditions are met, DynamoDB performs the
|
906
|
+
# delete. Otherwise, the item is not deleted.
|
907
|
+
# @option params [required, String] :table_name
|
908
|
+
# The name of the table from which to delete the item.
|
909
|
+
# @option params [required, Hash<String,Types::AttributeValue>] :key
|
910
|
+
# A map of attribute names to *AttributeValue* objects, representing the
|
911
|
+
# primary key of the item to delete.
|
912
|
+
#
|
913
|
+
# For the primary key, you must provide all of the attributes. For
|
914
|
+
# example, with a simple primary key, you only need to provide a value
|
915
|
+
# for the partition key. For a composite primary key, you must provide
|
916
|
+
# values for both the partition key and the sort key.
|
917
|
+
# @option params [Hash<String,Types::ExpectedAttributeValue>] :expected
|
918
|
+
# This is a legacy parameter, for backward compatibility. New
|
919
|
+
# applications should use *ConditionExpression* instead. Do not combine
|
920
|
+
# legacy parameters and expression parameters in a single API call;
|
921
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
922
|
+
#
|
923
|
+
# A map of attribute/condition pairs. *Expected* provides a conditional
|
924
|
+
# block for the *DeleteItem* operation.
|
925
|
+
#
|
926
|
+
# Each element of *Expected* consists of an attribute name, a comparison
|
927
|
+
# operator, and one or more values. DynamoDB compares the attribute with
|
928
|
+
# the value(s) you supplied, using the comparison operator. For each
|
929
|
+
# *Expected* element, the result of the evaluation is either true or
|
930
|
+
# false.
|
931
|
+
#
|
932
|
+
# If you specify more than one element in the *Expected* map, then by
|
933
|
+
# default all of the conditions must evaluate to true. In other words,
|
934
|
+
# the conditions are ANDed together. (You can use the
|
935
|
+
# *ConditionalOperator* parameter to OR the conditions instead. If you
|
936
|
+
# do this, then at least one of the conditions must evaluate to true,
|
937
|
+
# rather than all of them.)
|
938
|
+
#
|
939
|
+
# If the *Expected* map evaluates to true, then the conditional
|
940
|
+
# operation succeeds; otherwise, it fails.
|
941
|
+
#
|
942
|
+
# *Expected* contains the following:
|
943
|
+
#
|
944
|
+
# * *AttributeValueList* - One or more values to evaluate against the
|
945
|
+
# supplied attribute. The number of values in the list depends on the
|
946
|
+
# *ComparisonOperator* being used.
|
947
|
+
#
|
948
|
+
# For type Number, value comparisons are numeric.
|
949
|
+
#
|
950
|
+
# String value comparisons for greater than, equals, or less than are
|
951
|
+
# based on ASCII character code values. For example, `a` is greater
|
952
|
+
# than `A`, and `a` is greater than `B`. For a list of code values,
|
953
|
+
# see
|
954
|
+
# [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
|
955
|
+
#
|
956
|
+
# For type Binary, DynamoDB treats each byte of the binary data as
|
957
|
+
# unsigned when it compares binary values.
|
958
|
+
#
|
959
|
+
# * *ComparisonOperator* - A comparator for evaluating attributes in the
|
960
|
+
# *AttributeValueList*. When performing the comparison, DynamoDB uses
|
961
|
+
# strongly consistent reads.
|
962
|
+
#
|
963
|
+
# The following comparison operators are available:
|
964
|
+
#
|
965
|
+
# `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
|
966
|
+
# NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
|
967
|
+
#
|
968
|
+
# The following are descriptions of each comparison operator.
|
969
|
+
#
|
970
|
+
# * `EQ`\: Equal. `EQ` is supported for all datatypes, including lists
|
971
|
+
# and maps.
|
972
|
+
#
|
973
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
974
|
+
# of type String, Number, Binary, String Set, Number Set, or Binary
|
975
|
+
# Set. If an item contains an *AttributeValue* element of a
|
976
|
+
# different type than the one provided in the request, the value
|
977
|
+
# does not match. For example, `\{"S":"6"\}` does not equal
|
978
|
+
# `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not equal `\{"NS":["6",
|
979
|
+
# "2", "1"]\}`.
|
980
|
+
#
|
981
|
+
#
|
982
|
+
#
|
983
|
+
# * `NE`\: Not equal. `NE` is supported for all datatypes, including
|
984
|
+
# lists and maps.
|
985
|
+
#
|
986
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
987
|
+
# String, Number, Binary, String Set, Number Set, or Binary Set. If
|
988
|
+
# an item contains an *AttributeValue* of a different type than the
|
989
|
+
# one provided in the request, the value does not match. For
|
990
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
991
|
+
# `\{"N":"6"\}` does not equal `\{"NS":["6", "2", "1"]\}`.
|
992
|
+
#
|
993
|
+
#
|
994
|
+
#
|
995
|
+
# * `LE`\: Less than or equal.
|
996
|
+
#
|
997
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
998
|
+
# of type String, Number, or Binary (not a set type). If an item
|
999
|
+
# contains an *AttributeValue* element of a different type than the
|
1000
|
+
# one provided in the request, the value does not match. For
|
1001
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
1002
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
1003
|
+
#
|
1004
|
+
#
|
1005
|
+
#
|
1006
|
+
# * `LT`\: Less than.
|
1007
|
+
#
|
1008
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
1009
|
+
# String, Number, or Binary (not a set type). If an item contains an
|
1010
|
+
# *AttributeValue* element of a different type than the one provided
|
1011
|
+
# in the request, the value does not match. For example,
|
1012
|
+
# `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
|
1013
|
+
# does not compare to `\{"NS":["6", "2", "1"]\}`.
|
1014
|
+
#
|
1015
|
+
#
|
1016
|
+
#
|
1017
|
+
# * `GE`\: Greater than or equal.
|
1018
|
+
#
|
1019
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
1020
|
+
# of type String, Number, or Binary (not a set type). If an item
|
1021
|
+
# contains an *AttributeValue* element of a different type than the
|
1022
|
+
# one provided in the request, the value does not match. For
|
1023
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
1024
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
1025
|
+
#
|
1026
|
+
#
|
1027
|
+
#
|
1028
|
+
# * `GT`\: Greater than.
|
1029
|
+
#
|
1030
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
1031
|
+
# of type String, Number, or Binary (not a set type). If an item
|
1032
|
+
# contains an *AttributeValue* element of a different type than the
|
1033
|
+
# one provided in the request, the value does not match. For
|
1034
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
1035
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
1036
|
+
#
|
1037
|
+
#
|
1038
|
+
#
|
1039
|
+
# * `NOT_NULL`\: The attribute exists. `NOT_NULL` is supported for all
|
1040
|
+
# datatypes, including lists and maps.
|
1041
|
+
#
|
1042
|
+
# <note markdown="1"> This operator tests for the existence of an attribute, not its
|
1043
|
+
# data type. If the data type of attribute "`a`" is null, and you
|
1044
|
+
# evaluate it using `NOT_NULL`, the result is a Boolean *true*. This
|
1045
|
+
# result is because the attribute "`a`" exists; its data type is
|
1046
|
+
# not relevant to the `NOT_NULL` comparison operator.
|
1047
|
+
#
|
1048
|
+
# </note>
|
1049
|
+
#
|
1050
|
+
# * `NULL`\: The attribute does not exist. `NULL` is supported for all
|
1051
|
+
# datatypes, including lists and maps.
|
1052
|
+
#
|
1053
|
+
# <note markdown="1"> This operator tests for the nonexistence of an attribute, not its
|
1054
|
+
# data type. If the data type of attribute "`a`" is null, and you
|
1055
|
+
# evaluate it using `NULL`, the result is a Boolean *false*. This is
|
1056
|
+
# because the attribute "`a`" exists; its data type is not
|
1057
|
+
# relevant to the `NULL` comparison operator.
|
1058
|
+
#
|
1059
|
+
# </note>
|
1060
|
+
#
|
1061
|
+
# * `CONTAINS`\: Checks for a subsequence, or value in a set.
|
1062
|
+
#
|
1063
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
1064
|
+
# of type String, Number, or Binary (not a set type). If the target
|
1065
|
+
# attribute of the comparison is of type String, then the operator
|
1066
|
+
# checks for a substring match. If the target attribute of the
|
1067
|
+
# comparison is of type Binary, then the operator looks for a
|
1068
|
+
# subsequence of the target that matches the input. If the target
|
1069
|
+
# attribute of the comparison is a set ("`SS`", "`NS`", or
|
1070
|
+
# "`BS`"), then the operator evaluates to true if it finds an
|
1071
|
+
# exact match with any member of the set.
|
1072
|
+
#
|
1073
|
+
# CONTAINS is supported for lists: When evaluating "`a CONTAINS
|
1074
|
+
# b`", "`a`" can be a list; however, "`b`" cannot be a set, a
|
1075
|
+
# map, or a list.
|
1076
|
+
#
|
1077
|
+
# * `NOT_CONTAINS`\: Checks for absence of a subsequence, or absence
|
1078
|
+
# of a value in a set.
|
1079
|
+
#
|
1080
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
1081
|
+
# of type String, Number, or Binary (not a set type). If the target
|
1082
|
+
# attribute of the comparison is a String, then the operator checks
|
1083
|
+
# for the absence of a substring match. If the target attribute of
|
1084
|
+
# the comparison is Binary, then the operator checks for the absence
|
1085
|
+
# of a subsequence of the target that matches the input. If the
|
1086
|
+
# target attribute of the comparison is a set ("`SS`", "`NS`",
|
1087
|
+
# or "`BS`"), then the operator evaluates to true if it *does not*
|
1088
|
+
# find an exact match with any member of the set.
|
1089
|
+
#
|
1090
|
+
# NOT\_CONTAINS is supported for lists: When evaluating "`a NOT
|
1091
|
+
# CONTAINS b`", "`a`" can be a list; however, "`b`" cannot be a
|
1092
|
+
# set, a map, or a list.
|
1093
|
+
#
|
1094
|
+
# * `BEGINS_WITH`\: Checks for a prefix.
|
1095
|
+
#
|
1096
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
1097
|
+
# String or Binary (not a Number or a set type). The target
|
1098
|
+
# attribute of the comparison must be of type String or Binary (not
|
1099
|
+
# a Number or a set type).
|
1100
|
+
#
|
1101
|
+
#
|
1102
|
+
#
|
1103
|
+
# * `IN`\: Checks for matching elements within two sets.
|
1104
|
+
#
|
1105
|
+
# *AttributeValueList* can contain one or more *AttributeValue*
|
1106
|
+
# elements of type String, Number, or Binary (not a set type). These
|
1107
|
+
# attributes are compared against an existing set type attribute of
|
1108
|
+
# an item. If any elements of the input set are present in the item
|
1109
|
+
# attribute, the expression evaluates to true.
|
1110
|
+
#
|
1111
|
+
# * `BETWEEN`\: Greater than or equal to the first value, and less
|
1112
|
+
# than or equal to the second value.
|
1113
|
+
#
|
1114
|
+
# *AttributeValueList* must contain two *AttributeValue* elements of
|
1115
|
+
# the same type, either String, Number, or Binary (not a set type).
|
1116
|
+
# A target attribute matches if the target value is greater than, or
|
1117
|
+
# equal to, the first element and less than, or equal to, the second
|
1118
|
+
# element. If an item contains an *AttributeValue* element of a
|
1119
|
+
# different type than the one provided in the request, the value
|
1120
|
+
# does not match. For example, `\{"S":"6"\}` does not compare to
|
1121
|
+
# `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
|
1122
|
+
# `\{"NS":["6", "2", "1"]\}`
|
1123
|
+
#
|
1124
|
+
# For usage examples of *AttributeValueList* and *ComparisonOperator*,
|
1125
|
+
# see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
|
1126
|
+
# Developer Guide*.
|
1127
|
+
#
|
1128
|
+
# For backward compatibility with previous DynamoDB releases, the
|
1129
|
+
# following parameters can be used instead of *AttributeValueList* and
|
1130
|
+
# *ComparisonOperator*\:
|
1131
|
+
#
|
1132
|
+
# * *Value* - A value for DynamoDB to compare with an attribute.
|
1133
|
+
#
|
1134
|
+
# * *Exists* - A Boolean value that causes DynamoDB to evaluate the
|
1135
|
+
# value before attempting the conditional operation:
|
1136
|
+
#
|
1137
|
+
# * If *Exists* is `true`, DynamoDB will check to see if that
|
1138
|
+
# attribute value already exists in the table. If it is found, then
|
1139
|
+
# the condition evaluates to true; otherwise the condition evaluate
|
1140
|
+
# to false.
|
1141
|
+
#
|
1142
|
+
# * If *Exists* is `false`, DynamoDB assumes that the attribute value
|
1143
|
+
# does *not* exist in the table. If in fact the value does not
|
1144
|
+
# exist, then the assumption is valid and the condition evaluates to
|
1145
|
+
# true. If the value is found, despite the assumption that it does
|
1146
|
+
# not exist, the condition evaluates to false.
|
1147
|
+
#
|
1148
|
+
# Note that the default value for *Exists* is `true`.
|
1149
|
+
#
|
1150
|
+
# The *Value* and *Exists* parameters are incompatible with
|
1151
|
+
# *AttributeValueList* and *ComparisonOperator*. Note that if you use
|
1152
|
+
# both sets of parameters at once, DynamoDB will return a
|
1153
|
+
# *ValidationException* exception.
|
1154
|
+
#
|
1155
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
1156
|
+
#
|
1157
|
+
# </note>
|
1158
|
+
#
|
1159
|
+
#
|
1160
|
+
#
|
1161
|
+
# [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
1162
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
|
1163
|
+
# @option params [String] :conditional_operator
|
1164
|
+
# This is a legacy parameter, for backward compatibility. New
|
1165
|
+
# applications should use *ConditionExpression* instead. Do not combine
|
1166
|
+
# legacy parameters and expression parameters in a single API call;
|
1167
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
1168
|
+
#
|
1169
|
+
# A logical operator to apply to the conditions in the *Expected* map:
|
1170
|
+
#
|
1171
|
+
# * `AND` - If all of the conditions evaluate to true, then the entire
|
1172
|
+
# map evaluates to true.
|
1173
|
+
#
|
1174
|
+
# * `OR` - If at least one of the conditions evaluate to true, then the
|
1175
|
+
# entire map evaluates to true.
|
1176
|
+
#
|
1177
|
+
# If you omit *ConditionalOperator*, then `AND` is the default.
|
1178
|
+
#
|
1179
|
+
# The operation will succeed only if the entire map evaluates to true.
|
1180
|
+
#
|
1181
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
1182
|
+
#
|
1183
|
+
# </note>
|
1184
|
+
# @option params [String] :return_values
|
1185
|
+
# Use *ReturnValues* if you want to get the item attributes as they
|
1186
|
+
# appeared before they were deleted. For *DeleteItem*, the valid values
|
1187
|
+
# are:
|
1188
|
+
#
|
1189
|
+
# * `NONE` - If *ReturnValues* is not specified, or if its value is
|
1190
|
+
# `NONE`, then nothing is returned. (This setting is the default for
|
1191
|
+
# *ReturnValues*.)
|
1192
|
+
#
|
1193
|
+
# * `ALL_OLD` - The content of the old item is returned.
|
1194
|
+
#
|
1195
|
+
# <note markdown="1"> The *ReturnValues* parameter is used by several DynamoDB operations;
|
1196
|
+
# however, *DeleteItem* does not recognize any values other than `NONE`
|
1197
|
+
# or `ALL_OLD`.
|
1198
|
+
#
|
1199
|
+
# </note>
|
1200
|
+
# @option params [String] :return_consumed_capacity
|
1201
|
+
# Determines the level of detail about provisioned throughput
|
1202
|
+
# consumption that is returned in the response:
|
1203
|
+
#
|
1204
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
1205
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
1206
|
+
# and secondary index that was accessed.
|
1207
|
+
#
|
1208
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
1209
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
1210
|
+
# will only return *ConsumedCapacity* information for table(s).
|
1211
|
+
#
|
1212
|
+
# * *TOTAL* - The response includes only the aggregate
|
1213
|
+
# *ConsumedCapacity* for the operation.
|
1214
|
+
#
|
1215
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
1216
|
+
# @option params [String] :return_item_collection_metrics
|
1217
|
+
# Determines whether item collection metrics are returned. If set to
|
1218
|
+
# `SIZE`, the response includes statistics about item collections, if
|
1219
|
+
# any, that were modified during the operation are returned in the
|
1220
|
+
# response. If set to `NONE` (the default), no statistics are returned.
|
1221
|
+
# @option params [String] :condition_expression
|
1222
|
+
# A condition that must be satisfied in order for a conditional
|
1223
|
+
# *DeleteItem* to succeed.
|
1224
|
+
#
|
1225
|
+
# An expression can contain any of the following:
|
1226
|
+
#
|
1227
|
+
# * Functions: `attribute_exists | attribute_not_exists | attribute_type
|
1228
|
+
# | contains | begins_with | size`
|
1229
|
+
#
|
1230
|
+
# These function names are case-sensitive.
|
1231
|
+
#
|
1232
|
+
# * Comparison operators: ` = | <> | < | > | <=
|
1233
|
+
# | >= | BETWEEN | IN`
|
1234
|
+
#
|
1235
|
+
# * Logical operators: `AND | OR | NOT`
|
1236
|
+
#
|
1237
|
+
# For more information on condition expressions, see [Specifying
|
1238
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
1239
|
+
#
|
1240
|
+
# <note markdown="1"> *ConditionExpression* replaces the legacy *ConditionalOperator* and
|
1241
|
+
# *Expected* parameters.
|
1242
|
+
#
|
1243
|
+
# </note>
|
1244
|
+
#
|
1245
|
+
#
|
1246
|
+
#
|
1247
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
1248
|
+
# @option params [Hash<String,String>] :expression_attribute_names
|
1249
|
+
# One or more substitution tokens for attribute names in an expression.
|
1250
|
+
# The following are some use cases for using
|
1251
|
+
# *ExpressionAttributeNames*\:
|
1252
|
+
#
|
1253
|
+
# * To access an attribute whose name conflicts with a DynamoDB reserved
|
1254
|
+
# word.
|
1255
|
+
#
|
1256
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
1257
|
+
# name in an expression.
|
1258
|
+
#
|
1259
|
+
# * To prevent special characters in an attribute name from being
|
1260
|
+
# misinterpreted in an expression.
|
1261
|
+
#
|
1262
|
+
# Use the **#** character in an expression to dereference an attribute
|
1263
|
+
# name. For example, consider the following attribute name:
|
1264
|
+
#
|
1265
|
+
# * `Percentile`
|
1266
|
+
#
|
1267
|
+
# ^
|
1268
|
+
#
|
1269
|
+
# The name of this attribute conflicts with a reserved word, so it
|
1270
|
+
# cannot be used directly in an expression. (For the complete list of
|
1271
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
1272
|
+
# Developer Guide*). To work around this, you could specify the
|
1273
|
+
# following for *ExpressionAttributeNames*\:
|
1274
|
+
#
|
1275
|
+
# * `\{"#P":"Percentile"\}`
|
1276
|
+
#
|
1277
|
+
# ^
|
1278
|
+
#
|
1279
|
+
# You could then use this substitution in an expression, as in this
|
1280
|
+
# example:
|
1281
|
+
#
|
1282
|
+
# * `#P = :val`
|
1283
|
+
#
|
1284
|
+
# ^
|
1285
|
+
#
|
1286
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
|
1287
|
+
# values*, which are placeholders for the actual value at runtime.
|
1288
|
+
#
|
1289
|
+
# </note>
|
1290
|
+
#
|
1291
|
+
# For more information on expression attribute names, see [Accessing
|
1292
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
1293
|
+
#
|
1294
|
+
#
|
1295
|
+
#
|
1296
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
1297
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
1298
|
+
# @option params [Hash<String,Types::AttributeValue>] :expression_attribute_values
|
1299
|
+
# One or more values that can be substituted in an expression.
|
1300
|
+
#
|
1301
|
+
# Use the **\:** (colon) character in an expression to dereference an
|
1302
|
+
# attribute value. For example, suppose that you wanted to check whether
|
1303
|
+
# the value of the *ProductStatus* attribute was one of the following:
|
1304
|
+
#
|
1305
|
+
# `Available | Backordered | Discontinued`
|
1306
|
+
#
|
1307
|
+
# You would first need to specify *ExpressionAttributeValues* as
|
1308
|
+
# follows:
|
1309
|
+
#
|
1310
|
+
# `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
|
1311
|
+
# ":disc":\{"S":"Discontinued"\} \}`
|
1312
|
+
#
|
1313
|
+
# You could then use these values in an expression, such as this:
|
1314
|
+
#
|
1315
|
+
# `ProductStatus IN (:avail, :back, :disc)`
|
1316
|
+
#
|
1317
|
+
# For more information on expression attribute values, see [Specifying
|
1318
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
1319
|
+
#
|
1320
|
+
#
|
1321
|
+
#
|
1322
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
1323
|
+
# @return [Types::DeleteItemOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1324
|
+
#
|
1325
|
+
# * {Types::DeleteItemOutput#attributes #Attributes} => Hash<String,Types::AttributeValue>
|
1326
|
+
# * {Types::DeleteItemOutput#consumed_capacity #ConsumedCapacity} => Types::ConsumedCapacity
|
1327
|
+
# * {Types::DeleteItemOutput#item_collection_metrics #ItemCollectionMetrics} => Types::ItemCollectionMetrics
|
1328
|
+
#
|
1329
|
+
# @example Request syntax with placeholder values
|
1330
|
+
# resp = client.delete_item({
|
1331
|
+
# table_name: "TableName", # required
|
1332
|
+
# key: { # required
|
1333
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1334
|
+
# },
|
1335
|
+
# expected: {
|
1336
|
+
# "AttributeName" => {
|
1337
|
+
# value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1338
|
+
# exists: false,
|
1339
|
+
# comparison_operator: "EQ", # accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
|
1340
|
+
# attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1341
|
+
# },
|
1342
|
+
# },
|
1343
|
+
# conditional_operator: "AND", # accepts AND, OR
|
1344
|
+
# return_values: "NONE", # accepts NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW
|
1345
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
1346
|
+
# return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
|
1347
|
+
# condition_expression: "ConditionExpression",
|
1348
|
+
# expression_attribute_names: {
|
1349
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
1350
|
+
# },
|
1351
|
+
# expression_attribute_values: {
|
1352
|
+
# "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1353
|
+
# },
|
1354
|
+
# })
|
1355
|
+
#
|
1356
|
+
# @example Response structure
|
1357
|
+
# resp.attributes #=> Hash
|
1358
|
+
# resp.attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1359
|
+
# resp.consumed_capacity.table_name #=> String
|
1360
|
+
# resp.consumed_capacity.capacity_units #=> Float
|
1361
|
+
# resp.consumed_capacity.table.capacity_units #=> Float
|
1362
|
+
# resp.consumed_capacity.local_secondary_indexes #=> Hash
|
1363
|
+
# resp.consumed_capacity.local_secondary_indexes["IndexName"].capacity_units #=> Float
|
1364
|
+
# resp.consumed_capacity.global_secondary_indexes #=> Hash
|
1365
|
+
# resp.consumed_capacity.global_secondary_indexes["IndexName"].capacity_units #=> Float
|
1366
|
+
# resp.item_collection_metrics.item_collection_key #=> Hash
|
1367
|
+
# resp.item_collection_metrics.item_collection_key["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1368
|
+
# resp.item_collection_metrics.size_estimate_range_gb #=> Array
|
1369
|
+
# resp.item_collection_metrics.size_estimate_range_gb[0] #=> Float
|
1370
|
+
# @overload delete_item(params = {})
|
1371
|
+
# @param [Hash] params ({})
|
1372
|
+
def delete_item(params = {}, options = {})
|
1373
|
+
req = build_request(:delete_item, params)
|
1374
|
+
req.send_request(options)
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
# The *DeleteTable* operation deletes a table and all of its items.
|
1378
|
+
# After a *DeleteTable* request, the specified table is in the
|
1379
|
+
# `DELETING` state until DynamoDB completes the deletion. If the table
|
1380
|
+
# is in the `ACTIVE` state, you can delete it. If a table is in
|
1381
|
+
# `CREATING` or `UPDATING` states, then DynamoDB returns a
|
1382
|
+
# *ResourceInUseException*. If the specified table does not exist,
|
1383
|
+
# DynamoDB returns a *ResourceNotFoundException*. If table is already in
|
1384
|
+
# the `DELETING` state, no error is returned.
|
1385
|
+
#
|
1386
|
+
# <note markdown="1"> DynamoDB might continue to accept data read and write operations, such
|
1387
|
+
# as *GetItem* and *PutItem*, on a table in the `DELETING` state until
|
1388
|
+
# the table deletion is complete.
|
1389
|
+
#
|
1390
|
+
# </note>
|
1391
|
+
#
|
1392
|
+
# When you delete a table, any indexes on that table are also deleted.
|
1393
|
+
#
|
1394
|
+
# If you have DynamoDB Streams enabled on the table, then the
|
1395
|
+
# corresponding stream on that table goes into the `DISABLED` state, and
|
1396
|
+
# the stream is automatically deleted after 24 hours.
|
1397
|
+
#
|
1398
|
+
# Use the *DescribeTable* API to check the status of the table.
|
1399
|
+
# @option params [required, String] :table_name
|
1400
|
+
# The name of the table to delete.
|
1401
|
+
# @return [Types::DeleteTableOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1402
|
+
#
|
1403
|
+
# * {Types::DeleteTableOutput#table_description #TableDescription} => Types::TableDescription
|
1404
|
+
#
|
1405
|
+
# @example Request syntax with placeholder values
|
1406
|
+
# resp = client.delete_table({
|
1407
|
+
# table_name: "TableName", # required
|
1408
|
+
# })
|
1409
|
+
#
|
1410
|
+
# @example Response structure
|
1411
|
+
# resp.table_description.attribute_definitions #=> Array
|
1412
|
+
# resp.table_description.attribute_definitions[0].attribute_name #=> String
|
1413
|
+
# resp.table_description.attribute_definitions[0].attribute_type #=> String, one of "S", "N", "B"
|
1414
|
+
# resp.table_description.table_name #=> String
|
1415
|
+
# resp.table_description.key_schema #=> Array
|
1416
|
+
# resp.table_description.key_schema[0].attribute_name #=> String
|
1417
|
+
# resp.table_description.key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
1418
|
+
# resp.table_description.table_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
1419
|
+
# resp.table_description.creation_date_time #=> Time
|
1420
|
+
# resp.table_description.provisioned_throughput.last_increase_date_time #=> Time
|
1421
|
+
# resp.table_description.provisioned_throughput.last_decrease_date_time #=> Time
|
1422
|
+
# resp.table_description.provisioned_throughput.number_of_decreases_today #=> Integer
|
1423
|
+
# resp.table_description.provisioned_throughput.read_capacity_units #=> Integer
|
1424
|
+
# resp.table_description.provisioned_throughput.write_capacity_units #=> Integer
|
1425
|
+
# resp.table_description.table_size_bytes #=> Integer
|
1426
|
+
# resp.table_description.item_count #=> Integer
|
1427
|
+
# resp.table_description.table_arn #=> String
|
1428
|
+
# resp.table_description.local_secondary_indexes #=> Array
|
1429
|
+
# resp.table_description.local_secondary_indexes[0].index_name #=> String
|
1430
|
+
# resp.table_description.local_secondary_indexes[0].key_schema #=> Array
|
1431
|
+
# resp.table_description.local_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
1432
|
+
# resp.table_description.local_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
1433
|
+
# resp.table_description.local_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
1434
|
+
# resp.table_description.local_secondary_indexes[0].projection.non_key_attributes #=> Array
|
1435
|
+
# resp.table_description.local_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
1436
|
+
# resp.table_description.local_secondary_indexes[0].index_size_bytes #=> Integer
|
1437
|
+
# resp.table_description.local_secondary_indexes[0].item_count #=> Integer
|
1438
|
+
# resp.table_description.local_secondary_indexes[0].index_arn #=> String
|
1439
|
+
# resp.table_description.global_secondary_indexes #=> Array
|
1440
|
+
# resp.table_description.global_secondary_indexes[0].index_name #=> String
|
1441
|
+
# resp.table_description.global_secondary_indexes[0].key_schema #=> Array
|
1442
|
+
# resp.table_description.global_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
1443
|
+
# resp.table_description.global_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
1444
|
+
# resp.table_description.global_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
1445
|
+
# resp.table_description.global_secondary_indexes[0].projection.non_key_attributes #=> Array
|
1446
|
+
# resp.table_description.global_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
1447
|
+
# resp.table_description.global_secondary_indexes[0].index_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
1448
|
+
# resp.table_description.global_secondary_indexes[0].backfilling #=> Boolean
|
1449
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.last_increase_date_time #=> Time
|
1450
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.last_decrease_date_time #=> Time
|
1451
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.number_of_decreases_today #=> Integer
|
1452
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.read_capacity_units #=> Integer
|
1453
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.write_capacity_units #=> Integer
|
1454
|
+
# resp.table_description.global_secondary_indexes[0].index_size_bytes #=> Integer
|
1455
|
+
# resp.table_description.global_secondary_indexes[0].item_count #=> Integer
|
1456
|
+
# resp.table_description.global_secondary_indexes[0].index_arn #=> String
|
1457
|
+
# resp.table_description.stream_specification.stream_enabled #=> Boolean
|
1458
|
+
# resp.table_description.stream_specification.stream_view_type #=> String, one of "NEW_IMAGE", "OLD_IMAGE", "NEW_AND_OLD_IMAGES", "KEYS_ONLY"
|
1459
|
+
# resp.table_description.latest_stream_label #=> String
|
1460
|
+
# resp.table_description.latest_stream_arn #=> String
|
1461
|
+
# @overload delete_table(params = {})
|
1462
|
+
# @param [Hash] params ({})
|
1463
|
+
def delete_table(params = {}, options = {})
|
1464
|
+
req = build_request(:delete_table, params)
|
1465
|
+
req.send_request(options)
|
1466
|
+
end
|
1467
|
+
|
1468
|
+
# Returns the current provisioned-capacity limits for your AWS account
|
1469
|
+
# in a region, both for the region as a whole and for any one DynamoDB
|
1470
|
+
# table that you create there.
|
1471
|
+
#
|
1472
|
+
# When you establish an AWS account, the account has initial limits on
|
1473
|
+
# the maximum read capacity units and write capacity units that you can
|
1474
|
+
# provision across all of your DynamoDB tables in a given region. Also,
|
1475
|
+
# there are per-table limits that apply when you create a table there.
|
1476
|
+
# For more information, see [Limits][1] page in the *Amazon DynamoDB
|
1477
|
+
# Developer Guide*.
|
1478
|
+
#
|
1479
|
+
# Although you can increase these limits by filing a case at [AWS
|
1480
|
+
# Support Center][2], obtaining the increase is not instantaneous. The
|
1481
|
+
# *DescribeLimits* API lets you write code to compare the capacity you
|
1482
|
+
# are currently using to those limits imposed by your account so that
|
1483
|
+
# you have enough time to apply for an increase before you hit a limit.
|
1484
|
+
#
|
1485
|
+
# For example, you could use one of the AWS SDKs to do the following:
|
1486
|
+
#
|
1487
|
+
# 1. Call *DescribeLimits* for a particular region to obtain your
|
1488
|
+
# current account limits on provisioned capacity there.
|
1489
|
+
#
|
1490
|
+
# 2. Create a variable to hold the aggregate read capacity units
|
1491
|
+
# provisioned for all your tables in that region, and one to hold
|
1492
|
+
# the aggregate write capacity units. Zero them both.
|
1493
|
+
#
|
1494
|
+
# 3. Call *ListTables* to obtain a list of all your DynamoDB tables.
|
1495
|
+
#
|
1496
|
+
# 4. For each table name listed by *ListTables*, do the following:
|
1497
|
+
#
|
1498
|
+
# * Call *DescribeTable* with the table name.
|
1499
|
+
#
|
1500
|
+
# * Use the data returned by *DescribeTable* to add the read
|
1501
|
+
# capacity units and write capacity units provisioned for the
|
1502
|
+
# table itself to your variables.
|
1503
|
+
#
|
1504
|
+
# * If the table has one or more global secondary indexes (GSIs),
|
1505
|
+
# loop over these GSIs and add their provisioned capacity values
|
1506
|
+
# to your variables as well.
|
1507
|
+
#
|
1508
|
+
# 5. Report the account limits for that region returned by
|
1509
|
+
# *DescribeLimits*, along with the total current provisioned
|
1510
|
+
# capacity levels you have calculated.
|
1511
|
+
#
|
1512
|
+
# This will let you see whether you are getting close to your
|
1513
|
+
# account-level limits.
|
1514
|
+
#
|
1515
|
+
# The per-table limits apply only when you are creating a new table.
|
1516
|
+
# They restrict the sum of the provisioned capacity of the new table
|
1517
|
+
# itself and all its global secondary indexes.
|
1518
|
+
#
|
1519
|
+
# For existing tables and their GSIs, DynamoDB will not let you increase
|
1520
|
+
# provisioned capacity extremely rapidly, but the only upper limit that
|
1521
|
+
# applies is that the aggregate provisioned capacity over all your
|
1522
|
+
# tables and GSIs cannot exceed either of the per-account limits.
|
1523
|
+
#
|
1524
|
+
# <note markdown="1"> *DescribeLimits* should only be called periodically. You can expect
|
1525
|
+
# throttling errors if you call it more than once in a minute.
|
1526
|
+
#
|
1527
|
+
# </note>
|
1528
|
+
#
|
1529
|
+
# The *DescribeLimits* Request element has no content.
|
1530
|
+
#
|
1531
|
+
#
|
1532
|
+
#
|
1533
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html
|
1534
|
+
# [2]: https://console.aws.amazon.com/support/home#/
|
1535
|
+
# @return [Types::DescribeLimitsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1536
|
+
#
|
1537
|
+
# * {Types::DescribeLimitsOutput#account_max_read_capacity_units #AccountMaxReadCapacityUnits} => Integer
|
1538
|
+
# * {Types::DescribeLimitsOutput#account_max_write_capacity_units #AccountMaxWriteCapacityUnits} => Integer
|
1539
|
+
# * {Types::DescribeLimitsOutput#table_max_read_capacity_units #TableMaxReadCapacityUnits} => Integer
|
1540
|
+
# * {Types::DescribeLimitsOutput#table_max_write_capacity_units #TableMaxWriteCapacityUnits} => Integer
|
1541
|
+
#
|
1542
|
+
# @example Request syntax with placeholder values
|
1543
|
+
# resp = client.describe_limits()
|
1544
|
+
#
|
1545
|
+
# @example Response structure
|
1546
|
+
# resp.account_max_read_capacity_units #=> Integer
|
1547
|
+
# resp.account_max_write_capacity_units #=> Integer
|
1548
|
+
# resp.table_max_read_capacity_units #=> Integer
|
1549
|
+
# resp.table_max_write_capacity_units #=> Integer
|
1550
|
+
# @overload describe_limits(params = {})
|
1551
|
+
# @param [Hash] params ({})
|
1552
|
+
def describe_limits(params = {}, options = {})
|
1553
|
+
req = build_request(:describe_limits, params)
|
1554
|
+
req.send_request(options)
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
# Returns information about the table, including the current status of
|
1558
|
+
# the table, when it was created, the primary key schema, and any
|
1559
|
+
# indexes on the table.
|
1560
|
+
#
|
1561
|
+
# <note markdown="1"> If you issue a *DescribeTable* request immediately after a
|
1562
|
+
# *CreateTable* request, DynamoDB might return a
|
1563
|
+
# *ResourceNotFoundException*. This is because *DescribeTable* uses an
|
1564
|
+
# eventually consistent query, and the metadata for your table might not
|
1565
|
+
# be available at that moment. Wait for a few seconds, and then try the
|
1566
|
+
# *DescribeTable* request again.
|
1567
|
+
#
|
1568
|
+
# </note>
|
1569
|
+
# @option params [required, String] :table_name
|
1570
|
+
# The name of the table to describe.
|
1571
|
+
# @return [Types::DescribeTableOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1572
|
+
#
|
1573
|
+
# * {Types::DescribeTableOutput#table #Table} => Types::TableDescription
|
1574
|
+
#
|
1575
|
+
# @example Request syntax with placeholder values
|
1576
|
+
# resp = client.describe_table({
|
1577
|
+
# table_name: "TableName", # required
|
1578
|
+
# })
|
1579
|
+
#
|
1580
|
+
# @example Response structure
|
1581
|
+
# resp.table.attribute_definitions #=> Array
|
1582
|
+
# resp.table.attribute_definitions[0].attribute_name #=> String
|
1583
|
+
# resp.table.attribute_definitions[0].attribute_type #=> String, one of "S", "N", "B"
|
1584
|
+
# resp.table.table_name #=> String
|
1585
|
+
# resp.table.key_schema #=> Array
|
1586
|
+
# resp.table.key_schema[0].attribute_name #=> String
|
1587
|
+
# resp.table.key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
1588
|
+
# resp.table.table_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
1589
|
+
# resp.table.creation_date_time #=> Time
|
1590
|
+
# resp.table.provisioned_throughput.last_increase_date_time #=> Time
|
1591
|
+
# resp.table.provisioned_throughput.last_decrease_date_time #=> Time
|
1592
|
+
# resp.table.provisioned_throughput.number_of_decreases_today #=> Integer
|
1593
|
+
# resp.table.provisioned_throughput.read_capacity_units #=> Integer
|
1594
|
+
# resp.table.provisioned_throughput.write_capacity_units #=> Integer
|
1595
|
+
# resp.table.table_size_bytes #=> Integer
|
1596
|
+
# resp.table.item_count #=> Integer
|
1597
|
+
# resp.table.table_arn #=> String
|
1598
|
+
# resp.table.local_secondary_indexes #=> Array
|
1599
|
+
# resp.table.local_secondary_indexes[0].index_name #=> String
|
1600
|
+
# resp.table.local_secondary_indexes[0].key_schema #=> Array
|
1601
|
+
# resp.table.local_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
1602
|
+
# resp.table.local_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
1603
|
+
# resp.table.local_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
1604
|
+
# resp.table.local_secondary_indexes[0].projection.non_key_attributes #=> Array
|
1605
|
+
# resp.table.local_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
1606
|
+
# resp.table.local_secondary_indexes[0].index_size_bytes #=> Integer
|
1607
|
+
# resp.table.local_secondary_indexes[0].item_count #=> Integer
|
1608
|
+
# resp.table.local_secondary_indexes[0].index_arn #=> String
|
1609
|
+
# resp.table.global_secondary_indexes #=> Array
|
1610
|
+
# resp.table.global_secondary_indexes[0].index_name #=> String
|
1611
|
+
# resp.table.global_secondary_indexes[0].key_schema #=> Array
|
1612
|
+
# resp.table.global_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
1613
|
+
# resp.table.global_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
1614
|
+
# resp.table.global_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
1615
|
+
# resp.table.global_secondary_indexes[0].projection.non_key_attributes #=> Array
|
1616
|
+
# resp.table.global_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
1617
|
+
# resp.table.global_secondary_indexes[0].index_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
1618
|
+
# resp.table.global_secondary_indexes[0].backfilling #=> Boolean
|
1619
|
+
# resp.table.global_secondary_indexes[0].provisioned_throughput.last_increase_date_time #=> Time
|
1620
|
+
# resp.table.global_secondary_indexes[0].provisioned_throughput.last_decrease_date_time #=> Time
|
1621
|
+
# resp.table.global_secondary_indexes[0].provisioned_throughput.number_of_decreases_today #=> Integer
|
1622
|
+
# resp.table.global_secondary_indexes[0].provisioned_throughput.read_capacity_units #=> Integer
|
1623
|
+
# resp.table.global_secondary_indexes[0].provisioned_throughput.write_capacity_units #=> Integer
|
1624
|
+
# resp.table.global_secondary_indexes[0].index_size_bytes #=> Integer
|
1625
|
+
# resp.table.global_secondary_indexes[0].item_count #=> Integer
|
1626
|
+
# resp.table.global_secondary_indexes[0].index_arn #=> String
|
1627
|
+
# resp.table.stream_specification.stream_enabled #=> Boolean
|
1628
|
+
# resp.table.stream_specification.stream_view_type #=> String, one of "NEW_IMAGE", "OLD_IMAGE", "NEW_AND_OLD_IMAGES", "KEYS_ONLY"
|
1629
|
+
# resp.table.latest_stream_label #=> String
|
1630
|
+
# resp.table.latest_stream_arn #=> String
|
1631
|
+
# @overload describe_table(params = {})
|
1632
|
+
# @param [Hash] params ({})
|
1633
|
+
def describe_table(params = {}, options = {})
|
1634
|
+
req = build_request(:describe_table, params)
|
1635
|
+
req.send_request(options)
|
1636
|
+
end
|
1637
|
+
|
1638
|
+
# The *GetItem* operation returns a set of attributes for the item with
|
1639
|
+
# the given primary key. If there is no matching item, *GetItem* does
|
1640
|
+
# not return any data.
|
1641
|
+
#
|
1642
|
+
# *GetItem* provides an eventually consistent read by default. If your
|
1643
|
+
# application requires a strongly consistent read, set *ConsistentRead*
|
1644
|
+
# to `true`. Although a strongly consistent read might take more time
|
1645
|
+
# than an eventually consistent read, it always returns the last updated
|
1646
|
+
# value.
|
1647
|
+
# @option params [required, String] :table_name
|
1648
|
+
# The name of the table containing the requested item.
|
1649
|
+
# @option params [required, Hash<String,Types::AttributeValue>] :key
|
1650
|
+
# A map of attribute names to *AttributeValue* objects, representing the
|
1651
|
+
# primary key of the item to retrieve.
|
1652
|
+
#
|
1653
|
+
# For the primary key, you must provide all of the attributes. For
|
1654
|
+
# example, with a simple primary key, you only need to provide a value
|
1655
|
+
# for the partition key. For a composite primary key, you must provide
|
1656
|
+
# values for both the partition key and the sort key.
|
1657
|
+
# @option params [Array<String>] :attributes_to_get
|
1658
|
+
# This is a legacy parameter, for backward compatibility. New
|
1659
|
+
# applications should use *ProjectionExpression* instead. Do not combine
|
1660
|
+
# legacy parameters and expression parameters in a single API call;
|
1661
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
1662
|
+
#
|
1663
|
+
# This parameter allows you to retrieve attributes of type List or Map;
|
1664
|
+
# however, it cannot retrieve individual elements within a List or a
|
1665
|
+
# Map.
|
1666
|
+
#
|
1667
|
+
# The names of one or more attributes to retrieve. If no attribute names
|
1668
|
+
# are provided, then all attributes will be returned. If any of the
|
1669
|
+
# requested attributes are not found, they will not appear in the
|
1670
|
+
# result.
|
1671
|
+
#
|
1672
|
+
# Note that *AttributesToGet* has no effect on provisioned throughput
|
1673
|
+
# consumption. DynamoDB determines capacity units consumed based on item
|
1674
|
+
# size, not on the amount of data that is returned to an application.
|
1675
|
+
# @option params [Boolean] :consistent_read
|
1676
|
+
# Determines the read consistency model: If set to `true`, then the
|
1677
|
+
# operation uses strongly consistent reads; otherwise, the operation
|
1678
|
+
# uses eventually consistent reads.
|
1679
|
+
# @option params [String] :return_consumed_capacity
|
1680
|
+
# Determines the level of detail about provisioned throughput
|
1681
|
+
# consumption that is returned in the response:
|
1682
|
+
#
|
1683
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
1684
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
1685
|
+
# and secondary index that was accessed.
|
1686
|
+
#
|
1687
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
1688
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
1689
|
+
# will only return *ConsumedCapacity* information for table(s).
|
1690
|
+
#
|
1691
|
+
# * *TOTAL* - The response includes only the aggregate
|
1692
|
+
# *ConsumedCapacity* for the operation.
|
1693
|
+
#
|
1694
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
1695
|
+
# @option params [String] :projection_expression
|
1696
|
+
# A string that identifies one or more attributes to retrieve from the
|
1697
|
+
# table. These attributes can include scalars, sets, or elements of a
|
1698
|
+
# JSON document. The attributes in the expression must be separated by
|
1699
|
+
# commas.
|
1700
|
+
#
|
1701
|
+
# If no attribute names are specified, then all attributes will be
|
1702
|
+
# returned. If any of the requested attributes are not found, they will
|
1703
|
+
# not appear in the result.
|
1704
|
+
#
|
1705
|
+
# For more information, see [Accessing Item Attributes][1] in the
|
1706
|
+
# *Amazon DynamoDB Developer Guide*.
|
1707
|
+
#
|
1708
|
+
# <note markdown="1"> *ProjectionExpression* replaces the legacy *AttributesToGet*
|
1709
|
+
# parameter.
|
1710
|
+
#
|
1711
|
+
# </note>
|
1712
|
+
#
|
1713
|
+
#
|
1714
|
+
#
|
1715
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
1716
|
+
# @option params [Hash<String,String>] :expression_attribute_names
|
1717
|
+
# One or more substitution tokens for attribute names in an expression.
|
1718
|
+
# The following are some use cases for using
|
1719
|
+
# *ExpressionAttributeNames*\:
|
1720
|
+
#
|
1721
|
+
# * To access an attribute whose name conflicts with a DynamoDB reserved
|
1722
|
+
# word.
|
1723
|
+
#
|
1724
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
1725
|
+
# name in an expression.
|
1726
|
+
#
|
1727
|
+
# * To prevent special characters in an attribute name from being
|
1728
|
+
# misinterpreted in an expression.
|
1729
|
+
#
|
1730
|
+
# Use the **#** character in an expression to dereference an attribute
|
1731
|
+
# name. For example, consider the following attribute name:
|
1732
|
+
#
|
1733
|
+
# * `Percentile`
|
1734
|
+
#
|
1735
|
+
# ^
|
1736
|
+
#
|
1737
|
+
# The name of this attribute conflicts with a reserved word, so it
|
1738
|
+
# cannot be used directly in an expression. (For the complete list of
|
1739
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
1740
|
+
# Developer Guide*). To work around this, you could specify the
|
1741
|
+
# following for *ExpressionAttributeNames*\:
|
1742
|
+
#
|
1743
|
+
# * `\{"#P":"Percentile"\}`
|
1744
|
+
#
|
1745
|
+
# ^
|
1746
|
+
#
|
1747
|
+
# You could then use this substitution in an expression, as in this
|
1748
|
+
# example:
|
1749
|
+
#
|
1750
|
+
# * `#P = :val`
|
1751
|
+
#
|
1752
|
+
# ^
|
1753
|
+
#
|
1754
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
|
1755
|
+
# values*, which are placeholders for the actual value at runtime.
|
1756
|
+
#
|
1757
|
+
# </note>
|
1758
|
+
#
|
1759
|
+
# For more information on expression attribute names, see [Accessing
|
1760
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
1761
|
+
#
|
1762
|
+
#
|
1763
|
+
#
|
1764
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
1765
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
1766
|
+
# @return [Types::GetItemOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1767
|
+
#
|
1768
|
+
# * {Types::GetItemOutput#item #Item} => Hash<String,Types::AttributeValue>
|
1769
|
+
# * {Types::GetItemOutput#consumed_capacity #ConsumedCapacity} => Types::ConsumedCapacity
|
1770
|
+
#
|
1771
|
+
# @example Request syntax with placeholder values
|
1772
|
+
# resp = client.get_item({
|
1773
|
+
# table_name: "TableName", # required
|
1774
|
+
# key: { # required
|
1775
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1776
|
+
# },
|
1777
|
+
# attributes_to_get: ["AttributeName"],
|
1778
|
+
# consistent_read: false,
|
1779
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
1780
|
+
# projection_expression: "ProjectionExpression",
|
1781
|
+
# expression_attribute_names: {
|
1782
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
1783
|
+
# },
|
1784
|
+
# })
|
1785
|
+
#
|
1786
|
+
# @example Response structure
|
1787
|
+
# resp.item #=> Hash
|
1788
|
+
# resp.item["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
1789
|
+
# resp.consumed_capacity.table_name #=> String
|
1790
|
+
# resp.consumed_capacity.capacity_units #=> Float
|
1791
|
+
# resp.consumed_capacity.table.capacity_units #=> Float
|
1792
|
+
# resp.consumed_capacity.local_secondary_indexes #=> Hash
|
1793
|
+
# resp.consumed_capacity.local_secondary_indexes["IndexName"].capacity_units #=> Float
|
1794
|
+
# resp.consumed_capacity.global_secondary_indexes #=> Hash
|
1795
|
+
# resp.consumed_capacity.global_secondary_indexes["IndexName"].capacity_units #=> Float
|
1796
|
+
# @overload get_item(params = {})
|
1797
|
+
# @param [Hash] params ({})
|
1798
|
+
def get_item(params = {}, options = {})
|
1799
|
+
req = build_request(:get_item, params)
|
1800
|
+
req.send_request(options)
|
1801
|
+
end
|
1802
|
+
|
1803
|
+
# Returns an array of table names associated with the current account
|
1804
|
+
# and endpoint. The output from *ListTables* is paginated, with each
|
1805
|
+
# page returning a maximum of 100 table names.
|
1806
|
+
# @option params [String] :exclusive_start_table_name
|
1807
|
+
# The first table name that this operation will evaluate. Use the value
|
1808
|
+
# that was returned for *LastEvaluatedTableName* in a previous
|
1809
|
+
# operation, so that you can obtain the next page of results.
|
1810
|
+
# @option params [Integer] :limit
|
1811
|
+
# A maximum number of table names to return. If this parameter is not
|
1812
|
+
# specified, the limit is 100.
|
1813
|
+
# @return [Types::ListTablesOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1814
|
+
#
|
1815
|
+
# * {Types::ListTablesOutput#table_names #TableNames} => Array<String>
|
1816
|
+
# * {Types::ListTablesOutput#last_evaluated_table_name #LastEvaluatedTableName} => String
|
1817
|
+
#
|
1818
|
+
# @example Request syntax with placeholder values
|
1819
|
+
# resp = client.list_tables({
|
1820
|
+
# exclusive_start_table_name: "TableName",
|
1821
|
+
# limit: 1,
|
1822
|
+
# })
|
1823
|
+
#
|
1824
|
+
# @example Response structure
|
1825
|
+
# resp.table_names #=> Array
|
1826
|
+
# resp.table_names[0] #=> String
|
1827
|
+
# resp.last_evaluated_table_name #=> String
|
1828
|
+
# @overload list_tables(params = {})
|
1829
|
+
# @param [Hash] params ({})
|
1830
|
+
def list_tables(params = {}, options = {})
|
1831
|
+
req = build_request(:list_tables, params)
|
1832
|
+
req.send_request(options)
|
1833
|
+
end
|
1834
|
+
|
1835
|
+
# Creates a new item, or replaces an old item with a new item. If an
|
1836
|
+
# item that has the same primary key as the new item already exists in
|
1837
|
+
# the specified table, the new item completely replaces the existing
|
1838
|
+
# item. You can perform a conditional put operation (add a new item if
|
1839
|
+
# one with the specified primary key doesn't exist), or replace an
|
1840
|
+
# existing item if it has certain attribute values.
|
1841
|
+
#
|
1842
|
+
# In addition to putting an item, you can also return the item's
|
1843
|
+
# attribute values in the same operation, using the *ReturnValues*
|
1844
|
+
# parameter.
|
1845
|
+
#
|
1846
|
+
# When you add an item, the primary key attribute(s) are the only
|
1847
|
+
# required attributes. Attribute values cannot be null. String and
|
1848
|
+
# Binary type attributes must have lengths greater than zero. Set type
|
1849
|
+
# attributes cannot be empty. Requests with empty values will be
|
1850
|
+
# rejected with a *ValidationException* exception.
|
1851
|
+
#
|
1852
|
+
# You can request that *PutItem* return either a copy of the original
|
1853
|
+
# item (before the update) or a copy of the updated item (after the
|
1854
|
+
# update). For more information, see the *ReturnValues* description
|
1855
|
+
# below.
|
1856
|
+
#
|
1857
|
+
# <note markdown="1"> To prevent a new item from replacing an existing item, use a
|
1858
|
+
# conditional expression that contains the `attribute_not_exists`
|
1859
|
+
# function with the name of the attribute being used as the partition
|
1860
|
+
# key for the table. Since every record must contain that attribute, the
|
1861
|
+
# `attribute_not_exists` function will only succeed if no matching item
|
1862
|
+
# exists.
|
1863
|
+
#
|
1864
|
+
# </note>
|
1865
|
+
#
|
1866
|
+
# For more information about using this API, see [Working with Items][1]
|
1867
|
+
# in the *Amazon DynamoDB Developer Guide*.
|
1868
|
+
#
|
1869
|
+
#
|
1870
|
+
#
|
1871
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html
|
1872
|
+
# @option params [required, String] :table_name
|
1873
|
+
# The name of the table to contain the item.
|
1874
|
+
# @option params [required, Hash<String,Types::AttributeValue>] :item
|
1875
|
+
# A map of attribute name/value pairs, one for each attribute. Only the
|
1876
|
+
# primary key attributes are required; you can optionally provide other
|
1877
|
+
# attribute name-value pairs for the item.
|
1878
|
+
#
|
1879
|
+
# You must provide all of the attributes for the primary key. For
|
1880
|
+
# example, with a simple primary key, you only need to provide a value
|
1881
|
+
# for the partition key. For a composite primary key, you must provide
|
1882
|
+
# both values for both the partition key and the sort key.
|
1883
|
+
#
|
1884
|
+
# If you specify any attributes that are part of an index key, then the
|
1885
|
+
# data types for those attributes must match those of the schema in the
|
1886
|
+
# table's attribute definition.
|
1887
|
+
#
|
1888
|
+
# For more information about primary keys, see [Primary Key][1] in the
|
1889
|
+
# *Amazon DynamoDB Developer Guide*.
|
1890
|
+
#
|
1891
|
+
# Each element in the *Item* map is an *AttributeValue* object.
|
1892
|
+
#
|
1893
|
+
#
|
1894
|
+
#
|
1895
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModelPrimaryKey
|
1896
|
+
# @option params [Hash<String,Types::ExpectedAttributeValue>] :expected
|
1897
|
+
# This is a legacy parameter, for backward compatibility. New
|
1898
|
+
# applications should use *ConditionExpression* instead. Do not combine
|
1899
|
+
# legacy parameters and expression parameters in a single API call;
|
1900
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
1901
|
+
#
|
1902
|
+
# A map of attribute/condition pairs. *Expected* provides a conditional
|
1903
|
+
# block for the *PutItem* operation.
|
1904
|
+
#
|
1905
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
1906
|
+
#
|
1907
|
+
# </note>
|
1908
|
+
#
|
1909
|
+
# Each element of *Expected* consists of an attribute name, a comparison
|
1910
|
+
# operator, and one or more values. DynamoDB compares the attribute with
|
1911
|
+
# the value(s) you supplied, using the comparison operator. For each
|
1912
|
+
# *Expected* element, the result of the evaluation is either true or
|
1913
|
+
# false.
|
1914
|
+
#
|
1915
|
+
# If you specify more than one element in the *Expected* map, then by
|
1916
|
+
# default all of the conditions must evaluate to true. In other words,
|
1917
|
+
# the conditions are ANDed together. (You can use the
|
1918
|
+
# *ConditionalOperator* parameter to OR the conditions instead. If you
|
1919
|
+
# do this, then at least one of the conditions must evaluate to true,
|
1920
|
+
# rather than all of them.)
|
1921
|
+
#
|
1922
|
+
# If the *Expected* map evaluates to true, then the conditional
|
1923
|
+
# operation succeeds; otherwise, it fails.
|
1924
|
+
#
|
1925
|
+
# *Expected* contains the following:
|
1926
|
+
#
|
1927
|
+
# * *AttributeValueList* - One or more values to evaluate against the
|
1928
|
+
# supplied attribute. The number of values in the list depends on the
|
1929
|
+
# *ComparisonOperator* being used.
|
1930
|
+
#
|
1931
|
+
# For type Number, value comparisons are numeric.
|
1932
|
+
#
|
1933
|
+
# String value comparisons for greater than, equals, or less than are
|
1934
|
+
# based on ASCII character code values. For example, `a` is greater
|
1935
|
+
# than `A`, and `a` is greater than `B`. For a list of code values,
|
1936
|
+
# see
|
1937
|
+
# [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
|
1938
|
+
#
|
1939
|
+
# For type Binary, DynamoDB treats each byte of the binary data as
|
1940
|
+
# unsigned when it compares binary values.
|
1941
|
+
#
|
1942
|
+
# * *ComparisonOperator* - A comparator for evaluating attributes in the
|
1943
|
+
# *AttributeValueList*. When performing the comparison, DynamoDB uses
|
1944
|
+
# strongly consistent reads.
|
1945
|
+
#
|
1946
|
+
# The following comparison operators are available:
|
1947
|
+
#
|
1948
|
+
# `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
|
1949
|
+
# NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
|
1950
|
+
#
|
1951
|
+
# The following are descriptions of each comparison operator.
|
1952
|
+
#
|
1953
|
+
# * `EQ`\: Equal. `EQ` is supported for all datatypes, including lists
|
1954
|
+
# and maps.
|
1955
|
+
#
|
1956
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
1957
|
+
# of type String, Number, Binary, String Set, Number Set, or Binary
|
1958
|
+
# Set. If an item contains an *AttributeValue* element of a
|
1959
|
+
# different type than the one provided in the request, the value
|
1960
|
+
# does not match. For example, `\{"S":"6"\}` does not equal
|
1961
|
+
# `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not equal `\{"NS":["6",
|
1962
|
+
# "2", "1"]\}`.
|
1963
|
+
#
|
1964
|
+
#
|
1965
|
+
#
|
1966
|
+
# * `NE`\: Not equal. `NE` is supported for all datatypes, including
|
1967
|
+
# lists and maps.
|
1968
|
+
#
|
1969
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
1970
|
+
# String, Number, Binary, String Set, Number Set, or Binary Set. If
|
1971
|
+
# an item contains an *AttributeValue* of a different type than the
|
1972
|
+
# one provided in the request, the value does not match. For
|
1973
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
1974
|
+
# `\{"N":"6"\}` does not equal `\{"NS":["6", "2", "1"]\}`.
|
1975
|
+
#
|
1976
|
+
#
|
1977
|
+
#
|
1978
|
+
# * `LE`\: Less than or equal.
|
1979
|
+
#
|
1980
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
1981
|
+
# of type String, Number, or Binary (not a set type). If an item
|
1982
|
+
# contains an *AttributeValue* element of a different type than the
|
1983
|
+
# one provided in the request, the value does not match. For
|
1984
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
1985
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
1986
|
+
#
|
1987
|
+
#
|
1988
|
+
#
|
1989
|
+
# * `LT`\: Less than.
|
1990
|
+
#
|
1991
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
1992
|
+
# String, Number, or Binary (not a set type). If an item contains an
|
1993
|
+
# *AttributeValue* element of a different type than the one provided
|
1994
|
+
# in the request, the value does not match. For example,
|
1995
|
+
# `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
|
1996
|
+
# does not compare to `\{"NS":["6", "2", "1"]\}`.
|
1997
|
+
#
|
1998
|
+
#
|
1999
|
+
#
|
2000
|
+
# * `GE`\: Greater than or equal.
|
2001
|
+
#
|
2002
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
2003
|
+
# of type String, Number, or Binary (not a set type). If an item
|
2004
|
+
# contains an *AttributeValue* element of a different type than the
|
2005
|
+
# one provided in the request, the value does not match. For
|
2006
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
2007
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
2008
|
+
#
|
2009
|
+
#
|
2010
|
+
#
|
2011
|
+
# * `GT`\: Greater than.
|
2012
|
+
#
|
2013
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
2014
|
+
# of type String, Number, or Binary (not a set type). If an item
|
2015
|
+
# contains an *AttributeValue* element of a different type than the
|
2016
|
+
# one provided in the request, the value does not match. For
|
2017
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
2018
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
2019
|
+
#
|
2020
|
+
#
|
2021
|
+
#
|
2022
|
+
# * `NOT_NULL`\: The attribute exists. `NOT_NULL` is supported for all
|
2023
|
+
# datatypes, including lists and maps.
|
2024
|
+
#
|
2025
|
+
# <note markdown="1"> This operator tests for the existence of an attribute, not its
|
2026
|
+
# data type. If the data type of attribute "`a`" is null, and you
|
2027
|
+
# evaluate it using `NOT_NULL`, the result is a Boolean *true*. This
|
2028
|
+
# result is because the attribute "`a`" exists; its data type is
|
2029
|
+
# not relevant to the `NOT_NULL` comparison operator.
|
2030
|
+
#
|
2031
|
+
# </note>
|
2032
|
+
#
|
2033
|
+
# * `NULL`\: The attribute does not exist. `NULL` is supported for all
|
2034
|
+
# datatypes, including lists and maps.
|
2035
|
+
#
|
2036
|
+
# <note markdown="1"> This operator tests for the nonexistence of an attribute, not its
|
2037
|
+
# data type. If the data type of attribute "`a`" is null, and you
|
2038
|
+
# evaluate it using `NULL`, the result is a Boolean *false*. This is
|
2039
|
+
# because the attribute "`a`" exists; its data type is not
|
2040
|
+
# relevant to the `NULL` comparison operator.
|
2041
|
+
#
|
2042
|
+
# </note>
|
2043
|
+
#
|
2044
|
+
# * `CONTAINS`\: Checks for a subsequence, or value in a set.
|
2045
|
+
#
|
2046
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
2047
|
+
# of type String, Number, or Binary (not a set type). If the target
|
2048
|
+
# attribute of the comparison is of type String, then the operator
|
2049
|
+
# checks for a substring match. If the target attribute of the
|
2050
|
+
# comparison is of type Binary, then the operator looks for a
|
2051
|
+
# subsequence of the target that matches the input. If the target
|
2052
|
+
# attribute of the comparison is a set ("`SS`", "`NS`", or
|
2053
|
+
# "`BS`"), then the operator evaluates to true if it finds an
|
2054
|
+
# exact match with any member of the set.
|
2055
|
+
#
|
2056
|
+
# CONTAINS is supported for lists: When evaluating "`a CONTAINS
|
2057
|
+
# b`", "`a`" can be a list; however, "`b`" cannot be a set, a
|
2058
|
+
# map, or a list.
|
2059
|
+
#
|
2060
|
+
# * `NOT_CONTAINS`\: Checks for absence of a subsequence, or absence
|
2061
|
+
# of a value in a set.
|
2062
|
+
#
|
2063
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
2064
|
+
# of type String, Number, or Binary (not a set type). If the target
|
2065
|
+
# attribute of the comparison is a String, then the operator checks
|
2066
|
+
# for the absence of a substring match. If the target attribute of
|
2067
|
+
# the comparison is Binary, then the operator checks for the absence
|
2068
|
+
# of a subsequence of the target that matches the input. If the
|
2069
|
+
# target attribute of the comparison is a set ("`SS`", "`NS`",
|
2070
|
+
# or "`BS`"), then the operator evaluates to true if it *does not*
|
2071
|
+
# find an exact match with any member of the set.
|
2072
|
+
#
|
2073
|
+
# NOT\_CONTAINS is supported for lists: When evaluating "`a NOT
|
2074
|
+
# CONTAINS b`", "`a`" can be a list; however, "`b`" cannot be a
|
2075
|
+
# set, a map, or a list.
|
2076
|
+
#
|
2077
|
+
# * `BEGINS_WITH`\: Checks for a prefix.
|
2078
|
+
#
|
2079
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
2080
|
+
# String or Binary (not a Number or a set type). The target
|
2081
|
+
# attribute of the comparison must be of type String or Binary (not
|
2082
|
+
# a Number or a set type).
|
2083
|
+
#
|
2084
|
+
#
|
2085
|
+
#
|
2086
|
+
# * `IN`\: Checks for matching elements within two sets.
|
2087
|
+
#
|
2088
|
+
# *AttributeValueList* can contain one or more *AttributeValue*
|
2089
|
+
# elements of type String, Number, or Binary (not a set type). These
|
2090
|
+
# attributes are compared against an existing set type attribute of
|
2091
|
+
# an item. If any elements of the input set are present in the item
|
2092
|
+
# attribute, the expression evaluates to true.
|
2093
|
+
#
|
2094
|
+
# * `BETWEEN`\: Greater than or equal to the first value, and less
|
2095
|
+
# than or equal to the second value.
|
2096
|
+
#
|
2097
|
+
# *AttributeValueList* must contain two *AttributeValue* elements of
|
2098
|
+
# the same type, either String, Number, or Binary (not a set type).
|
2099
|
+
# A target attribute matches if the target value is greater than, or
|
2100
|
+
# equal to, the first element and less than, or equal to, the second
|
2101
|
+
# element. If an item contains an *AttributeValue* element of a
|
2102
|
+
# different type than the one provided in the request, the value
|
2103
|
+
# does not match. For example, `\{"S":"6"\}` does not compare to
|
2104
|
+
# `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
|
2105
|
+
# `\{"NS":["6", "2", "1"]\}`
|
2106
|
+
#
|
2107
|
+
# For usage examples of *AttributeValueList* and *ComparisonOperator*,
|
2108
|
+
# see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
|
2109
|
+
# Developer Guide*.
|
2110
|
+
#
|
2111
|
+
# For backward compatibility with previous DynamoDB releases, the
|
2112
|
+
# following parameters can be used instead of *AttributeValueList* and
|
2113
|
+
# *ComparisonOperator*\:
|
2114
|
+
#
|
2115
|
+
# * *Value* - A value for DynamoDB to compare with an attribute.
|
2116
|
+
#
|
2117
|
+
# * *Exists* - A Boolean value that causes DynamoDB to evaluate the
|
2118
|
+
# value before attempting the conditional operation:
|
2119
|
+
#
|
2120
|
+
# * If *Exists* is `true`, DynamoDB will check to see if that
|
2121
|
+
# attribute value already exists in the table. If it is found, then
|
2122
|
+
# the condition evaluates to true; otherwise the condition evaluate
|
2123
|
+
# to false.
|
2124
|
+
#
|
2125
|
+
# * If *Exists* is `false`, DynamoDB assumes that the attribute value
|
2126
|
+
# does *not* exist in the table. If in fact the value does not
|
2127
|
+
# exist, then the assumption is valid and the condition evaluates to
|
2128
|
+
# true. If the value is found, despite the assumption that it does
|
2129
|
+
# not exist, the condition evaluates to false.
|
2130
|
+
#
|
2131
|
+
# Note that the default value for *Exists* is `true`.
|
2132
|
+
#
|
2133
|
+
# The *Value* and *Exists* parameters are incompatible with
|
2134
|
+
# *AttributeValueList* and *ComparisonOperator*. Note that if you use
|
2135
|
+
# both sets of parameters at once, DynamoDB will return a
|
2136
|
+
# *ValidationException* exception.
|
2137
|
+
#
|
2138
|
+
#
|
2139
|
+
#
|
2140
|
+
# [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
2141
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
|
2142
|
+
# @option params [String] :return_values
|
2143
|
+
# Use *ReturnValues* if you want to get the item attributes as they
|
2144
|
+
# appeared before they were updated with the *PutItem* request. For
|
2145
|
+
# *PutItem*, the valid values are:
|
2146
|
+
#
|
2147
|
+
# * `NONE` - If *ReturnValues* is not specified, or if its value is
|
2148
|
+
# `NONE`, then nothing is returned. (This setting is the default for
|
2149
|
+
# *ReturnValues*.)
|
2150
|
+
#
|
2151
|
+
# * `ALL_OLD` - If *PutItem* overwrote an attribute name-value pair,
|
2152
|
+
# then the content of the old item is returned.
|
2153
|
+
#
|
2154
|
+
# <note markdown="1"> The *ReturnValues* parameter is used by several DynamoDB operations;
|
2155
|
+
# however, *PutItem* does not recognize any values other than `NONE` or
|
2156
|
+
# `ALL_OLD`.
|
2157
|
+
#
|
2158
|
+
# </note>
|
2159
|
+
# @option params [String] :return_consumed_capacity
|
2160
|
+
# Determines the level of detail about provisioned throughput
|
2161
|
+
# consumption that is returned in the response:
|
2162
|
+
#
|
2163
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
2164
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
2165
|
+
# and secondary index that was accessed.
|
2166
|
+
#
|
2167
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
2168
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
2169
|
+
# will only return *ConsumedCapacity* information for table(s).
|
2170
|
+
#
|
2171
|
+
# * *TOTAL* - The response includes only the aggregate
|
2172
|
+
# *ConsumedCapacity* for the operation.
|
2173
|
+
#
|
2174
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
2175
|
+
# @option params [String] :return_item_collection_metrics
|
2176
|
+
# Determines whether item collection metrics are returned. If set to
|
2177
|
+
# `SIZE`, the response includes statistics about item collections, if
|
2178
|
+
# any, that were modified during the operation are returned in the
|
2179
|
+
# response. If set to `NONE` (the default), no statistics are returned.
|
2180
|
+
# @option params [String] :conditional_operator
|
2181
|
+
# This is a legacy parameter, for backward compatibility. New
|
2182
|
+
# applications should use *ConditionExpression* instead. Do not combine
|
2183
|
+
# legacy parameters and expression parameters in a single API call;
|
2184
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
2185
|
+
#
|
2186
|
+
# A logical operator to apply to the conditions in the *Expected* map:
|
2187
|
+
#
|
2188
|
+
# * `AND` - If all of the conditions evaluate to true, then the entire
|
2189
|
+
# map evaluates to true.
|
2190
|
+
#
|
2191
|
+
# * `OR` - If at least one of the conditions evaluate to true, then the
|
2192
|
+
# entire map evaluates to true.
|
2193
|
+
#
|
2194
|
+
# If you omit *ConditionalOperator*, then `AND` is the default.
|
2195
|
+
#
|
2196
|
+
# The operation will succeed only if the entire map evaluates to true.
|
2197
|
+
#
|
2198
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
2199
|
+
#
|
2200
|
+
# </note>
|
2201
|
+
# @option params [String] :condition_expression
|
2202
|
+
# A condition that must be satisfied in order for a conditional
|
2203
|
+
# *PutItem* operation to succeed.
|
2204
|
+
#
|
2205
|
+
# An expression can contain any of the following:
|
2206
|
+
#
|
2207
|
+
# * Functions: `attribute_exists | attribute_not_exists | attribute_type
|
2208
|
+
# | contains | begins_with | size`
|
2209
|
+
#
|
2210
|
+
# These function names are case-sensitive.
|
2211
|
+
#
|
2212
|
+
# * Comparison operators: ` = | <> | < | > | <=
|
2213
|
+
# | >= | BETWEEN | IN`
|
2214
|
+
#
|
2215
|
+
# * Logical operators: `AND | OR | NOT`
|
2216
|
+
#
|
2217
|
+
# For more information on condition expressions, see [Specifying
|
2218
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
2219
|
+
#
|
2220
|
+
# <note markdown="1"> *ConditionExpression* replaces the legacy *ConditionalOperator* and
|
2221
|
+
# *Expected* parameters.
|
2222
|
+
#
|
2223
|
+
# </note>
|
2224
|
+
#
|
2225
|
+
#
|
2226
|
+
#
|
2227
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
2228
|
+
# @option params [Hash<String,String>] :expression_attribute_names
|
2229
|
+
# One or more substitution tokens for attribute names in an expression.
|
2230
|
+
# The following are some use cases for using
|
2231
|
+
# *ExpressionAttributeNames*\:
|
2232
|
+
#
|
2233
|
+
# * To access an attribute whose name conflicts with a DynamoDB reserved
|
2234
|
+
# word.
|
2235
|
+
#
|
2236
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
2237
|
+
# name in an expression.
|
2238
|
+
#
|
2239
|
+
# * To prevent special characters in an attribute name from being
|
2240
|
+
# misinterpreted in an expression.
|
2241
|
+
#
|
2242
|
+
# Use the **#** character in an expression to dereference an attribute
|
2243
|
+
# name. For example, consider the following attribute name:
|
2244
|
+
#
|
2245
|
+
# * `Percentile`
|
2246
|
+
#
|
2247
|
+
# ^
|
2248
|
+
#
|
2249
|
+
# The name of this attribute conflicts with a reserved word, so it
|
2250
|
+
# cannot be used directly in an expression. (For the complete list of
|
2251
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
2252
|
+
# Developer Guide*). To work around this, you could specify the
|
2253
|
+
# following for *ExpressionAttributeNames*\:
|
2254
|
+
#
|
2255
|
+
# * `\{"#P":"Percentile"\}`
|
2256
|
+
#
|
2257
|
+
# ^
|
2258
|
+
#
|
2259
|
+
# You could then use this substitution in an expression, as in this
|
2260
|
+
# example:
|
2261
|
+
#
|
2262
|
+
# * `#P = :val`
|
2263
|
+
#
|
2264
|
+
# ^
|
2265
|
+
#
|
2266
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
|
2267
|
+
# values*, which are placeholders for the actual value at runtime.
|
2268
|
+
#
|
2269
|
+
# </note>
|
2270
|
+
#
|
2271
|
+
# For more information on expression attribute names, see [Accessing
|
2272
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
2273
|
+
#
|
2274
|
+
#
|
2275
|
+
#
|
2276
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
2277
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
2278
|
+
# @option params [Hash<String,Types::AttributeValue>] :expression_attribute_values
|
2279
|
+
# One or more values that can be substituted in an expression.
|
2280
|
+
#
|
2281
|
+
# Use the **\:** (colon) character in an expression to dereference an
|
2282
|
+
# attribute value. For example, suppose that you wanted to check whether
|
2283
|
+
# the value of the *ProductStatus* attribute was one of the following:
|
2284
|
+
#
|
2285
|
+
# `Available | Backordered | Discontinued`
|
2286
|
+
#
|
2287
|
+
# You would first need to specify *ExpressionAttributeValues* as
|
2288
|
+
# follows:
|
2289
|
+
#
|
2290
|
+
# `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
|
2291
|
+
# ":disc":\{"S":"Discontinued"\} \}`
|
2292
|
+
#
|
2293
|
+
# You could then use these values in an expression, such as this:
|
2294
|
+
#
|
2295
|
+
# `ProductStatus IN (:avail, :back, :disc)`
|
2296
|
+
#
|
2297
|
+
# For more information on expression attribute values, see [Specifying
|
2298
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
2299
|
+
#
|
2300
|
+
#
|
2301
|
+
#
|
2302
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
2303
|
+
# @return [Types::PutItemOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
2304
|
+
#
|
2305
|
+
# * {Types::PutItemOutput#attributes #Attributes} => Hash<String,Types::AttributeValue>
|
2306
|
+
# * {Types::PutItemOutput#consumed_capacity #ConsumedCapacity} => Types::ConsumedCapacity
|
2307
|
+
# * {Types::PutItemOutput#item_collection_metrics #ItemCollectionMetrics} => Types::ItemCollectionMetrics
|
2308
|
+
#
|
2309
|
+
# @example Request syntax with placeholder values
|
2310
|
+
# resp = client.put_item({
|
2311
|
+
# table_name: "TableName", # required
|
2312
|
+
# item: { # required
|
2313
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2314
|
+
# },
|
2315
|
+
# expected: {
|
2316
|
+
# "AttributeName" => {
|
2317
|
+
# value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2318
|
+
# exists: false,
|
2319
|
+
# comparison_operator: "EQ", # accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
|
2320
|
+
# attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2321
|
+
# },
|
2322
|
+
# },
|
2323
|
+
# return_values: "NONE", # accepts NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW
|
2324
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
2325
|
+
# return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
|
2326
|
+
# conditional_operator: "AND", # accepts AND, OR
|
2327
|
+
# condition_expression: "ConditionExpression",
|
2328
|
+
# expression_attribute_names: {
|
2329
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
2330
|
+
# },
|
2331
|
+
# expression_attribute_values: {
|
2332
|
+
# "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2333
|
+
# },
|
2334
|
+
# })
|
2335
|
+
#
|
2336
|
+
# @example Response structure
|
2337
|
+
# resp.attributes #=> Hash
|
2338
|
+
# resp.attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2339
|
+
# resp.consumed_capacity.table_name #=> String
|
2340
|
+
# resp.consumed_capacity.capacity_units #=> Float
|
2341
|
+
# resp.consumed_capacity.table.capacity_units #=> Float
|
2342
|
+
# resp.consumed_capacity.local_secondary_indexes #=> Hash
|
2343
|
+
# resp.consumed_capacity.local_secondary_indexes["IndexName"].capacity_units #=> Float
|
2344
|
+
# resp.consumed_capacity.global_secondary_indexes #=> Hash
|
2345
|
+
# resp.consumed_capacity.global_secondary_indexes["IndexName"].capacity_units #=> Float
|
2346
|
+
# resp.item_collection_metrics.item_collection_key #=> Hash
|
2347
|
+
# resp.item_collection_metrics.item_collection_key["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2348
|
+
# resp.item_collection_metrics.size_estimate_range_gb #=> Array
|
2349
|
+
# resp.item_collection_metrics.size_estimate_range_gb[0] #=> Float
|
2350
|
+
# @overload put_item(params = {})
|
2351
|
+
# @param [Hash] params ({})
|
2352
|
+
def put_item(params = {}, options = {})
|
2353
|
+
req = build_request(:put_item, params)
|
2354
|
+
req.send_request(options)
|
2355
|
+
end
|
2356
|
+
|
2357
|
+
# A *Query* operation uses the primary key of a table or a secondary
|
2358
|
+
# index to directly access items from that table or index.
|
2359
|
+
#
|
2360
|
+
# Use the *KeyConditionExpression* parameter to provide a specific value
|
2361
|
+
# for the partition key. The *Query* operation will return all of the
|
2362
|
+
# items from the table or index with that partition key value. You can
|
2363
|
+
# optionally narrow the scope of the *Query* operation by specifying a
|
2364
|
+
# sort key value and a comparison operator in *KeyConditionExpression*.
|
2365
|
+
# You can use the *ScanIndexForward* parameter to get results in forward
|
2366
|
+
# or reverse order, by sort key.
|
2367
|
+
#
|
2368
|
+
# Queries that do not return results consume the minimum number of read
|
2369
|
+
# capacity units for that type of read operation.
|
2370
|
+
#
|
2371
|
+
# If the total number of items meeting the query criteria exceeds the
|
2372
|
+
# result set size limit of 1 MB, the query stops and results are
|
2373
|
+
# returned to the user with the *LastEvaluatedKey* element to continue
|
2374
|
+
# the query in a subsequent operation. Unlike a *Scan* operation, a
|
2375
|
+
# *Query* operation never returns both an empty result set and a
|
2376
|
+
# *LastEvaluatedKey* value. *LastEvaluatedKey* is only provided if you
|
2377
|
+
# have used the *Limit* parameter, or if the result set exceeds 1 MB
|
2378
|
+
# (prior to applying a filter).
|
2379
|
+
#
|
2380
|
+
# You can query a table, a local secondary index, or a global secondary
|
2381
|
+
# index. For a query on a table or on a local secondary index, you can
|
2382
|
+
# set the *ConsistentRead* parameter to `true` and obtain a strongly
|
2383
|
+
# consistent result. Global secondary indexes support eventually
|
2384
|
+
# consistent reads only, so do not specify *ConsistentRead* when
|
2385
|
+
# querying a global secondary index.
|
2386
|
+
# @option params [required, String] :table_name
|
2387
|
+
# The name of the table containing the requested items.
|
2388
|
+
# @option params [String] :index_name
|
2389
|
+
# The name of an index to query. This index can be any local secondary
|
2390
|
+
# index or global secondary index on the table. Note that if you use the
|
2391
|
+
# *IndexName* parameter, you must also provide *TableName.*
|
2392
|
+
# @option params [String] :select
|
2393
|
+
# The attributes to be returned in the result. You can retrieve all item
|
2394
|
+
# attributes, specific item attributes, the count of matching items, or
|
2395
|
+
# in the case of an index, some or all of the attributes projected into
|
2396
|
+
# the index.
|
2397
|
+
#
|
2398
|
+
# * `ALL_ATTRIBUTES` - Returns all of the item attributes from the
|
2399
|
+
# specified table or index. If you query a local secondary index, then
|
2400
|
+
# for each matching item in the index DynamoDB will fetch the entire
|
2401
|
+
# item from the parent table. If the index is configured to project
|
2402
|
+
# all item attributes, then all of the data can be obtained from the
|
2403
|
+
# local secondary index, and no fetching is required.
|
2404
|
+
#
|
2405
|
+
# * `ALL_PROJECTED_ATTRIBUTES` - Allowed only when querying an index.
|
2406
|
+
# Retrieves all attributes that have been projected into the index. If
|
2407
|
+
# the index is configured to project all attributes, this return value
|
2408
|
+
# is equivalent to specifying `ALL_ATTRIBUTES`.
|
2409
|
+
#
|
2410
|
+
# * `COUNT` - Returns the number of matching items, rather than the
|
2411
|
+
# matching items themselves.
|
2412
|
+
#
|
2413
|
+
# * `SPECIFIC_ATTRIBUTES` - Returns only the attributes listed in
|
2414
|
+
# *AttributesToGet*. This return value is equivalent to specifying
|
2415
|
+
# *AttributesToGet* without specifying any value for *Select*.
|
2416
|
+
#
|
2417
|
+
# If you query a local secondary index and request only attributes
|
2418
|
+
# that are projected into that index, the operation will read only the
|
2419
|
+
# index and not the table. If any of the requested attributes are not
|
2420
|
+
# projected into the local secondary index, DynamoDB will fetch each
|
2421
|
+
# of these attributes from the parent table. This extra fetching
|
2422
|
+
# incurs additional throughput cost and latency.
|
2423
|
+
#
|
2424
|
+
# If you query a global secondary index, you can only request
|
2425
|
+
# attributes that are projected into the index. Global secondary index
|
2426
|
+
# queries cannot fetch attributes from the parent table.
|
2427
|
+
#
|
2428
|
+
# If neither *Select* nor *AttributesToGet* are specified, DynamoDB
|
2429
|
+
# defaults to `ALL_ATTRIBUTES` when accessing a table, and
|
2430
|
+
# `ALL_PROJECTED_ATTRIBUTES` when accessing an index. You cannot use
|
2431
|
+
# both *Select* and *AttributesToGet* together in a single request,
|
2432
|
+
# unless the value for *Select* is `SPECIFIC_ATTRIBUTES`. (This usage is
|
2433
|
+
# equivalent to specifying *AttributesToGet* without any value for
|
2434
|
+
# *Select*.)
|
2435
|
+
#
|
2436
|
+
# <note markdown="1"> If you use the *ProjectionExpression* parameter, then the value for
|
2437
|
+
# *Select* can only be `SPECIFIC_ATTRIBUTES`. Any other value for
|
2438
|
+
# *Select* will return an error.
|
2439
|
+
#
|
2440
|
+
# </note>
|
2441
|
+
# @option params [Array<String>] :attributes_to_get
|
2442
|
+
# This is a legacy parameter, for backward compatibility. New
|
2443
|
+
# applications should use *ProjectionExpression* instead. Do not combine
|
2444
|
+
# legacy parameters and expression parameters in a single API call;
|
2445
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
2446
|
+
#
|
2447
|
+
# This parameter allows you to retrieve attributes of type List or Map;
|
2448
|
+
# however, it cannot retrieve individual elements within a List or a
|
2449
|
+
# Map.
|
2450
|
+
#
|
2451
|
+
# The names of one or more attributes to retrieve. If no attribute names
|
2452
|
+
# are provided, then all attributes will be returned. If any of the
|
2453
|
+
# requested attributes are not found, they will not appear in the
|
2454
|
+
# result.
|
2455
|
+
#
|
2456
|
+
# Note that *AttributesToGet* has no effect on provisioned throughput
|
2457
|
+
# consumption. DynamoDB determines capacity units consumed based on item
|
2458
|
+
# size, not on the amount of data that is returned to an application.
|
2459
|
+
#
|
2460
|
+
# You cannot use both *AttributesToGet* and *Select* together in a
|
2461
|
+
# *Query* request, *unless* the value for *Select* is
|
2462
|
+
# `SPECIFIC_ATTRIBUTES`. (This usage is equivalent to specifying
|
2463
|
+
# *AttributesToGet* without any value for *Select*.)
|
2464
|
+
#
|
2465
|
+
# If you query a local secondary index and request only attributes that
|
2466
|
+
# are projected into that index, the operation will read only the index
|
2467
|
+
# and not the table. If any of the requested attributes are not
|
2468
|
+
# projected into the local secondary index, DynamoDB will fetch each of
|
2469
|
+
# these attributes from the parent table. This extra fetching incurs
|
2470
|
+
# additional throughput cost and latency.
|
2471
|
+
#
|
2472
|
+
# If you query a global secondary index, you can only request attributes
|
2473
|
+
# that are projected into the index. Global secondary index queries
|
2474
|
+
# cannot fetch attributes from the parent table.
|
2475
|
+
# @option params [Integer] :limit
|
2476
|
+
# The maximum number of items to evaluate (not necessarily the number of
|
2477
|
+
# matching items). If DynamoDB processes the number of items up to the
|
2478
|
+
# limit while processing the results, it stops the operation and returns
|
2479
|
+
# the matching values up to that point, and a key in *LastEvaluatedKey*
|
2480
|
+
# to apply in a subsequent operation, so that you can pick up where you
|
2481
|
+
# left off. Also, if the processed data set size exceeds 1 MB before
|
2482
|
+
# DynamoDB reaches this limit, it stops the operation and returns the
|
2483
|
+
# matching values up to the limit, and a key in *LastEvaluatedKey* to
|
2484
|
+
# apply in a subsequent operation to continue the operation. For more
|
2485
|
+
# information, see [Query and Scan][1] in the *Amazon DynamoDB Developer
|
2486
|
+
# Guide*.
|
2487
|
+
#
|
2488
|
+
#
|
2489
|
+
#
|
2490
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html
|
2491
|
+
# @option params [Boolean] :consistent_read
|
2492
|
+
# Determines the read consistency model: If set to `true`, then the
|
2493
|
+
# operation uses strongly consistent reads; otherwise, the operation
|
2494
|
+
# uses eventually consistent reads.
|
2495
|
+
#
|
2496
|
+
# Strongly consistent reads are not supported on global secondary
|
2497
|
+
# indexes. If you query a global secondary index with *ConsistentRead*
|
2498
|
+
# set to `true`, you will receive a *ValidationException*.
|
2499
|
+
# @option params [Hash<String,Types::Condition>] :key_conditions
|
2500
|
+
# This is a legacy parameter, for backward compatibility. New
|
2501
|
+
# applications should use *KeyConditionExpression* instead. Do not
|
2502
|
+
# combine legacy parameters and expression parameters in a single API
|
2503
|
+
# call; otherwise, DynamoDB will return a *ValidationException*
|
2504
|
+
# exception.
|
2505
|
+
#
|
2506
|
+
# The selection criteria for the query. For a query on a table, you can
|
2507
|
+
# have conditions only on the table primary key attributes. You must
|
2508
|
+
# provide the partition key name and value as an `EQ` condition. You can
|
2509
|
+
# optionally provide a second condition, referring to the sort key.
|
2510
|
+
#
|
2511
|
+
# <note markdown="1"> If you don't provide a sort key condition, all of the items that
|
2512
|
+
# match the partition key will be retrieved. If a *FilterExpression* or
|
2513
|
+
# *QueryFilter* is present, it will be applied after the items are
|
2514
|
+
# retrieved.
|
2515
|
+
#
|
2516
|
+
# </note>
|
2517
|
+
#
|
2518
|
+
# For a query on an index, you can have conditions only on the index key
|
2519
|
+
# attributes. You must provide the index partition key name and value as
|
2520
|
+
# an `EQ` condition. You can optionally provide a second condition,
|
2521
|
+
# referring to the index sort key.
|
2522
|
+
#
|
2523
|
+
# Each *KeyConditions* element consists of an attribute name to compare,
|
2524
|
+
# along with the following:
|
2525
|
+
#
|
2526
|
+
# * *AttributeValueList* - One or more values to evaluate against the
|
2527
|
+
# supplied attribute. The number of values in the list depends on the
|
2528
|
+
# *ComparisonOperator* being used.
|
2529
|
+
#
|
2530
|
+
# For type Number, value comparisons are numeric.
|
2531
|
+
#
|
2532
|
+
# String value comparisons for greater than, equals, or less than are
|
2533
|
+
# based on ASCII character code values. For example, `a` is greater
|
2534
|
+
# than `A`, and `a` is greater than `B`. For a list of code values,
|
2535
|
+
# see
|
2536
|
+
# [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
|
2537
|
+
#
|
2538
|
+
# For Binary, DynamoDB treats each byte of the binary data as unsigned
|
2539
|
+
# when it compares binary values.
|
2540
|
+
#
|
2541
|
+
# * *ComparisonOperator* - A comparator for evaluating attributes, for
|
2542
|
+
# example, equals, greater than, less than, and so on.
|
2543
|
+
#
|
2544
|
+
# For *KeyConditions*, only the following comparison operators are
|
2545
|
+
# supported:
|
2546
|
+
#
|
2547
|
+
# `EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN`
|
2548
|
+
#
|
2549
|
+
# The following are descriptions of these comparison operators.
|
2550
|
+
#
|
2551
|
+
# * `EQ`\: Equal.
|
2552
|
+
#
|
2553
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
2554
|
+
# String, Number, or Binary (not a set type). If an item contains an
|
2555
|
+
# *AttributeValue* element of a different type than the one
|
2556
|
+
# specified in the request, the value does not match. For example,
|
2557
|
+
# `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
|
2558
|
+
# does not equal `\{"NS":["6", "2", "1"]\}`.
|
2559
|
+
#
|
2560
|
+
#
|
2561
|
+
#
|
2562
|
+
# * `LE`\: Less than or equal.
|
2563
|
+
#
|
2564
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
2565
|
+
# of type String, Number, or Binary (not a set type). If an item
|
2566
|
+
# contains an *AttributeValue* element of a different type than the
|
2567
|
+
# one provided in the request, the value does not match. For
|
2568
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
2569
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
2570
|
+
#
|
2571
|
+
#
|
2572
|
+
#
|
2573
|
+
# * `LT`\: Less than.
|
2574
|
+
#
|
2575
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
2576
|
+
# String, Number, or Binary (not a set type). If an item contains an
|
2577
|
+
# *AttributeValue* element of a different type than the one provided
|
2578
|
+
# in the request, the value does not match. For example,
|
2579
|
+
# `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
|
2580
|
+
# does not compare to `\{"NS":["6", "2", "1"]\}`.
|
2581
|
+
#
|
2582
|
+
#
|
2583
|
+
#
|
2584
|
+
# * `GE`\: Greater than or equal.
|
2585
|
+
#
|
2586
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
2587
|
+
# of type String, Number, or Binary (not a set type). If an item
|
2588
|
+
# contains an *AttributeValue* element of a different type than the
|
2589
|
+
# one provided in the request, the value does not match. For
|
2590
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
2591
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
2592
|
+
#
|
2593
|
+
#
|
2594
|
+
#
|
2595
|
+
# * `GT`\: Greater than.
|
2596
|
+
#
|
2597
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
2598
|
+
# of type String, Number, or Binary (not a set type). If an item
|
2599
|
+
# contains an *AttributeValue* element of a different type than the
|
2600
|
+
# one provided in the request, the value does not match. For
|
2601
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
2602
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
2603
|
+
#
|
2604
|
+
#
|
2605
|
+
#
|
2606
|
+
# * `BEGINS_WITH`\: Checks for a prefix.
|
2607
|
+
#
|
2608
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
2609
|
+
# String or Binary (not a Number or a set type). The target
|
2610
|
+
# attribute of the comparison must be of type String or Binary (not
|
2611
|
+
# a Number or a set type).
|
2612
|
+
#
|
2613
|
+
#
|
2614
|
+
#
|
2615
|
+
# * `BETWEEN`\: Greater than or equal to the first value, and less
|
2616
|
+
# than or equal to the second value.
|
2617
|
+
#
|
2618
|
+
# *AttributeValueList* must contain two *AttributeValue* elements of
|
2619
|
+
# the same type, either String, Number, or Binary (not a set type).
|
2620
|
+
# A target attribute matches if the target value is greater than, or
|
2621
|
+
# equal to, the first element and less than, or equal to, the second
|
2622
|
+
# element. If an item contains an *AttributeValue* element of a
|
2623
|
+
# different type than the one provided in the request, the value
|
2624
|
+
# does not match. For example, `\{"S":"6"\}` does not compare to
|
2625
|
+
# `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
|
2626
|
+
# `\{"NS":["6", "2", "1"]\}`
|
2627
|
+
#
|
2628
|
+
# For usage examples of *AttributeValueList* and *ComparisonOperator*,
|
2629
|
+
# see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
|
2630
|
+
# Developer Guide*.
|
2631
|
+
#
|
2632
|
+
#
|
2633
|
+
#
|
2634
|
+
# [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
2635
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
|
2636
|
+
# @option params [Hash<String,Types::Condition>] :query_filter
|
2637
|
+
# This is a legacy parameter, for backward compatibility. New
|
2638
|
+
# applications should use *FilterExpression* instead. Do not combine
|
2639
|
+
# legacy parameters and expression parameters in a single API call;
|
2640
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
2641
|
+
#
|
2642
|
+
# A condition that evaluates the query results after the items are read
|
2643
|
+
# and returns only the desired values.
|
2644
|
+
#
|
2645
|
+
# This parameter does not support attributes of type List or Map.
|
2646
|
+
#
|
2647
|
+
# <note markdown="1"> A *QueryFilter* is applied after the items have already been read; the
|
2648
|
+
# process of filtering does not consume any additional read capacity
|
2649
|
+
# units.
|
2650
|
+
#
|
2651
|
+
# </note>
|
2652
|
+
#
|
2653
|
+
# If you provide more than one condition in the *QueryFilter* map, then
|
2654
|
+
# by default all of the conditions must evaluate to true. In other
|
2655
|
+
# words, the conditions are ANDed together. (You can use the
|
2656
|
+
# *ConditionalOperator* parameter to OR the conditions instead. If you
|
2657
|
+
# do this, then at least one of the conditions must evaluate to true,
|
2658
|
+
# rather than all of them.)
|
2659
|
+
#
|
2660
|
+
# Note that *QueryFilter* does not allow key attributes. You cannot
|
2661
|
+
# define a filter condition on a partition key or a sort key.
|
2662
|
+
#
|
2663
|
+
# Each *QueryFilter* element consists of an attribute name to compare,
|
2664
|
+
# along with the following:
|
2665
|
+
#
|
2666
|
+
# * *AttributeValueList* - One or more values to evaluate against the
|
2667
|
+
# supplied attribute. The number of values in the list depends on the
|
2668
|
+
# operator specified in *ComparisonOperator*.
|
2669
|
+
#
|
2670
|
+
# For type Number, value comparisons are numeric.
|
2671
|
+
#
|
2672
|
+
# String value comparisons for greater than, equals, or less than are
|
2673
|
+
# based on ASCII character code values. For example, `a` is greater
|
2674
|
+
# than `A`, and `a` is greater than `B`. For a list of code values,
|
2675
|
+
# see
|
2676
|
+
# [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
|
2677
|
+
#
|
2678
|
+
# For type Binary, DynamoDB treats each byte of the binary data as
|
2679
|
+
# unsigned when it compares binary values.
|
2680
|
+
#
|
2681
|
+
# For information on specifying data types in JSON, see [JSON Data
|
2682
|
+
# Format][2] in the *Amazon DynamoDB Developer Guide*.
|
2683
|
+
#
|
2684
|
+
# * *ComparisonOperator* - A comparator for evaluating attributes. For
|
2685
|
+
# example, equals, greater than, less than, etc.
|
2686
|
+
#
|
2687
|
+
# The following comparison operators are available:
|
2688
|
+
#
|
2689
|
+
# `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
|
2690
|
+
# NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
|
2691
|
+
#
|
2692
|
+
# For complete descriptions of all comparison operators, see the
|
2693
|
+
# [Condition][3] data type.
|
2694
|
+
#
|
2695
|
+
#
|
2696
|
+
#
|
2697
|
+
# [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
2698
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html
|
2699
|
+
# [3]: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html
|
2700
|
+
# @option params [String] :conditional_operator
|
2701
|
+
# This is a legacy parameter, for backward compatibility. New
|
2702
|
+
# applications should use *FilterExpression* instead. Do not combine
|
2703
|
+
# legacy parameters and expression parameters in a single API call;
|
2704
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
2705
|
+
#
|
2706
|
+
# A logical operator to apply to the conditions in a *QueryFilter* map:
|
2707
|
+
#
|
2708
|
+
# * `AND` - If all of the conditions evaluate to true, then the entire
|
2709
|
+
# map evaluates to true.
|
2710
|
+
#
|
2711
|
+
# * `OR` - If at least one of the conditions evaluate to true, then the
|
2712
|
+
# entire map evaluates to true.
|
2713
|
+
#
|
2714
|
+
# If you omit *ConditionalOperator*, then `AND` is the default.
|
2715
|
+
#
|
2716
|
+
# The operation will succeed only if the entire map evaluates to true.
|
2717
|
+
#
|
2718
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
2719
|
+
#
|
2720
|
+
# </note>
|
2721
|
+
# @option params [Boolean] :scan_index_forward
|
2722
|
+
# Specifies the order for index traversal: If `true` (default), the
|
2723
|
+
# traversal is performed in ascending order; if `false`, the traversal
|
2724
|
+
# is performed in descending order.
|
2725
|
+
#
|
2726
|
+
# Items with the same partition key value are stored in sorted order by
|
2727
|
+
# sort key. If the sort key data type is Number, the results are stored
|
2728
|
+
# in numeric order. For type String, the results are stored in order of
|
2729
|
+
# ASCII character code values. For type Binary, DynamoDB treats each
|
2730
|
+
# byte of the binary data as unsigned.
|
2731
|
+
#
|
2732
|
+
# If *ScanIndexForward* is `true`, DynamoDB returns the results in the
|
2733
|
+
# order in which they are stored (by sort key value). This is the
|
2734
|
+
# default behavior. If *ScanIndexForward* is `false`, DynamoDB reads the
|
2735
|
+
# results in reverse order by sort key value, and then returns the
|
2736
|
+
# results to the client.
|
2737
|
+
# @option params [Hash<String,Types::AttributeValue>] :exclusive_start_key
|
2738
|
+
# The primary key of the first item that this operation will evaluate.
|
2739
|
+
# Use the value that was returned for *LastEvaluatedKey* in the previous
|
2740
|
+
# operation.
|
2741
|
+
#
|
2742
|
+
# The data type for *ExclusiveStartKey* must be String, Number or
|
2743
|
+
# Binary. No set data types are allowed.
|
2744
|
+
# @option params [String] :return_consumed_capacity
|
2745
|
+
# Determines the level of detail about provisioned throughput
|
2746
|
+
# consumption that is returned in the response:
|
2747
|
+
#
|
2748
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
2749
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
2750
|
+
# and secondary index that was accessed.
|
2751
|
+
#
|
2752
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
2753
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
2754
|
+
# will only return *ConsumedCapacity* information for table(s).
|
2755
|
+
#
|
2756
|
+
# * *TOTAL* - The response includes only the aggregate
|
2757
|
+
# *ConsumedCapacity* for the operation.
|
2758
|
+
#
|
2759
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
2760
|
+
# @option params [String] :projection_expression
|
2761
|
+
# A string that identifies one or more attributes to retrieve from the
|
2762
|
+
# table. These attributes can include scalars, sets, or elements of a
|
2763
|
+
# JSON document. The attributes in the expression must be separated by
|
2764
|
+
# commas.
|
2765
|
+
#
|
2766
|
+
# If no attribute names are specified, then all attributes will be
|
2767
|
+
# returned. If any of the requested attributes are not found, they will
|
2768
|
+
# not appear in the result.
|
2769
|
+
#
|
2770
|
+
# For more information, see [Accessing Item Attributes][1] in the
|
2771
|
+
# *Amazon DynamoDB Developer Guide*.
|
2772
|
+
#
|
2773
|
+
# <note markdown="1"> *ProjectionExpression* replaces the legacy *AttributesToGet*
|
2774
|
+
# parameter.
|
2775
|
+
#
|
2776
|
+
# </note>
|
2777
|
+
#
|
2778
|
+
#
|
2779
|
+
#
|
2780
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
2781
|
+
# @option params [String] :filter_expression
|
2782
|
+
# A string that contains conditions that DynamoDB applies after the
|
2783
|
+
# *Query* operation, but before the data is returned to you. Items that
|
2784
|
+
# do not satisfy the *FilterExpression* criteria are not returned.
|
2785
|
+
#
|
2786
|
+
# <note markdown="1"> A *FilterExpression* is applied after the items have already been
|
2787
|
+
# read; the process of filtering does not consume any additional read
|
2788
|
+
# capacity units.
|
2789
|
+
#
|
2790
|
+
# </note>
|
2791
|
+
#
|
2792
|
+
# For more information, see [Filter Expressions][1] in the *Amazon
|
2793
|
+
# DynamoDB Developer Guide*.
|
2794
|
+
#
|
2795
|
+
# <note markdown="1"> *FilterExpression* replaces the legacy *QueryFilter* and
|
2796
|
+
# *ConditionalOperator* parameters.
|
2797
|
+
#
|
2798
|
+
# </note>
|
2799
|
+
#
|
2800
|
+
#
|
2801
|
+
#
|
2802
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#FilteringResults
|
2803
|
+
# @option params [String] :key_condition_expression
|
2804
|
+
# The condition that specifies the key value(s) for items to be
|
2805
|
+
# retrieved by the *Query* action.
|
2806
|
+
#
|
2807
|
+
# The condition must perform an equality test on a single partition key
|
2808
|
+
# value. The condition can also perform one of several comparison tests
|
2809
|
+
# on a single sort key value. *Query* can use *KeyConditionExpression*
|
2810
|
+
# to retrieve one item with a given partition key value and sort key
|
2811
|
+
# value, or several items that have the same partition key value but
|
2812
|
+
# different sort key values.
|
2813
|
+
#
|
2814
|
+
# The partition key equality test is required, and must be specified in
|
2815
|
+
# the following format:
|
2816
|
+
#
|
2817
|
+
# `partitionKeyName` *=* `:partitionkeyval`
|
2818
|
+
#
|
2819
|
+
# If you also want to provide a condition for the sort key, it must be
|
2820
|
+
# combined using *AND* with the condition for the sort key. Following is
|
2821
|
+
# an example, using the **=** comparison operator for the sort key:
|
2822
|
+
#
|
2823
|
+
# `partitionKeyName` *=* `:partitionkeyval` *AND* `sortKeyName` *=*
|
2824
|
+
# `:sortkeyval`
|
2825
|
+
#
|
2826
|
+
# Valid comparisons for the sort key condition are as follows:
|
2827
|
+
#
|
2828
|
+
# * `sortKeyName` *=* `:sortkeyval` - true if the sort key value is
|
2829
|
+
# equal to `:sortkeyval`.
|
2830
|
+
#
|
2831
|
+
# * `sortKeyName` *<* `:sortkeyval` - true if the sort key value is
|
2832
|
+
# less than `:sortkeyval`.
|
2833
|
+
#
|
2834
|
+
# * `sortKeyName` *<=* `:sortkeyval` - true if the sort key value is
|
2835
|
+
# less than or equal to `:sortkeyval`.
|
2836
|
+
#
|
2837
|
+
# * `sortKeyName` *>* `:sortkeyval` - true if the sort key value is
|
2838
|
+
# greater than `:sortkeyval`.
|
2839
|
+
#
|
2840
|
+
# * `sortKeyName` <i>>= </i> `:sortkeyval` - true if the sort key
|
2841
|
+
# value is greater than or equal to `:sortkeyval`.
|
2842
|
+
#
|
2843
|
+
# * `sortKeyName` *BETWEEN* `:sortkeyval1` *AND* `:sortkeyval2` - true
|
2844
|
+
# if the sort key value is greater than or equal to `:sortkeyval1`,
|
2845
|
+
# and less than or equal to `:sortkeyval2`.
|
2846
|
+
#
|
2847
|
+
# * *begins\_with (* `sortKeyName`, `:sortkeyval` *)* - true if the sort
|
2848
|
+
# key value begins with a particular operand. (You cannot use this
|
2849
|
+
# function with a sort key that is of type Number.) Note that the
|
2850
|
+
# function name `begins_with` is case-sensitive.
|
2851
|
+
#
|
2852
|
+
# Use the *ExpressionAttributeValues* parameter to replace tokens such
|
2853
|
+
# as `:partitionval` and `:sortval` with actual values at runtime.
|
2854
|
+
#
|
2855
|
+
# You can optionally use the *ExpressionAttributeNames* parameter to
|
2856
|
+
# replace the names of the partition key and sort key with placeholder
|
2857
|
+
# tokens. This option might be necessary if an attribute name conflicts
|
2858
|
+
# with a DynamoDB reserved word. For example, the following
|
2859
|
+
# *KeyConditionExpression* parameter causes an error because *Size* is a
|
2860
|
+
# reserved word:
|
2861
|
+
#
|
2862
|
+
# * `Size = :myval`
|
2863
|
+
#
|
2864
|
+
# ^
|
2865
|
+
#
|
2866
|
+
# To work around this, define a placeholder (such a `#S`) to represent
|
2867
|
+
# the attribute name *Size*. *KeyConditionExpression* then is as
|
2868
|
+
# follows:
|
2869
|
+
#
|
2870
|
+
# * `#S = :myval`
|
2871
|
+
#
|
2872
|
+
# ^
|
2873
|
+
#
|
2874
|
+
# For a list of reserved words, see [Reserved Words][1] in the *Amazon
|
2875
|
+
# DynamoDB Developer Guide*.
|
2876
|
+
#
|
2877
|
+
# For more information on *ExpressionAttributeNames* and
|
2878
|
+
# *ExpressionAttributeValues*, see [Using Placeholders for Attribute
|
2879
|
+
# Names and Values][2] in the *Amazon DynamoDB Developer Guide*.
|
2880
|
+
#
|
2881
|
+
# <note markdown="1"> *KeyConditionExpression* replaces the legacy *KeyConditions*
|
2882
|
+
# parameter.
|
2883
|
+
#
|
2884
|
+
# </note>
|
2885
|
+
#
|
2886
|
+
#
|
2887
|
+
#
|
2888
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
2889
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ExpressionPlaceholders.html
|
2890
|
+
# @option params [Hash<String,String>] :expression_attribute_names
|
2891
|
+
# One or more substitution tokens for attribute names in an expression.
|
2892
|
+
# The following are some use cases for using
|
2893
|
+
# *ExpressionAttributeNames*\:
|
2894
|
+
#
|
2895
|
+
# * To access an attribute whose name conflicts with a DynamoDB reserved
|
2896
|
+
# word.
|
2897
|
+
#
|
2898
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
2899
|
+
# name in an expression.
|
2900
|
+
#
|
2901
|
+
# * To prevent special characters in an attribute name from being
|
2902
|
+
# misinterpreted in an expression.
|
2903
|
+
#
|
2904
|
+
# Use the **#** character in an expression to dereference an attribute
|
2905
|
+
# name. For example, consider the following attribute name:
|
2906
|
+
#
|
2907
|
+
# * `Percentile`
|
2908
|
+
#
|
2909
|
+
# ^
|
2910
|
+
#
|
2911
|
+
# The name of this attribute conflicts with a reserved word, so it
|
2912
|
+
# cannot be used directly in an expression. (For the complete list of
|
2913
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
2914
|
+
# Developer Guide*). To work around this, you could specify the
|
2915
|
+
# following for *ExpressionAttributeNames*\:
|
2916
|
+
#
|
2917
|
+
# * `\{"#P":"Percentile"\}`
|
2918
|
+
#
|
2919
|
+
# ^
|
2920
|
+
#
|
2921
|
+
# You could then use this substitution in an expression, as in this
|
2922
|
+
# example:
|
2923
|
+
#
|
2924
|
+
# * `#P = :val`
|
2925
|
+
#
|
2926
|
+
# ^
|
2927
|
+
#
|
2928
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
|
2929
|
+
# values*, which are placeholders for the actual value at runtime.
|
2930
|
+
#
|
2931
|
+
# </note>
|
2932
|
+
#
|
2933
|
+
# For more information on expression attribute names, see [Accessing
|
2934
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
2935
|
+
#
|
2936
|
+
#
|
2937
|
+
#
|
2938
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
2939
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
2940
|
+
# @option params [Hash<String,Types::AttributeValue>] :expression_attribute_values
|
2941
|
+
# One or more values that can be substituted in an expression.
|
2942
|
+
#
|
2943
|
+
# Use the **\:** (colon) character in an expression to dereference an
|
2944
|
+
# attribute value. For example, suppose that you wanted to check whether
|
2945
|
+
# the value of the *ProductStatus* attribute was one of the following:
|
2946
|
+
#
|
2947
|
+
# `Available | Backordered | Discontinued`
|
2948
|
+
#
|
2949
|
+
# You would first need to specify *ExpressionAttributeValues* as
|
2950
|
+
# follows:
|
2951
|
+
#
|
2952
|
+
# `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
|
2953
|
+
# ":disc":\{"S":"Discontinued"\} \}`
|
2954
|
+
#
|
2955
|
+
# You could then use these values in an expression, such as this:
|
2956
|
+
#
|
2957
|
+
# `ProductStatus IN (:avail, :back, :disc)`
|
2958
|
+
#
|
2959
|
+
# For more information on expression attribute values, see [Specifying
|
2960
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
2961
|
+
#
|
2962
|
+
#
|
2963
|
+
#
|
2964
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
2965
|
+
# @return [Types::QueryOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
2966
|
+
#
|
2967
|
+
# * {Types::QueryOutput#items #Items} => Array<Hash<String,Types::AttributeValue>>
|
2968
|
+
# * {Types::QueryOutput#count #Count} => Integer
|
2969
|
+
# * {Types::QueryOutput#scanned_count #ScannedCount} => Integer
|
2970
|
+
# * {Types::QueryOutput#last_evaluated_key #LastEvaluatedKey} => Hash<String,Types::AttributeValue>
|
2971
|
+
# * {Types::QueryOutput#consumed_capacity #ConsumedCapacity} => Types::ConsumedCapacity
|
2972
|
+
#
|
2973
|
+
# @example Request syntax with placeholder values
|
2974
|
+
# resp = client.query({
|
2975
|
+
# table_name: "TableName", # required
|
2976
|
+
# index_name: "IndexName",
|
2977
|
+
# select: "ALL_ATTRIBUTES", # accepts ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT
|
2978
|
+
# attributes_to_get: ["AttributeName"],
|
2979
|
+
# limit: 1,
|
2980
|
+
# consistent_read: false,
|
2981
|
+
# key_conditions: {
|
2982
|
+
# "AttributeName" => {
|
2983
|
+
# attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2984
|
+
# comparison_operator: "EQ", # required, accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
|
2985
|
+
# },
|
2986
|
+
# },
|
2987
|
+
# query_filter: {
|
2988
|
+
# "AttributeName" => {
|
2989
|
+
# attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2990
|
+
# comparison_operator: "EQ", # required, accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
|
2991
|
+
# },
|
2992
|
+
# },
|
2993
|
+
# conditional_operator: "AND", # accepts AND, OR
|
2994
|
+
# scan_index_forward: false,
|
2995
|
+
# exclusive_start_key: {
|
2996
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
2997
|
+
# },
|
2998
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
2999
|
+
# projection_expression: "ProjectionExpression",
|
3000
|
+
# filter_expression: "ConditionExpression",
|
3001
|
+
# key_condition_expression: "KeyExpression",
|
3002
|
+
# expression_attribute_names: {
|
3003
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
3004
|
+
# },
|
3005
|
+
# expression_attribute_values: {
|
3006
|
+
# "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3007
|
+
# },
|
3008
|
+
# })
|
3009
|
+
#
|
3010
|
+
# @example Response structure
|
3011
|
+
# resp.items #=> Array
|
3012
|
+
# resp.items[0] #=> Hash
|
3013
|
+
# resp.items[0]["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3014
|
+
# resp.count #=> Integer
|
3015
|
+
# resp.scanned_count #=> Integer
|
3016
|
+
# resp.last_evaluated_key #=> Hash
|
3017
|
+
# resp.last_evaluated_key["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3018
|
+
# resp.consumed_capacity.table_name #=> String
|
3019
|
+
# resp.consumed_capacity.capacity_units #=> Float
|
3020
|
+
# resp.consumed_capacity.table.capacity_units #=> Float
|
3021
|
+
# resp.consumed_capacity.local_secondary_indexes #=> Hash
|
3022
|
+
# resp.consumed_capacity.local_secondary_indexes["IndexName"].capacity_units #=> Float
|
3023
|
+
# resp.consumed_capacity.global_secondary_indexes #=> Hash
|
3024
|
+
# resp.consumed_capacity.global_secondary_indexes["IndexName"].capacity_units #=> Float
|
3025
|
+
# @overload query(params = {})
|
3026
|
+
# @param [Hash] params ({})
|
3027
|
+
def query(params = {}, options = {})
|
3028
|
+
req = build_request(:query, params)
|
3029
|
+
req.send_request(options)
|
3030
|
+
end
|
3031
|
+
|
3032
|
+
# The *Scan* operation returns one or more items and item attributes by
|
3033
|
+
# accessing every item in a table or a secondary index. To have DynamoDB
|
3034
|
+
# return fewer items, you can provide a *ScanFilter* operation.
|
3035
|
+
#
|
3036
|
+
# If the total number of scanned items exceeds the maximum data set size
|
3037
|
+
# limit of 1 MB, the scan stops and results are returned to the user as
|
3038
|
+
# a *LastEvaluatedKey* value to continue the scan in a subsequent
|
3039
|
+
# operation. The results also include the number of items exceeding the
|
3040
|
+
# limit. A scan can result in no table data meeting the filter criteria.
|
3041
|
+
#
|
3042
|
+
# By default, *Scan* operations proceed sequentially; however, for
|
3043
|
+
# faster performance on a large table or secondary index, applications
|
3044
|
+
# can request a parallel *Scan* operation by providing the *Segment* and
|
3045
|
+
# *TotalSegments* parameters. For more information, see [Parallel
|
3046
|
+
# Scan][1] in the *Amazon DynamoDB Developer Guide*.
|
3047
|
+
#
|
3048
|
+
# By default, *Scan* uses eventually consistent reads when accessing the
|
3049
|
+
# data in a table; therefore, the result set might not include the
|
3050
|
+
# changes to data in the table immediately before the operation began.
|
3051
|
+
# If you need a consistent copy of the data, as of the time that the
|
3052
|
+
# Scan begins, you can set the *ConsistentRead* parameter to *true*.
|
3053
|
+
#
|
3054
|
+
#
|
3055
|
+
#
|
3056
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#QueryAndScanParallelScan
|
3057
|
+
# @option params [required, String] :table_name
|
3058
|
+
# The name of the table containing the requested items; or, if you
|
3059
|
+
# provide `IndexName`, the name of the table to which that index
|
3060
|
+
# belongs.
|
3061
|
+
# @option params [String] :index_name
|
3062
|
+
# The name of a secondary index to scan. This index can be any local
|
3063
|
+
# secondary index or global secondary index. Note that if you use the
|
3064
|
+
# `IndexName` parameter, you must also provide `TableName`.
|
3065
|
+
# @option params [Array<String>] :attributes_to_get
|
3066
|
+
# This is a legacy parameter, for backward compatibility. New
|
3067
|
+
# applications should use *ProjectionExpression* instead. Do not combine
|
3068
|
+
# legacy parameters and expression parameters in a single API call;
|
3069
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
3070
|
+
#
|
3071
|
+
# This parameter allows you to retrieve attributes of type List or Map;
|
3072
|
+
# however, it cannot retrieve individual elements within a List or a
|
3073
|
+
# Map.
|
3074
|
+
#
|
3075
|
+
# The names of one or more attributes to retrieve. If no attribute names
|
3076
|
+
# are provided, then all attributes will be returned. If any of the
|
3077
|
+
# requested attributes are not found, they will not appear in the
|
3078
|
+
# result.
|
3079
|
+
#
|
3080
|
+
# Note that *AttributesToGet* has no effect on provisioned throughput
|
3081
|
+
# consumption. DynamoDB determines capacity units consumed based on item
|
3082
|
+
# size, not on the amount of data that is returned to an application.
|
3083
|
+
# @option params [Integer] :limit
|
3084
|
+
# The maximum number of items to evaluate (not necessarily the number of
|
3085
|
+
# matching items). If DynamoDB processes the number of items up to the
|
3086
|
+
# limit while processing the results, it stops the operation and returns
|
3087
|
+
# the matching values up to that point, and a key in *LastEvaluatedKey*
|
3088
|
+
# to apply in a subsequent operation, so that you can pick up where you
|
3089
|
+
# left off. Also, if the processed data set size exceeds 1 MB before
|
3090
|
+
# DynamoDB reaches this limit, it stops the operation and returns the
|
3091
|
+
# matching values up to the limit, and a key in *LastEvaluatedKey* to
|
3092
|
+
# apply in a subsequent operation to continue the operation. For more
|
3093
|
+
# information, see [Query and Scan][1] in the *Amazon DynamoDB Developer
|
3094
|
+
# Guide*.
|
3095
|
+
#
|
3096
|
+
#
|
3097
|
+
#
|
3098
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html
|
3099
|
+
# @option params [String] :select
|
3100
|
+
# The attributes to be returned in the result. You can retrieve all item
|
3101
|
+
# attributes, specific item attributes, or the count of matching items.
|
3102
|
+
#
|
3103
|
+
# * `ALL_ATTRIBUTES` - Returns all of the item attributes.
|
3104
|
+
#
|
3105
|
+
# * `ALL_PROJECTED_ATTRIBUTES` - Allowed only when querying an index.
|
3106
|
+
# Retrieves all attributes that have been projected into the index. If
|
3107
|
+
# the index is configured to project all attributes, this return value
|
3108
|
+
# is equivalent to specifying `ALL_ATTRIBUTES`.
|
3109
|
+
#
|
3110
|
+
# * `COUNT` - Returns the number of matching items, rather than the
|
3111
|
+
# matching items themselves.
|
3112
|
+
#
|
3113
|
+
# * `SPECIFIC_ATTRIBUTES` - Returns only the attributes listed in
|
3114
|
+
# *AttributesToGet*. This return value is equivalent to specifying
|
3115
|
+
# *AttributesToGet* without specifying any value for *Select*.
|
3116
|
+
#
|
3117
|
+
# If neither *Select* nor *AttributesToGet* are specified, DynamoDB
|
3118
|
+
# defaults to `ALL_ATTRIBUTES`. You cannot use both *AttributesToGet*
|
3119
|
+
# and *Select* together in a single request, unless the value for
|
3120
|
+
# *Select* is `SPECIFIC_ATTRIBUTES`. (This usage is equivalent to
|
3121
|
+
# specifying *AttributesToGet* without any value for *Select*.)
|
3122
|
+
# @option params [Hash<String,Types::Condition>] :scan_filter
|
3123
|
+
# This is a legacy parameter, for backward compatibility. New
|
3124
|
+
# applications should use *FilterExpression* instead. Do not combine
|
3125
|
+
# legacy parameters and expression parameters in a single API call;
|
3126
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
3127
|
+
#
|
3128
|
+
# A condition that evaluates the scan results and returns only the
|
3129
|
+
# desired values.
|
3130
|
+
#
|
3131
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
3132
|
+
#
|
3133
|
+
# </note>
|
3134
|
+
#
|
3135
|
+
# If you specify more than one condition in the *ScanFilter* map, then
|
3136
|
+
# by default all of the conditions must evaluate to true. In other
|
3137
|
+
# words, the conditions are ANDed together. (You can use the
|
3138
|
+
# *ConditionalOperator* parameter to OR the conditions instead. If you
|
3139
|
+
# do this, then at least one of the conditions must evaluate to true,
|
3140
|
+
# rather than all of them.)
|
3141
|
+
#
|
3142
|
+
# Each *ScanFilter* element consists of an attribute name to compare,
|
3143
|
+
# along with the following:
|
3144
|
+
#
|
3145
|
+
# * *AttributeValueList* - One or more values to evaluate against the
|
3146
|
+
# supplied attribute. The number of values in the list depends on the
|
3147
|
+
# operator specified in *ComparisonOperator* .
|
3148
|
+
#
|
3149
|
+
# For type Number, value comparisons are numeric.
|
3150
|
+
#
|
3151
|
+
# String value comparisons for greater than, equals, or less than are
|
3152
|
+
# based on ASCII character code values. For example, `a` is greater
|
3153
|
+
# than `A`, and `a` is greater than `B`. For a list of code values,
|
3154
|
+
# see
|
3155
|
+
# [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
|
3156
|
+
#
|
3157
|
+
# For Binary, DynamoDB treats each byte of the binary data as unsigned
|
3158
|
+
# when it compares binary values.
|
3159
|
+
#
|
3160
|
+
# For information on specifying data types in JSON, see [JSON Data
|
3161
|
+
# Format][2] in the *Amazon DynamoDB Developer Guide*.
|
3162
|
+
#
|
3163
|
+
# * *ComparisonOperator* - A comparator for evaluating attributes. For
|
3164
|
+
# example, equals, greater than, less than, etc.
|
3165
|
+
#
|
3166
|
+
# The following comparison operators are available:
|
3167
|
+
#
|
3168
|
+
# `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
|
3169
|
+
# NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
|
3170
|
+
#
|
3171
|
+
# For complete descriptions of all comparison operators, see
|
3172
|
+
# [Condition][3].
|
3173
|
+
#
|
3174
|
+
#
|
3175
|
+
#
|
3176
|
+
# [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
3177
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html
|
3178
|
+
# [3]: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html
|
3179
|
+
# @option params [String] :conditional_operator
|
3180
|
+
# This is a legacy parameter, for backward compatibility. New
|
3181
|
+
# applications should use *FilterExpression* instead. Do not combine
|
3182
|
+
# legacy parameters and expression parameters in a single API call;
|
3183
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
3184
|
+
#
|
3185
|
+
# A logical operator to apply to the conditions in a *ScanFilter* map:
|
3186
|
+
#
|
3187
|
+
# * `AND` - If all of the conditions evaluate to true, then the entire
|
3188
|
+
# map evaluates to true.
|
3189
|
+
#
|
3190
|
+
# * `OR` - If at least one of the conditions evaluate to true, then the
|
3191
|
+
# entire map evaluates to true.
|
3192
|
+
#
|
3193
|
+
# If you omit *ConditionalOperator*, then `AND` is the default.
|
3194
|
+
#
|
3195
|
+
# The operation will succeed only if the entire map evaluates to true.
|
3196
|
+
#
|
3197
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
3198
|
+
#
|
3199
|
+
# </note>
|
3200
|
+
# @option params [Hash<String,Types::AttributeValue>] :exclusive_start_key
|
3201
|
+
# The primary key of the first item that this operation will evaluate.
|
3202
|
+
# Use the value that was returned for *LastEvaluatedKey* in the previous
|
3203
|
+
# operation.
|
3204
|
+
#
|
3205
|
+
# The data type for *ExclusiveStartKey* must be String, Number or
|
3206
|
+
# Binary. No set data types are allowed.
|
3207
|
+
#
|
3208
|
+
# In a parallel scan, a *Scan* request that includes *ExclusiveStartKey*
|
3209
|
+
# must specify the same segment whose previous *Scan* returned the
|
3210
|
+
# corresponding value of *LastEvaluatedKey*.
|
3211
|
+
# @option params [String] :return_consumed_capacity
|
3212
|
+
# Determines the level of detail about provisioned throughput
|
3213
|
+
# consumption that is returned in the response:
|
3214
|
+
#
|
3215
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
3216
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
3217
|
+
# and secondary index that was accessed.
|
3218
|
+
#
|
3219
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
3220
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
3221
|
+
# will only return *ConsumedCapacity* information for table(s).
|
3222
|
+
#
|
3223
|
+
# * *TOTAL* - The response includes only the aggregate
|
3224
|
+
# *ConsumedCapacity* for the operation.
|
3225
|
+
#
|
3226
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
3227
|
+
# @option params [Integer] :total_segments
|
3228
|
+
# For a parallel *Scan* request, *TotalSegments* represents the total
|
3229
|
+
# number of segments into which the *Scan* operation will be divided.
|
3230
|
+
# The value of *TotalSegments* corresponds to the number of application
|
3231
|
+
# workers that will perform the parallel scan. For example, if you want
|
3232
|
+
# to use four application threads to scan a table or an index, specify a
|
3233
|
+
# *TotalSegments* value of 4.
|
3234
|
+
#
|
3235
|
+
# The value for *TotalSegments* must be greater than or equal to 1, and
|
3236
|
+
# less than or equal to 1000000. If you specify a *TotalSegments* value
|
3237
|
+
# of 1, the *Scan* operation will be sequential rather than parallel.
|
3238
|
+
#
|
3239
|
+
# If you specify *TotalSegments*, you must also specify *Segment*.
|
3240
|
+
# @option params [Integer] :segment
|
3241
|
+
# For a parallel *Scan* request, *Segment* identifies an individual
|
3242
|
+
# segment to be scanned by an application worker.
|
3243
|
+
#
|
3244
|
+
# Segment IDs are zero-based, so the first segment is always 0. For
|
3245
|
+
# example, if you want to use four application threads to scan a table
|
3246
|
+
# or an index, then the first thread specifies a *Segment* value of 0,
|
3247
|
+
# the second thread specifies 1, and so on.
|
3248
|
+
#
|
3249
|
+
# The value of *LastEvaluatedKey* returned from a parallel *Scan*
|
3250
|
+
# request must be used as *ExclusiveStartKey* with the same segment ID
|
3251
|
+
# in a subsequent *Scan* operation.
|
3252
|
+
#
|
3253
|
+
# The value for *Segment* must be greater than or equal to 0, and less
|
3254
|
+
# than the value provided for *TotalSegments*.
|
3255
|
+
#
|
3256
|
+
# If you provide *Segment*, you must also provide *TotalSegments*.
|
3257
|
+
# @option params [String] :projection_expression
|
3258
|
+
# A string that identifies one or more attributes to retrieve from the
|
3259
|
+
# specified table or index. These attributes can include scalars, sets,
|
3260
|
+
# or elements of a JSON document. The attributes in the expression must
|
3261
|
+
# be separated by commas.
|
3262
|
+
#
|
3263
|
+
# If no attribute names are specified, then all attributes will be
|
3264
|
+
# returned. If any of the requested attributes are not found, they will
|
3265
|
+
# not appear in the result.
|
3266
|
+
#
|
3267
|
+
# For more information, see [Accessing Item Attributes][1] in the
|
3268
|
+
# *Amazon DynamoDB Developer Guide*.
|
3269
|
+
#
|
3270
|
+
# <note markdown="1"> *ProjectionExpression* replaces the legacy *AttributesToGet*
|
3271
|
+
# parameter.
|
3272
|
+
#
|
3273
|
+
# </note>
|
3274
|
+
#
|
3275
|
+
#
|
3276
|
+
#
|
3277
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
3278
|
+
# @option params [String] :filter_expression
|
3279
|
+
# A string that contains conditions that DynamoDB applies after the
|
3280
|
+
# *Scan* operation, but before the data is returned to you. Items that
|
3281
|
+
# do not satisfy the *FilterExpression* criteria are not returned.
|
3282
|
+
#
|
3283
|
+
# <note markdown="1"> A *FilterExpression* is applied after the items have already been
|
3284
|
+
# read; the process of filtering does not consume any additional read
|
3285
|
+
# capacity units.
|
3286
|
+
#
|
3287
|
+
# </note>
|
3288
|
+
#
|
3289
|
+
# For more information, see [Filter Expressions][1] in the *Amazon
|
3290
|
+
# DynamoDB Developer Guide*.
|
3291
|
+
#
|
3292
|
+
# <note markdown="1"> *FilterExpression* replaces the legacy *ScanFilter* and
|
3293
|
+
# *ConditionalOperator* parameters.
|
3294
|
+
#
|
3295
|
+
# </note>
|
3296
|
+
#
|
3297
|
+
#
|
3298
|
+
#
|
3299
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#FilteringResults
|
3300
|
+
# @option params [Hash<String,String>] :expression_attribute_names
|
3301
|
+
# One or more substitution tokens for attribute names in an expression.
|
3302
|
+
# The following are some use cases for using
|
3303
|
+
# *ExpressionAttributeNames*\:
|
3304
|
+
#
|
3305
|
+
# * To access an attribute whose name conflicts with a DynamoDB reserved
|
3306
|
+
# word.
|
3307
|
+
#
|
3308
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
3309
|
+
# name in an expression.
|
3310
|
+
#
|
3311
|
+
# * To prevent special characters in an attribute name from being
|
3312
|
+
# misinterpreted in an expression.
|
3313
|
+
#
|
3314
|
+
# Use the **#** character in an expression to dereference an attribute
|
3315
|
+
# name. For example, consider the following attribute name:
|
3316
|
+
#
|
3317
|
+
# * `Percentile`
|
3318
|
+
#
|
3319
|
+
# ^
|
3320
|
+
#
|
3321
|
+
# The name of this attribute conflicts with a reserved word, so it
|
3322
|
+
# cannot be used directly in an expression. (For the complete list of
|
3323
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
3324
|
+
# Developer Guide*). To work around this, you could specify the
|
3325
|
+
# following for *ExpressionAttributeNames*\:
|
3326
|
+
#
|
3327
|
+
# * `\{"#P":"Percentile"\}`
|
3328
|
+
#
|
3329
|
+
# ^
|
3330
|
+
#
|
3331
|
+
# You could then use this substitution in an expression, as in this
|
3332
|
+
# example:
|
3333
|
+
#
|
3334
|
+
# * `#P = :val`
|
3335
|
+
#
|
3336
|
+
# ^
|
3337
|
+
#
|
3338
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
|
3339
|
+
# values*, which are placeholders for the actual value at runtime.
|
3340
|
+
#
|
3341
|
+
# </note>
|
3342
|
+
#
|
3343
|
+
# For more information on expression attribute names, see [Accessing
|
3344
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
3345
|
+
#
|
3346
|
+
#
|
3347
|
+
#
|
3348
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
3349
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
3350
|
+
# @option params [Hash<String,Types::AttributeValue>] :expression_attribute_values
|
3351
|
+
# One or more values that can be substituted in an expression.
|
3352
|
+
#
|
3353
|
+
# Use the **\:** (colon) character in an expression to dereference an
|
3354
|
+
# attribute value. For example, suppose that you wanted to check whether
|
3355
|
+
# the value of the *ProductStatus* attribute was one of the following:
|
3356
|
+
#
|
3357
|
+
# `Available | Backordered | Discontinued`
|
3358
|
+
#
|
3359
|
+
# You would first need to specify *ExpressionAttributeValues* as
|
3360
|
+
# follows:
|
3361
|
+
#
|
3362
|
+
# `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
|
3363
|
+
# ":disc":\{"S":"Discontinued"\} \}`
|
3364
|
+
#
|
3365
|
+
# You could then use these values in an expression, such as this:
|
3366
|
+
#
|
3367
|
+
# `ProductStatus IN (:avail, :back, :disc)`
|
3368
|
+
#
|
3369
|
+
# For more information on expression attribute values, see [Specifying
|
3370
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
3371
|
+
#
|
3372
|
+
#
|
3373
|
+
#
|
3374
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
3375
|
+
# @option params [Boolean] :consistent_read
|
3376
|
+
# A Boolean value that determines the read consistency model during the
|
3377
|
+
# scan:
|
3378
|
+
#
|
3379
|
+
# * If *ConsistentRead* is `false`, then the data returned from *Scan*
|
3380
|
+
# might not contain the results from other recently completed write
|
3381
|
+
# operations (PutItem, UpdateItem or DeleteItem).
|
3382
|
+
#
|
3383
|
+
# * If *ConsistentRead* is `true`, then all of the write operations that
|
3384
|
+
# completed before the *Scan* began are guaranteed to be contained in
|
3385
|
+
# the *Scan* response.
|
3386
|
+
#
|
3387
|
+
# The default setting for *ConsistentRead* is `false`.
|
3388
|
+
#
|
3389
|
+
# The *ConsistentRead* parameter is not supported on global secondary
|
3390
|
+
# indexes. If you scan a global secondary index with *ConsistentRead*
|
3391
|
+
# set to true, you will receive a *ValidationException*.
|
3392
|
+
# @return [Types::ScanOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
3393
|
+
#
|
3394
|
+
# * {Types::ScanOutput#items #Items} => Array<Hash<String,Types::AttributeValue>>
|
3395
|
+
# * {Types::ScanOutput#count #Count} => Integer
|
3396
|
+
# * {Types::ScanOutput#scanned_count #ScannedCount} => Integer
|
3397
|
+
# * {Types::ScanOutput#last_evaluated_key #LastEvaluatedKey} => Hash<String,Types::AttributeValue>
|
3398
|
+
# * {Types::ScanOutput#consumed_capacity #ConsumedCapacity} => Types::ConsumedCapacity
|
3399
|
+
#
|
3400
|
+
# @example Request syntax with placeholder values
|
3401
|
+
# resp = client.scan({
|
3402
|
+
# table_name: "TableName", # required
|
3403
|
+
# index_name: "IndexName",
|
3404
|
+
# attributes_to_get: ["AttributeName"],
|
3405
|
+
# limit: 1,
|
3406
|
+
# select: "ALL_ATTRIBUTES", # accepts ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT
|
3407
|
+
# scan_filter: {
|
3408
|
+
# "AttributeName" => {
|
3409
|
+
# attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3410
|
+
# comparison_operator: "EQ", # required, accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
|
3411
|
+
# },
|
3412
|
+
# },
|
3413
|
+
# conditional_operator: "AND", # accepts AND, OR
|
3414
|
+
# exclusive_start_key: {
|
3415
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3416
|
+
# },
|
3417
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
3418
|
+
# total_segments: 1,
|
3419
|
+
# segment: 1,
|
3420
|
+
# projection_expression: "ProjectionExpression",
|
3421
|
+
# filter_expression: "ConditionExpression",
|
3422
|
+
# expression_attribute_names: {
|
3423
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
3424
|
+
# },
|
3425
|
+
# expression_attribute_values: {
|
3426
|
+
# "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3427
|
+
# },
|
3428
|
+
# consistent_read: false,
|
3429
|
+
# })
|
3430
|
+
#
|
3431
|
+
# @example Response structure
|
3432
|
+
# resp.items #=> Array
|
3433
|
+
# resp.items[0] #=> Hash
|
3434
|
+
# resp.items[0]["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3435
|
+
# resp.count #=> Integer
|
3436
|
+
# resp.scanned_count #=> Integer
|
3437
|
+
# resp.last_evaluated_key #=> Hash
|
3438
|
+
# resp.last_evaluated_key["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
3439
|
+
# resp.consumed_capacity.table_name #=> String
|
3440
|
+
# resp.consumed_capacity.capacity_units #=> Float
|
3441
|
+
# resp.consumed_capacity.table.capacity_units #=> Float
|
3442
|
+
# resp.consumed_capacity.local_secondary_indexes #=> Hash
|
3443
|
+
# resp.consumed_capacity.local_secondary_indexes["IndexName"].capacity_units #=> Float
|
3444
|
+
# resp.consumed_capacity.global_secondary_indexes #=> Hash
|
3445
|
+
# resp.consumed_capacity.global_secondary_indexes["IndexName"].capacity_units #=> Float
|
3446
|
+
# @overload scan(params = {})
|
3447
|
+
# @param [Hash] params ({})
|
3448
|
+
def scan(params = {}, options = {})
|
3449
|
+
req = build_request(:scan, params)
|
3450
|
+
req.send_request(options)
|
3451
|
+
end
|
3452
|
+
|
3453
|
+
# Edits an existing item's attributes, or adds a new item to the table
|
3454
|
+
# if it does not already exist. You can put, delete, or add attribute
|
3455
|
+
# values. You can also perform a conditional update on an existing item
|
3456
|
+
# (insert a new attribute name-value pair if it doesn't exist, or
|
3457
|
+
# replace an existing name-value pair if it has certain expected
|
3458
|
+
# attribute values).
|
3459
|
+
#
|
3460
|
+
# You can also return the item's attribute values in the same
|
3461
|
+
# *UpdateItem* operation using the *ReturnValues* parameter.
|
3462
|
+
# @option params [required, String] :table_name
|
3463
|
+
# The name of the table containing the item to update.
|
3464
|
+
# @option params [required, Hash<String,Types::AttributeValue>] :key
|
3465
|
+
# The primary key of the item to be updated. Each element consists of an
|
3466
|
+
# attribute name and a value for that attribute.
|
3467
|
+
#
|
3468
|
+
# For the primary key, you must provide all of the attributes. For
|
3469
|
+
# example, with a simple primary key, you only need to provide a value
|
3470
|
+
# for the partition key. For a composite primary key, you must provide
|
3471
|
+
# values for both the partition key and the sort key.
|
3472
|
+
# @option params [Hash<String,Types::AttributeValueUpdate>] :attribute_updates
|
3473
|
+
# This is a legacy parameter, for backward compatibility. New
|
3474
|
+
# applications should use *UpdateExpression* instead. Do not combine
|
3475
|
+
# legacy parameters and expression parameters in a single API call;
|
3476
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
3477
|
+
#
|
3478
|
+
# This parameter can be used for modifying top-level attributes;
|
3479
|
+
# however, it does not support individual list or map elements.
|
3480
|
+
#
|
3481
|
+
# The names of attributes to be modified, the action to perform on each,
|
3482
|
+
# and the new value for each. If you are updating an attribute that is
|
3483
|
+
# an index key attribute for any indexes on that table, the attribute
|
3484
|
+
# type must match the index key type defined in the
|
3485
|
+
# *AttributesDefinition* of the table description. You can use
|
3486
|
+
# *UpdateItem* to update any non-key attributes.
|
3487
|
+
#
|
3488
|
+
# Attribute values cannot be null. String and Binary type attributes
|
3489
|
+
# must have lengths greater than zero. Set type attributes must not be
|
3490
|
+
# empty. Requests with empty values will be rejected with a
|
3491
|
+
# *ValidationException* exception.
|
3492
|
+
#
|
3493
|
+
# Each *AttributeUpdates* element consists of an attribute name to
|
3494
|
+
# modify, along with the following:
|
3495
|
+
#
|
3496
|
+
# * *Value* - The new value, if applicable, for this attribute.
|
3497
|
+
#
|
3498
|
+
# * *Action* - A value that specifies how to perform the update. This
|
3499
|
+
# action is only valid for an existing attribute whose data type is
|
3500
|
+
# Number or is a set; do not use `ADD` for other data types.
|
3501
|
+
#
|
3502
|
+
# If an item with the specified primary key is found in the table, the
|
3503
|
+
# following values perform the following actions:
|
3504
|
+
#
|
3505
|
+
# * `PUT` - Adds the specified attribute to the item. If the attribute
|
3506
|
+
# already exists, it is replaced by the new value.
|
3507
|
+
#
|
3508
|
+
# * `DELETE` - Removes the attribute and its value, if no value is
|
3509
|
+
# specified for `DELETE`. The data type of the specified value must
|
3510
|
+
# match the existing value's data type.
|
3511
|
+
#
|
3512
|
+
# If a set of values is specified, then those values are subtracted
|
3513
|
+
# from the old set. For example, if the attribute value was the set
|
3514
|
+
# `[a,b,c]` and the `DELETE` action specifies `[a,c]`, then the
|
3515
|
+
# final attribute value is `[b]`. Specifying an empty set is an
|
3516
|
+
# error.
|
3517
|
+
#
|
3518
|
+
# * `ADD` - Adds the specified value to the item, if the attribute
|
3519
|
+
# does not already exist. If the attribute does exist, then the
|
3520
|
+
# behavior of `ADD` depends on the data type of the attribute:
|
3521
|
+
#
|
3522
|
+
# * If the existing attribute is a number, and if *Value* is also a
|
3523
|
+
# number, then *Value* is mathematically added to the existing
|
3524
|
+
# attribute. If *Value* is a negative number, then it is
|
3525
|
+
# subtracted from the existing attribute.
|
3526
|
+
#
|
3527
|
+
# <note markdown="1"> If you use `ADD` to increment or decrement a number value for an
|
3528
|
+
# item that doesn't exist before the update, DynamoDB uses 0 as
|
3529
|
+
# the initial value.
|
3530
|
+
#
|
3531
|
+
# Similarly, if you use `ADD` for an existing item to increment or
|
3532
|
+
# decrement an attribute value that doesn't exist before the
|
3533
|
+
# update, DynamoDB uses `0` as the initial value. For example,
|
3534
|
+
# suppose that the item you want to update doesn't have an
|
3535
|
+
# attribute named *itemcount*, but you decide to `ADD` the number
|
3536
|
+
# `3` to this attribute anyway. DynamoDB will create the
|
3537
|
+
# *itemcount* attribute, set its initial value to `0`, and finally
|
3538
|
+
# add `3` to it. The result will be a new *itemcount* attribute,
|
3539
|
+
# with a value of `3`.
|
3540
|
+
#
|
3541
|
+
# </note>
|
3542
|
+
#
|
3543
|
+
# * If the existing data type is a set, and if *Value* is also a
|
3544
|
+
# set, then *Value* is appended to the existing set. For example,
|
3545
|
+
# if the attribute value is the set `[1,2]`, and the `ADD` action
|
3546
|
+
# specified `[3]`, then the final attribute value is `[1,2,3]`. An
|
3547
|
+
# error occurs if an `ADD` action is specified for a set attribute
|
3548
|
+
# and the attribute type specified does not match the existing set
|
3549
|
+
# type.
|
3550
|
+
#
|
3551
|
+
# Both sets must have the same primitive data type. For example,
|
3552
|
+
# if the existing data type is a set of strings, *Value* must also
|
3553
|
+
# be a set of strings.
|
3554
|
+
#
|
3555
|
+
# If no item with the specified key is found in the table, the
|
3556
|
+
# following values perform the following actions:
|
3557
|
+
#
|
3558
|
+
# * `PUT` - Causes DynamoDB to create a new item with the specified
|
3559
|
+
# primary key, and then adds the attribute.
|
3560
|
+
#
|
3561
|
+
# * `DELETE` - Nothing happens, because attributes cannot be deleted
|
3562
|
+
# from a nonexistent item. The operation succeeds, but DynamoDB does
|
3563
|
+
# not create a new item.
|
3564
|
+
#
|
3565
|
+
# * `ADD` - Causes DynamoDB to create an item with the supplied
|
3566
|
+
# primary key and number (or set of numbers) for the attribute
|
3567
|
+
# value. The only data types allowed are Number and Number Set.
|
3568
|
+
#
|
3569
|
+
# If you provide any attributes that are part of an index key, then the
|
3570
|
+
# data types for those attributes must match those of the schema in the
|
3571
|
+
# table's attribute definition.
|
3572
|
+
# @option params [Hash<String,Types::ExpectedAttributeValue>] :expected
|
3573
|
+
# This is a legacy parameter, for backward compatibility. New
|
3574
|
+
# applications should use <i> ConditionExpression </i> instead. Do not
|
3575
|
+
# combine legacy parameters and expression parameters in a single API
|
3576
|
+
# call; otherwise, DynamoDB will return a *ValidationException*
|
3577
|
+
# exception.
|
3578
|
+
#
|
3579
|
+
# A map of attribute/condition pairs. *Expected* provides a conditional
|
3580
|
+
# block for the *UpdateItem* operation.
|
3581
|
+
#
|
3582
|
+
# Each element of *Expected* consists of an attribute name, a comparison
|
3583
|
+
# operator, and one or more values. DynamoDB compares the attribute with
|
3584
|
+
# the value(s) you supplied, using the comparison operator. For each
|
3585
|
+
# *Expected* element, the result of the evaluation is either true or
|
3586
|
+
# false.
|
3587
|
+
#
|
3588
|
+
# If you specify more than one element in the *Expected* map, then by
|
3589
|
+
# default all of the conditions must evaluate to true. In other words,
|
3590
|
+
# the conditions are ANDed together. (You can use the
|
3591
|
+
# *ConditionalOperator* parameter to OR the conditions instead. If you
|
3592
|
+
# do this, then at least one of the conditions must evaluate to true,
|
3593
|
+
# rather than all of them.)
|
3594
|
+
#
|
3595
|
+
# If the *Expected* map evaluates to true, then the conditional
|
3596
|
+
# operation succeeds; otherwise, it fails.
|
3597
|
+
#
|
3598
|
+
# *Expected* contains the following:
|
3599
|
+
#
|
3600
|
+
# * *AttributeValueList* - One or more values to evaluate against the
|
3601
|
+
# supplied attribute. The number of values in the list depends on the
|
3602
|
+
# *ComparisonOperator* being used.
|
3603
|
+
#
|
3604
|
+
# For type Number, value comparisons are numeric.
|
3605
|
+
#
|
3606
|
+
# String value comparisons for greater than, equals, or less than are
|
3607
|
+
# based on ASCII character code values. For example, `a` is greater
|
3608
|
+
# than `A`, and `a` is greater than `B`. For a list of code values,
|
3609
|
+
# see
|
3610
|
+
# [http://en.wikipedia.org/wiki/ASCII#ASCII\_printable\_characters][1].
|
3611
|
+
#
|
3612
|
+
# For type Binary, DynamoDB treats each byte of the binary data as
|
3613
|
+
# unsigned when it compares binary values.
|
3614
|
+
#
|
3615
|
+
# * *ComparisonOperator* - A comparator for evaluating attributes in the
|
3616
|
+
# *AttributeValueList*. When performing the comparison, DynamoDB uses
|
3617
|
+
# strongly consistent reads.
|
3618
|
+
#
|
3619
|
+
# The following comparison operators are available:
|
3620
|
+
#
|
3621
|
+
# `EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS |
|
3622
|
+
# NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN`
|
3623
|
+
#
|
3624
|
+
# The following are descriptions of each comparison operator.
|
3625
|
+
#
|
3626
|
+
# * `EQ`\: Equal. `EQ` is supported for all datatypes, including lists
|
3627
|
+
# and maps.
|
3628
|
+
#
|
3629
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
3630
|
+
# of type String, Number, Binary, String Set, Number Set, or Binary
|
3631
|
+
# Set. If an item contains an *AttributeValue* element of a
|
3632
|
+
# different type than the one provided in the request, the value
|
3633
|
+
# does not match. For example, `\{"S":"6"\}` does not equal
|
3634
|
+
# `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not equal `\{"NS":["6",
|
3635
|
+
# "2", "1"]\}`.
|
3636
|
+
#
|
3637
|
+
#
|
3638
|
+
#
|
3639
|
+
# * `NE`\: Not equal. `NE` is supported for all datatypes, including
|
3640
|
+
# lists and maps.
|
3641
|
+
#
|
3642
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
3643
|
+
# String, Number, Binary, String Set, Number Set, or Binary Set. If
|
3644
|
+
# an item contains an *AttributeValue* of a different type than the
|
3645
|
+
# one provided in the request, the value does not match. For
|
3646
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
3647
|
+
# `\{"N":"6"\}` does not equal `\{"NS":["6", "2", "1"]\}`.
|
3648
|
+
#
|
3649
|
+
#
|
3650
|
+
#
|
3651
|
+
# * `LE`\: Less than or equal.
|
3652
|
+
#
|
3653
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
3654
|
+
# of type String, Number, or Binary (not a set type). If an item
|
3655
|
+
# contains an *AttributeValue* element of a different type than the
|
3656
|
+
# one provided in the request, the value does not match. For
|
3657
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
3658
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
3659
|
+
#
|
3660
|
+
#
|
3661
|
+
#
|
3662
|
+
# * `LT`\: Less than.
|
3663
|
+
#
|
3664
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
3665
|
+
# String, Number, or Binary (not a set type). If an item contains an
|
3666
|
+
# *AttributeValue* element of a different type than the one provided
|
3667
|
+
# in the request, the value does not match. For example,
|
3668
|
+
# `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also, `\{"N":"6"\}`
|
3669
|
+
# does not compare to `\{"NS":["6", "2", "1"]\}`.
|
3670
|
+
#
|
3671
|
+
#
|
3672
|
+
#
|
3673
|
+
# * `GE`\: Greater than or equal.
|
3674
|
+
#
|
3675
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
3676
|
+
# of type String, Number, or Binary (not a set type). If an item
|
3677
|
+
# contains an *AttributeValue* element of a different type than the
|
3678
|
+
# one provided in the request, the value does not match. For
|
3679
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
3680
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
3681
|
+
#
|
3682
|
+
#
|
3683
|
+
#
|
3684
|
+
# * `GT`\: Greater than.
|
3685
|
+
#
|
3686
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
3687
|
+
# of type String, Number, or Binary (not a set type). If an item
|
3688
|
+
# contains an *AttributeValue* element of a different type than the
|
3689
|
+
# one provided in the request, the value does not match. For
|
3690
|
+
# example, `\{"S":"6"\}` does not equal `\{"N":"6"\}`. Also,
|
3691
|
+
# `\{"N":"6"\}` does not compare to `\{"NS":["6", "2", "1"]\}`.
|
3692
|
+
#
|
3693
|
+
#
|
3694
|
+
#
|
3695
|
+
# * `NOT_NULL`\: The attribute exists. `NOT_NULL` is supported for all
|
3696
|
+
# datatypes, including lists and maps.
|
3697
|
+
#
|
3698
|
+
# <note markdown="1"> This operator tests for the existence of an attribute, not its
|
3699
|
+
# data type. If the data type of attribute "`a`" is null, and you
|
3700
|
+
# evaluate it using `NOT_NULL`, the result is a Boolean *true*. This
|
3701
|
+
# result is because the attribute "`a`" exists; its data type is
|
3702
|
+
# not relevant to the `NOT_NULL` comparison operator.
|
3703
|
+
#
|
3704
|
+
# </note>
|
3705
|
+
#
|
3706
|
+
# * `NULL`\: The attribute does not exist. `NULL` is supported for all
|
3707
|
+
# datatypes, including lists and maps.
|
3708
|
+
#
|
3709
|
+
# <note markdown="1"> This operator tests for the nonexistence of an attribute, not its
|
3710
|
+
# data type. If the data type of attribute "`a`" is null, and you
|
3711
|
+
# evaluate it using `NULL`, the result is a Boolean *false*. This is
|
3712
|
+
# because the attribute "`a`" exists; its data type is not
|
3713
|
+
# relevant to the `NULL` comparison operator.
|
3714
|
+
#
|
3715
|
+
# </note>
|
3716
|
+
#
|
3717
|
+
# * `CONTAINS`\: Checks for a subsequence, or value in a set.
|
3718
|
+
#
|
3719
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
3720
|
+
# of type String, Number, or Binary (not a set type). If the target
|
3721
|
+
# attribute of the comparison is of type String, then the operator
|
3722
|
+
# checks for a substring match. If the target attribute of the
|
3723
|
+
# comparison is of type Binary, then the operator looks for a
|
3724
|
+
# subsequence of the target that matches the input. If the target
|
3725
|
+
# attribute of the comparison is a set ("`SS`", "`NS`", or
|
3726
|
+
# "`BS`"), then the operator evaluates to true if it finds an
|
3727
|
+
# exact match with any member of the set.
|
3728
|
+
#
|
3729
|
+
# CONTAINS is supported for lists: When evaluating "`a CONTAINS
|
3730
|
+
# b`", "`a`" can be a list; however, "`b`" cannot be a set, a
|
3731
|
+
# map, or a list.
|
3732
|
+
#
|
3733
|
+
# * `NOT_CONTAINS`\: Checks for absence of a subsequence, or absence
|
3734
|
+
# of a value in a set.
|
3735
|
+
#
|
3736
|
+
# *AttributeValueList* can contain only one *AttributeValue* element
|
3737
|
+
# of type String, Number, or Binary (not a set type). If the target
|
3738
|
+
# attribute of the comparison is a String, then the operator checks
|
3739
|
+
# for the absence of a substring match. If the target attribute of
|
3740
|
+
# the comparison is Binary, then the operator checks for the absence
|
3741
|
+
# of a subsequence of the target that matches the input. If the
|
3742
|
+
# target attribute of the comparison is a set ("`SS`", "`NS`",
|
3743
|
+
# or "`BS`"), then the operator evaluates to true if it *does not*
|
3744
|
+
# find an exact match with any member of the set.
|
3745
|
+
#
|
3746
|
+
# NOT\_CONTAINS is supported for lists: When evaluating "`a NOT
|
3747
|
+
# CONTAINS b`", "`a`" can be a list; however, "`b`" cannot be a
|
3748
|
+
# set, a map, or a list.
|
3749
|
+
#
|
3750
|
+
# * `BEGINS_WITH`\: Checks for a prefix.
|
3751
|
+
#
|
3752
|
+
# *AttributeValueList* can contain only one *AttributeValue* of type
|
3753
|
+
# String or Binary (not a Number or a set type). The target
|
3754
|
+
# attribute of the comparison must be of type String or Binary (not
|
3755
|
+
# a Number or a set type).
|
3756
|
+
#
|
3757
|
+
#
|
3758
|
+
#
|
3759
|
+
# * `IN`\: Checks for matching elements within two sets.
|
3760
|
+
#
|
3761
|
+
# *AttributeValueList* can contain one or more *AttributeValue*
|
3762
|
+
# elements of type String, Number, or Binary (not a set type). These
|
3763
|
+
# attributes are compared against an existing set type attribute of
|
3764
|
+
# an item. If any elements of the input set are present in the item
|
3765
|
+
# attribute, the expression evaluates to true.
|
3766
|
+
#
|
3767
|
+
# * `BETWEEN`\: Greater than or equal to the first value, and less
|
3768
|
+
# than or equal to the second value.
|
3769
|
+
#
|
3770
|
+
# *AttributeValueList* must contain two *AttributeValue* elements of
|
3771
|
+
# the same type, either String, Number, or Binary (not a set type).
|
3772
|
+
# A target attribute matches if the target value is greater than, or
|
3773
|
+
# equal to, the first element and less than, or equal to, the second
|
3774
|
+
# element. If an item contains an *AttributeValue* element of a
|
3775
|
+
# different type than the one provided in the request, the value
|
3776
|
+
# does not match. For example, `\{"S":"6"\}` does not compare to
|
3777
|
+
# `\{"N":"6"\}`. Also, `\{"N":"6"\}` does not compare to
|
3778
|
+
# `\{"NS":["6", "2", "1"]\}`
|
3779
|
+
#
|
3780
|
+
# For usage examples of *AttributeValueList* and *ComparisonOperator*,
|
3781
|
+
# see [Legacy Conditional Parameters][2] in the *Amazon DynamoDB
|
3782
|
+
# Developer Guide*.
|
3783
|
+
#
|
3784
|
+
# For backward compatibility with previous DynamoDB releases, the
|
3785
|
+
# following parameters can be used instead of *AttributeValueList* and
|
3786
|
+
# *ComparisonOperator*\:
|
3787
|
+
#
|
3788
|
+
# * *Value* - A value for DynamoDB to compare with an attribute.
|
3789
|
+
#
|
3790
|
+
# * *Exists* - A Boolean value that causes DynamoDB to evaluate the
|
3791
|
+
# value before attempting the conditional operation:
|
3792
|
+
#
|
3793
|
+
# * If *Exists* is `true`, DynamoDB will check to see if that
|
3794
|
+
# attribute value already exists in the table. If it is found, then
|
3795
|
+
# the condition evaluates to true; otherwise the condition evaluate
|
3796
|
+
# to false.
|
3797
|
+
#
|
3798
|
+
# * If *Exists* is `false`, DynamoDB assumes that the attribute value
|
3799
|
+
# does *not* exist in the table. If in fact the value does not
|
3800
|
+
# exist, then the assumption is valid and the condition evaluates to
|
3801
|
+
# true. If the value is found, despite the assumption that it does
|
3802
|
+
# not exist, the condition evaluates to false.
|
3803
|
+
#
|
3804
|
+
# Note that the default value for *Exists* is `true`.
|
3805
|
+
#
|
3806
|
+
# The *Value* and *Exists* parameters are incompatible with
|
3807
|
+
# *AttributeValueList* and *ComparisonOperator*. Note that if you use
|
3808
|
+
# both sets of parameters at once, DynamoDB will return a
|
3809
|
+
# *ValidationException* exception.
|
3810
|
+
#
|
3811
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
3812
|
+
#
|
3813
|
+
# </note>
|
3814
|
+
#
|
3815
|
+
#
|
3816
|
+
#
|
3817
|
+
# [1]: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
3818
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.html
|
3819
|
+
# @option params [String] :conditional_operator
|
3820
|
+
# This is a legacy parameter, for backward compatibility. New
|
3821
|
+
# applications should use *ConditionExpression* instead. Do not combine
|
3822
|
+
# legacy parameters and expression parameters in a single API call;
|
3823
|
+
# otherwise, DynamoDB will return a *ValidationException* exception.
|
3824
|
+
#
|
3825
|
+
# A logical operator to apply to the conditions in the *Expected* map:
|
3826
|
+
#
|
3827
|
+
# * `AND` - If all of the conditions evaluate to true, then the entire
|
3828
|
+
# map evaluates to true.
|
3829
|
+
#
|
3830
|
+
# * `OR` - If at least one of the conditions evaluate to true, then the
|
3831
|
+
# entire map evaluates to true.
|
3832
|
+
#
|
3833
|
+
# If you omit *ConditionalOperator*, then `AND` is the default.
|
3834
|
+
#
|
3835
|
+
# The operation will succeed only if the entire map evaluates to true.
|
3836
|
+
#
|
3837
|
+
# <note markdown="1"> This parameter does not support attributes of type List or Map.
|
3838
|
+
#
|
3839
|
+
# </note>
|
3840
|
+
# @option params [String] :return_values
|
3841
|
+
# Use *ReturnValues* if you want to get the item attributes as they
|
3842
|
+
# appeared either before or after they were updated. For *UpdateItem*,
|
3843
|
+
# the valid values are:
|
3844
|
+
#
|
3845
|
+
# * `NONE` - If *ReturnValues* is not specified, or if its value is
|
3846
|
+
# `NONE`, then nothing is returned. (This setting is the default for
|
3847
|
+
# *ReturnValues*.)
|
3848
|
+
#
|
3849
|
+
# * `ALL_OLD` - If *UpdateItem* overwrote an attribute name-value pair,
|
3850
|
+
# then the content of the old item is returned.
|
3851
|
+
#
|
3852
|
+
# * `UPDATED_OLD` - The old versions of only the updated attributes are
|
3853
|
+
# returned.
|
3854
|
+
#
|
3855
|
+
# * `ALL_NEW` - All of the attributes of the new version of the item are
|
3856
|
+
# returned.
|
3857
|
+
#
|
3858
|
+
# * `UPDATED_NEW` - The new versions of only the updated attributes are
|
3859
|
+
# returned.
|
3860
|
+
#
|
3861
|
+
# There is no additional cost associated with requesting a return value
|
3862
|
+
# aside from the small network and processing overhead of receiving a
|
3863
|
+
# larger response. No Read Capacity Units are consumed.
|
3864
|
+
#
|
3865
|
+
# Values returned are strongly consistent
|
3866
|
+
# @option params [String] :return_consumed_capacity
|
3867
|
+
# Determines the level of detail about provisioned throughput
|
3868
|
+
# consumption that is returned in the response:
|
3869
|
+
#
|
3870
|
+
# * *INDEXES* - The response includes the aggregate *ConsumedCapacity*
|
3871
|
+
# for the operation, together with *ConsumedCapacity* for each table
|
3872
|
+
# and secondary index that was accessed.
|
3873
|
+
#
|
3874
|
+
# Note that some operations, such as *GetItem* and *BatchGetItem*, do
|
3875
|
+
# not access any indexes at all. In these cases, specifying *INDEXES*
|
3876
|
+
# will only return *ConsumedCapacity* information for table(s).
|
3877
|
+
#
|
3878
|
+
# * *TOTAL* - The response includes only the aggregate
|
3879
|
+
# *ConsumedCapacity* for the operation.
|
3880
|
+
#
|
3881
|
+
# * *NONE* - No *ConsumedCapacity* details are included in the response.
|
3882
|
+
# @option params [String] :return_item_collection_metrics
|
3883
|
+
# Determines whether item collection metrics are returned. If set to
|
3884
|
+
# `SIZE`, the response includes statistics about item collections, if
|
3885
|
+
# any, that were modified during the operation are returned in the
|
3886
|
+
# response. If set to `NONE` (the default), no statistics are returned.
|
3887
|
+
# @option params [String] :update_expression
|
3888
|
+
# An expression that defines one or more attributes to be updated, the
|
3889
|
+
# action to be performed on them, and new value(s) for them.
|
3890
|
+
#
|
3891
|
+
# The following action values are available for *UpdateExpression*.
|
3892
|
+
#
|
3893
|
+
# * `SET` - Adds one or more attributes and values to an item. If any of
|
3894
|
+
# these attribute already exist, they are replaced by the new values.
|
3895
|
+
# You can also use `SET` to add or subtract from an attribute that is
|
3896
|
+
# of type Number. For example: `SET myNum = myNum + :val`
|
3897
|
+
#
|
3898
|
+
# `SET` supports the following functions:
|
3899
|
+
#
|
3900
|
+
# * `if_not_exists (path, operand)` - if the item does not contain an
|
3901
|
+
# attribute at the specified path, then `if_not_exists` evaluates to
|
3902
|
+
# operand; otherwise, it evaluates to path. You can use this
|
3903
|
+
# function to avoid overwriting an attribute that may already be
|
3904
|
+
# present in the item.
|
3905
|
+
#
|
3906
|
+
# * `list_append (operand, operand)` - evaluates to a list with a new
|
3907
|
+
# element added to it. You can append the new element to the start
|
3908
|
+
# or the end of the list by reversing the order of the operands.
|
3909
|
+
#
|
3910
|
+
# These function names are case-sensitive.
|
3911
|
+
#
|
3912
|
+
# * `REMOVE` - Removes one or more attributes from an item.
|
3913
|
+
#
|
3914
|
+
# * `ADD` - Adds the specified value to the item, if the attribute does
|
3915
|
+
# not already exist. If the attribute does exist, then the behavior of
|
3916
|
+
# `ADD` depends on the data type of the attribute:
|
3917
|
+
#
|
3918
|
+
# * If the existing attribute is a number, and if *Value* is also a
|
3919
|
+
# number, then *Value* is mathematically added to the existing
|
3920
|
+
# attribute. If *Value* is a negative number, then it is subtracted
|
3921
|
+
# from the existing attribute.
|
3922
|
+
#
|
3923
|
+
# <note markdown="1"> If you use `ADD` to increment or decrement a number value for an
|
3924
|
+
# item that doesn't exist before the update, DynamoDB uses `0` as
|
3925
|
+
# the initial value.
|
3926
|
+
#
|
3927
|
+
# Similarly, if you use `ADD` for an existing item to increment or
|
3928
|
+
# decrement an attribute value that doesn't exist before the
|
3929
|
+
# update, DynamoDB uses `0` as the initial value. For example,
|
3930
|
+
# suppose that the item you want to update doesn't have an
|
3931
|
+
# attribute named *itemcount*, but you decide to `ADD` the number
|
3932
|
+
# `3` to this attribute anyway. DynamoDB will create the *itemcount*
|
3933
|
+
# attribute, set its initial value to `0`, and finally add `3` to
|
3934
|
+
# it. The result will be a new *itemcount* attribute in the item,
|
3935
|
+
# with a value of `3`.
|
3936
|
+
#
|
3937
|
+
# </note>
|
3938
|
+
#
|
3939
|
+
# * If the existing data type is a set and if *Value* is also a set,
|
3940
|
+
# then *Value* is added to the existing set. For example, if the
|
3941
|
+
# attribute value is the set `[1,2]`, and the `ADD` action specified
|
3942
|
+
# `[3]`, then the final attribute value is `[1,2,3]`. An error
|
3943
|
+
# occurs if an `ADD` action is specified for a set attribute and the
|
3944
|
+
# attribute type specified does not match the existing set type.
|
3945
|
+
#
|
3946
|
+
# Both sets must have the same primitive data type. For example, if
|
3947
|
+
# the existing data type is a set of strings, the *Value* must also
|
3948
|
+
# be a set of strings.
|
3949
|
+
#
|
3950
|
+
# The `ADD` action only supports Number and set data types. In
|
3951
|
+
# addition, `ADD` can only be used on top-level attributes, not nested
|
3952
|
+
# attributes.
|
3953
|
+
#
|
3954
|
+
# * `DELETE` - Deletes an element from a set.
|
3955
|
+
#
|
3956
|
+
# If a set of values is specified, then those values are subtracted
|
3957
|
+
# from the old set. For example, if the attribute value was the set
|
3958
|
+
# `[a,b,c]` and the `DELETE` action specifies `[a,c]`, then the final
|
3959
|
+
# attribute value is `[b]`. Specifying an empty set is an error.
|
3960
|
+
#
|
3961
|
+
# The `DELETE` action only supports set data types. In addition,
|
3962
|
+
# `DELETE` can only be used on top-level attributes, not nested
|
3963
|
+
# attributes.
|
3964
|
+
#
|
3965
|
+
# You can have many actions in a single expression, such as the
|
3966
|
+
# following: `SET a=:value1, b=:value2 DELETE :value3, :value4, :value5`
|
3967
|
+
#
|
3968
|
+
# For more information on update expressions, see [Modifying Items and
|
3969
|
+
# Attributes][1] in the *Amazon DynamoDB Developer Guide*.
|
3970
|
+
#
|
3971
|
+
# <note markdown="1"> *UpdateExpression* replaces the legacy *AttributeUpdates* parameter.
|
3972
|
+
#
|
3973
|
+
# </note>
|
3974
|
+
#
|
3975
|
+
#
|
3976
|
+
#
|
3977
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html
|
3978
|
+
# @option params [String] :condition_expression
|
3979
|
+
# A condition that must be satisfied in order for a conditional update
|
3980
|
+
# to succeed.
|
3981
|
+
#
|
3982
|
+
# An expression can contain any of the following:
|
3983
|
+
#
|
3984
|
+
# * Functions: `attribute_exists | attribute_not_exists | attribute_type
|
3985
|
+
# | contains | begins_with | size`
|
3986
|
+
#
|
3987
|
+
# These function names are case-sensitive.
|
3988
|
+
#
|
3989
|
+
# * Comparison operators: ` = | <> | < | > | <=
|
3990
|
+
# | >= | BETWEEN | IN`
|
3991
|
+
#
|
3992
|
+
# * Logical operators: `AND | OR | NOT`
|
3993
|
+
#
|
3994
|
+
# For more information on condition expressions, see [Specifying
|
3995
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
3996
|
+
#
|
3997
|
+
# <note markdown="1"> *ConditionExpression* replaces the legacy *ConditionalOperator* and
|
3998
|
+
# *Expected* parameters.
|
3999
|
+
#
|
4000
|
+
# </note>
|
4001
|
+
#
|
4002
|
+
#
|
4003
|
+
#
|
4004
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
4005
|
+
# @option params [Hash<String,String>] :expression_attribute_names
|
4006
|
+
# One or more substitution tokens for attribute names in an expression.
|
4007
|
+
# The following are some use cases for using
|
4008
|
+
# *ExpressionAttributeNames*\:
|
4009
|
+
#
|
4010
|
+
# * To access an attribute whose name conflicts with a DynamoDB reserved
|
4011
|
+
# word.
|
4012
|
+
#
|
4013
|
+
# * To create a placeholder for repeating occurrences of an attribute
|
4014
|
+
# name in an expression.
|
4015
|
+
#
|
4016
|
+
# * To prevent special characters in an attribute name from being
|
4017
|
+
# misinterpreted in an expression.
|
4018
|
+
#
|
4019
|
+
# Use the **#** character in an expression to dereference an attribute
|
4020
|
+
# name. For example, consider the following attribute name:
|
4021
|
+
#
|
4022
|
+
# * `Percentile`
|
4023
|
+
#
|
4024
|
+
# ^
|
4025
|
+
#
|
4026
|
+
# The name of this attribute conflicts with a reserved word, so it
|
4027
|
+
# cannot be used directly in an expression. (For the complete list of
|
4028
|
+
# reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
|
4029
|
+
# Developer Guide*). To work around this, you could specify the
|
4030
|
+
# following for *ExpressionAttributeNames*\:
|
4031
|
+
#
|
4032
|
+
# * `\{"#P":"Percentile"\}`
|
4033
|
+
#
|
4034
|
+
# ^
|
4035
|
+
#
|
4036
|
+
# You could then use this substitution in an expression, as in this
|
4037
|
+
# example:
|
4038
|
+
#
|
4039
|
+
# * `#P = :val`
|
4040
|
+
#
|
4041
|
+
# ^
|
4042
|
+
#
|
4043
|
+
# <note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
|
4044
|
+
# values*, which are placeholders for the actual value at runtime.
|
4045
|
+
#
|
4046
|
+
# </note>
|
4047
|
+
#
|
4048
|
+
# For more information on expression attribute names, see [Accessing
|
4049
|
+
# Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
|
4050
|
+
#
|
4051
|
+
#
|
4052
|
+
#
|
4053
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
|
4054
|
+
# [2]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
|
4055
|
+
# @option params [Hash<String,Types::AttributeValue>] :expression_attribute_values
|
4056
|
+
# One or more values that can be substituted in an expression.
|
4057
|
+
#
|
4058
|
+
# Use the **\:** (colon) character in an expression to dereference an
|
4059
|
+
# attribute value. For example, suppose that you wanted to check whether
|
4060
|
+
# the value of the *ProductStatus* attribute was one of the following:
|
4061
|
+
#
|
4062
|
+
# `Available | Backordered | Discontinued`
|
4063
|
+
#
|
4064
|
+
# You would first need to specify *ExpressionAttributeValues* as
|
4065
|
+
# follows:
|
4066
|
+
#
|
4067
|
+
# `\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
|
4068
|
+
# ":disc":\{"S":"Discontinued"\} \}`
|
4069
|
+
#
|
4070
|
+
# You could then use these values in an expression, such as this:
|
4071
|
+
#
|
4072
|
+
# `ProductStatus IN (:avail, :back, :disc)`
|
4073
|
+
#
|
4074
|
+
# For more information on expression attribute values, see [Specifying
|
4075
|
+
# Conditions][1] in the *Amazon DynamoDB Developer Guide*.
|
4076
|
+
#
|
4077
|
+
#
|
4078
|
+
#
|
4079
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
|
4080
|
+
# @return [Types::UpdateItemOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
4081
|
+
#
|
4082
|
+
# * {Types::UpdateItemOutput#attributes #Attributes} => Hash<String,Types::AttributeValue>
|
4083
|
+
# * {Types::UpdateItemOutput#consumed_capacity #ConsumedCapacity} => Types::ConsumedCapacity
|
4084
|
+
# * {Types::UpdateItemOutput#item_collection_metrics #ItemCollectionMetrics} => Types::ItemCollectionMetrics
|
4085
|
+
#
|
4086
|
+
# @example Request syntax with placeholder values
|
4087
|
+
# resp = client.update_item({
|
4088
|
+
# table_name: "TableName", # required
|
4089
|
+
# key: { # required
|
4090
|
+
# "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
4091
|
+
# },
|
4092
|
+
# attribute_updates: {
|
4093
|
+
# "AttributeName" => {
|
4094
|
+
# value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
4095
|
+
# action: "ADD", # accepts ADD, PUT, DELETE
|
4096
|
+
# },
|
4097
|
+
# },
|
4098
|
+
# expected: {
|
4099
|
+
# "AttributeName" => {
|
4100
|
+
# value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
4101
|
+
# exists: false,
|
4102
|
+
# comparison_operator: "EQ", # accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
|
4103
|
+
# attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
4104
|
+
# },
|
4105
|
+
# },
|
4106
|
+
# conditional_operator: "AND", # accepts AND, OR
|
4107
|
+
# return_values: "NONE", # accepts NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW
|
4108
|
+
# return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
|
4109
|
+
# return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
|
4110
|
+
# update_expression: "UpdateExpression",
|
4111
|
+
# condition_expression: "ConditionExpression",
|
4112
|
+
# expression_attribute_names: {
|
4113
|
+
# "ExpressionAttributeNameVariable" => "AttributeName",
|
4114
|
+
# },
|
4115
|
+
# expression_attribute_values: {
|
4116
|
+
# "ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
4117
|
+
# },
|
4118
|
+
# })
|
4119
|
+
#
|
4120
|
+
# @example Response structure
|
4121
|
+
# resp.attributes #=> Hash
|
4122
|
+
# resp.attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
4123
|
+
# resp.consumed_capacity.table_name #=> String
|
4124
|
+
# resp.consumed_capacity.capacity_units #=> Float
|
4125
|
+
# resp.consumed_capacity.table.capacity_units #=> Float
|
4126
|
+
# resp.consumed_capacity.local_secondary_indexes #=> Hash
|
4127
|
+
# resp.consumed_capacity.local_secondary_indexes["IndexName"].capacity_units #=> Float
|
4128
|
+
# resp.consumed_capacity.global_secondary_indexes #=> Hash
|
4129
|
+
# resp.consumed_capacity.global_secondary_indexes["IndexName"].capacity_units #=> Float
|
4130
|
+
# resp.item_collection_metrics.item_collection_key #=> Hash
|
4131
|
+
# resp.item_collection_metrics.item_collection_key["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
4132
|
+
# resp.item_collection_metrics.size_estimate_range_gb #=> Array
|
4133
|
+
# resp.item_collection_metrics.size_estimate_range_gb[0] #=> Float
|
4134
|
+
# @overload update_item(params = {})
|
4135
|
+
# @param [Hash] params ({})
|
4136
|
+
def update_item(params = {}, options = {})
|
4137
|
+
req = build_request(:update_item, params)
|
4138
|
+
req.send_request(options)
|
4139
|
+
end
|
4140
|
+
|
4141
|
+
# Modifies the provisioned throughput settings, global secondary
|
4142
|
+
# indexes, or DynamoDB Streams settings for a given table.
|
4143
|
+
#
|
4144
|
+
# You can only perform one of the following operations at once:
|
4145
|
+
#
|
4146
|
+
# * Modify the provisioned throughput settings of the table.
|
4147
|
+
#
|
4148
|
+
# * Enable or disable Streams on the table.
|
4149
|
+
#
|
4150
|
+
# * Remove a global secondary index from the table.
|
4151
|
+
#
|
4152
|
+
# * Create a new global secondary index on the table. Once the index
|
4153
|
+
# begins backfilling, you can use *UpdateTable* to perform other
|
4154
|
+
# operations.
|
4155
|
+
#
|
4156
|
+
# *UpdateTable* is an asynchronous operation; while it is executing, the
|
4157
|
+
# table status changes from `ACTIVE` to `UPDATING`. While it is
|
4158
|
+
# `UPDATING`, you cannot issue another *UpdateTable* request. When the
|
4159
|
+
# table returns to the `ACTIVE` state, the *UpdateTable* operation is
|
4160
|
+
# complete.
|
4161
|
+
# @option params [Array<Types::AttributeDefinition>] :attribute_definitions
|
4162
|
+
# An array of attributes that describe the key schema for the table and
|
4163
|
+
# indexes. If you are adding a new global secondary index to the table,
|
4164
|
+
# *AttributeDefinitions* must include the key element(s) of the new
|
4165
|
+
# index.
|
4166
|
+
# @option params [required, String] :table_name
|
4167
|
+
# The name of the table to be updated.
|
4168
|
+
# @option params [Types::ProvisionedThroughput] :provisioned_throughput
|
4169
|
+
# Represents the provisioned throughput settings for a specified table
|
4170
|
+
# or index. The settings can be modified using the *UpdateTable*
|
4171
|
+
# operation.
|
4172
|
+
#
|
4173
|
+
# For current minimum and maximum provisioned throughput values, see
|
4174
|
+
# [Limits][1] in the *Amazon DynamoDB Developer Guide*.
|
4175
|
+
#
|
4176
|
+
#
|
4177
|
+
#
|
4178
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html
|
4179
|
+
# @option params [Array<Types::GlobalSecondaryIndexUpdate>] :global_secondary_index_updates
|
4180
|
+
# An array of one or more global secondary indexes for the table. For
|
4181
|
+
# each index in the array, you can request one action:
|
4182
|
+
#
|
4183
|
+
# * *Create* - add a new global secondary index to the table.
|
4184
|
+
#
|
4185
|
+
# * *Update* - modify the provisioned throughput settings of an existing
|
4186
|
+
# global secondary index.
|
4187
|
+
#
|
4188
|
+
# * *Delete* - remove a global secondary index from the table.
|
4189
|
+
#
|
4190
|
+
# For more information, see [Managing Global Secondary Indexes][1] in
|
4191
|
+
# the *Amazon DynamoDB Developer Guide*.
|
4192
|
+
#
|
4193
|
+
#
|
4194
|
+
#
|
4195
|
+
# [1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html
|
4196
|
+
# @option params [Types::StreamSpecification] :stream_specification
|
4197
|
+
# Represents the DynamoDB Streams configuration for the table.
|
4198
|
+
#
|
4199
|
+
# <note markdown="1"> You will receive a *ResourceInUseException* if you attempt to enable a
|
4200
|
+
# stream on a table that already has a stream, or if you attempt to
|
4201
|
+
# disable a stream on a table which does not have a stream.
|
4202
|
+
#
|
4203
|
+
# </note>
|
4204
|
+
# @return [Types::UpdateTableOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
4205
|
+
#
|
4206
|
+
# * {Types::UpdateTableOutput#table_description #TableDescription} => Types::TableDescription
|
4207
|
+
#
|
4208
|
+
# @example Request syntax with placeholder values
|
4209
|
+
# resp = client.update_table({
|
4210
|
+
# attribute_definitions: [
|
4211
|
+
# {
|
4212
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
4213
|
+
# attribute_type: "S", # required, accepts S, N, B
|
4214
|
+
# },
|
4215
|
+
# ],
|
4216
|
+
# table_name: "TableName", # required
|
4217
|
+
# provisioned_throughput: {
|
4218
|
+
# read_capacity_units: 1, # required
|
4219
|
+
# write_capacity_units: 1, # required
|
4220
|
+
# },
|
4221
|
+
# global_secondary_index_updates: [
|
4222
|
+
# {
|
4223
|
+
# update: {
|
4224
|
+
# index_name: "IndexName", # required
|
4225
|
+
# provisioned_throughput: { # required
|
4226
|
+
# read_capacity_units: 1, # required
|
4227
|
+
# write_capacity_units: 1, # required
|
4228
|
+
# },
|
4229
|
+
# },
|
4230
|
+
# create: {
|
4231
|
+
# index_name: "IndexName", # required
|
4232
|
+
# key_schema: [ # required
|
4233
|
+
# {
|
4234
|
+
# attribute_name: "KeySchemaAttributeName", # required
|
4235
|
+
# key_type: "HASH", # required, accepts HASH, RANGE
|
4236
|
+
# },
|
4237
|
+
# ],
|
4238
|
+
# projection: { # required
|
4239
|
+
# projection_type: "ALL", # accepts ALL, KEYS_ONLY, INCLUDE
|
4240
|
+
# non_key_attributes: ["NonKeyAttributeName"],
|
4241
|
+
# },
|
4242
|
+
# provisioned_throughput: { # required
|
4243
|
+
# read_capacity_units: 1, # required
|
4244
|
+
# write_capacity_units: 1, # required
|
4245
|
+
# },
|
4246
|
+
# },
|
4247
|
+
# delete: {
|
4248
|
+
# index_name: "IndexName", # required
|
4249
|
+
# },
|
4250
|
+
# },
|
4251
|
+
# ],
|
4252
|
+
# stream_specification: {
|
4253
|
+
# stream_enabled: false,
|
4254
|
+
# stream_view_type: "NEW_IMAGE", # accepts NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES, KEYS_ONLY
|
4255
|
+
# },
|
4256
|
+
# })
|
4257
|
+
#
|
4258
|
+
# @example Response structure
|
4259
|
+
# resp.table_description.attribute_definitions #=> Array
|
4260
|
+
# resp.table_description.attribute_definitions[0].attribute_name #=> String
|
4261
|
+
# resp.table_description.attribute_definitions[0].attribute_type #=> String, one of "S", "N", "B"
|
4262
|
+
# resp.table_description.table_name #=> String
|
4263
|
+
# resp.table_description.key_schema #=> Array
|
4264
|
+
# resp.table_description.key_schema[0].attribute_name #=> String
|
4265
|
+
# resp.table_description.key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
4266
|
+
# resp.table_description.table_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
4267
|
+
# resp.table_description.creation_date_time #=> Time
|
4268
|
+
# resp.table_description.provisioned_throughput.last_increase_date_time #=> Time
|
4269
|
+
# resp.table_description.provisioned_throughput.last_decrease_date_time #=> Time
|
4270
|
+
# resp.table_description.provisioned_throughput.number_of_decreases_today #=> Integer
|
4271
|
+
# resp.table_description.provisioned_throughput.read_capacity_units #=> Integer
|
4272
|
+
# resp.table_description.provisioned_throughput.write_capacity_units #=> Integer
|
4273
|
+
# resp.table_description.table_size_bytes #=> Integer
|
4274
|
+
# resp.table_description.item_count #=> Integer
|
4275
|
+
# resp.table_description.table_arn #=> String
|
4276
|
+
# resp.table_description.local_secondary_indexes #=> Array
|
4277
|
+
# resp.table_description.local_secondary_indexes[0].index_name #=> String
|
4278
|
+
# resp.table_description.local_secondary_indexes[0].key_schema #=> Array
|
4279
|
+
# resp.table_description.local_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
4280
|
+
# resp.table_description.local_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
4281
|
+
# resp.table_description.local_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
4282
|
+
# resp.table_description.local_secondary_indexes[0].projection.non_key_attributes #=> Array
|
4283
|
+
# resp.table_description.local_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
4284
|
+
# resp.table_description.local_secondary_indexes[0].index_size_bytes #=> Integer
|
4285
|
+
# resp.table_description.local_secondary_indexes[0].item_count #=> Integer
|
4286
|
+
# resp.table_description.local_secondary_indexes[0].index_arn #=> String
|
4287
|
+
# resp.table_description.global_secondary_indexes #=> Array
|
4288
|
+
# resp.table_description.global_secondary_indexes[0].index_name #=> String
|
4289
|
+
# resp.table_description.global_secondary_indexes[0].key_schema #=> Array
|
4290
|
+
# resp.table_description.global_secondary_indexes[0].key_schema[0].attribute_name #=> String
|
4291
|
+
# resp.table_description.global_secondary_indexes[0].key_schema[0].key_type #=> String, one of "HASH", "RANGE"
|
4292
|
+
# resp.table_description.global_secondary_indexes[0].projection.projection_type #=> String, one of "ALL", "KEYS_ONLY", "INCLUDE"
|
4293
|
+
# resp.table_description.global_secondary_indexes[0].projection.non_key_attributes #=> Array
|
4294
|
+
# resp.table_description.global_secondary_indexes[0].projection.non_key_attributes[0] #=> String
|
4295
|
+
# resp.table_description.global_secondary_indexes[0].index_status #=> String, one of "CREATING", "UPDATING", "DELETING", "ACTIVE"
|
4296
|
+
# resp.table_description.global_secondary_indexes[0].backfilling #=> Boolean
|
4297
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.last_increase_date_time #=> Time
|
4298
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.last_decrease_date_time #=> Time
|
4299
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.number_of_decreases_today #=> Integer
|
4300
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.read_capacity_units #=> Integer
|
4301
|
+
# resp.table_description.global_secondary_indexes[0].provisioned_throughput.write_capacity_units #=> Integer
|
4302
|
+
# resp.table_description.global_secondary_indexes[0].index_size_bytes #=> Integer
|
4303
|
+
# resp.table_description.global_secondary_indexes[0].item_count #=> Integer
|
4304
|
+
# resp.table_description.global_secondary_indexes[0].index_arn #=> String
|
4305
|
+
# resp.table_description.stream_specification.stream_enabled #=> Boolean
|
4306
|
+
# resp.table_description.stream_specification.stream_view_type #=> String, one of "NEW_IMAGE", "OLD_IMAGE", "NEW_AND_OLD_IMAGES", "KEYS_ONLY"
|
4307
|
+
# resp.table_description.latest_stream_label #=> String
|
4308
|
+
# resp.table_description.latest_stream_arn #=> String
|
4309
|
+
# @overload update_table(params = {})
|
4310
|
+
# @param [Hash] params ({})
|
4311
|
+
def update_table(params = {}, options = {})
|
4312
|
+
req = build_request(:update_table, params)
|
4313
|
+
req.send_request(options)
|
4314
|
+
end
|
4315
|
+
|
4316
|
+
# @!endgroup
|
4317
|
+
|
4318
|
+
# @param params ({})
|
4319
|
+
# @api private
|
4320
|
+
def build_request(operation_name, params = {})
|
4321
|
+
handlers = @handlers.for(operation_name)
|
4322
|
+
context = Seahorse::Client::RequestContext.new(
|
4323
|
+
operation_name: operation_name,
|
4324
|
+
operation: config.api.operation(operation_name),
|
4325
|
+
client: self,
|
4326
|
+
params: params,
|
4327
|
+
config: config)
|
4328
|
+
context[:gem_name] = 'aws-sdk-dynamodb'
|
4329
|
+
context[:gem_version] = '1.0.0.rc1'
|
4330
|
+
Seahorse::Client::Request.new(handlers, context)
|
4331
|
+
end
|
4332
|
+
|
4333
|
+
# Polls an API operation until a resource enters a desired state.
|
4334
|
+
#
|
4335
|
+
# ## Basic Usage
|
4336
|
+
#
|
4337
|
+
# A waiter will call an API operation until:
|
4338
|
+
#
|
4339
|
+
# * It is successful
|
4340
|
+
# * It enters a terminal state
|
4341
|
+
# * It makes the maximum number of attempts
|
4342
|
+
#
|
4343
|
+
# In between attempts, the waiter will sleep.
|
4344
|
+
#
|
4345
|
+
# # polls in a loop, sleeping between attempts
|
4346
|
+
# client.waiter_until(waiter_name, params)
|
4347
|
+
#
|
4348
|
+
# ## Configuration
|
4349
|
+
#
|
4350
|
+
# You can configure the maximum number of polling attempts, and the
|
4351
|
+
# delay (in seconds) between each polling attempt. You can pass
|
4352
|
+
# configuration as the final arguments hash.
|
4353
|
+
#
|
4354
|
+
# # poll for ~25 seconds
|
4355
|
+
# client.wait_until(waiter_name, params, {
|
4356
|
+
# max_attempts: 5,
|
4357
|
+
# delay: 5,
|
4358
|
+
# })
|
4359
|
+
#
|
4360
|
+
# ## Callbacks
|
4361
|
+
#
|
4362
|
+
# You can be notified before each polling attempt and before each
|
4363
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
4364
|
+
# it will terminate the waiter.
|
4365
|
+
#
|
4366
|
+
# started_at = Time.now
|
4367
|
+
# client.wait_until(waiter_name, params, {
|
4368
|
+
#
|
4369
|
+
# # disable max attempts
|
4370
|
+
# max_attempts: nil,
|
4371
|
+
#
|
4372
|
+
# # poll for 1 hour, instead of a number of attempts
|
4373
|
+
# before_wait: -> (attempts, response) do
|
4374
|
+
# throw :failure if Time.now - started_at > 3600
|
4375
|
+
# end
|
4376
|
+
# })
|
4377
|
+
#
|
4378
|
+
# ## Handling Errors
|
4379
|
+
#
|
4380
|
+
# When a waiter is unsuccessful, it will raise an error.
|
4381
|
+
# All of the failure errors extend from
|
4382
|
+
# {Aws::Waiters::Errors::WaiterFailed}.
|
4383
|
+
#
|
4384
|
+
# begin
|
4385
|
+
# client.wait_until(...)
|
4386
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
4387
|
+
# # resource did not enter the desired state in time
|
4388
|
+
# end
|
4389
|
+
#
|
4390
|
+
# ## Valid Waiters
|
4391
|
+
#
|
4392
|
+
# The following table lists the valid waiter names, the operations they call,
|
4393
|
+
# and the default `:delay` and `:max_attempts` values.
|
4394
|
+
#
|
4395
|
+
# | waiter_name | params | :delay | :max_attempts |
|
4396
|
+
# | ---------------- | ----------------- | -------- | ------------- |
|
4397
|
+
# | table_exists | {#describe_table} | 20 | 25 |
|
4398
|
+
# | table_not_exists | {#describe_table} | 20 | 25 |
|
4399
|
+
#
|
4400
|
+
# @raise [Errors::FailureStateError] Raised when the waiter terminates
|
4401
|
+
# because the waiter has entered a state that it will not transition
|
4402
|
+
# out of, preventing success.
|
4403
|
+
#
|
4404
|
+
# @raise [Errors::TooManyAttemptsError] Raised when the configured
|
4405
|
+
# maximum number of attempts have been made, and the waiter is not
|
4406
|
+
# yet successful.
|
4407
|
+
#
|
4408
|
+
# @raise [Errors::UnexpectedError] Raised when an error is encounted
|
4409
|
+
# while polling for a resource that is not expected.
|
4410
|
+
#
|
4411
|
+
# @raise [Errors::NoSuchWaiterError] Raised when you request to wait
|
4412
|
+
# for an unknown state.
|
4413
|
+
#
|
4414
|
+
# @return [Boolean] Returns `true` if the waiter was successful.
|
4415
|
+
# @param [Symbol] waiter_name
|
4416
|
+
# @param [Hash] params ({})
|
4417
|
+
# @param [Hash] options ({})
|
4418
|
+
# @option options [Integer] :max_attempts
|
4419
|
+
# @option options [Integer] :delay
|
4420
|
+
# @option options [Proc] :before_attempt
|
4421
|
+
# @option options [Proc] :before_wait
|
4422
|
+
def wait_until(waiter_name, params = {}, options = {})
|
4423
|
+
w = waiter(waiter_name, options)
|
4424
|
+
yield(w.waiter) if block_given? # deprecated
|
4425
|
+
w.wait(params)
|
4426
|
+
end
|
4427
|
+
|
4428
|
+
# @api private
|
4429
|
+
# @deprecated
|
4430
|
+
def waiter_names
|
4431
|
+
waiters.keys
|
4432
|
+
end
|
4433
|
+
|
4434
|
+
private
|
4435
|
+
|
4436
|
+
# @param [Symbol] waiter_name
|
4437
|
+
# @param [Hash] options ({})
|
4438
|
+
def waiter(waiter_name, options = {})
|
4439
|
+
waiter_class = waiters[waiter_name]
|
4440
|
+
if waiter_class
|
4441
|
+
waiter_class.new(options.merge(client: self))
|
4442
|
+
else
|
4443
|
+
raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
|
4444
|
+
end
|
4445
|
+
end
|
4446
|
+
|
4447
|
+
def waiters
|
4448
|
+
{
|
4449
|
+
table_exists: Waiters::TableExists,
|
4450
|
+
table_not_exists: Waiters::TableNotExists
|
4451
|
+
}
|
4452
|
+
end
|
4453
|
+
|
4454
|
+
class << self
|
4455
|
+
|
4456
|
+
# @api private
|
4457
|
+
attr_reader :identifier
|
4458
|
+
|
4459
|
+
# @api private
|
4460
|
+
def errors_module
|
4461
|
+
Errors
|
4462
|
+
end
|
4463
|
+
|
4464
|
+
end
|
4465
|
+
end
|
4466
|
+
end
|
4467
|
+
end
|