aws-sdk-vpclattice 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,232 @@
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::VPCLattice
11
+
12
+ # When VPCLattice returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::VPCLattice::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all VPCLattice errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::VPCLattice::Errors::ServiceError
20
+ # # rescues all VPCLattice API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {AccessDeniedException}
31
+ # * {ConflictException}
32
+ # * {InternalServerException}
33
+ # * {ResourceNotFoundException}
34
+ # * {ServiceQuotaExceededException}
35
+ # * {ThrottlingException}
36
+ # * {ValidationException}
37
+ #
38
+ # Additionally, error classes are dynamically generated for service errors based on the error code
39
+ # if they are not defined above.
40
+ module Errors
41
+
42
+ extend Aws::Errors::DynamicErrors
43
+
44
+ class AccessDeniedException < ServiceError
45
+
46
+ # @param [Seahorse::Client::RequestContext] context
47
+ # @param [String] message
48
+ # @param [Aws::VPCLattice::Types::AccessDeniedException] data
49
+ def initialize(context, message, data = Aws::EmptyStructure.new)
50
+ super(context, message, data)
51
+ end
52
+
53
+ # @return [String]
54
+ def message
55
+ @message || @data[:message]
56
+ end
57
+ end
58
+
59
+ class ConflictException < ServiceError
60
+
61
+ # @param [Seahorse::Client::RequestContext] context
62
+ # @param [String] message
63
+ # @param [Aws::VPCLattice::Types::ConflictException] data
64
+ def initialize(context, message, data = Aws::EmptyStructure.new)
65
+ super(context, message, data)
66
+ end
67
+
68
+ # @return [String]
69
+ def message
70
+ @message || @data[:message]
71
+ end
72
+
73
+ # @return [String]
74
+ def resource_id
75
+ @data[:resource_id]
76
+ end
77
+
78
+ # @return [String]
79
+ def resource_type
80
+ @data[:resource_type]
81
+ end
82
+ end
83
+
84
+ class InternalServerException < ServiceError
85
+
86
+ # @param [Seahorse::Client::RequestContext] context
87
+ # @param [String] message
88
+ # @param [Aws::VPCLattice::Types::InternalServerException] data
89
+ def initialize(context, message, data = Aws::EmptyStructure.new)
90
+ super(context, message, data)
91
+ end
92
+
93
+ # @return [String]
94
+ def message
95
+ @message || @data[:message]
96
+ end
97
+
98
+ # @return [String]
99
+ def retry_after_seconds
100
+ @data[:retry_after_seconds]
101
+ end
102
+
103
+ def retryable?
104
+ true
105
+ end
106
+ end
107
+
108
+ class ResourceNotFoundException < ServiceError
109
+
110
+ # @param [Seahorse::Client::RequestContext] context
111
+ # @param [String] message
112
+ # @param [Aws::VPCLattice::Types::ResourceNotFoundException] data
113
+ def initialize(context, message, data = Aws::EmptyStructure.new)
114
+ super(context, message, data)
115
+ end
116
+
117
+ # @return [String]
118
+ def message
119
+ @message || @data[:message]
120
+ end
121
+
122
+ # @return [String]
123
+ def resource_id
124
+ @data[:resource_id]
125
+ end
126
+
127
+ # @return [String]
128
+ def resource_type
129
+ @data[:resource_type]
130
+ end
131
+ end
132
+
133
+ class ServiceQuotaExceededException < ServiceError
134
+
135
+ # @param [Seahorse::Client::RequestContext] context
136
+ # @param [String] message
137
+ # @param [Aws::VPCLattice::Types::ServiceQuotaExceededException] data
138
+ def initialize(context, message, data = Aws::EmptyStructure.new)
139
+ super(context, message, data)
140
+ end
141
+
142
+ # @return [String]
143
+ def message
144
+ @message || @data[:message]
145
+ end
146
+
147
+ # @return [String]
148
+ def quota_code
149
+ @data[:quota_code]
150
+ end
151
+
152
+ # @return [String]
153
+ def resource_id
154
+ @data[:resource_id]
155
+ end
156
+
157
+ # @return [String]
158
+ def resource_type
159
+ @data[:resource_type]
160
+ end
161
+
162
+ # @return [String]
163
+ def service_code
164
+ @data[:service_code]
165
+ end
166
+ end
167
+
168
+ class ThrottlingException < ServiceError
169
+
170
+ # @param [Seahorse::Client::RequestContext] context
171
+ # @param [String] message
172
+ # @param [Aws::VPCLattice::Types::ThrottlingException] data
173
+ def initialize(context, message, data = Aws::EmptyStructure.new)
174
+ super(context, message, data)
175
+ end
176
+
177
+ # @return [String]
178
+ def message
179
+ @message || @data[:message]
180
+ end
181
+
182
+ # @return [String]
183
+ def quota_code
184
+ @data[:quota_code]
185
+ end
186
+
187
+ # @return [String]
188
+ def retry_after_seconds
189
+ @data[:retry_after_seconds]
190
+ end
191
+
192
+ # @return [String]
193
+ def service_code
194
+ @data[:service_code]
195
+ end
196
+
197
+ def retryable?
198
+ true
199
+ end
200
+
201
+ def throttling?
202
+ true
203
+ end
204
+ end
205
+
206
+ class ValidationException < ServiceError
207
+
208
+ # @param [Seahorse::Client::RequestContext] context
209
+ # @param [String] message
210
+ # @param [Aws::VPCLattice::Types::ValidationException] data
211
+ def initialize(context, message, data = Aws::EmptyStructure.new)
212
+ super(context, message, data)
213
+ end
214
+
215
+ # @return [String]
216
+ def field_list
217
+ @data[:field_list]
218
+ end
219
+
220
+ # @return [String]
221
+ def message
222
+ @message || @data[:message]
223
+ end
224
+
225
+ # @return [String]
226
+ def reason
227
+ @data[:reason]
228
+ end
229
+ end
230
+
231
+ end
232
+ end
@@ -0,0 +1,172 @@
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::VPCLattice
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::VPCLattice::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::VPCLattice::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::VPCLattice::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 :batch_update_rule
60
+ Aws::VPCLattice::Endpoints::BatchUpdateRule.build(context)
61
+ when :create_access_log_subscription
62
+ Aws::VPCLattice::Endpoints::CreateAccessLogSubscription.build(context)
63
+ when :create_listener
64
+ Aws::VPCLattice::Endpoints::CreateListener.build(context)
65
+ when :create_rule
66
+ Aws::VPCLattice::Endpoints::CreateRule.build(context)
67
+ when :create_service
68
+ Aws::VPCLattice::Endpoints::CreateService.build(context)
69
+ when :create_service_network
70
+ Aws::VPCLattice::Endpoints::CreateServiceNetwork.build(context)
71
+ when :create_service_network_service_association
72
+ Aws::VPCLattice::Endpoints::CreateServiceNetworkServiceAssociation.build(context)
73
+ when :create_service_network_vpc_association
74
+ Aws::VPCLattice::Endpoints::CreateServiceNetworkVpcAssociation.build(context)
75
+ when :create_target_group
76
+ Aws::VPCLattice::Endpoints::CreateTargetGroup.build(context)
77
+ when :delete_access_log_subscription
78
+ Aws::VPCLattice::Endpoints::DeleteAccessLogSubscription.build(context)
79
+ when :delete_auth_policy
80
+ Aws::VPCLattice::Endpoints::DeleteAuthPolicy.build(context)
81
+ when :delete_listener
82
+ Aws::VPCLattice::Endpoints::DeleteListener.build(context)
83
+ when :delete_resource_policy
84
+ Aws::VPCLattice::Endpoints::DeleteResourcePolicy.build(context)
85
+ when :delete_rule
86
+ Aws::VPCLattice::Endpoints::DeleteRule.build(context)
87
+ when :delete_service
88
+ Aws::VPCLattice::Endpoints::DeleteService.build(context)
89
+ when :delete_service_network
90
+ Aws::VPCLattice::Endpoints::DeleteServiceNetwork.build(context)
91
+ when :delete_service_network_service_association
92
+ Aws::VPCLattice::Endpoints::DeleteServiceNetworkServiceAssociation.build(context)
93
+ when :delete_service_network_vpc_association
94
+ Aws::VPCLattice::Endpoints::DeleteServiceNetworkVpcAssociation.build(context)
95
+ when :delete_target_group
96
+ Aws::VPCLattice::Endpoints::DeleteTargetGroup.build(context)
97
+ when :deregister_targets
98
+ Aws::VPCLattice::Endpoints::DeregisterTargets.build(context)
99
+ when :get_access_log_subscription
100
+ Aws::VPCLattice::Endpoints::GetAccessLogSubscription.build(context)
101
+ when :get_auth_policy
102
+ Aws::VPCLattice::Endpoints::GetAuthPolicy.build(context)
103
+ when :get_listener
104
+ Aws::VPCLattice::Endpoints::GetListener.build(context)
105
+ when :get_resource_policy
106
+ Aws::VPCLattice::Endpoints::GetResourcePolicy.build(context)
107
+ when :get_rule
108
+ Aws::VPCLattice::Endpoints::GetRule.build(context)
109
+ when :get_service
110
+ Aws::VPCLattice::Endpoints::GetService.build(context)
111
+ when :get_service_network
112
+ Aws::VPCLattice::Endpoints::GetServiceNetwork.build(context)
113
+ when :get_service_network_service_association
114
+ Aws::VPCLattice::Endpoints::GetServiceNetworkServiceAssociation.build(context)
115
+ when :get_service_network_vpc_association
116
+ Aws::VPCLattice::Endpoints::GetServiceNetworkVpcAssociation.build(context)
117
+ when :get_target_group
118
+ Aws::VPCLattice::Endpoints::GetTargetGroup.build(context)
119
+ when :list_access_log_subscriptions
120
+ Aws::VPCLattice::Endpoints::ListAccessLogSubscriptions.build(context)
121
+ when :list_listeners
122
+ Aws::VPCLattice::Endpoints::ListListeners.build(context)
123
+ when :list_rules
124
+ Aws::VPCLattice::Endpoints::ListRules.build(context)
125
+ when :list_service_network_service_associations
126
+ Aws::VPCLattice::Endpoints::ListServiceNetworkServiceAssociations.build(context)
127
+ when :list_service_network_vpc_associations
128
+ Aws::VPCLattice::Endpoints::ListServiceNetworkVpcAssociations.build(context)
129
+ when :list_service_networks
130
+ Aws::VPCLattice::Endpoints::ListServiceNetworks.build(context)
131
+ when :list_services
132
+ Aws::VPCLattice::Endpoints::ListServices.build(context)
133
+ when :list_tags_for_resource
134
+ Aws::VPCLattice::Endpoints::ListTagsForResource.build(context)
135
+ when :list_target_groups
136
+ Aws::VPCLattice::Endpoints::ListTargetGroups.build(context)
137
+ when :list_targets
138
+ Aws::VPCLattice::Endpoints::ListTargets.build(context)
139
+ when :put_auth_policy
140
+ Aws::VPCLattice::Endpoints::PutAuthPolicy.build(context)
141
+ when :put_resource_policy
142
+ Aws::VPCLattice::Endpoints::PutResourcePolicy.build(context)
143
+ when :register_targets
144
+ Aws::VPCLattice::Endpoints::RegisterTargets.build(context)
145
+ when :tag_resource
146
+ Aws::VPCLattice::Endpoints::TagResource.build(context)
147
+ when :untag_resource
148
+ Aws::VPCLattice::Endpoints::UntagResource.build(context)
149
+ when :update_access_log_subscription
150
+ Aws::VPCLattice::Endpoints::UpdateAccessLogSubscription.build(context)
151
+ when :update_listener
152
+ Aws::VPCLattice::Endpoints::UpdateListener.build(context)
153
+ when :update_rule
154
+ Aws::VPCLattice::Endpoints::UpdateRule.build(context)
155
+ when :update_service
156
+ Aws::VPCLattice::Endpoints::UpdateService.build(context)
157
+ when :update_service_network
158
+ Aws::VPCLattice::Endpoints::UpdateServiceNetwork.build(context)
159
+ when :update_service_network_vpc_association
160
+ Aws::VPCLattice::Endpoints::UpdateServiceNetworkVpcAssociation.build(context)
161
+ when :update_target_group
162
+ Aws::VPCLattice::Endpoints::UpdateTargetGroup.build(context)
163
+ end
164
+ end
165
+ end
166
+
167
+ def add_handlers(handlers, _config)
168
+ handlers.add(Handler, step: :build, priority: 75)
169
+ end
170
+ end
171
+ end
172
+ 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::VPCLattice
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