aws-sdk-ssmcontacts 1.14.0 → 1.16.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::SSMContacts
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::SSMContacts::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::SSMContacts::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::SSMContacts::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 :accept_page
60
+ Aws::SSMContacts::Endpoints::AcceptPage.build(context)
61
+ when :activate_contact_channel
62
+ Aws::SSMContacts::Endpoints::ActivateContactChannel.build(context)
63
+ when :create_contact
64
+ Aws::SSMContacts::Endpoints::CreateContact.build(context)
65
+ when :create_contact_channel
66
+ Aws::SSMContacts::Endpoints::CreateContactChannel.build(context)
67
+ when :deactivate_contact_channel
68
+ Aws::SSMContacts::Endpoints::DeactivateContactChannel.build(context)
69
+ when :delete_contact
70
+ Aws::SSMContacts::Endpoints::DeleteContact.build(context)
71
+ when :delete_contact_channel
72
+ Aws::SSMContacts::Endpoints::DeleteContactChannel.build(context)
73
+ when :describe_engagement
74
+ Aws::SSMContacts::Endpoints::DescribeEngagement.build(context)
75
+ when :describe_page
76
+ Aws::SSMContacts::Endpoints::DescribePage.build(context)
77
+ when :get_contact
78
+ Aws::SSMContacts::Endpoints::GetContact.build(context)
79
+ when :get_contact_channel
80
+ Aws::SSMContacts::Endpoints::GetContactChannel.build(context)
81
+ when :get_contact_policy
82
+ Aws::SSMContacts::Endpoints::GetContactPolicy.build(context)
83
+ when :list_contact_channels
84
+ Aws::SSMContacts::Endpoints::ListContactChannels.build(context)
85
+ when :list_contacts
86
+ Aws::SSMContacts::Endpoints::ListContacts.build(context)
87
+ when :list_engagements
88
+ Aws::SSMContacts::Endpoints::ListEngagements.build(context)
89
+ when :list_page_receipts
90
+ Aws::SSMContacts::Endpoints::ListPageReceipts.build(context)
91
+ when :list_pages_by_contact
92
+ Aws::SSMContacts::Endpoints::ListPagesByContact.build(context)
93
+ when :list_pages_by_engagement
94
+ Aws::SSMContacts::Endpoints::ListPagesByEngagement.build(context)
95
+ when :list_tags_for_resource
96
+ Aws::SSMContacts::Endpoints::ListTagsForResource.build(context)
97
+ when :put_contact_policy
98
+ Aws::SSMContacts::Endpoints::PutContactPolicy.build(context)
99
+ when :send_activation_code
100
+ Aws::SSMContacts::Endpoints::SendActivationCode.build(context)
101
+ when :start_engagement
102
+ Aws::SSMContacts::Endpoints::StartEngagement.build(context)
103
+ when :stop_engagement
104
+ Aws::SSMContacts::Endpoints::StopEngagement.build(context)
105
+ when :tag_resource
106
+ Aws::SSMContacts::Endpoints::TagResource.build(context)
107
+ when :untag_resource
108
+ Aws::SSMContacts::Endpoints::UntagResource.build(context)
109
+ when :update_contact
110
+ Aws::SSMContacts::Endpoints::UpdateContact.build(context)
111
+ when :update_contact_channel
112
+ Aws::SSMContacts::Endpoints::UpdateContactChannel.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