aws-sdk-cloudfront 1.27.1 → 1.75.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'base64'
2
4
  require 'uri'
3
5
  require 'time'
4
- require 'json'
5
6
  require 'openssl'
6
7
 
7
8
  module Aws
@@ -11,7 +12,7 @@ module Aws
11
12
  #
12
13
  # signer = Aws::CloudFront::CookieSigner.new(
13
14
  # key_pair_id: "cf-keypair-id",
14
- # private_key_path: "./cf_private_key.pem"
15
+ # private_key_path: "./unit_test_dummy_key"
15
16
  # )
16
17
  # cookies = signer.signed_cookie(url,
17
18
  # policy: policy.to_json
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # utility classes
2
4
  require 'aws-sdk-cloudfront/signer'
3
5
  require 'aws-sdk-cloudfront/url_signer'
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::CloudFront
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute region
14
+ # The AWS region used to dispatch the request.
15
+ #
16
+ # @return [String]
17
+ #
18
+ # @!attribute use_dual_stack
19
+ # When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
20
+ #
21
+ # @return [Boolean]
22
+ #
23
+ # @!attribute use_fips
24
+ # When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
25
+ #
26
+ # @return [Boolean]
27
+ #
28
+ # @!attribute endpoint
29
+ # Override the endpoint used to send this request
30
+ #
31
+ # @return [String]
32
+ #
33
+ EndpointParameters = Struct.new(
34
+ :region,
35
+ :use_dual_stack,
36
+ :use_fips,
37
+ :endpoint,
38
+ ) do
39
+ include Aws::Structure
40
+
41
+ # @api private
42
+ class << self
43
+ PARAM_MAP = {
44
+ 'Region' => :region,
45
+ 'UseDualStack' => :use_dual_stack,
46
+ 'UseFIPS' => :use_fips,
47
+ 'Endpoint' => :endpoint,
48
+ }.freeze
49
+ end
50
+
51
+ def initialize(options = {})
52
+ self[:region] = options[:region]
53
+ if self[:region].nil?
54
+ raise ArgumentError, "Missing required EndpointParameter: :region"
55
+ end
56
+ self[:use_dual_stack] = options[:use_dual_stack]
57
+ self[:use_dual_stack] = false if self[:use_dual_stack].nil?
58
+ if self[:use_dual_stack].nil?
59
+ raise ArgumentError, "Missing required EndpointParameter: :use_dual_stack"
60
+ end
61
+ self[:use_fips] = options[:use_fips]
62
+ self[:use_fips] = false if self[:use_fips].nil?
63
+ if self[:use_fips].nil?
64
+ raise ArgumentError, "Missing required EndpointParameter: :use_fips"
65
+ end
66
+ self[:endpoint] = options[:endpoint]
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::CloudFront
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ region = parameters.region
14
+ use_dual_stack = parameters.use_dual_stack
15
+ use_fips = parameters.use_fips
16
+ endpoint = parameters.endpoint
17
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
18
+ if Aws::Endpoints::Matchers.set?(endpoint)
19
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
20
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
21
+ end
22
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
23
+ raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
24
+ end
25
+ return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
26
+ end
27
+ if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws")
28
+ 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://cloudfront-fips.#{region}.api.aws", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"us-east-1", "signingName"=>"cloudfront"}]})
31
+ end
32
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
33
+ end
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
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront-fips.#{region}.amazonaws.com", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"us-east-1", "signingName"=>"cloudfront"}]})
37
+ end
38
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
39
+ end
40
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
41
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
42
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.#{region}.api.aws", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"us-east-1", "signingName"=>"cloudfront"}]})
43
+ end
44
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
45
+ end
46
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.amazonaws.com", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"us-east-1", "signingName"=>"cloudfront"}]})
47
+ end
48
+ if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "aws-cn")
49
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
50
+ 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"))
51
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront-fips.#{region}.api.amazonwebservices.com.cn", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"cn-northwest-1", "signingName"=>"cloudfront"}]})
52
+ end
53
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
54
+ end
55
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
56
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"))
57
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront-fips.#{region}.amazonaws.com.cn", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"cn-northwest-1", "signingName"=>"cloudfront"}]})
58
+ end
59
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
60
+ end
61
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
62
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
63
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.#{region}.api.amazonwebservices.com.cn", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"cn-northwest-1", "signingName"=>"cloudfront"}]})
64
+ end
65
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
66
+ end
67
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.cn-northwest-1.amazonaws.com.cn", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"cn-northwest-1", "signingName"=>"cloudfront"}]})
68
+ end
69
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
70
+ 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"))
71
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
72
+ end
73
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
74
+ end
75
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
76
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"))
77
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
78
+ end
79
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
80
+ end
81
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
82
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
83
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
84
+ end
85
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
86
+ end
87
+ if Aws::Endpoints::Matchers.string_equals?(region, "aws-global")
88
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.amazonaws.com", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"us-east-1", "signingName"=>"cloudfront"}]})
89
+ end
90
+ if Aws::Endpoints::Matchers.string_equals?(region, "aws-cn-global")
91
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.cn-northwest-1.amazonaws.com.cn", headers: {}, properties: {"authSchemes"=>[{"name"=>"sigv4", "signingRegion"=>"cn-northwest-1", "signingName"=>"cloudfront"}]})
92
+ end
93
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudfront.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
94
+ end
95
+ raise ArgumentError, 'No endpoint could be resolved'
96
+
97
+ end
98
+ end
99
+ end