aws-sdk-iotroborunner 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.
@@ -0,0 +1,108 @@
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::IoTRoboRunner
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::IoTRoboRunner::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::IoTRoboRunner::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::IoTRoboRunner::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_destination
60
+ Aws::IoTRoboRunner::Endpoints::CreateDestination.build(context)
61
+ when :create_site
62
+ Aws::IoTRoboRunner::Endpoints::CreateSite.build(context)
63
+ when :create_worker
64
+ Aws::IoTRoboRunner::Endpoints::CreateWorker.build(context)
65
+ when :create_worker_fleet
66
+ Aws::IoTRoboRunner::Endpoints::CreateWorkerFleet.build(context)
67
+ when :delete_destination
68
+ Aws::IoTRoboRunner::Endpoints::DeleteDestination.build(context)
69
+ when :delete_site
70
+ Aws::IoTRoboRunner::Endpoints::DeleteSite.build(context)
71
+ when :delete_worker
72
+ Aws::IoTRoboRunner::Endpoints::DeleteWorker.build(context)
73
+ when :delete_worker_fleet
74
+ Aws::IoTRoboRunner::Endpoints::DeleteWorkerFleet.build(context)
75
+ when :get_destination
76
+ Aws::IoTRoboRunner::Endpoints::GetDestination.build(context)
77
+ when :get_site
78
+ Aws::IoTRoboRunner::Endpoints::GetSite.build(context)
79
+ when :get_worker
80
+ Aws::IoTRoboRunner::Endpoints::GetWorker.build(context)
81
+ when :get_worker_fleet
82
+ Aws::IoTRoboRunner::Endpoints::GetWorkerFleet.build(context)
83
+ when :list_destinations
84
+ Aws::IoTRoboRunner::Endpoints::ListDestinations.build(context)
85
+ when :list_sites
86
+ Aws::IoTRoboRunner::Endpoints::ListSites.build(context)
87
+ when :list_worker_fleets
88
+ Aws::IoTRoboRunner::Endpoints::ListWorkerFleets.build(context)
89
+ when :list_workers
90
+ Aws::IoTRoboRunner::Endpoints::ListWorkers.build(context)
91
+ when :update_destination
92
+ Aws::IoTRoboRunner::Endpoints::UpdateDestination.build(context)
93
+ when :update_site
94
+ Aws::IoTRoboRunner::Endpoints::UpdateSite.build(context)
95
+ when :update_worker
96
+ Aws::IoTRoboRunner::Endpoints::UpdateWorker.build(context)
97
+ when :update_worker_fleet
98
+ Aws::IoTRoboRunner::Endpoints::UpdateWorkerFleet.build(context)
99
+ end
100
+ end
101
+ end
102
+
103
+ def add_handlers(handlers, _config)
104
+ handlers.add(Handler, step: :build, priority: 75)
105
+ end
106
+ end
107
+ end
108
+ 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::IoTRoboRunner
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