aws-sdk-dynamodb 1.96.0 → 1.132.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,11 +30,23 @@ module Aws::DynamoDB
30
30
  #
31
31
  # @return [String]
32
32
  #
33
+ # @!attribute account_id
34
+ # The AWS AccountId used for the request.
35
+ #
36
+ # @return [String]
37
+ #
38
+ # @!attribute account_id_endpoint_mode
39
+ # The AccountId Endpoint Mode.
40
+ #
41
+ # @return [String]
42
+ #
33
43
  EndpointParameters = Struct.new(
34
44
  :region,
35
45
  :use_dual_stack,
36
46
  :use_fips,
37
47
  :endpoint,
48
+ :account_id,
49
+ :account_id_endpoint_mode,
38
50
  ) do
39
51
  include Aws::Structure
40
52
 
@@ -45,6 +57,8 @@ module Aws::DynamoDB
45
57
  'UseDualStack' => :use_dual_stack,
46
58
  'UseFIPS' => :use_fips,
47
59
  'Endpoint' => :endpoint,
60
+ 'AccountId' => :account_id,
61
+ 'AccountIdEndpointMode' => :account_id_endpoint_mode,
48
62
  }.freeze
49
63
  end
50
64
 
@@ -52,15 +66,22 @@ module Aws::DynamoDB
52
66
  self[:region] = options[:region]
53
67
  self[:use_dual_stack] = options[:use_dual_stack]
54
68
  self[:use_dual_stack] = false if self[:use_dual_stack].nil?
55
- if self[:use_dual_stack].nil?
56
- raise ArgumentError, "Missing required EndpointParameter: :use_dual_stack"
57
- end
58
69
  self[:use_fips] = options[:use_fips]
59
70
  self[:use_fips] = false if self[:use_fips].nil?
60
- if self[:use_fips].nil?
61
- raise ArgumentError, "Missing required EndpointParameter: :use_fips"
62
- end
63
71
  self[:endpoint] = options[:endpoint]
72
+ self[:account_id] = options[:account_id]
73
+ self[:account_id_endpoint_mode] = options[:account_id_endpoint_mode]
74
+ end
75
+
76
+ def self.create(config, options={})
77
+ new({
78
+ region: config.region,
79
+ use_dual_stack: config.use_dualstack_endpoint,
80
+ use_fips: config.use_fips_endpoint,
81
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
82
+ account_id: config.credentials.credentials.account_id,
83
+ account_id_endpoint_mode: config.account_id_endpoint_mode,
84
+ }.merge(options))
64
85
  end
65
86
  end
66
87
  end
@@ -14,6 +14,8 @@ module Aws::DynamoDB
14
14
  use_dual_stack = parameters.use_dual_stack
15
15
  use_fips = parameters.use_fips
16
16
  endpoint = parameters.endpoint
17
+ account_id = parameters.account_id
18
+ account_id_endpoint_mode = parameters.account_id_endpoint_mode
17
19
  if Aws::Endpoints::Matchers.set?(endpoint)
18
20
  if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
19
21
  raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
@@ -21,35 +23,65 @@ module Aws::DynamoDB
21
23
  if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
22
24
  raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
23
25
  end
24
- return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
26
+ return Aws::Endpoints::Endpoint.new(url: "#{endpoint}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
25
27
  end
26
28
  if Aws::Endpoints::Matchers.set?(region)
27
29
  if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
30
+ if Aws::Endpoints::Matchers.string_equals?(region, "local")
31
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
32
+ raise ArgumentError, "Invalid Configuration: FIPS and local endpoint are not supported"
33
+ end
34
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
35
+ raise ArgumentError, "Invalid Configuration: Dualstack and local endpoint are not supported"
36
+ end
37
+ return Aws::Endpoints::Endpoint.new(url: "http://localhost:8000", headers: {}, properties: {"authSchemes"=>[{"signingRegion"=>"us-east-1", "signingName"=>"dynamodb", "name"=>"sigv4"}]}, metadata: { account_id_endpoint: false })
38
+ end
39
+ if Aws::Endpoints::Matchers.set?(account_id_endpoint_mode) && Aws::Endpoints::Matchers.string_equals?(account_id_endpoint_mode, "required") && Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.set?(account_id))
40
+ raise ArgumentError, "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded."
41
+ end
42
+ if Aws::Endpoints::Matchers.set?(account_id) && Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws") && Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)) && Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)) && Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.valid_host_label?(account_id, false))
43
+ raise ArgumentError, "Credentials-sourced account ID parameter is invalid"
44
+ end
28
45
  if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
29
- if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS")) && Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
30
- return Aws::Endpoints::Endpoint.new(url: "https://dynamodb-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
46
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true) && Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"), true)
47
+ if Aws::Endpoints::Matchers.set?(account_id_endpoint_mode) && Aws::Endpoints::Matchers.string_equals?(account_id_endpoint_mode, "disabled")
48
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
49
+ end
50
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
31
51
  end
32
52
  raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
33
53
  end
34
54
  if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
35
55
  if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
36
56
  if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws-us-gov")
37
- return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.amazonaws.com", headers: {}, properties: {})
57
+ if Aws::Endpoints::Matchers.set?(account_id_endpoint_mode) && Aws::Endpoints::Matchers.string_equals?(account_id_endpoint_mode, "disabled")
58
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
59
+ end
60
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
61
+ end
62
+ if Aws::Endpoints::Matchers.set?(account_id_endpoint_mode) && Aws::Endpoints::Matchers.string_equals?(account_id_endpoint_mode, "disabled")
63
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
38
64
  end
39
- return Aws::Endpoints::Endpoint.new(url: "https://dynamodb-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
65
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
40
66
  end
41
67
  raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
42
68
  end
43
69
  if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
44
- if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
45
- return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
70
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"), true)
71
+ if Aws::Endpoints::Matchers.set?(account_id_endpoint_mode) && Aws::Endpoints::Matchers.string_equals?(account_id_endpoint_mode, "disabled")
72
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
73
+ end
74
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
46
75
  end
47
76
  raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
48
77
  end
49
- if Aws::Endpoints::Matchers.string_equals?(region, "local")
50
- return Aws::Endpoints::Endpoint.new(url: "http://localhost:8000", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingName"=>"dynamodb", "signingRegion"=>"us-east-1"}]})
78
+ if Aws::Endpoints::Matchers.set?(account_id_endpoint_mode) && Aws::Endpoints::Matchers.string_equals?(account_id_endpoint_mode, "disabled")
79
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
80
+ end
81
+ if Aws::Endpoints::Matchers.set?(account_id) && Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws") && Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)) && Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true))
82
+ return Aws::Endpoints::Endpoint.new(url: "https://#{account_id}.ddb.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: true })
51
83
  end
52
- return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
84
+ return Aws::Endpoints::Endpoint.new(url: "https://dynamodb.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {}, metadata: { account_id_endpoint: false })
53
85
  end
54
86
  end
55
87
  raise ArgumentError, "Invalid Configuration: Missing Region"