aws-sdk-qbusiness 1.0.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.
File without changes
@@ -0,0 +1,54 @@
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::QBusiness
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_fips
19
+ # 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.
20
+ #
21
+ # @return [Boolean]
22
+ #
23
+ # @!attribute endpoint
24
+ # Override the endpoint used to send this request
25
+ #
26
+ # @return [String]
27
+ #
28
+ EndpointParameters = Struct.new(
29
+ :region,
30
+ :use_fips,
31
+ :endpoint,
32
+ ) do
33
+ include Aws::Structure
34
+
35
+ # @api private
36
+ class << self
37
+ PARAM_MAP = {
38
+ 'Region' => :region,
39
+ 'UseFIPS' => :use_fips,
40
+ 'Endpoint' => :endpoint,
41
+ }.freeze
42
+ end
43
+
44
+ def initialize(options = {})
45
+ self[:region] = options[:region]
46
+ self[:use_fips] = options[:use_fips]
47
+ self[:use_fips] = false if self[:use_fips].nil?
48
+ if self[:use_fips].nil?
49
+ raise ArgumentError, "Missing required EndpointParameter: :use_fips"
50
+ end
51
+ self[:endpoint] = options[:endpoint]
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,47 @@
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::QBusiness
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ region = parameters.region
14
+ use_fips = parameters.use_fips
15
+ endpoint = parameters.endpoint
16
+ if Aws::Endpoints::Matchers.set?(endpoint)
17
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
18
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
19
+ end
20
+ return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
21
+ end
22
+ if Aws::Endpoints::Matchers.set?(region)
23
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
24
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
25
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
26
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
27
+ return Aws::Endpoints::Endpoint.new(url: "https://qbusiness-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
28
+ end
29
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
30
+ end
31
+ return Aws::Endpoints::Endpoint.new(url: "https://qbusiness.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
32
+ end
33
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
34
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
35
+ return Aws::Endpoints::Endpoint.new(url: "https://qbusiness-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
36
+ end
37
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
38
+ end
39
+ return Aws::Endpoints::Endpoint.new(url: "https://qbusiness.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
40
+ end
41
+ end
42
+ raise ArgumentError, "Invalid Configuration: Missing Region"
43
+ raise ArgumentError, 'No endpoint could be resolved'
44
+
45
+ end
46
+ end
47
+ end