aws-sdk-servicediscovery 1.47.0 → 1.49.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,120 @@
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::ServiceDiscovery
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::ServiceDiscovery::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::ServiceDiscovery::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::ServiceDiscovery::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_http_namespace
60
+ Aws::ServiceDiscovery::Endpoints::CreateHttpNamespace.build(context)
61
+ when :create_private_dns_namespace
62
+ Aws::ServiceDiscovery::Endpoints::CreatePrivateDnsNamespace.build(context)
63
+ when :create_public_dns_namespace
64
+ Aws::ServiceDiscovery::Endpoints::CreatePublicDnsNamespace.build(context)
65
+ when :create_service
66
+ Aws::ServiceDiscovery::Endpoints::CreateService.build(context)
67
+ when :delete_namespace
68
+ Aws::ServiceDiscovery::Endpoints::DeleteNamespace.build(context)
69
+ when :delete_service
70
+ Aws::ServiceDiscovery::Endpoints::DeleteService.build(context)
71
+ when :deregister_instance
72
+ Aws::ServiceDiscovery::Endpoints::DeregisterInstance.build(context)
73
+ when :discover_instances
74
+ Aws::ServiceDiscovery::Endpoints::DiscoverInstances.build(context)
75
+ when :get_instance
76
+ Aws::ServiceDiscovery::Endpoints::GetInstance.build(context)
77
+ when :get_instances_health_status
78
+ Aws::ServiceDiscovery::Endpoints::GetInstancesHealthStatus.build(context)
79
+ when :get_namespace
80
+ Aws::ServiceDiscovery::Endpoints::GetNamespace.build(context)
81
+ when :get_operation
82
+ Aws::ServiceDiscovery::Endpoints::GetOperation.build(context)
83
+ when :get_service
84
+ Aws::ServiceDiscovery::Endpoints::GetService.build(context)
85
+ when :list_instances
86
+ Aws::ServiceDiscovery::Endpoints::ListInstances.build(context)
87
+ when :list_namespaces
88
+ Aws::ServiceDiscovery::Endpoints::ListNamespaces.build(context)
89
+ when :list_operations
90
+ Aws::ServiceDiscovery::Endpoints::ListOperations.build(context)
91
+ when :list_services
92
+ Aws::ServiceDiscovery::Endpoints::ListServices.build(context)
93
+ when :list_tags_for_resource
94
+ Aws::ServiceDiscovery::Endpoints::ListTagsForResource.build(context)
95
+ when :register_instance
96
+ Aws::ServiceDiscovery::Endpoints::RegisterInstance.build(context)
97
+ when :tag_resource
98
+ Aws::ServiceDiscovery::Endpoints::TagResource.build(context)
99
+ when :untag_resource
100
+ Aws::ServiceDiscovery::Endpoints::UntagResource.build(context)
101
+ when :update_http_namespace
102
+ Aws::ServiceDiscovery::Endpoints::UpdateHttpNamespace.build(context)
103
+ when :update_instance_custom_health_status
104
+ Aws::ServiceDiscovery::Endpoints::UpdateInstanceCustomHealthStatus.build(context)
105
+ when :update_private_dns_namespace
106
+ Aws::ServiceDiscovery::Endpoints::UpdatePrivateDnsNamespace.build(context)
107
+ when :update_public_dns_namespace
108
+ Aws::ServiceDiscovery::Endpoints::UpdatePublicDnsNamespace.build(context)
109
+ when :update_service
110
+ Aws::ServiceDiscovery::Endpoints::UpdateService.build(context)
111
+ end
112
+ end
113
+ end
114
+
115
+ def add_handlers(handlers, _config)
116
+ handlers.add(Handler, step: :build, priority: 75)
117
+ end
118
+ end
119
+ end
120
+ end