aws-sdk-taxsettings 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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::TaxSettings
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 Aws::Endpoints::Matchers.set?(endpoint)
18
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
19
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
20
+ end
21
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
22
+ raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
25
+ end
26
+ if Aws::Endpoints::Matchers.set?(region)
27
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
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://tax-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
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?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
36
+ return Aws::Endpoints::Endpoint.new(url: "https://tax-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
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://tax.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
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://tax.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
47
+ end
48
+ end
49
+ raise ArgumentError, "Invalid Configuration: Missing Region"
50
+ raise ArgumentError, 'No endpoint could be resolved'
51
+
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,114 @@
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
+
11
+ module Aws::TaxSettings
12
+ # @api private
13
+ module Endpoints
14
+
15
+ class BatchDeleteTaxRegistration
16
+ def self.build(context)
17
+ unless context.config.regional_endpoint
18
+ endpoint = context.config.endpoint.to_s
19
+ end
20
+ Aws::TaxSettings::EndpointParameters.new(
21
+ region: context.config.region,
22
+ use_dual_stack: context.config.use_dualstack_endpoint,
23
+ use_fips: context.config.use_fips_endpoint,
24
+ endpoint: endpoint,
25
+ )
26
+ end
27
+ end
28
+
29
+ class BatchPutTaxRegistration
30
+ def self.build(context)
31
+ unless context.config.regional_endpoint
32
+ endpoint = context.config.endpoint.to_s
33
+ end
34
+ Aws::TaxSettings::EndpointParameters.new(
35
+ region: context.config.region,
36
+ use_dual_stack: context.config.use_dualstack_endpoint,
37
+ use_fips: context.config.use_fips_endpoint,
38
+ endpoint: endpoint,
39
+ )
40
+ end
41
+ end
42
+
43
+ class DeleteTaxRegistration
44
+ def self.build(context)
45
+ unless context.config.regional_endpoint
46
+ endpoint = context.config.endpoint.to_s
47
+ end
48
+ Aws::TaxSettings::EndpointParameters.new(
49
+ region: context.config.region,
50
+ use_dual_stack: context.config.use_dualstack_endpoint,
51
+ use_fips: context.config.use_fips_endpoint,
52
+ endpoint: endpoint,
53
+ )
54
+ end
55
+ end
56
+
57
+ class GetTaxRegistration
58
+ def self.build(context)
59
+ unless context.config.regional_endpoint
60
+ endpoint = context.config.endpoint.to_s
61
+ end
62
+ Aws::TaxSettings::EndpointParameters.new(
63
+ region: context.config.region,
64
+ use_dual_stack: context.config.use_dualstack_endpoint,
65
+ use_fips: context.config.use_fips_endpoint,
66
+ endpoint: endpoint,
67
+ )
68
+ end
69
+ end
70
+
71
+ class GetTaxRegistrationDocument
72
+ def self.build(context)
73
+ unless context.config.regional_endpoint
74
+ endpoint = context.config.endpoint.to_s
75
+ end
76
+ Aws::TaxSettings::EndpointParameters.new(
77
+ region: context.config.region,
78
+ use_dual_stack: context.config.use_dualstack_endpoint,
79
+ use_fips: context.config.use_fips_endpoint,
80
+ endpoint: endpoint,
81
+ )
82
+ end
83
+ end
84
+
85
+ class ListTaxRegistrations
86
+ def self.build(context)
87
+ unless context.config.regional_endpoint
88
+ endpoint = context.config.endpoint.to_s
89
+ end
90
+ Aws::TaxSettings::EndpointParameters.new(
91
+ region: context.config.region,
92
+ use_dual_stack: context.config.use_dualstack_endpoint,
93
+ use_fips: context.config.use_fips_endpoint,
94
+ endpoint: endpoint,
95
+ )
96
+ end
97
+ end
98
+
99
+ class PutTaxRegistration
100
+ def self.build(context)
101
+ unless context.config.regional_endpoint
102
+ endpoint = context.config.endpoint.to_s
103
+ end
104
+ Aws::TaxSettings::EndpointParameters.new(
105
+ region: context.config.region,
106
+ use_dual_stack: context.config.use_dualstack_endpoint,
107
+ use_fips: context.config.use_fips_endpoint,
108
+ endpoint: endpoint,
109
+ )
110
+ end
111
+ end
112
+
113
+ end
114
+ end
@@ -0,0 +1,127 @@
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::TaxSettings
11
+
12
+ # When TaxSettings returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::TaxSettings::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all TaxSettings errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::TaxSettings::Errors::ServiceError
20
+ # # rescues all TaxSettings API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {ConflictException}
31
+ # * {InternalServerException}
32
+ # * {ResourceNotFoundException}
33
+ # * {ValidationException}
34
+ #
35
+ # Additionally, error classes are dynamically generated for service errors based on the error code
36
+ # if they are not defined above.
37
+ module Errors
38
+
39
+ extend Aws::Errors::DynamicErrors
40
+
41
+ class ConflictException < ServiceError
42
+
43
+ # @param [Seahorse::Client::RequestContext] context
44
+ # @param [String] message
45
+ # @param [Aws::TaxSettings::Types::ConflictException] data
46
+ def initialize(context, message, data = Aws::EmptyStructure.new)
47
+ super(context, message, data)
48
+ end
49
+
50
+ # @return [String]
51
+ def error_code
52
+ @data[:error_code]
53
+ end
54
+
55
+ # @return [String]
56
+ def message
57
+ @message || @data[:message]
58
+ end
59
+ end
60
+
61
+ class InternalServerException < ServiceError
62
+
63
+ # @param [Seahorse::Client::RequestContext] context
64
+ # @param [String] message
65
+ # @param [Aws::TaxSettings::Types::InternalServerException] data
66
+ def initialize(context, message, data = Aws::EmptyStructure.new)
67
+ super(context, message, data)
68
+ end
69
+
70
+ # @return [String]
71
+ def error_code
72
+ @data[:error_code]
73
+ end
74
+
75
+ # @return [String]
76
+ def message
77
+ @message || @data[:message]
78
+ end
79
+ end
80
+
81
+ class ResourceNotFoundException < ServiceError
82
+
83
+ # @param [Seahorse::Client::RequestContext] context
84
+ # @param [String] message
85
+ # @param [Aws::TaxSettings::Types::ResourceNotFoundException] data
86
+ def initialize(context, message, data = Aws::EmptyStructure.new)
87
+ super(context, message, data)
88
+ end
89
+
90
+ # @return [String]
91
+ def error_code
92
+ @data[:error_code]
93
+ end
94
+
95
+ # @return [String]
96
+ def message
97
+ @message || @data[:message]
98
+ end
99
+ end
100
+
101
+ class ValidationException < ServiceError
102
+
103
+ # @param [Seahorse::Client::RequestContext] context
104
+ # @param [String] message
105
+ # @param [Aws::TaxSettings::Types::ValidationException] data
106
+ def initialize(context, message, data = Aws::EmptyStructure.new)
107
+ super(context, message, data)
108
+ end
109
+
110
+ # @return [String]
111
+ def error_code
112
+ @data[:error_code]
113
+ end
114
+
115
+ # @return [String]
116
+ def field_list
117
+ @data[:field_list]
118
+ end
119
+
120
+ # @return [String]
121
+ def message
122
+ @message || @data[:message]
123
+ end
124
+ end
125
+
126
+ end
127
+ end
@@ -0,0 +1,84 @@
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
+
11
+ module Aws::TaxSettings
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::TaxSettings::EndpointProvider',
17
+ rbs_type: 'untyped',
18
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
19
+ 'object that responds to `#resolve_endpoint(parameters)` '\
20
+ 'where `parameters` is a Struct similar to '\
21
+ '`Aws::TaxSettings::EndpointParameters`'
22
+ ) do |cfg|
23
+ Aws::TaxSettings::EndpointProvider.new
24
+ end
25
+
26
+ # @api private
27
+ class Handler < Seahorse::Client::Handler
28
+ def call(context)
29
+ unless context[:discovered_endpoint]
30
+ params = parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
38
+ end
39
+
40
+ context[:auth_scheme] =
41
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
+
43
+ @handler.call(context)
44
+ end
45
+
46
+ private
47
+
48
+ def apply_endpoint_headers(context, headers)
49
+ headers.each do |key, values|
50
+ value = values
51
+ .compact
52
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
53
+ .join(',')
54
+
55
+ context.http_request.headers[key] = value
56
+ end
57
+ end
58
+
59
+ def parameters_for_operation(context)
60
+ case context.operation_name
61
+ when :batch_delete_tax_registration
62
+ Aws::TaxSettings::Endpoints::BatchDeleteTaxRegistration.build(context)
63
+ when :batch_put_tax_registration
64
+ Aws::TaxSettings::Endpoints::BatchPutTaxRegistration.build(context)
65
+ when :delete_tax_registration
66
+ Aws::TaxSettings::Endpoints::DeleteTaxRegistration.build(context)
67
+ when :get_tax_registration
68
+ Aws::TaxSettings::Endpoints::GetTaxRegistration.build(context)
69
+ when :get_tax_registration_document
70
+ Aws::TaxSettings::Endpoints::GetTaxRegistrationDocument.build(context)
71
+ when :list_tax_registrations
72
+ Aws::TaxSettings::Endpoints::ListTaxRegistrations.build(context)
73
+ when :put_tax_registration
74
+ Aws::TaxSettings::Endpoints::PutTaxRegistration.build(context)
75
+ end
76
+ end
77
+ end
78
+
79
+ def add_handlers(handlers, _config)
80
+ handlers.add(Handler, step: :build, priority: 75)
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,26 @@
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::TaxSettings
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end