aws-sdk-verifiedpermissions 1.0.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,116 @@
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::VerifiedPermissions
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::VerifiedPermissions::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::VerifiedPermissions::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::VerifiedPermissions::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_identity_source
60
+ Aws::VerifiedPermissions::Endpoints::CreateIdentitySource.build(context)
61
+ when :create_policy
62
+ Aws::VerifiedPermissions::Endpoints::CreatePolicy.build(context)
63
+ when :create_policy_store
64
+ Aws::VerifiedPermissions::Endpoints::CreatePolicyStore.build(context)
65
+ when :create_policy_template
66
+ Aws::VerifiedPermissions::Endpoints::CreatePolicyTemplate.build(context)
67
+ when :delete_identity_source
68
+ Aws::VerifiedPermissions::Endpoints::DeleteIdentitySource.build(context)
69
+ when :delete_policy
70
+ Aws::VerifiedPermissions::Endpoints::DeletePolicy.build(context)
71
+ when :delete_policy_store
72
+ Aws::VerifiedPermissions::Endpoints::DeletePolicyStore.build(context)
73
+ when :delete_policy_template
74
+ Aws::VerifiedPermissions::Endpoints::DeletePolicyTemplate.build(context)
75
+ when :get_identity_source
76
+ Aws::VerifiedPermissions::Endpoints::GetIdentitySource.build(context)
77
+ when :get_policy
78
+ Aws::VerifiedPermissions::Endpoints::GetPolicy.build(context)
79
+ when :get_policy_store
80
+ Aws::VerifiedPermissions::Endpoints::GetPolicyStore.build(context)
81
+ when :get_policy_template
82
+ Aws::VerifiedPermissions::Endpoints::GetPolicyTemplate.build(context)
83
+ when :get_schema
84
+ Aws::VerifiedPermissions::Endpoints::GetSchema.build(context)
85
+ when :is_authorized
86
+ Aws::VerifiedPermissions::Endpoints::IsAuthorized.build(context)
87
+ when :is_authorized_with_token
88
+ Aws::VerifiedPermissions::Endpoints::IsAuthorizedWithToken.build(context)
89
+ when :list_identity_sources
90
+ Aws::VerifiedPermissions::Endpoints::ListIdentitySources.build(context)
91
+ when :list_policies
92
+ Aws::VerifiedPermissions::Endpoints::ListPolicies.build(context)
93
+ when :list_policy_stores
94
+ Aws::VerifiedPermissions::Endpoints::ListPolicyStores.build(context)
95
+ when :list_policy_templates
96
+ Aws::VerifiedPermissions::Endpoints::ListPolicyTemplates.build(context)
97
+ when :put_schema
98
+ Aws::VerifiedPermissions::Endpoints::PutSchema.build(context)
99
+ when :update_identity_source
100
+ Aws::VerifiedPermissions::Endpoints::UpdateIdentitySource.build(context)
101
+ when :update_policy
102
+ Aws::VerifiedPermissions::Endpoints::UpdatePolicy.build(context)
103
+ when :update_policy_store
104
+ Aws::VerifiedPermissions::Endpoints::UpdatePolicyStore.build(context)
105
+ when :update_policy_template
106
+ Aws::VerifiedPermissions::Endpoints::UpdatePolicyTemplate.build(context)
107
+ end
108
+ end
109
+ end
110
+
111
+ def add_handlers(handlers, _config)
112
+ handlers.add(Handler, step: :build, priority: 75)
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,26 @@
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
+ module Aws::VerifiedPermissions
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end