aws-sdk-dynamodb 1.84.0 → 1.118.0

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.
@@ -21,9 +21,11 @@ module Aws
21
21
  def data_to_http_resp(operation_name, data)
22
22
  api = config.api
23
23
  operation = api.operation(operation_name)
24
- translator = Plugins::SimpleAttributes::ValueTranslator
25
- translator = translator.new(operation.output, :marshal)
26
- data = translator.apply(data)
24
+ if config.simple_attributes
25
+ translator = Plugins::SimpleAttributes::ValueTranslator
26
+ translator = translator.new(operation.output, :marshal)
27
+ data = translator.apply(data)
28
+ end
27
29
  ParamValidator.validate!(operation.output, data)
28
30
  protocol_helper.stub_data(api, operation, data)
29
31
  end
@@ -32,8 +32,8 @@ module Aws::DynamoDB
32
32
  raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
33
33
  end
34
34
  if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
35
- if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"))
36
- if Aws::Endpoints::Matchers.string_equals?("aws-us-gov", Aws::Endpoints::Matchers.attr(partition_result, "name"))
35
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
36
+ if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws-us-gov")
37
37
  return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.amazonaws.com", headers: {}, properties: {})
38
38
  end
39
39
  return Aws::Endpoints::Endpoint.new(url: "https://dynamodb-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
@@ -9,6 +9,7 @@
9
9
 
10
10
 
11
11
  module Aws::DynamoDB
12
+ # @api private
12
13
  module Endpoints
13
14
 
14
15
  class BatchExecuteStatement
@@ -123,6 +124,20 @@ module Aws::DynamoDB
123
124
  end
124
125
  end
125
126
 
127
+ class DeleteResourcePolicy
128
+ def self.build(context)
129
+ unless context.config.regional_endpoint
130
+ endpoint = context.config.endpoint.to_s
131
+ end
132
+ Aws::DynamoDB::EndpointParameters.new(
133
+ region: context.config.region,
134
+ use_dual_stack: context.config.use_dualstack_endpoint,
135
+ use_fips: context.config.use_fips_endpoint,
136
+ endpoint: endpoint,
137
+ )
138
+ end
139
+ end
140
+
126
141
  class DeleteTable
127
142
  def self.build(context)
128
143
  unless context.config.regional_endpoint
@@ -403,6 +418,20 @@ module Aws::DynamoDB
403
418
  end
404
419
  end
405
420
 
421
+ class GetResourcePolicy
422
+ def self.build(context)
423
+ unless context.config.regional_endpoint
424
+ endpoint = context.config.endpoint.to_s
425
+ end
426
+ Aws::DynamoDB::EndpointParameters.new(
427
+ region: context.config.region,
428
+ use_dual_stack: context.config.use_dualstack_endpoint,
429
+ use_fips: context.config.use_fips_endpoint,
430
+ endpoint: endpoint,
431
+ )
432
+ end
433
+ end
434
+
406
435
  class ImportTable
407
436
  def self.build(context)
408
437
  unless context.config.regional_endpoint
@@ -529,6 +558,20 @@ module Aws::DynamoDB
529
558
  end
530
559
  end
531
560
 
561
+ class PutResourcePolicy
562
+ def self.build(context)
563
+ unless context.config.regional_endpoint
564
+ endpoint = context.config.endpoint.to_s
565
+ end
566
+ Aws::DynamoDB::EndpointParameters.new(
567
+ region: context.config.region,
568
+ use_dual_stack: context.config.use_dualstack_endpoint,
569
+ use_fips: context.config.use_fips_endpoint,
570
+ endpoint: endpoint,
571
+ )
572
+ end
573
+ end
574
+
532
575
  class Query
533
576
  def self.build(context)
534
577
  unless context.config.regional_endpoint
@@ -711,6 +754,20 @@ module Aws::DynamoDB
711
754
  end
712
755
  end
713
756
 
757
+ class UpdateKinesisStreamingDestination
758
+ def self.build(context)
759
+ unless context.config.regional_endpoint
760
+ endpoint = context.config.endpoint.to_s
761
+ end
762
+ Aws::DynamoDB::EndpointParameters.new(
763
+ region: context.config.region,
764
+ use_dual_stack: context.config.use_dualstack_endpoint,
765
+ use_fips: context.config.use_fips_endpoint,
766
+ endpoint: endpoint,
767
+ )
768
+ end
769
+ end
770
+
714
771
  class UpdateTable
715
772
  def self.build(context)
716
773
  unless context.config.regional_endpoint
@@ -46,6 +46,7 @@ module Aws::DynamoDB
46
46
  # * {ItemCollectionSizeLimitExceededException}
47
47
  # * {LimitExceededException}
48
48
  # * {PointInTimeRecoveryUnavailableException}
49
+ # * {PolicyNotFoundException}
49
50
  # * {ProvisionedThroughputExceededException}
50
51
  # * {ReplicaAlreadyExistsException}
51
52
  # * {ReplicaNotFoundException}
@@ -108,6 +109,11 @@ module Aws::DynamoDB
108
109
  def message
109
110
  @message || @data[:message]
110
111
  end
112
+
113
+ # @return [String]
114
+ def item
115
+ @data[:item]
116
+ end
111
117
  end
112
118
 
113
119
  class ContinuousBackupsUnavailableException < ServiceError
@@ -350,6 +356,21 @@ module Aws::DynamoDB
350
356
  end
351
357
  end
352
358
 
359
+ class PolicyNotFoundException < ServiceError
360
+
361
+ # @param [Seahorse::Client::RequestContext] context
362
+ # @param [String] message
363
+ # @param [Aws::DynamoDB::Types::PolicyNotFoundException] data
364
+ def initialize(context, message, data = Aws::EmptyStructure.new)
365
+ super(context, message, data)
366
+ end
367
+
368
+ # @return [String]
369
+ def message
370
+ @message || @data[:message]
371
+ end
372
+ end
373
+
353
374
  class ProvisionedThroughputExceededException < ServiceError
354
375
 
355
376
  # @param [Seahorse::Client::RequestContext] context
@@ -14,6 +14,7 @@ module Aws::DynamoDB
14
14
  option(
15
15
  :endpoint_provider,
16
16
  doc_type: 'Aws::DynamoDB::EndpointProvider',
17
+ rbs_type: 'untyped',
17
18
  docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
19
  'object that responds to `#resolve_endpoint(parameters)` '\
19
20
  'where `parameters` is a Struct similar to '\
@@ -25,16 +26,17 @@ module Aws::DynamoDB
25
26
  # @api private
26
27
  class Handler < Seahorse::Client::Handler
27
28
  def call(context)
28
- # If endpoint was discovered, do not resolve or apply the endpoint.
29
29
  unless context[:discovered_endpoint]
30
30
  params = parameters_for_operation(context)
31
31
  endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
32
 
33
33
  context.http_request.endpoint = endpoint.url
34
34
  apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
35
38
  end
36
39
 
37
- context[:endpoint_params] = params
38
40
  context[:auth_scheme] =
39
41
  Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
42
 
@@ -72,6 +74,8 @@ module Aws::DynamoDB
72
74
  Aws::DynamoDB::Endpoints::DeleteBackup.build(context)
73
75
  when :delete_item
74
76
  Aws::DynamoDB::Endpoints::DeleteItem.build(context)
77
+ when :delete_resource_policy
78
+ Aws::DynamoDB::Endpoints::DeleteResourcePolicy.build(context)
75
79
  when :delete_table
76
80
  Aws::DynamoDB::Endpoints::DeleteTable.build(context)
77
81
  when :describe_backup
@@ -112,6 +116,8 @@ module Aws::DynamoDB
112
116
  Aws::DynamoDB::Endpoints::ExportTableToPointInTime.build(context)
113
117
  when :get_item
114
118
  Aws::DynamoDB::Endpoints::GetItem.build(context)
119
+ when :get_resource_policy
120
+ Aws::DynamoDB::Endpoints::GetResourcePolicy.build(context)
115
121
  when :import_table
116
122
  Aws::DynamoDB::Endpoints::ImportTable.build(context)
117
123
  when :list_backups
@@ -130,6 +136,8 @@ module Aws::DynamoDB
130
136
  Aws::DynamoDB::Endpoints::ListTagsOfResource.build(context)
131
137
  when :put_item
132
138
  Aws::DynamoDB::Endpoints::PutItem.build(context)
139
+ when :put_resource_policy
140
+ Aws::DynamoDB::Endpoints::PutResourcePolicy.build(context)
133
141
  when :query
134
142
  Aws::DynamoDB::Endpoints::Query.build(context)
135
143
  when :restore_table_from_backup
@@ -156,6 +164,8 @@ module Aws::DynamoDB
156
164
  Aws::DynamoDB::Endpoints::UpdateGlobalTableSettings.build(context)
157
165
  when :update_item
158
166
  Aws::DynamoDB::Endpoints::UpdateItem.build(context)
167
+ when :update_kinesis_streaming_destination
168
+ Aws::DynamoDB::Endpoints::UpdateKinesisStreamingDestination.build(context)
159
169
  when :update_table
160
170
  Aws::DynamoDB::Endpoints::UpdateTable.build(context)
161
171
  when :update_table_replica_auto_scaling
@@ -83,11 +83,11 @@ module Aws
83
83
  # # note that the request `:key` had to be type prefixed
84
84
  # resp = dynamodb.get(table_name: 'aws-sdk', key: { 'id' => { s: 'uuid' }})
85
85
  # resp.item
86
- # # {
87
- # # "id"=> <struct s='uuid', n=nil, b=nil, ss=nil, ns=nil, bs=nil, m=nil, l=nil, null=nil, bool=nil>
88
- # # "age"=> <struct s=nil, n="35", b=nil, ss=nil, ns=nil, bs=nil, m=nil, l=nil, null=nil, bool=nil>
89
- # # ...
90
- # # }
86
+ # {
87
+ # "id"=> <struct s='uuid', n=nil, b=nil, ss=nil, ns=nil, bs=nil, m=nil, l=nil, null=nil, bool=nil>
88
+ # "age"=> <struct s=nil, n="35", b=nil, ss=nil, ns=nil, bs=nil, m=nil, l=nil, null=nil, bool=nil>
89
+ # ...
90
+ # }
91
91
  #
92
92
  class SimpleAttributes < Seahorse::Client::Plugin
93
93
 
@@ -119,12 +119,15 @@ their types specified, e.g. `{ s: 'abc' }` instead of simply
119
119
  @handler.call(context).on(200) do |response|
120
120
  response.data = translate_output(response)
121
121
  end
122
+ rescue Aws::Errors::ServiceError => e
123
+ e.data = translate_error_data(context, e.data)
124
+ raise e
122
125
  end
123
126
 
124
127
  private
125
128
 
126
129
  def translate_input(context)
127
- if shape = context.operation.input
130
+ if (shape = context.operation.input)
128
131
  ValueTranslator.new(shape, :marshal).apply(context.params)
129
132
  else
130
133
  context.params
@@ -132,13 +135,24 @@ their types specified, e.g. `{ s: 'abc' }` instead of simply
132
135
  end
133
136
 
134
137
  def translate_output(response)
135
- if shape = response.context.operation.output
138
+ if (shape = response.context.operation.output)
136
139
  ValueTranslator.new(shape, :unmarshal).apply(response.data)
137
140
  else
138
141
  response.data
139
142
  end
140
143
  end
141
144
 
145
+ def translate_error_data(context, error_data)
146
+ shape = context.operation.errors.find do |e|
147
+ error_data.is_a?(e.shape.struct_class)
148
+ end
149
+ if shape
150
+ ValueTranslator.new(shape, :unmarshal).apply(error_data)
151
+ else
152
+ error_data
153
+ end
154
+ end
155
+
142
156
  end
143
157
 
144
158
  # @api private
@@ -39,7 +39,7 @@ module Aws::DynamoDB
39
39
  #
40
40
  # dynamo_db.batch_get_item({
41
41
  # request_items: { # required
42
- # "TableName" => {
42
+ # "TableArn" => {
43
43
  # keys: [ # required
44
44
  # {
45
45
  # "AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
@@ -57,9 +57,9 @@ module Aws::DynamoDB
57
57
  # })
58
58
  # @param [Hash] options ({})
59
59
  # @option options [required, Hash<String,Types::KeysAndAttributes>] :request_items
60
- # A map of one or more table names and, for each table, a map that
61
- # describes one or more items to retrieve from that table. Each table
62
- # name can be used only once per `BatchGetItem` request.
60
+ # A map of one or more table names or table ARNs and, for each table, a
61
+ # map that describes one or more items to retrieve from that table. Each
62
+ # table name or ARN can be used only once per `BatchGetItem` request.
63
63
  #
64
64
  # Each element in the map of items to retrieve consists of the
65
65
  # following:
@@ -160,7 +160,9 @@ module Aws::DynamoDB
160
160
  # * `NONE` - No `ConsumedCapacity` details are included in the response.
161
161
  # @return [Types::BatchGetItemOutput]
162
162
  def batch_get_item(options = {})
163
- resp = @client.batch_get_item(options)
163
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
164
+ @client.batch_get_item(options)
165
+ end
164
166
  resp.data
165
167
  end
166
168
 
@@ -168,7 +170,7 @@ module Aws::DynamoDB
168
170
  #
169
171
  # dynamo_db.batch_write_item({
170
172
  # request_items: { # required
171
- # "TableName" => [
173
+ # "TableArn" => [
172
174
  # {
173
175
  # put_request: {
174
176
  # item: { # required
@@ -188,9 +190,9 @@ module Aws::DynamoDB
188
190
  # })
189
191
  # @param [Hash] options ({})
190
192
  # @option options [required, Hash<String,Array>] :request_items
191
- # A map of one or more table names and, for each table, a list of
192
- # operations to be performed (`DeleteRequest` or `PutRequest`). Each
193
- # element in the map consists of the following:
193
+ # A map of one or more table names or table ARNs and, for each table, a
194
+ # list of operations to be performed (`DeleteRequest` or `PutRequest`).
195
+ # Each element in the map consists of the following:
194
196
  #
195
197
  # * `DeleteRequest` - Perform a `DeleteItem` operation on the specified
196
198
  # item. The item to be deleted is identified by a `Key` subelement:
@@ -241,7 +243,9 @@ module Aws::DynamoDB
241
243
  # response. If set to `NONE` (the default), no statistics are returned.
242
244
  # @return [Types::BatchWriteItemOutput]
243
245
  def batch_write_item(options = {})
244
- resp = @client.batch_write_item(options)
246
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
247
+ @client.batch_write_item(options)
248
+ end
245
249
  resp.data
246
250
  end
247
251
 
@@ -254,7 +258,7 @@ module Aws::DynamoDB
254
258
  # attribute_type: "S", # required, accepts S, N, B
255
259
  # },
256
260
  # ],
257
- # table_name: "TableName", # required
261
+ # table_name: "TableArn", # required
258
262
  # key_schema: [ # required
259
263
  # {
260
264
  # attribute_name: "KeySchemaAttributeName", # required
@@ -293,6 +297,10 @@ module Aws::DynamoDB
293
297
  # read_capacity_units: 1, # required
294
298
  # write_capacity_units: 1, # required
295
299
  # },
300
+ # on_demand_throughput: {
301
+ # max_read_request_units: 1,
302
+ # max_write_request_units: 1,
303
+ # },
296
304
  # },
297
305
  # ],
298
306
  # billing_mode: "PROVISIONED", # accepts PROVISIONED, PAY_PER_REQUEST
@@ -317,13 +325,19 @@ module Aws::DynamoDB
317
325
  # ],
318
326
  # table_class: "STANDARD", # accepts STANDARD, STANDARD_INFREQUENT_ACCESS
319
327
  # deletion_protection_enabled: false,
328
+ # resource_policy: "ResourcePolicy",
329
+ # on_demand_throughput: {
330
+ # max_read_request_units: 1,
331
+ # max_write_request_units: 1,
332
+ # },
320
333
  # })
321
334
  # @param [Hash] options ({})
322
335
  # @option options [required, Array<Types::AttributeDefinition>] :attribute_definitions
323
336
  # An array of attributes that describe the key schema for the table and
324
337
  # indexes.
325
338
  # @option options [required, String] :table_name
326
- # The name of the table to create.
339
+ # The name of the table to create. You can also provide the Amazon
340
+ # Resource Name (ARN) of the table in this parameter.
327
341
  # @option options [required, Array<Types::KeySchemaElement>] :key_schema
328
342
  # Specifies the attributes that make up the primary key for a table or
329
343
  # an index. The attributes in `KeySchema` must also be defined in the
@@ -453,16 +467,16 @@ module Aws::DynamoDB
453
467
  #
454
468
  # * `PROVISIONED` - We recommend using `PROVISIONED` for predictable
455
469
  # workloads. `PROVISIONED` sets the billing mode to [Provisioned
456
- # Mode][1].
470
+ # capacity mode][1].
457
471
  #
458
472
  # * `PAY_PER_REQUEST` - We recommend using `PAY_PER_REQUEST` for
459
473
  # unpredictable workloads. `PAY_PER_REQUEST` sets the billing mode to
460
- # [On-Demand Mode][2].
474
+ # [On-demand capacity mode][2].
461
475
  #
462
476
  #
463
477
  #
464
- # [1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.ProvisionedThroughput.Manual
465
- # [2]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.OnDemand
478
+ # [1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/provisioned-capacity-mode.html
479
+ # [2]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/on-demand-capacity-mode.html
466
480
  # @option options [Types::ProvisionedThroughput] :provisioned_throughput
467
481
  # Represents the provisioned throughput settings for a specified table
468
482
  # or index. The settings can be modified using the `UpdateTable`
@@ -516,9 +530,37 @@ module Aws::DynamoDB
516
530
  # @option options [Boolean] :deletion_protection_enabled
517
531
  # Indicates whether deletion protection is to be enabled (true) or
518
532
  # disabled (false) on the table.
533
+ # @option options [String] :resource_policy
534
+ # An Amazon Web Services resource-based policy document in JSON format
535
+ # that will be attached to the table.
536
+ #
537
+ # When you attach a resource-based policy while creating a table, the
538
+ # policy application is *strongly consistent*.
539
+ #
540
+ # The maximum size supported for a resource-based policy document is 20
541
+ # KB. DynamoDB counts whitespaces when calculating the size of a policy
542
+ # against this limit. For a full list of all considerations that apply
543
+ # for resource-based policies, see [Resource-based policy
544
+ # considerations][1].
545
+ #
546
+ # <note markdown="1"> You need to specify the `CreateTable` and `PutResourcePolicy` IAM
547
+ # actions for authorizing a user to create a table with a resource-based
548
+ # policy.
549
+ #
550
+ # </note>
551
+ #
552
+ #
553
+ #
554
+ # [1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html
555
+ # @option options [Types::OnDemandThroughput] :on_demand_throughput
556
+ # Sets the maximum number of read and write units for the specified
557
+ # table in on-demand capacity mode. If you use this parameter, you must
558
+ # specify `MaxReadRequestUnits`, `MaxWriteRequestUnits`, or both.
519
559
  # @return [Table]
520
560
  def create_table(options = {})
521
- resp = @client.create_table(options)
561
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
562
+ @client.create_table(options)
563
+ end
522
564
  Table.new(
523
565
  name: resp.data.table_description.table_name,
524
566
  data: resp.data.table_description,
@@ -544,7 +586,9 @@ module Aws::DynamoDB
544
586
  # @return [Table::Collection]
545
587
  def tables(options = {})
546
588
  batches = Enumerator.new do |y|
547
- resp = @client.list_tables(options)
589
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
590
+ @client.list_tables(options)
591
+ end
548
592
  resp.each_page do |page|
549
593
  batch = []
550
594
  page.data.table_names.each do |t|