google-cloud-apigee_connect-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/apigee_connect/v1"
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/apigee_connect/v1/connection_service"
20
+ require "google/cloud/apigee_connect/v1/tether"
21
+ require "google/cloud/apigee_connect/v1/version"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ApigeeConnect
26
+ ##
27
+ # To load this package, including all its services, and instantiate a client:
28
+ #
29
+ # require "google/cloud/apigee_connect/v1"
30
+ # client = ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client.new
31
+ #
32
+ module V1
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
39
+ require "google/cloud/apigee_connect/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/apigee_connect/v1/version"
24
+
25
+ require "google/cloud/apigee_connect/v1/connection_service/credentials"
26
+ require "google/cloud/apigee_connect/v1/connection_service/paths"
27
+ require "google/cloud/apigee_connect/v1/connection_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module ApigeeConnect
32
+ module V1
33
+ ##
34
+ # Service Interface for the Apigee Connect connection management APIs.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/apigee_connect/v1/connection_service"
39
+ # client = ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client.new
40
+ #
41
+ module ConnectionService
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "connection_service", "helpers.rb"
49
+ require "google/cloud/apigee_connect/v1/connection_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,396 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/apigeeconnect/v1/connection_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module ApigeeConnect
25
+ module V1
26
+ module ConnectionService
27
+ ##
28
+ # Client for the ConnectionService service.
29
+ #
30
+ # Service Interface for the Apigee Connect connection management APIs.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :connection_service_stub
37
+
38
+ ##
39
+ # Configure the ConnectionService Client class.
40
+ #
41
+ # See {::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all ConnectionService clients:
47
+ #
48
+ # ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "ApigeeConnect", "V1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.list_connections.timeout = 60.0
69
+ default_config.rpcs.list_connections.retry_policy = {
70
+ initial_delay: 1.0,
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [14, 2]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the ConnectionService Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new ConnectionService client object.
104
+ #
105
+ # ## Examples
106
+ #
107
+ # To create a new ConnectionService client with the default
108
+ # configuration:
109
+ #
110
+ # client = ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client.new
111
+ #
112
+ # To create a new ConnectionService client with a custom
113
+ # configuration:
114
+ #
115
+ # client = ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the ConnectionService client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ def initialize
123
+ # These require statements are intentionally placed here to initialize
124
+ # the gRPC module only when it's required.
125
+ # See https://github.com/googleapis/toolkit/issues/446
126
+ require "gapic/grpc"
127
+ require "google/cloud/apigeeconnect/v1/connection_services_pb"
128
+
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
140
+ @config.endpoint == Client.configure.endpoint &&
141
+ !@config.endpoint.split(".").first.include?("-")
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @connection_service_stub = ::Gapic::ServiceStub.new(
151
+ ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Stub,
152
+ credentials: credentials,
153
+ endpoint: @config.endpoint,
154
+ channel_args: @config.channel_args,
155
+ interceptors: @config.interceptors
156
+ )
157
+ end
158
+
159
+ # Service calls
160
+
161
+ ##
162
+ # Lists connections that are currently active for the given Apigee Connect
163
+ # endpoint.
164
+ #
165
+ # @overload list_connections(request, options = nil)
166
+ # Pass arguments to `list_connections` via a request object, either of type
167
+ # {::Google::Cloud::ApigeeConnect::V1::ListConnectionsRequest} or an equivalent Hash.
168
+ #
169
+ # @param request [::Google::Cloud::ApigeeConnect::V1::ListConnectionsRequest, ::Hash]
170
+ # A request object representing the call parameters. Required. To specify no
171
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
172
+ # @param options [::Gapic::CallOptions, ::Hash]
173
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
174
+ #
175
+ # @overload list_connections(parent: nil, page_size: nil, page_token: nil)
176
+ # Pass arguments to `list_connections` via keyword arguments. Note that at
177
+ # least one keyword argument is required. To specify no parameters, or to keep all
178
+ # the default parameter values, pass an empty Hash as a request object (see above).
179
+ #
180
+ # @param parent [::String]
181
+ # Required. Parent name of the form:
182
+ # `projects/{project_number or project_id}/endpoints/{endpoint}`.
183
+ # @param page_size [::Integer]
184
+ # The maximum number of connections to return. The service may return fewer
185
+ # than this value. If unspecified, at most 100 connections will be returned.
186
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
187
+ # @param page_token [::String]
188
+ # A page token, received from a previous `ListConnections` call.
189
+ # Provide this to retrieve the subsequent page.
190
+ #
191
+ # When paginating, all other parameters provided to `ListConnections` must
192
+ # match the call that provided the page token.
193
+ #
194
+ # @yield [response, operation] Access the result along with the RPC operation
195
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ApigeeConnect::V1::Connection>]
196
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
197
+ #
198
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::ApigeeConnect::V1::Connection>]
199
+ #
200
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
201
+ #
202
+ def list_connections request, options = nil
203
+ raise ::ArgumentError, "request must be provided" if request.nil?
204
+
205
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApigeeConnect::V1::ListConnectionsRequest
206
+
207
+ # Converts hash and nil to an options object
208
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
209
+
210
+ # Customize the options with defaults
211
+ metadata = @config.rpcs.list_connections.metadata.to_h
212
+
213
+ # Set x-goog-api-client and x-goog-user-project headers
214
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
215
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
216
+ gapic_version: ::Google::Cloud::ApigeeConnect::V1::VERSION
217
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
218
+
219
+ header_params = {
220
+ "parent" => request.parent
221
+ }
222
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
223
+ metadata[:"x-goog-request-params"] ||= request_params_header
224
+
225
+ options.apply_defaults timeout: @config.rpcs.list_connections.timeout,
226
+ metadata: metadata,
227
+ retry_policy: @config.rpcs.list_connections.retry_policy
228
+ options.apply_defaults metadata: @config.metadata,
229
+ retry_policy: @config.retry_policy
230
+
231
+ @connection_service_stub.call_rpc :list_connections, request, options: options do |response, operation|
232
+ response = ::Gapic::PagedEnumerable.new @connection_service_stub, :list_connections, request, response, operation, options
233
+ yield response, operation if block_given?
234
+ return response
235
+ end
236
+ rescue ::GRPC::BadStatus => e
237
+ raise ::Google::Cloud::Error.from_error(e)
238
+ end
239
+
240
+ ##
241
+ # Configuration class for the ConnectionService API.
242
+ #
243
+ # This class represents the configuration for ConnectionService,
244
+ # providing control over timeouts, retry behavior, logging, transport
245
+ # parameters, and other low-level controls. Certain parameters can also be
246
+ # applied individually to specific RPCs. See
247
+ # {::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client::Configuration::Rpcs}
248
+ # for a list of RPCs that can be configured independently.
249
+ #
250
+ # Configuration can be applied globally to all clients, or to a single client
251
+ # on construction.
252
+ #
253
+ # # Examples
254
+ #
255
+ # To modify the global config, setting the timeout for list_connections
256
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
257
+ #
258
+ # ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client.configure do |config|
259
+ # config.timeout = 10.0
260
+ # config.rpcs.list_connections.timeout = 20.0
261
+ # end
262
+ #
263
+ # To apply the above configuration only to a new client:
264
+ #
265
+ # client = ::Google::Cloud::ApigeeConnect::V1::ConnectionService::Client.new do |config|
266
+ # config.timeout = 10.0
267
+ # config.rpcs.list_connections.timeout = 20.0
268
+ # end
269
+ #
270
+ # @!attribute [rw] endpoint
271
+ # The hostname or hostname:port of the service endpoint.
272
+ # Defaults to `"apigeeconnect.googleapis.com"`.
273
+ # @return [::String]
274
+ # @!attribute [rw] credentials
275
+ # Credentials to send with calls. You may provide any of the following types:
276
+ # * (`String`) The path to a service account key file in JSON format
277
+ # * (`Hash`) A service account key as a Hash
278
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
279
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
280
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
281
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
282
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
283
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
284
+ # * (`nil`) indicating no credentials
285
+ # @return [::Object]
286
+ # @!attribute [rw] scope
287
+ # The OAuth scopes
288
+ # @return [::Array<::String>]
289
+ # @!attribute [rw] lib_name
290
+ # The library name as recorded in instrumentation and logging
291
+ # @return [::String]
292
+ # @!attribute [rw] lib_version
293
+ # The library version as recorded in instrumentation and logging
294
+ # @return [::String]
295
+ # @!attribute [rw] channel_args
296
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
297
+ # `GRPC::Core::Channel` object is provided as the credential.
298
+ # @return [::Hash]
299
+ # @!attribute [rw] interceptors
300
+ # An array of interceptors that are run before calls are executed.
301
+ # @return [::Array<::GRPC::ClientInterceptor>]
302
+ # @!attribute [rw] timeout
303
+ # The call timeout in seconds.
304
+ # @return [::Numeric]
305
+ # @!attribute [rw] metadata
306
+ # Additional gRPC headers to be sent with the call.
307
+ # @return [::Hash{::Symbol=>::String}]
308
+ # @!attribute [rw] retry_policy
309
+ # The retry policy. The value is a hash with the following keys:
310
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
311
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
312
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
313
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
314
+ # trigger a retry.
315
+ # @return [::Hash]
316
+ # @!attribute [rw] quota_project
317
+ # A separate project against which to charge quota.
318
+ # @return [::String]
319
+ #
320
+ class Configuration
321
+ extend ::Gapic::Config
322
+
323
+ config_attr :endpoint, "apigeeconnect.googleapis.com", ::String
324
+ config_attr :credentials, nil do |value|
325
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
326
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
327
+ allowed.any? { |klass| klass === value }
328
+ end
329
+ config_attr :scope, nil, ::String, ::Array, nil
330
+ config_attr :lib_name, nil, ::String, nil
331
+ config_attr :lib_version, nil, ::String, nil
332
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
333
+ config_attr :interceptors, nil, ::Array, nil
334
+ config_attr :timeout, nil, ::Numeric, nil
335
+ config_attr :metadata, nil, ::Hash, nil
336
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
337
+ config_attr :quota_project, nil, ::String, nil
338
+
339
+ # @private
340
+ def initialize parent_config = nil
341
+ @parent_config = parent_config unless parent_config.nil?
342
+
343
+ yield self if block_given?
344
+ end
345
+
346
+ ##
347
+ # Configurations for individual RPCs
348
+ # @return [Rpcs]
349
+ #
350
+ def rpcs
351
+ @rpcs ||= begin
352
+ parent_rpcs = nil
353
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
354
+ Rpcs.new parent_rpcs
355
+ end
356
+ end
357
+
358
+ ##
359
+ # Configuration RPC class for the ConnectionService API.
360
+ #
361
+ # Includes fields providing the configuration for each RPC in this service.
362
+ # Each configuration object is of type `Gapic::Config::Method` and includes
363
+ # the following configuration fields:
364
+ #
365
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
366
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
367
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
368
+ # include the following keys:
369
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
370
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
371
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
372
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
373
+ # trigger a retry.
374
+ #
375
+ class Rpcs
376
+ ##
377
+ # RPC-specific configuration for `list_connections`
378
+ # @return [::Gapic::Config::Method]
379
+ #
380
+ attr_reader :list_connections
381
+
382
+ # @private
383
+ def initialize parent_rpcs = nil
384
+ list_connections_config = parent_rpcs.list_connections if parent_rpcs.respond_to? :list_connections
385
+ @list_connections = ::Gapic::Config::Method.new list_connections_config
386
+
387
+ yield self if block_given?
388
+ end
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end
394
+ end
395
+ end
396
+ end