aws-sdk-budgets 1.50.0 → 1.52.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,114 @@
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::Budgets
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::Budgets::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::Budgets::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::Budgets::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_budget
60
+ Aws::Budgets::Endpoints::CreateBudget.build(context)
61
+ when :create_budget_action
62
+ Aws::Budgets::Endpoints::CreateBudgetAction.build(context)
63
+ when :create_notification
64
+ Aws::Budgets::Endpoints::CreateNotification.build(context)
65
+ when :create_subscriber
66
+ Aws::Budgets::Endpoints::CreateSubscriber.build(context)
67
+ when :delete_budget
68
+ Aws::Budgets::Endpoints::DeleteBudget.build(context)
69
+ when :delete_budget_action
70
+ Aws::Budgets::Endpoints::DeleteBudgetAction.build(context)
71
+ when :delete_notification
72
+ Aws::Budgets::Endpoints::DeleteNotification.build(context)
73
+ when :delete_subscriber
74
+ Aws::Budgets::Endpoints::DeleteSubscriber.build(context)
75
+ when :describe_budget
76
+ Aws::Budgets::Endpoints::DescribeBudget.build(context)
77
+ when :describe_budget_action
78
+ Aws::Budgets::Endpoints::DescribeBudgetAction.build(context)
79
+ when :describe_budget_action_histories
80
+ Aws::Budgets::Endpoints::DescribeBudgetActionHistories.build(context)
81
+ when :describe_budget_actions_for_account
82
+ Aws::Budgets::Endpoints::DescribeBudgetActionsForAccount.build(context)
83
+ when :describe_budget_actions_for_budget
84
+ Aws::Budgets::Endpoints::DescribeBudgetActionsForBudget.build(context)
85
+ when :describe_budget_notifications_for_account
86
+ Aws::Budgets::Endpoints::DescribeBudgetNotificationsForAccount.build(context)
87
+ when :describe_budget_performance_history
88
+ Aws::Budgets::Endpoints::DescribeBudgetPerformanceHistory.build(context)
89
+ when :describe_budgets
90
+ Aws::Budgets::Endpoints::DescribeBudgets.build(context)
91
+ when :describe_notifications_for_budget
92
+ Aws::Budgets::Endpoints::DescribeNotificationsForBudget.build(context)
93
+ when :describe_subscribers_for_notification
94
+ Aws::Budgets::Endpoints::DescribeSubscribersForNotification.build(context)
95
+ when :execute_budget_action
96
+ Aws::Budgets::Endpoints::ExecuteBudgetAction.build(context)
97
+ when :update_budget
98
+ Aws::Budgets::Endpoints::UpdateBudget.build(context)
99
+ when :update_budget_action
100
+ Aws::Budgets::Endpoints::UpdateBudgetAction.build(context)
101
+ when :update_notification
102
+ Aws::Budgets::Endpoints::UpdateNotification.build(context)
103
+ when :update_subscriber
104
+ Aws::Budgets::Endpoints::UpdateSubscriber.build(context)
105
+ end
106
+ end
107
+ end
108
+
109
+ def add_handlers(handlers, _config)
110
+ handlers.add(Handler, step: :build, priority: 75)
111
+ end
112
+ end
113
+ end
114
+ end