aws-sdk-inspector2 1.6.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,132 @@
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::Inspector2
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::Inspector2::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::Inspector2::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::Inspector2::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 :associate_member
60
+ Aws::Inspector2::Endpoints::AssociateMember.build(context)
61
+ when :batch_get_account_status
62
+ Aws::Inspector2::Endpoints::BatchGetAccountStatus.build(context)
63
+ when :batch_get_free_trial_info
64
+ Aws::Inspector2::Endpoints::BatchGetFreeTrialInfo.build(context)
65
+ when :cancel_findings_report
66
+ Aws::Inspector2::Endpoints::CancelFindingsReport.build(context)
67
+ when :create_filter
68
+ Aws::Inspector2::Endpoints::CreateFilter.build(context)
69
+ when :create_findings_report
70
+ Aws::Inspector2::Endpoints::CreateFindingsReport.build(context)
71
+ when :delete_filter
72
+ Aws::Inspector2::Endpoints::DeleteFilter.build(context)
73
+ when :describe_organization_configuration
74
+ Aws::Inspector2::Endpoints::DescribeOrganizationConfiguration.build(context)
75
+ when :disable
76
+ Aws::Inspector2::Endpoints::Disable.build(context)
77
+ when :disable_delegated_admin_account
78
+ Aws::Inspector2::Endpoints::DisableDelegatedAdminAccount.build(context)
79
+ when :disassociate_member
80
+ Aws::Inspector2::Endpoints::DisassociateMember.build(context)
81
+ when :enable
82
+ Aws::Inspector2::Endpoints::Enable.build(context)
83
+ when :enable_delegated_admin_account
84
+ Aws::Inspector2::Endpoints::EnableDelegatedAdminAccount.build(context)
85
+ when :get_configuration
86
+ Aws::Inspector2::Endpoints::GetConfiguration.build(context)
87
+ when :get_delegated_admin_account
88
+ Aws::Inspector2::Endpoints::GetDelegatedAdminAccount.build(context)
89
+ when :get_findings_report_status
90
+ Aws::Inspector2::Endpoints::GetFindingsReportStatus.build(context)
91
+ when :get_member
92
+ Aws::Inspector2::Endpoints::GetMember.build(context)
93
+ when :list_account_permissions
94
+ Aws::Inspector2::Endpoints::ListAccountPermissions.build(context)
95
+ when :list_coverage
96
+ Aws::Inspector2::Endpoints::ListCoverage.build(context)
97
+ when :list_coverage_statistics
98
+ Aws::Inspector2::Endpoints::ListCoverageStatistics.build(context)
99
+ when :list_delegated_admin_accounts
100
+ Aws::Inspector2::Endpoints::ListDelegatedAdminAccounts.build(context)
101
+ when :list_filters
102
+ Aws::Inspector2::Endpoints::ListFilters.build(context)
103
+ when :list_finding_aggregations
104
+ Aws::Inspector2::Endpoints::ListFindingAggregations.build(context)
105
+ when :list_findings
106
+ Aws::Inspector2::Endpoints::ListFindings.build(context)
107
+ when :list_members
108
+ Aws::Inspector2::Endpoints::ListMembers.build(context)
109
+ when :list_tags_for_resource
110
+ Aws::Inspector2::Endpoints::ListTagsForResource.build(context)
111
+ when :list_usage_totals
112
+ Aws::Inspector2::Endpoints::ListUsageTotals.build(context)
113
+ when :tag_resource
114
+ Aws::Inspector2::Endpoints::TagResource.build(context)
115
+ when :untag_resource
116
+ Aws::Inspector2::Endpoints::UntagResource.build(context)
117
+ when :update_configuration
118
+ Aws::Inspector2::Endpoints::UpdateConfiguration.build(context)
119
+ when :update_filter
120
+ Aws::Inspector2::Endpoints::UpdateFilter.build(context)
121
+ when :update_organization_configuration
122
+ Aws::Inspector2::Endpoints::UpdateOrganizationConfiguration.build(context)
123
+ end
124
+ end
125
+ end
126
+
127
+ def add_handlers(handlers, _config)
128
+ handlers.add(Handler, step: :build, priority: 75)
129
+ end
130
+ end
131
+ end
132
+ end