aws-sdk-billingconductor 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,130 @@
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::BillingConductor
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::BillingConductor::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::BillingConductor::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::BillingConductor::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_accounts
60
+ Aws::BillingConductor::Endpoints::AssociateAccounts.build(context)
61
+ when :associate_pricing_rules
62
+ Aws::BillingConductor::Endpoints::AssociatePricingRules.build(context)
63
+ when :batch_associate_resources_to_custom_line_item
64
+ Aws::BillingConductor::Endpoints::BatchAssociateResourcesToCustomLineItem.build(context)
65
+ when :batch_disassociate_resources_from_custom_line_item
66
+ Aws::BillingConductor::Endpoints::BatchDisassociateResourcesFromCustomLineItem.build(context)
67
+ when :create_billing_group
68
+ Aws::BillingConductor::Endpoints::CreateBillingGroup.build(context)
69
+ when :create_custom_line_item
70
+ Aws::BillingConductor::Endpoints::CreateCustomLineItem.build(context)
71
+ when :create_pricing_plan
72
+ Aws::BillingConductor::Endpoints::CreatePricingPlan.build(context)
73
+ when :create_pricing_rule
74
+ Aws::BillingConductor::Endpoints::CreatePricingRule.build(context)
75
+ when :delete_billing_group
76
+ Aws::BillingConductor::Endpoints::DeleteBillingGroup.build(context)
77
+ when :delete_custom_line_item
78
+ Aws::BillingConductor::Endpoints::DeleteCustomLineItem.build(context)
79
+ when :delete_pricing_plan
80
+ Aws::BillingConductor::Endpoints::DeletePricingPlan.build(context)
81
+ when :delete_pricing_rule
82
+ Aws::BillingConductor::Endpoints::DeletePricingRule.build(context)
83
+ when :disassociate_accounts
84
+ Aws::BillingConductor::Endpoints::DisassociateAccounts.build(context)
85
+ when :disassociate_pricing_rules
86
+ Aws::BillingConductor::Endpoints::DisassociatePricingRules.build(context)
87
+ when :list_account_associations
88
+ Aws::BillingConductor::Endpoints::ListAccountAssociations.build(context)
89
+ when :list_billing_group_cost_reports
90
+ Aws::BillingConductor::Endpoints::ListBillingGroupCostReports.build(context)
91
+ when :list_billing_groups
92
+ Aws::BillingConductor::Endpoints::ListBillingGroups.build(context)
93
+ when :list_custom_line_item_versions
94
+ Aws::BillingConductor::Endpoints::ListCustomLineItemVersions.build(context)
95
+ when :list_custom_line_items
96
+ Aws::BillingConductor::Endpoints::ListCustomLineItems.build(context)
97
+ when :list_pricing_plans
98
+ Aws::BillingConductor::Endpoints::ListPricingPlans.build(context)
99
+ when :list_pricing_plans_associated_with_pricing_rule
100
+ Aws::BillingConductor::Endpoints::ListPricingPlansAssociatedWithPricingRule.build(context)
101
+ when :list_pricing_rules
102
+ Aws::BillingConductor::Endpoints::ListPricingRules.build(context)
103
+ when :list_pricing_rules_associated_to_pricing_plan
104
+ Aws::BillingConductor::Endpoints::ListPricingRulesAssociatedToPricingPlan.build(context)
105
+ when :list_resources_associated_to_custom_line_item
106
+ Aws::BillingConductor::Endpoints::ListResourcesAssociatedToCustomLineItem.build(context)
107
+ when :list_tags_for_resource
108
+ Aws::BillingConductor::Endpoints::ListTagsForResource.build(context)
109
+ when :tag_resource
110
+ Aws::BillingConductor::Endpoints::TagResource.build(context)
111
+ when :untag_resource
112
+ Aws::BillingConductor::Endpoints::UntagResource.build(context)
113
+ when :update_billing_group
114
+ Aws::BillingConductor::Endpoints::UpdateBillingGroup.build(context)
115
+ when :update_custom_line_item
116
+ Aws::BillingConductor::Endpoints::UpdateCustomLineItem.build(context)
117
+ when :update_pricing_plan
118
+ Aws::BillingConductor::Endpoints::UpdatePricingPlan.build(context)
119
+ when :update_pricing_rule
120
+ Aws::BillingConductor::Endpoints::UpdatePricingRule.build(context)
121
+ end
122
+ end
123
+ end
124
+
125
+ def add_handlers(handlers, _config)
126
+ handlers.add(Handler, step: :build, priority: 75)
127
+ end
128
+ end
129
+ end
130
+ end