aws-sdk-b2bi 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,122 @@
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::B2bi
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::B2bi::EndpointProvider',
17
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
+ 'object that responds to `#resolve_endpoint(parameters)` '\
19
+ 'where `parameters` is a Struct similar to '\
20
+ '`Aws::B2bi::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::B2bi::EndpointProvider.new
23
+ end
24
+
25
+ # @api private
26
+ class Handler < Seahorse::Client::Handler
27
+ def call(context)
28
+ # If endpoint was discovered, do not resolve or apply the endpoint.
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
+ end
36
+
37
+ context[:endpoint_params] = params
38
+ context[:auth_scheme] =
39
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
+
41
+ @handler.call(context)
42
+ end
43
+
44
+ private
45
+
46
+ def apply_endpoint_headers(context, headers)
47
+ headers.each do |key, values|
48
+ value = values
49
+ .compact
50
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
51
+ .join(',')
52
+
53
+ context.http_request.headers[key] = value
54
+ end
55
+ end
56
+
57
+ def parameters_for_operation(context)
58
+ case context.operation_name
59
+ when :create_capability
60
+ Aws::B2bi::Endpoints::CreateCapability.build(context)
61
+ when :create_partnership
62
+ Aws::B2bi::Endpoints::CreatePartnership.build(context)
63
+ when :create_profile
64
+ Aws::B2bi::Endpoints::CreateProfile.build(context)
65
+ when :create_transformer
66
+ Aws::B2bi::Endpoints::CreateTransformer.build(context)
67
+ when :delete_capability
68
+ Aws::B2bi::Endpoints::DeleteCapability.build(context)
69
+ when :delete_partnership
70
+ Aws::B2bi::Endpoints::DeletePartnership.build(context)
71
+ when :delete_profile
72
+ Aws::B2bi::Endpoints::DeleteProfile.build(context)
73
+ when :delete_transformer
74
+ Aws::B2bi::Endpoints::DeleteTransformer.build(context)
75
+ when :get_capability
76
+ Aws::B2bi::Endpoints::GetCapability.build(context)
77
+ when :get_partnership
78
+ Aws::B2bi::Endpoints::GetPartnership.build(context)
79
+ when :get_profile
80
+ Aws::B2bi::Endpoints::GetProfile.build(context)
81
+ when :get_transformer
82
+ Aws::B2bi::Endpoints::GetTransformer.build(context)
83
+ when :get_transformer_job
84
+ Aws::B2bi::Endpoints::GetTransformerJob.build(context)
85
+ when :list_capabilities
86
+ Aws::B2bi::Endpoints::ListCapabilities.build(context)
87
+ when :list_partnerships
88
+ Aws::B2bi::Endpoints::ListPartnerships.build(context)
89
+ when :list_profiles
90
+ Aws::B2bi::Endpoints::ListProfiles.build(context)
91
+ when :list_tags_for_resource
92
+ Aws::B2bi::Endpoints::ListTagsForResource.build(context)
93
+ when :list_transformers
94
+ Aws::B2bi::Endpoints::ListTransformers.build(context)
95
+ when :start_transformer_job
96
+ Aws::B2bi::Endpoints::StartTransformerJob.build(context)
97
+ when :tag_resource
98
+ Aws::B2bi::Endpoints::TagResource.build(context)
99
+ when :test_mapping
100
+ Aws::B2bi::Endpoints::TestMapping.build(context)
101
+ when :test_parsing
102
+ Aws::B2bi::Endpoints::TestParsing.build(context)
103
+ when :untag_resource
104
+ Aws::B2bi::Endpoints::UntagResource.build(context)
105
+ when :update_capability
106
+ Aws::B2bi::Endpoints::UpdateCapability.build(context)
107
+ when :update_partnership
108
+ Aws::B2bi::Endpoints::UpdatePartnership.build(context)
109
+ when :update_profile
110
+ Aws::B2bi::Endpoints::UpdateProfile.build(context)
111
+ when :update_transformer
112
+ Aws::B2bi::Endpoints::UpdateTransformer.build(context)
113
+ end
114
+ end
115
+ end
116
+
117
+ def add_handlers(handlers, _config)
118
+ handlers.add(Handler, step: :build, priority: 75)
119
+ end
120
+ end
121
+ end
122
+ 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::B2bi
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