google-cloud-build-v2 0.14.1 → 0.14.2

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/lib/google/cloud/build/v2/bindings_override.rb +86 -0
  4. data/lib/google/cloud/build/v2/repository_manager/client.rb +1 -1
  5. data/lib/google/cloud/build/v2/repository_manager/credentials.rb +1 -1
  6. data/lib/google/cloud/build/v2/repository_manager/operations.rb +1 -1
  7. data/lib/google/cloud/build/v2/repository_manager/paths.rb +1 -1
  8. data/lib/google/cloud/build/v2/repository_manager/rest/client.rb +1778 -0
  9. data/lib/google/cloud/build/v2/repository_manager/rest/operations.rb +927 -0
  10. data/lib/google/cloud/build/v2/repository_manager/rest/service_stub.rb +941 -0
  11. data/lib/google/cloud/build/v2/repository_manager/rest.rb +54 -0
  12. data/lib/google/cloud/build/v2/repository_manager.rb +7 -1
  13. data/lib/google/cloud/build/v2/rest.rb +38 -0
  14. data/lib/google/cloud/build/v2/version.rb +1 -1
  15. data/lib/google/cloud/build/v2.rb +6 -1
  16. data/lib/google/devtools/cloudbuild/v2/repositories_services_pb.rb +1 -1
  17. data/lib/google-cloud-build-v2.rb +1 -1
  18. data/proto_docs/google/api/client.rb +1 -1
  19. data/proto_docs/google/api/field_behavior.rb +1 -1
  20. data/proto_docs/google/api/httpbody.rb +1 -1
  21. data/proto_docs/google/api/launch_stage.rb +1 -1
  22. data/proto_docs/google/api/resource.rb +1 -1
  23. data/proto_docs/google/devtools/cloudbuild/v2/cloudbuild.rb +1 -1
  24. data/proto_docs/google/devtools/cloudbuild/v2/repositories.rb +1 -1
  25. data/proto_docs/google/longrunning/operations.rb +1 -1
  26. data/proto_docs/google/protobuf/any.rb +1 -1
  27. data/proto_docs/google/protobuf/duration.rb +1 -1
  28. data/proto_docs/google/protobuf/empty.rb +1 -1
  29. data/proto_docs/google/protobuf/field_mask.rb +1 -1
  30. data/proto_docs/google/protobuf/timestamp.rb +8 -7
  31. data/proto_docs/google/rpc/status.rb +1 -1
  32. metadata +8 -6
  33. data/proto_docs/google/type/expr.rb +0 -75
@@ -0,0 +1,1778 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/devtools/cloudbuild/v2/repositories_pb"
21
+ require "google/cloud/build/v2/repository_manager/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module Build
28
+ module V2
29
+ module RepositoryManager
30
+ module Rest
31
+ ##
32
+ # REST client for the RepositoryManager service.
33
+ #
34
+ # Manages connections to source code repositories.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudbuild.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :repository_manager_stub
47
+
48
+ ##
49
+ # Configure the RepositoryManager Client class.
50
+ #
51
+ # See {::Google::Cloud::Build::V2::RepositoryManager::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all RepositoryManager clients
57
+ # ::Google::Cloud::Build::V2::RepositoryManager::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "Build", "V2"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.rpcs.create_connection.timeout = 60.0
78
+
79
+ default_config.rpcs.get_connection.timeout = 60.0
80
+ default_config.rpcs.get_connection.retry_policy = {
81
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
82
+ }
83
+
84
+ default_config.rpcs.list_connections.timeout = 60.0
85
+ default_config.rpcs.list_connections.retry_policy = {
86
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
87
+ }
88
+
89
+ default_config.rpcs.update_connection.timeout = 60.0
90
+
91
+ default_config.rpcs.delete_connection.timeout = 60.0
92
+
93
+ default_config.rpcs.create_repository.timeout = 60.0
94
+
95
+ default_config.rpcs.get_repository.timeout = 60.0
96
+ default_config.rpcs.get_repository.retry_policy = {
97
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
98
+ }
99
+
100
+ default_config.rpcs.list_repositories.timeout = 60.0
101
+ default_config.rpcs.list_repositories.retry_policy = {
102
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
103
+ }
104
+
105
+ default_config.rpcs.delete_repository.timeout = 60.0
106
+
107
+ default_config.rpcs.fetch_read_write_token.timeout = 60.0
108
+ default_config.rpcs.fetch_read_write_token.retry_policy = {
109
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
110
+ }
111
+
112
+ default_config.rpcs.fetch_read_token.timeout = 60.0
113
+ default_config.rpcs.fetch_read_token.retry_policy = {
114
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
115
+ }
116
+
117
+ default_config.rpcs.fetch_linkable_repositories.timeout = 60.0
118
+ default_config.rpcs.fetch_linkable_repositories.retry_policy = {
119
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
120
+ }
121
+
122
+ default_config
123
+ end
124
+ yield @configure if block_given?
125
+ @configure
126
+ end
127
+
128
+ ##
129
+ # Configure the RepositoryManager Client instance.
130
+ #
131
+ # The configuration is set to the derived mode, meaning that values can be changed,
132
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
133
+ # should be made on {Client.configure}.
134
+ #
135
+ # See {::Google::Cloud::Build::V2::RepositoryManager::Rest::Client::Configuration}
136
+ # for a description of the configuration fields.
137
+ #
138
+ # @yield [config] Configure the Client client.
139
+ # @yieldparam config [Client::Configuration]
140
+ #
141
+ # @return [Client::Configuration]
142
+ #
143
+ def configure
144
+ yield @config if block_given?
145
+ @config
146
+ end
147
+
148
+ ##
149
+ # The effective universe domain
150
+ #
151
+ # @return [String]
152
+ #
153
+ def universe_domain
154
+ @repository_manager_stub.universe_domain
155
+ end
156
+
157
+ ##
158
+ # Create a new RepositoryManager REST client object.
159
+ #
160
+ # @example
161
+ #
162
+ # # Create a client using the default configuration
163
+ # client = ::Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
164
+ #
165
+ # # Create a client using a custom configuration
166
+ # client = ::Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new do |config|
167
+ # config.timeout = 10.0
168
+ # end
169
+ #
170
+ # @yield [config] Configure the RepositoryManager client.
171
+ # @yieldparam config [Client::Configuration]
172
+ #
173
+ def initialize
174
+ # Create the configuration object
175
+ @config = Configuration.new Client.configure
176
+
177
+ # Yield the configuration if needed
178
+ yield @config if block_given?
179
+
180
+ # Create credentials
181
+ credentials = @config.credentials
182
+ # Use self-signed JWT if the endpoint is unchanged from default,
183
+ # but only if the default endpoint does not have a region prefix.
184
+ enable_self_signed_jwt = @config.endpoint.nil? ||
185
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
186
+ !@config.endpoint.split(".").first.include?("-"))
187
+ credentials ||= Credentials.default scope: @config.scope,
188
+ enable_self_signed_jwt: enable_self_signed_jwt
189
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
190
+ credentials = Credentials.new credentials, scope: @config.scope
191
+ end
192
+
193
+ @quota_project_id = @config.quota_project
194
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
195
+
196
+ @operations_client = ::Google::Cloud::Build::V2::RepositoryManager::Rest::Operations.new do |config|
197
+ config.credentials = credentials
198
+ config.quota_project = @quota_project_id
199
+ config.endpoint = @config.endpoint
200
+ config.universe_domain = @config.universe_domain
201
+ end
202
+
203
+ @repository_manager_stub = ::Google::Cloud::Build::V2::RepositoryManager::Rest::ServiceStub.new(
204
+ endpoint: @config.endpoint,
205
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
206
+ universe_domain: @config.universe_domain,
207
+ credentials: credentials,
208
+ logger: @config.logger
209
+ )
210
+
211
+ @repository_manager_stub.logger(stub: true)&.info do |entry|
212
+ entry.set_system_name
213
+ entry.set_service
214
+ entry.message = "Created client for #{entry.service}"
215
+ entry.set_credentials_fields credentials
216
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
217
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
218
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
219
+ end
220
+
221
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
222
+ config.credentials = credentials
223
+ config.quota_project = @quota_project_id
224
+ config.endpoint = @repository_manager_stub.endpoint
225
+ config.universe_domain = @repository_manager_stub.universe_domain
226
+ config.logger = @repository_manager_stub.logger if config.respond_to? :logger=
227
+ end
228
+
229
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
230
+ config.credentials = credentials
231
+ config.quota_project = @quota_project_id
232
+ config.endpoint = @repository_manager_stub.endpoint
233
+ config.universe_domain = @repository_manager_stub.universe_domain
234
+ config.bindings_override = @config.bindings_override
235
+ config.logger = @repository_manager_stub.logger if config.respond_to? :logger=
236
+ end
237
+ end
238
+
239
+ ##
240
+ # Get the associated client for long-running operations.
241
+ #
242
+ # @return [::Google::Cloud::Build::V2::RepositoryManager::Rest::Operations]
243
+ #
244
+ attr_reader :operations_client
245
+
246
+ ##
247
+ # Get the associated client for mix-in of the Locations.
248
+ #
249
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
250
+ #
251
+ attr_reader :location_client
252
+
253
+ ##
254
+ # Get the associated client for mix-in of the IAMPolicy.
255
+ #
256
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
257
+ #
258
+ attr_reader :iam_policy_client
259
+
260
+ ##
261
+ # The logger used for request/response debug logging.
262
+ #
263
+ # @return [Logger]
264
+ #
265
+ def logger
266
+ @repository_manager_stub.logger
267
+ end
268
+
269
+ # Service calls
270
+
271
+ ##
272
+ # Creates a Connection.
273
+ #
274
+ # @overload create_connection(request, options = nil)
275
+ # Pass arguments to `create_connection` via a request object, either of type
276
+ # {::Google::Cloud::Build::V2::CreateConnectionRequest} or an equivalent Hash.
277
+ #
278
+ # @param request [::Google::Cloud::Build::V2::CreateConnectionRequest, ::Hash]
279
+ # A request object representing the call parameters. Required. To specify no
280
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
281
+ # @param options [::Gapic::CallOptions, ::Hash]
282
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
283
+ #
284
+ # @overload create_connection(parent: nil, connection: nil, connection_id: nil)
285
+ # Pass arguments to `create_connection` via keyword arguments. Note that at
286
+ # least one keyword argument is required. To specify no parameters, or to keep all
287
+ # the default parameter values, pass an empty Hash as a request object (see above).
288
+ #
289
+ # @param parent [::String]
290
+ # Required. Project and location where the connection will be created.
291
+ # Format: `projects/*/locations/*`.
292
+ # @param connection [::Google::Cloud::Build::V2::Connection, ::Hash]
293
+ # Required. The Connection to create.
294
+ # @param connection_id [::String]
295
+ # Required. The ID to use for the Connection, which will become the final
296
+ # component of the Connection's resource name. Names must be unique
297
+ # per-project per-location. Allows alphanumeric characters and any of
298
+ # -._~%!$&'()*+,;=@.
299
+ # @yield [result, operation] Access the result along with the TransportOperation object
300
+ # @yieldparam result [::Gapic::Operation]
301
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
302
+ #
303
+ # @return [::Gapic::Operation]
304
+ #
305
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
306
+ #
307
+ # @example Basic example
308
+ # require "google/cloud/build/v2"
309
+ #
310
+ # # Create a client object. The client can be reused for multiple calls.
311
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
312
+ #
313
+ # # Create a request. To set request fields, pass in keyword arguments.
314
+ # request = Google::Cloud::Build::V2::CreateConnectionRequest.new
315
+ #
316
+ # # Call the create_connection method.
317
+ # result = client.create_connection request
318
+ #
319
+ # # The returned object is of type Gapic::Operation. You can use it to
320
+ # # check the status of an operation, cancel it, or wait for results.
321
+ # # Here is how to wait for a response.
322
+ # result.wait_until_done! timeout: 60
323
+ # if result.response?
324
+ # p result.response
325
+ # else
326
+ # puts "No response received."
327
+ # end
328
+ #
329
+ def create_connection request, options = nil
330
+ raise ::ArgumentError, "request must be provided" if request.nil?
331
+
332
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::CreateConnectionRequest
333
+
334
+ # Converts hash and nil to an options object
335
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
336
+
337
+ # Customize the options with defaults
338
+ call_metadata = @config.rpcs.create_connection.metadata.to_h
339
+
340
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
341
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
342
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
343
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
344
+ transports_version_send: [:rest]
345
+
346
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
347
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
+
349
+ options.apply_defaults timeout: @config.rpcs.create_connection.timeout,
350
+ metadata: call_metadata,
351
+ retry_policy: @config.rpcs.create_connection.retry_policy
352
+
353
+ options.apply_defaults timeout: @config.timeout,
354
+ metadata: @config.metadata,
355
+ retry_policy: @config.retry_policy
356
+
357
+ @repository_manager_stub.create_connection request, options do |result, operation|
358
+ result = ::Gapic::Operation.new result, @operations_client, options: options
359
+ yield result, operation if block_given?
360
+ throw :response, result
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Gets details of a single connection.
368
+ #
369
+ # @overload get_connection(request, options = nil)
370
+ # Pass arguments to `get_connection` via a request object, either of type
371
+ # {::Google::Cloud::Build::V2::GetConnectionRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::Build::V2::GetConnectionRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
378
+ #
379
+ # @overload get_connection(name: nil)
380
+ # Pass arguments to `get_connection` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param name [::String]
385
+ # Required. The name of the Connection to retrieve.
386
+ # Format: `projects/*/locations/*/connections/*`.
387
+ # @yield [result, operation] Access the result along with the TransportOperation object
388
+ # @yieldparam result [::Google::Cloud::Build::V2::Connection]
389
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
390
+ #
391
+ # @return [::Google::Cloud::Build::V2::Connection]
392
+ #
393
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
394
+ #
395
+ # @example Basic example
396
+ # require "google/cloud/build/v2"
397
+ #
398
+ # # Create a client object. The client can be reused for multiple calls.
399
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
400
+ #
401
+ # # Create a request. To set request fields, pass in keyword arguments.
402
+ # request = Google::Cloud::Build::V2::GetConnectionRequest.new
403
+ #
404
+ # # Call the get_connection method.
405
+ # result = client.get_connection request
406
+ #
407
+ # # The returned object is of type Google::Cloud::Build::V2::Connection.
408
+ # p result
409
+ #
410
+ def get_connection request, options = nil
411
+ raise ::ArgumentError, "request must be provided" if request.nil?
412
+
413
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::GetConnectionRequest
414
+
415
+ # Converts hash and nil to an options object
416
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
417
+
418
+ # Customize the options with defaults
419
+ call_metadata = @config.rpcs.get_connection.metadata.to_h
420
+
421
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
422
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
423
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
424
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
425
+ transports_version_send: [:rest]
426
+
427
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
428
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
429
+
430
+ options.apply_defaults timeout: @config.rpcs.get_connection.timeout,
431
+ metadata: call_metadata,
432
+ retry_policy: @config.rpcs.get_connection.retry_policy
433
+
434
+ options.apply_defaults timeout: @config.timeout,
435
+ metadata: @config.metadata,
436
+ retry_policy: @config.retry_policy
437
+
438
+ @repository_manager_stub.get_connection request, options do |result, operation|
439
+ yield result, operation if block_given?
440
+ end
441
+ rescue ::Gapic::Rest::Error => e
442
+ raise ::Google::Cloud::Error.from_error(e)
443
+ end
444
+
445
+ ##
446
+ # Lists Connections in a given project and location.
447
+ #
448
+ # @overload list_connections(request, options = nil)
449
+ # Pass arguments to `list_connections` via a request object, either of type
450
+ # {::Google::Cloud::Build::V2::ListConnectionsRequest} or an equivalent Hash.
451
+ #
452
+ # @param request [::Google::Cloud::Build::V2::ListConnectionsRequest, ::Hash]
453
+ # A request object representing the call parameters. Required. To specify no
454
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
455
+ # @param options [::Gapic::CallOptions, ::Hash]
456
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
457
+ #
458
+ # @overload list_connections(parent: nil, page_size: nil, page_token: nil)
459
+ # Pass arguments to `list_connections` via keyword arguments. Note that at
460
+ # least one keyword argument is required. To specify no parameters, or to keep all
461
+ # the default parameter values, pass an empty Hash as a request object (see above).
462
+ #
463
+ # @param parent [::String]
464
+ # Required. The parent, which owns this collection of Connections.
465
+ # Format: `projects/*/locations/*`.
466
+ # @param page_size [::Integer]
467
+ # Number of results to return in the list.
468
+ # @param page_token [::String]
469
+ # Page start.
470
+ # @yield [result, operation] Access the result along with the TransportOperation object
471
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V2::Connection>]
472
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
473
+ #
474
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V2::Connection>]
475
+ #
476
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
477
+ #
478
+ # @example Basic example
479
+ # require "google/cloud/build/v2"
480
+ #
481
+ # # Create a client object. The client can be reused for multiple calls.
482
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
483
+ #
484
+ # # Create a request. To set request fields, pass in keyword arguments.
485
+ # request = Google::Cloud::Build::V2::ListConnectionsRequest.new
486
+ #
487
+ # # Call the list_connections method.
488
+ # result = client.list_connections request
489
+ #
490
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
491
+ # # over elements, and API calls will be issued to fetch pages as needed.
492
+ # result.each do |item|
493
+ # # Each element is of type ::Google::Cloud::Build::V2::Connection.
494
+ # p item
495
+ # end
496
+ #
497
+ def list_connections request, options = nil
498
+ raise ::ArgumentError, "request must be provided" if request.nil?
499
+
500
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::ListConnectionsRequest
501
+
502
+ # Converts hash and nil to an options object
503
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
504
+
505
+ # Customize the options with defaults
506
+ call_metadata = @config.rpcs.list_connections.metadata.to_h
507
+
508
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
509
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
510
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
511
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
512
+ transports_version_send: [:rest]
513
+
514
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
515
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
516
+
517
+ options.apply_defaults timeout: @config.rpcs.list_connections.timeout,
518
+ metadata: call_metadata,
519
+ retry_policy: @config.rpcs.list_connections.retry_policy
520
+
521
+ options.apply_defaults timeout: @config.timeout,
522
+ metadata: @config.metadata,
523
+ retry_policy: @config.retry_policy
524
+
525
+ @repository_manager_stub.list_connections request, options do |result, operation|
526
+ result = ::Gapic::Rest::PagedEnumerable.new @repository_manager_stub, :list_connections, "connections", request, result, options
527
+ yield result, operation if block_given?
528
+ throw :response, result
529
+ end
530
+ rescue ::Gapic::Rest::Error => e
531
+ raise ::Google::Cloud::Error.from_error(e)
532
+ end
533
+
534
+ ##
535
+ # Updates a single connection.
536
+ #
537
+ # @overload update_connection(request, options = nil)
538
+ # Pass arguments to `update_connection` via a request object, either of type
539
+ # {::Google::Cloud::Build::V2::UpdateConnectionRequest} or an equivalent Hash.
540
+ #
541
+ # @param request [::Google::Cloud::Build::V2::UpdateConnectionRequest, ::Hash]
542
+ # A request object representing the call parameters. Required. To specify no
543
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
544
+ # @param options [::Gapic::CallOptions, ::Hash]
545
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
546
+ #
547
+ # @overload update_connection(connection: nil, update_mask: nil, allow_missing: nil, etag: nil)
548
+ # Pass arguments to `update_connection` via keyword arguments. Note that at
549
+ # least one keyword argument is required. To specify no parameters, or to keep all
550
+ # the default parameter values, pass an empty Hash as a request object (see above).
551
+ #
552
+ # @param connection [::Google::Cloud::Build::V2::Connection, ::Hash]
553
+ # Required. The Connection to update.
554
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
555
+ # The list of fields to be updated.
556
+ # @param allow_missing [::Boolean]
557
+ # If set to true, and the connection is not found a new connection
558
+ # will be created. In this situation `update_mask` is ignored.
559
+ # The creation will succeed only if the input connection has all the
560
+ # necessary information (e.g a github_config with both user_oauth_token and
561
+ # installation_id properties).
562
+ # @param etag [::String]
563
+ # The current etag of the connection.
564
+ # If an etag is provided and does not match the current etag of the
565
+ # connection, update will be blocked and an ABORTED error will be returned.
566
+ # @yield [result, operation] Access the result along with the TransportOperation object
567
+ # @yieldparam result [::Gapic::Operation]
568
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
569
+ #
570
+ # @return [::Gapic::Operation]
571
+ #
572
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
573
+ #
574
+ # @example Basic example
575
+ # require "google/cloud/build/v2"
576
+ #
577
+ # # Create a client object. The client can be reused for multiple calls.
578
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
579
+ #
580
+ # # Create a request. To set request fields, pass in keyword arguments.
581
+ # request = Google::Cloud::Build::V2::UpdateConnectionRequest.new
582
+ #
583
+ # # Call the update_connection method.
584
+ # result = client.update_connection request
585
+ #
586
+ # # The returned object is of type Gapic::Operation. You can use it to
587
+ # # check the status of an operation, cancel it, or wait for results.
588
+ # # Here is how to wait for a response.
589
+ # result.wait_until_done! timeout: 60
590
+ # if result.response?
591
+ # p result.response
592
+ # else
593
+ # puts "No response received."
594
+ # end
595
+ #
596
+ def update_connection request, options = nil
597
+ raise ::ArgumentError, "request must be provided" if request.nil?
598
+
599
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::UpdateConnectionRequest
600
+
601
+ # Converts hash and nil to an options object
602
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
603
+
604
+ # Customize the options with defaults
605
+ call_metadata = @config.rpcs.update_connection.metadata.to_h
606
+
607
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
608
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
609
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
610
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
611
+ transports_version_send: [:rest]
612
+
613
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
614
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
+
616
+ options.apply_defaults timeout: @config.rpcs.update_connection.timeout,
617
+ metadata: call_metadata,
618
+ retry_policy: @config.rpcs.update_connection.retry_policy
619
+
620
+ options.apply_defaults timeout: @config.timeout,
621
+ metadata: @config.metadata,
622
+ retry_policy: @config.retry_policy
623
+
624
+ @repository_manager_stub.update_connection request, options do |result, operation|
625
+ result = ::Gapic::Operation.new result, @operations_client, options: options
626
+ yield result, operation if block_given?
627
+ throw :response, result
628
+ end
629
+ rescue ::Gapic::Rest::Error => e
630
+ raise ::Google::Cloud::Error.from_error(e)
631
+ end
632
+
633
+ ##
634
+ # Deletes a single connection.
635
+ #
636
+ # @overload delete_connection(request, options = nil)
637
+ # Pass arguments to `delete_connection` via a request object, either of type
638
+ # {::Google::Cloud::Build::V2::DeleteConnectionRequest} or an equivalent Hash.
639
+ #
640
+ # @param request [::Google::Cloud::Build::V2::DeleteConnectionRequest, ::Hash]
641
+ # A request object representing the call parameters. Required. To specify no
642
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
643
+ # @param options [::Gapic::CallOptions, ::Hash]
644
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
645
+ #
646
+ # @overload delete_connection(name: nil, etag: nil, validate_only: nil)
647
+ # Pass arguments to `delete_connection` via keyword arguments. Note that at
648
+ # least one keyword argument is required. To specify no parameters, or to keep all
649
+ # the default parameter values, pass an empty Hash as a request object (see above).
650
+ #
651
+ # @param name [::String]
652
+ # Required. The name of the Connection to delete.
653
+ # Format: `projects/*/locations/*/connections/*`.
654
+ # @param etag [::String]
655
+ # The current etag of the connection.
656
+ # If an etag is provided and does not match the current etag of the
657
+ # connection, deletion will be blocked and an ABORTED error will be returned.
658
+ # @param validate_only [::Boolean]
659
+ # If set, validate the request, but do not actually post it.
660
+ # @yield [result, operation] Access the result along with the TransportOperation object
661
+ # @yieldparam result [::Gapic::Operation]
662
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
663
+ #
664
+ # @return [::Gapic::Operation]
665
+ #
666
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
667
+ #
668
+ # @example Basic example
669
+ # require "google/cloud/build/v2"
670
+ #
671
+ # # Create a client object. The client can be reused for multiple calls.
672
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
673
+ #
674
+ # # Create a request. To set request fields, pass in keyword arguments.
675
+ # request = Google::Cloud::Build::V2::DeleteConnectionRequest.new
676
+ #
677
+ # # Call the delete_connection method.
678
+ # result = client.delete_connection request
679
+ #
680
+ # # The returned object is of type Gapic::Operation. You can use it to
681
+ # # check the status of an operation, cancel it, or wait for results.
682
+ # # Here is how to wait for a response.
683
+ # result.wait_until_done! timeout: 60
684
+ # if result.response?
685
+ # p result.response
686
+ # else
687
+ # puts "No response received."
688
+ # end
689
+ #
690
+ def delete_connection request, options = nil
691
+ raise ::ArgumentError, "request must be provided" if request.nil?
692
+
693
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::DeleteConnectionRequest
694
+
695
+ # Converts hash and nil to an options object
696
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
697
+
698
+ # Customize the options with defaults
699
+ call_metadata = @config.rpcs.delete_connection.metadata.to_h
700
+
701
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
702
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
703
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
704
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
705
+ transports_version_send: [:rest]
706
+
707
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
708
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
709
+
710
+ options.apply_defaults timeout: @config.rpcs.delete_connection.timeout,
711
+ metadata: call_metadata,
712
+ retry_policy: @config.rpcs.delete_connection.retry_policy
713
+
714
+ options.apply_defaults timeout: @config.timeout,
715
+ metadata: @config.metadata,
716
+ retry_policy: @config.retry_policy
717
+
718
+ @repository_manager_stub.delete_connection request, options do |result, operation|
719
+ result = ::Gapic::Operation.new result, @operations_client, options: options
720
+ yield result, operation if block_given?
721
+ throw :response, result
722
+ end
723
+ rescue ::Gapic::Rest::Error => e
724
+ raise ::Google::Cloud::Error.from_error(e)
725
+ end
726
+
727
+ ##
728
+ # Creates a Repository.
729
+ #
730
+ # @overload create_repository(request, options = nil)
731
+ # Pass arguments to `create_repository` via a request object, either of type
732
+ # {::Google::Cloud::Build::V2::CreateRepositoryRequest} or an equivalent Hash.
733
+ #
734
+ # @param request [::Google::Cloud::Build::V2::CreateRepositoryRequest, ::Hash]
735
+ # A request object representing the call parameters. Required. To specify no
736
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
737
+ # @param options [::Gapic::CallOptions, ::Hash]
738
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
739
+ #
740
+ # @overload create_repository(parent: nil, repository: nil, repository_id: nil)
741
+ # Pass arguments to `create_repository` via keyword arguments. Note that at
742
+ # least one keyword argument is required. To specify no parameters, or to keep all
743
+ # the default parameter values, pass an empty Hash as a request object (see above).
744
+ #
745
+ # @param parent [::String]
746
+ # Required. The connection to contain the repository. If the request is part
747
+ # of a BatchCreateRepositoriesRequest, this field should be empty or match
748
+ # the parent specified there.
749
+ # @param repository [::Google::Cloud::Build::V2::Repository, ::Hash]
750
+ # Required. The repository to create.
751
+ # @param repository_id [::String]
752
+ # Required. The ID to use for the repository, which will become the final
753
+ # component of the repository's resource name. This ID should be unique in
754
+ # the connection. Allows alphanumeric characters and any of
755
+ # -._~%!$&'()*+,;=@.
756
+ # @yield [result, operation] Access the result along with the TransportOperation object
757
+ # @yieldparam result [::Gapic::Operation]
758
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
759
+ #
760
+ # @return [::Gapic::Operation]
761
+ #
762
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
763
+ #
764
+ # @example Basic example
765
+ # require "google/cloud/build/v2"
766
+ #
767
+ # # Create a client object. The client can be reused for multiple calls.
768
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
769
+ #
770
+ # # Create a request. To set request fields, pass in keyword arguments.
771
+ # request = Google::Cloud::Build::V2::CreateRepositoryRequest.new
772
+ #
773
+ # # Call the create_repository method.
774
+ # result = client.create_repository request
775
+ #
776
+ # # The returned object is of type Gapic::Operation. You can use it to
777
+ # # check the status of an operation, cancel it, or wait for results.
778
+ # # Here is how to wait for a response.
779
+ # result.wait_until_done! timeout: 60
780
+ # if result.response?
781
+ # p result.response
782
+ # else
783
+ # puts "No response received."
784
+ # end
785
+ #
786
+ def create_repository request, options = nil
787
+ raise ::ArgumentError, "request must be provided" if request.nil?
788
+
789
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::CreateRepositoryRequest
790
+
791
+ # Converts hash and nil to an options object
792
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
793
+
794
+ # Customize the options with defaults
795
+ call_metadata = @config.rpcs.create_repository.metadata.to_h
796
+
797
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
798
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
799
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
800
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
801
+ transports_version_send: [:rest]
802
+
803
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
804
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
805
+
806
+ options.apply_defaults timeout: @config.rpcs.create_repository.timeout,
807
+ metadata: call_metadata,
808
+ retry_policy: @config.rpcs.create_repository.retry_policy
809
+
810
+ options.apply_defaults timeout: @config.timeout,
811
+ metadata: @config.metadata,
812
+ retry_policy: @config.retry_policy
813
+
814
+ @repository_manager_stub.create_repository request, options do |result, operation|
815
+ result = ::Gapic::Operation.new result, @operations_client, options: options
816
+ yield result, operation if block_given?
817
+ throw :response, result
818
+ end
819
+ rescue ::Gapic::Rest::Error => e
820
+ raise ::Google::Cloud::Error.from_error(e)
821
+ end
822
+
823
+ ##
824
+ # Creates multiple repositories inside a connection.
825
+ #
826
+ # @overload batch_create_repositories(request, options = nil)
827
+ # Pass arguments to `batch_create_repositories` via a request object, either of type
828
+ # {::Google::Cloud::Build::V2::BatchCreateRepositoriesRequest} or an equivalent Hash.
829
+ #
830
+ # @param request [::Google::Cloud::Build::V2::BatchCreateRepositoriesRequest, ::Hash]
831
+ # A request object representing the call parameters. Required. To specify no
832
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
833
+ # @param options [::Gapic::CallOptions, ::Hash]
834
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
835
+ #
836
+ # @overload batch_create_repositories(parent: nil, requests: nil)
837
+ # Pass arguments to `batch_create_repositories` via keyword arguments. Note that at
838
+ # least one keyword argument is required. To specify no parameters, or to keep all
839
+ # the default parameter values, pass an empty Hash as a request object (see above).
840
+ #
841
+ # @param parent [::String]
842
+ # Required. The connection to contain all the repositories being created.
843
+ # Format: projects/*/locations/*/connections/*
844
+ # The parent field in the CreateRepositoryRequest messages
845
+ # must either be empty or match this field.
846
+ # @param requests [::Array<::Google::Cloud::Build::V2::CreateRepositoryRequest, ::Hash>]
847
+ # Required. The request messages specifying the repositories to create.
848
+ # @yield [result, operation] Access the result along with the TransportOperation object
849
+ # @yieldparam result [::Gapic::Operation]
850
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
851
+ #
852
+ # @return [::Gapic::Operation]
853
+ #
854
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
855
+ #
856
+ # @example Basic example
857
+ # require "google/cloud/build/v2"
858
+ #
859
+ # # Create a client object. The client can be reused for multiple calls.
860
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
861
+ #
862
+ # # Create a request. To set request fields, pass in keyword arguments.
863
+ # request = Google::Cloud::Build::V2::BatchCreateRepositoriesRequest.new
864
+ #
865
+ # # Call the batch_create_repositories method.
866
+ # result = client.batch_create_repositories request
867
+ #
868
+ # # The returned object is of type Gapic::Operation. You can use it to
869
+ # # check the status of an operation, cancel it, or wait for results.
870
+ # # Here is how to wait for a response.
871
+ # result.wait_until_done! timeout: 60
872
+ # if result.response?
873
+ # p result.response
874
+ # else
875
+ # puts "No response received."
876
+ # end
877
+ #
878
+ def batch_create_repositories request, options = nil
879
+ raise ::ArgumentError, "request must be provided" if request.nil?
880
+
881
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::BatchCreateRepositoriesRequest
882
+
883
+ # Converts hash and nil to an options object
884
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
885
+
886
+ # Customize the options with defaults
887
+ call_metadata = @config.rpcs.batch_create_repositories.metadata.to_h
888
+
889
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
890
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
891
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
892
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
893
+ transports_version_send: [:rest]
894
+
895
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
896
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
897
+
898
+ options.apply_defaults timeout: @config.rpcs.batch_create_repositories.timeout,
899
+ metadata: call_metadata,
900
+ retry_policy: @config.rpcs.batch_create_repositories.retry_policy
901
+
902
+ options.apply_defaults timeout: @config.timeout,
903
+ metadata: @config.metadata,
904
+ retry_policy: @config.retry_policy
905
+
906
+ @repository_manager_stub.batch_create_repositories request, options do |result, operation|
907
+ result = ::Gapic::Operation.new result, @operations_client, options: options
908
+ yield result, operation if block_given?
909
+ throw :response, result
910
+ end
911
+ rescue ::Gapic::Rest::Error => e
912
+ raise ::Google::Cloud::Error.from_error(e)
913
+ end
914
+
915
+ ##
916
+ # Gets details of a single repository.
917
+ #
918
+ # @overload get_repository(request, options = nil)
919
+ # Pass arguments to `get_repository` via a request object, either of type
920
+ # {::Google::Cloud::Build::V2::GetRepositoryRequest} or an equivalent Hash.
921
+ #
922
+ # @param request [::Google::Cloud::Build::V2::GetRepositoryRequest, ::Hash]
923
+ # A request object representing the call parameters. Required. To specify no
924
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
925
+ # @param options [::Gapic::CallOptions, ::Hash]
926
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
927
+ #
928
+ # @overload get_repository(name: nil)
929
+ # Pass arguments to `get_repository` via keyword arguments. Note that at
930
+ # least one keyword argument is required. To specify no parameters, or to keep all
931
+ # the default parameter values, pass an empty Hash as a request object (see above).
932
+ #
933
+ # @param name [::String]
934
+ # Required. The name of the Repository to retrieve.
935
+ # Format: `projects/*/locations/*/connections/*/repositories/*`.
936
+ # @yield [result, operation] Access the result along with the TransportOperation object
937
+ # @yieldparam result [::Google::Cloud::Build::V2::Repository]
938
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
939
+ #
940
+ # @return [::Google::Cloud::Build::V2::Repository]
941
+ #
942
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
943
+ #
944
+ # @example Basic example
945
+ # require "google/cloud/build/v2"
946
+ #
947
+ # # Create a client object. The client can be reused for multiple calls.
948
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
949
+ #
950
+ # # Create a request. To set request fields, pass in keyword arguments.
951
+ # request = Google::Cloud::Build::V2::GetRepositoryRequest.new
952
+ #
953
+ # # Call the get_repository method.
954
+ # result = client.get_repository request
955
+ #
956
+ # # The returned object is of type Google::Cloud::Build::V2::Repository.
957
+ # p result
958
+ #
959
+ def get_repository request, options = nil
960
+ raise ::ArgumentError, "request must be provided" if request.nil?
961
+
962
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::GetRepositoryRequest
963
+
964
+ # Converts hash and nil to an options object
965
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
966
+
967
+ # Customize the options with defaults
968
+ call_metadata = @config.rpcs.get_repository.metadata.to_h
969
+
970
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
971
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
972
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
973
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
974
+ transports_version_send: [:rest]
975
+
976
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
977
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
978
+
979
+ options.apply_defaults timeout: @config.rpcs.get_repository.timeout,
980
+ metadata: call_metadata,
981
+ retry_policy: @config.rpcs.get_repository.retry_policy
982
+
983
+ options.apply_defaults timeout: @config.timeout,
984
+ metadata: @config.metadata,
985
+ retry_policy: @config.retry_policy
986
+
987
+ @repository_manager_stub.get_repository request, options do |result, operation|
988
+ yield result, operation if block_given?
989
+ end
990
+ rescue ::Gapic::Rest::Error => e
991
+ raise ::Google::Cloud::Error.from_error(e)
992
+ end
993
+
994
+ ##
995
+ # Lists Repositories in a given connection.
996
+ #
997
+ # @overload list_repositories(request, options = nil)
998
+ # Pass arguments to `list_repositories` via a request object, either of type
999
+ # {::Google::Cloud::Build::V2::ListRepositoriesRequest} or an equivalent Hash.
1000
+ #
1001
+ # @param request [::Google::Cloud::Build::V2::ListRepositoriesRequest, ::Hash]
1002
+ # A request object representing the call parameters. Required. To specify no
1003
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1004
+ # @param options [::Gapic::CallOptions, ::Hash]
1005
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1006
+ #
1007
+ # @overload list_repositories(parent: nil, page_size: nil, page_token: nil, filter: nil)
1008
+ # Pass arguments to `list_repositories` via keyword arguments. Note that at
1009
+ # least one keyword argument is required. To specify no parameters, or to keep all
1010
+ # the default parameter values, pass an empty Hash as a request object (see above).
1011
+ #
1012
+ # @param parent [::String]
1013
+ # Required. The parent, which owns this collection of Repositories.
1014
+ # Format: `projects/*/locations/*/connections/*`.
1015
+ # @param page_size [::Integer]
1016
+ # Number of results to return in the list.
1017
+ # @param page_token [::String]
1018
+ # Page start.
1019
+ # @param filter [::String]
1020
+ # A filter expression that filters resources listed in the response.
1021
+ # Expressions must follow API improvement proposal
1022
+ # [AIP-160](https://google.aip.dev/160). e.g.
1023
+ # `remote_uri:"https://github.com*"`.
1024
+ # @yield [result, operation] Access the result along with the TransportOperation object
1025
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V2::Repository>]
1026
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1027
+ #
1028
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V2::Repository>]
1029
+ #
1030
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1031
+ #
1032
+ # @example Basic example
1033
+ # require "google/cloud/build/v2"
1034
+ #
1035
+ # # Create a client object. The client can be reused for multiple calls.
1036
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
1037
+ #
1038
+ # # Create a request. To set request fields, pass in keyword arguments.
1039
+ # request = Google::Cloud::Build::V2::ListRepositoriesRequest.new
1040
+ #
1041
+ # # Call the list_repositories method.
1042
+ # result = client.list_repositories request
1043
+ #
1044
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1045
+ # # over elements, and API calls will be issued to fetch pages as needed.
1046
+ # result.each do |item|
1047
+ # # Each element is of type ::Google::Cloud::Build::V2::Repository.
1048
+ # p item
1049
+ # end
1050
+ #
1051
+ def list_repositories request, options = nil
1052
+ raise ::ArgumentError, "request must be provided" if request.nil?
1053
+
1054
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::ListRepositoriesRequest
1055
+
1056
+ # Converts hash and nil to an options object
1057
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1058
+
1059
+ # Customize the options with defaults
1060
+ call_metadata = @config.rpcs.list_repositories.metadata.to_h
1061
+
1062
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1063
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1064
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1065
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
1066
+ transports_version_send: [:rest]
1067
+
1068
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1069
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1070
+
1071
+ options.apply_defaults timeout: @config.rpcs.list_repositories.timeout,
1072
+ metadata: call_metadata,
1073
+ retry_policy: @config.rpcs.list_repositories.retry_policy
1074
+
1075
+ options.apply_defaults timeout: @config.timeout,
1076
+ metadata: @config.metadata,
1077
+ retry_policy: @config.retry_policy
1078
+
1079
+ @repository_manager_stub.list_repositories request, options do |result, operation|
1080
+ result = ::Gapic::Rest::PagedEnumerable.new @repository_manager_stub, :list_repositories, "repositories", request, result, options
1081
+ yield result, operation if block_given?
1082
+ throw :response, result
1083
+ end
1084
+ rescue ::Gapic::Rest::Error => e
1085
+ raise ::Google::Cloud::Error.from_error(e)
1086
+ end
1087
+
1088
+ ##
1089
+ # Deletes a single repository.
1090
+ #
1091
+ # @overload delete_repository(request, options = nil)
1092
+ # Pass arguments to `delete_repository` via a request object, either of type
1093
+ # {::Google::Cloud::Build::V2::DeleteRepositoryRequest} or an equivalent Hash.
1094
+ #
1095
+ # @param request [::Google::Cloud::Build::V2::DeleteRepositoryRequest, ::Hash]
1096
+ # A request object representing the call parameters. Required. To specify no
1097
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1098
+ # @param options [::Gapic::CallOptions, ::Hash]
1099
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1100
+ #
1101
+ # @overload delete_repository(name: nil, etag: nil, validate_only: nil)
1102
+ # Pass arguments to `delete_repository` via keyword arguments. Note that at
1103
+ # least one keyword argument is required. To specify no parameters, or to keep all
1104
+ # the default parameter values, pass an empty Hash as a request object (see above).
1105
+ #
1106
+ # @param name [::String]
1107
+ # Required. The name of the Repository to delete.
1108
+ # Format: `projects/*/locations/*/connections/*/repositories/*`.
1109
+ # @param etag [::String]
1110
+ # The current etag of the repository.
1111
+ # If an etag is provided and does not match the current etag of the
1112
+ # repository, deletion will be blocked and an ABORTED error will be returned.
1113
+ # @param validate_only [::Boolean]
1114
+ # If set, validate the request, but do not actually post it.
1115
+ # @yield [result, operation] Access the result along with the TransportOperation object
1116
+ # @yieldparam result [::Gapic::Operation]
1117
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1118
+ #
1119
+ # @return [::Gapic::Operation]
1120
+ #
1121
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1122
+ #
1123
+ # @example Basic example
1124
+ # require "google/cloud/build/v2"
1125
+ #
1126
+ # # Create a client object. The client can be reused for multiple calls.
1127
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
1128
+ #
1129
+ # # Create a request. To set request fields, pass in keyword arguments.
1130
+ # request = Google::Cloud::Build::V2::DeleteRepositoryRequest.new
1131
+ #
1132
+ # # Call the delete_repository method.
1133
+ # result = client.delete_repository request
1134
+ #
1135
+ # # The returned object is of type Gapic::Operation. You can use it to
1136
+ # # check the status of an operation, cancel it, or wait for results.
1137
+ # # Here is how to wait for a response.
1138
+ # result.wait_until_done! timeout: 60
1139
+ # if result.response?
1140
+ # p result.response
1141
+ # else
1142
+ # puts "No response received."
1143
+ # end
1144
+ #
1145
+ def delete_repository request, options = nil
1146
+ raise ::ArgumentError, "request must be provided" if request.nil?
1147
+
1148
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::DeleteRepositoryRequest
1149
+
1150
+ # Converts hash and nil to an options object
1151
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1152
+
1153
+ # Customize the options with defaults
1154
+ call_metadata = @config.rpcs.delete_repository.metadata.to_h
1155
+
1156
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1157
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1158
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1159
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
1160
+ transports_version_send: [:rest]
1161
+
1162
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1163
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1164
+
1165
+ options.apply_defaults timeout: @config.rpcs.delete_repository.timeout,
1166
+ metadata: call_metadata,
1167
+ retry_policy: @config.rpcs.delete_repository.retry_policy
1168
+
1169
+ options.apply_defaults timeout: @config.timeout,
1170
+ metadata: @config.metadata,
1171
+ retry_policy: @config.retry_policy
1172
+
1173
+ @repository_manager_stub.delete_repository request, options do |result, operation|
1174
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1175
+ yield result, operation if block_given?
1176
+ throw :response, result
1177
+ end
1178
+ rescue ::Gapic::Rest::Error => e
1179
+ raise ::Google::Cloud::Error.from_error(e)
1180
+ end
1181
+
1182
+ ##
1183
+ # Fetches read/write token of a given repository.
1184
+ #
1185
+ # @overload fetch_read_write_token(request, options = nil)
1186
+ # Pass arguments to `fetch_read_write_token` via a request object, either of type
1187
+ # {::Google::Cloud::Build::V2::FetchReadWriteTokenRequest} or an equivalent Hash.
1188
+ #
1189
+ # @param request [::Google::Cloud::Build::V2::FetchReadWriteTokenRequest, ::Hash]
1190
+ # A request object representing the call parameters. Required. To specify no
1191
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1192
+ # @param options [::Gapic::CallOptions, ::Hash]
1193
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1194
+ #
1195
+ # @overload fetch_read_write_token(repository: nil)
1196
+ # Pass arguments to `fetch_read_write_token` via keyword arguments. Note that at
1197
+ # least one keyword argument is required. To specify no parameters, or to keep all
1198
+ # the default parameter values, pass an empty Hash as a request object (see above).
1199
+ #
1200
+ # @param repository [::String]
1201
+ # Required. The resource name of the repository in the format
1202
+ # `projects/*/locations/*/connections/*/repositories/*`.
1203
+ # @yield [result, operation] Access the result along with the TransportOperation object
1204
+ # @yieldparam result [::Google::Cloud::Build::V2::FetchReadWriteTokenResponse]
1205
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1206
+ #
1207
+ # @return [::Google::Cloud::Build::V2::FetchReadWriteTokenResponse]
1208
+ #
1209
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1210
+ #
1211
+ # @example Basic example
1212
+ # require "google/cloud/build/v2"
1213
+ #
1214
+ # # Create a client object. The client can be reused for multiple calls.
1215
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
1216
+ #
1217
+ # # Create a request. To set request fields, pass in keyword arguments.
1218
+ # request = Google::Cloud::Build::V2::FetchReadWriteTokenRequest.new
1219
+ #
1220
+ # # Call the fetch_read_write_token method.
1221
+ # result = client.fetch_read_write_token request
1222
+ #
1223
+ # # The returned object is of type Google::Cloud::Build::V2::FetchReadWriteTokenResponse.
1224
+ # p result
1225
+ #
1226
+ def fetch_read_write_token request, options = nil
1227
+ raise ::ArgumentError, "request must be provided" if request.nil?
1228
+
1229
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::FetchReadWriteTokenRequest
1230
+
1231
+ # Converts hash and nil to an options object
1232
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1233
+
1234
+ # Customize the options with defaults
1235
+ call_metadata = @config.rpcs.fetch_read_write_token.metadata.to_h
1236
+
1237
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1238
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1239
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1240
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
1241
+ transports_version_send: [:rest]
1242
+
1243
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1244
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1245
+
1246
+ options.apply_defaults timeout: @config.rpcs.fetch_read_write_token.timeout,
1247
+ metadata: call_metadata,
1248
+ retry_policy: @config.rpcs.fetch_read_write_token.retry_policy
1249
+
1250
+ options.apply_defaults timeout: @config.timeout,
1251
+ metadata: @config.metadata,
1252
+ retry_policy: @config.retry_policy
1253
+
1254
+ @repository_manager_stub.fetch_read_write_token request, options do |result, operation|
1255
+ yield result, operation if block_given?
1256
+ end
1257
+ rescue ::Gapic::Rest::Error => e
1258
+ raise ::Google::Cloud::Error.from_error(e)
1259
+ end
1260
+
1261
+ ##
1262
+ # Fetches read token of a given repository.
1263
+ #
1264
+ # @overload fetch_read_token(request, options = nil)
1265
+ # Pass arguments to `fetch_read_token` via a request object, either of type
1266
+ # {::Google::Cloud::Build::V2::FetchReadTokenRequest} or an equivalent Hash.
1267
+ #
1268
+ # @param request [::Google::Cloud::Build::V2::FetchReadTokenRequest, ::Hash]
1269
+ # A request object representing the call parameters. Required. To specify no
1270
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1271
+ # @param options [::Gapic::CallOptions, ::Hash]
1272
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1273
+ #
1274
+ # @overload fetch_read_token(repository: nil)
1275
+ # Pass arguments to `fetch_read_token` via keyword arguments. Note that at
1276
+ # least one keyword argument is required. To specify no parameters, or to keep all
1277
+ # the default parameter values, pass an empty Hash as a request object (see above).
1278
+ #
1279
+ # @param repository [::String]
1280
+ # Required. The resource name of the repository in the format
1281
+ # `projects/*/locations/*/connections/*/repositories/*`.
1282
+ # @yield [result, operation] Access the result along with the TransportOperation object
1283
+ # @yieldparam result [::Google::Cloud::Build::V2::FetchReadTokenResponse]
1284
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1285
+ #
1286
+ # @return [::Google::Cloud::Build::V2::FetchReadTokenResponse]
1287
+ #
1288
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1289
+ #
1290
+ # @example Basic example
1291
+ # require "google/cloud/build/v2"
1292
+ #
1293
+ # # Create a client object. The client can be reused for multiple calls.
1294
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
1295
+ #
1296
+ # # Create a request. To set request fields, pass in keyword arguments.
1297
+ # request = Google::Cloud::Build::V2::FetchReadTokenRequest.new
1298
+ #
1299
+ # # Call the fetch_read_token method.
1300
+ # result = client.fetch_read_token request
1301
+ #
1302
+ # # The returned object is of type Google::Cloud::Build::V2::FetchReadTokenResponse.
1303
+ # p result
1304
+ #
1305
+ def fetch_read_token request, options = nil
1306
+ raise ::ArgumentError, "request must be provided" if request.nil?
1307
+
1308
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::FetchReadTokenRequest
1309
+
1310
+ # Converts hash and nil to an options object
1311
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1312
+
1313
+ # Customize the options with defaults
1314
+ call_metadata = @config.rpcs.fetch_read_token.metadata.to_h
1315
+
1316
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1317
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1318
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1319
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
1320
+ transports_version_send: [:rest]
1321
+
1322
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1323
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1324
+
1325
+ options.apply_defaults timeout: @config.rpcs.fetch_read_token.timeout,
1326
+ metadata: call_metadata,
1327
+ retry_policy: @config.rpcs.fetch_read_token.retry_policy
1328
+
1329
+ options.apply_defaults timeout: @config.timeout,
1330
+ metadata: @config.metadata,
1331
+ retry_policy: @config.retry_policy
1332
+
1333
+ @repository_manager_stub.fetch_read_token request, options do |result, operation|
1334
+ yield result, operation if block_given?
1335
+ end
1336
+ rescue ::Gapic::Rest::Error => e
1337
+ raise ::Google::Cloud::Error.from_error(e)
1338
+ end
1339
+
1340
+ ##
1341
+ # FetchLinkableRepositories get repositories from SCM that are
1342
+ # accessible and could be added to the connection.
1343
+ #
1344
+ # @overload fetch_linkable_repositories(request, options = nil)
1345
+ # Pass arguments to `fetch_linkable_repositories` via a request object, either of type
1346
+ # {::Google::Cloud::Build::V2::FetchLinkableRepositoriesRequest} or an equivalent Hash.
1347
+ #
1348
+ # @param request [::Google::Cloud::Build::V2::FetchLinkableRepositoriesRequest, ::Hash]
1349
+ # A request object representing the call parameters. Required. To specify no
1350
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1351
+ # @param options [::Gapic::CallOptions, ::Hash]
1352
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1353
+ #
1354
+ # @overload fetch_linkable_repositories(connection: nil, page_size: nil, page_token: nil)
1355
+ # Pass arguments to `fetch_linkable_repositories` via keyword arguments. Note that at
1356
+ # least one keyword argument is required. To specify no parameters, or to keep all
1357
+ # the default parameter values, pass an empty Hash as a request object (see above).
1358
+ #
1359
+ # @param connection [::String]
1360
+ # Required. The name of the Connection.
1361
+ # Format: `projects/*/locations/*/connections/*`.
1362
+ # @param page_size [::Integer]
1363
+ # Number of results to return in the list. Default to 20.
1364
+ # @param page_token [::String]
1365
+ # Page start.
1366
+ # @yield [result, operation] Access the result along with the TransportOperation object
1367
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V2::Repository>]
1368
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1369
+ #
1370
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V2::Repository>]
1371
+ #
1372
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1373
+ #
1374
+ # @example Basic example
1375
+ # require "google/cloud/build/v2"
1376
+ #
1377
+ # # Create a client object. The client can be reused for multiple calls.
1378
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
1379
+ #
1380
+ # # Create a request. To set request fields, pass in keyword arguments.
1381
+ # request = Google::Cloud::Build::V2::FetchLinkableRepositoriesRequest.new
1382
+ #
1383
+ # # Call the fetch_linkable_repositories method.
1384
+ # result = client.fetch_linkable_repositories request
1385
+ #
1386
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1387
+ # # over elements, and API calls will be issued to fetch pages as needed.
1388
+ # result.each do |item|
1389
+ # # Each element is of type ::Google::Cloud::Build::V2::Repository.
1390
+ # p item
1391
+ # end
1392
+ #
1393
+ def fetch_linkable_repositories request, options = nil
1394
+ raise ::ArgumentError, "request must be provided" if request.nil?
1395
+
1396
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::FetchLinkableRepositoriesRequest
1397
+
1398
+ # Converts hash and nil to an options object
1399
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1400
+
1401
+ # Customize the options with defaults
1402
+ call_metadata = @config.rpcs.fetch_linkable_repositories.metadata.to_h
1403
+
1404
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1405
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1406
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1407
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
1408
+ transports_version_send: [:rest]
1409
+
1410
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1411
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1412
+
1413
+ options.apply_defaults timeout: @config.rpcs.fetch_linkable_repositories.timeout,
1414
+ metadata: call_metadata,
1415
+ retry_policy: @config.rpcs.fetch_linkable_repositories.retry_policy
1416
+
1417
+ options.apply_defaults timeout: @config.timeout,
1418
+ metadata: @config.metadata,
1419
+ retry_policy: @config.retry_policy
1420
+
1421
+ @repository_manager_stub.fetch_linkable_repositories request, options do |result, operation|
1422
+ result = ::Gapic::Rest::PagedEnumerable.new @repository_manager_stub, :fetch_linkable_repositories, "repositories", request, result, options
1423
+ yield result, operation if block_given?
1424
+ throw :response, result
1425
+ end
1426
+ rescue ::Gapic::Rest::Error => e
1427
+ raise ::Google::Cloud::Error.from_error(e)
1428
+ end
1429
+
1430
+ ##
1431
+ # Fetch the list of branches or tags for a given repository.
1432
+ #
1433
+ # @overload fetch_git_refs(request, options = nil)
1434
+ # Pass arguments to `fetch_git_refs` via a request object, either of type
1435
+ # {::Google::Cloud::Build::V2::FetchGitRefsRequest} or an equivalent Hash.
1436
+ #
1437
+ # @param request [::Google::Cloud::Build::V2::FetchGitRefsRequest, ::Hash]
1438
+ # A request object representing the call parameters. Required. To specify no
1439
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1440
+ # @param options [::Gapic::CallOptions, ::Hash]
1441
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1442
+ #
1443
+ # @overload fetch_git_refs(repository: nil, ref_type: nil)
1444
+ # Pass arguments to `fetch_git_refs` via keyword arguments. Note that at
1445
+ # least one keyword argument is required. To specify no parameters, or to keep all
1446
+ # the default parameter values, pass an empty Hash as a request object (see above).
1447
+ #
1448
+ # @param repository [::String]
1449
+ # Required. The resource name of the repository in the format
1450
+ # `projects/*/locations/*/connections/*/repositories/*`.
1451
+ # @param ref_type [::Google::Cloud::Build::V2::FetchGitRefsRequest::RefType]
1452
+ # Type of refs to fetch
1453
+ # @yield [result, operation] Access the result along with the TransportOperation object
1454
+ # @yieldparam result [::Google::Cloud::Build::V2::FetchGitRefsResponse]
1455
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1456
+ #
1457
+ # @return [::Google::Cloud::Build::V2::FetchGitRefsResponse]
1458
+ #
1459
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1460
+ #
1461
+ # @example Basic example
1462
+ # require "google/cloud/build/v2"
1463
+ #
1464
+ # # Create a client object. The client can be reused for multiple calls.
1465
+ # client = Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new
1466
+ #
1467
+ # # Create a request. To set request fields, pass in keyword arguments.
1468
+ # request = Google::Cloud::Build::V2::FetchGitRefsRequest.new
1469
+ #
1470
+ # # Call the fetch_git_refs method.
1471
+ # result = client.fetch_git_refs request
1472
+ #
1473
+ # # The returned object is of type Google::Cloud::Build::V2::FetchGitRefsResponse.
1474
+ # p result
1475
+ #
1476
+ def fetch_git_refs request, options = nil
1477
+ raise ::ArgumentError, "request must be provided" if request.nil?
1478
+
1479
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V2::FetchGitRefsRequest
1480
+
1481
+ # Converts hash and nil to an options object
1482
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1483
+
1484
+ # Customize the options with defaults
1485
+ call_metadata = @config.rpcs.fetch_git_refs.metadata.to_h
1486
+
1487
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1488
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1489
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1490
+ gapic_version: ::Google::Cloud::Build::V2::VERSION,
1491
+ transports_version_send: [:rest]
1492
+
1493
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1494
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1495
+
1496
+ options.apply_defaults timeout: @config.rpcs.fetch_git_refs.timeout,
1497
+ metadata: call_metadata,
1498
+ retry_policy: @config.rpcs.fetch_git_refs.retry_policy
1499
+
1500
+ options.apply_defaults timeout: @config.timeout,
1501
+ metadata: @config.metadata,
1502
+ retry_policy: @config.retry_policy
1503
+
1504
+ @repository_manager_stub.fetch_git_refs request, options do |result, operation|
1505
+ yield result, operation if block_given?
1506
+ end
1507
+ rescue ::Gapic::Rest::Error => e
1508
+ raise ::Google::Cloud::Error.from_error(e)
1509
+ end
1510
+
1511
+ ##
1512
+ # Configuration class for the RepositoryManager REST API.
1513
+ #
1514
+ # This class represents the configuration for RepositoryManager REST,
1515
+ # providing control over timeouts, retry behavior, logging, transport
1516
+ # parameters, and other low-level controls. Certain parameters can also be
1517
+ # applied individually to specific RPCs. See
1518
+ # {::Google::Cloud::Build::V2::RepositoryManager::Rest::Client::Configuration::Rpcs}
1519
+ # for a list of RPCs that can be configured independently.
1520
+ #
1521
+ # Configuration can be applied globally to all clients, or to a single client
1522
+ # on construction.
1523
+ #
1524
+ # @example
1525
+ #
1526
+ # # Modify the global config, setting the timeout for
1527
+ # # create_connection to 20 seconds,
1528
+ # # and all remaining timeouts to 10 seconds.
1529
+ # ::Google::Cloud::Build::V2::RepositoryManager::Rest::Client.configure do |config|
1530
+ # config.timeout = 10.0
1531
+ # config.rpcs.create_connection.timeout = 20.0
1532
+ # end
1533
+ #
1534
+ # # Apply the above configuration only to a new client.
1535
+ # client = ::Google::Cloud::Build::V2::RepositoryManager::Rest::Client.new do |config|
1536
+ # config.timeout = 10.0
1537
+ # config.rpcs.create_connection.timeout = 20.0
1538
+ # end
1539
+ #
1540
+ # @!attribute [rw] endpoint
1541
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1542
+ # nil, indicating to use the default endpoint in the current universe domain.
1543
+ # @return [::String,nil]
1544
+ # @!attribute [rw] credentials
1545
+ # Credentials to send with calls. You may provide any of the following types:
1546
+ # * (`String`) The path to a service account key file in JSON format
1547
+ # * (`Hash`) A service account key as a Hash
1548
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1549
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1550
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1551
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1552
+ # * (`nil`) indicating no credentials
1553
+ #
1554
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1555
+ # external source for authentication to Google Cloud, you must validate it before
1556
+ # providing it to a Google API client library. Providing an unvalidated credential
1557
+ # configuration to Google APIs can compromise the security of your systems and data.
1558
+ # For more information, refer to [Validate credential configurations from external
1559
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1560
+ # @return [::Object]
1561
+ # @!attribute [rw] scope
1562
+ # The OAuth scopes
1563
+ # @return [::Array<::String>]
1564
+ # @!attribute [rw] lib_name
1565
+ # The library name as recorded in instrumentation and logging
1566
+ # @return [::String]
1567
+ # @!attribute [rw] lib_version
1568
+ # The library version as recorded in instrumentation and logging
1569
+ # @return [::String]
1570
+ # @!attribute [rw] timeout
1571
+ # The call timeout in seconds.
1572
+ # @return [::Numeric]
1573
+ # @!attribute [rw] metadata
1574
+ # Additional headers to be sent with the call.
1575
+ # @return [::Hash{::Symbol=>::String}]
1576
+ # @!attribute [rw] retry_policy
1577
+ # The retry policy. The value is a hash with the following keys:
1578
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1579
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1580
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1581
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1582
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1583
+ # trigger a retry.
1584
+ # @return [::Hash]
1585
+ # @!attribute [rw] quota_project
1586
+ # A separate project against which to charge quota.
1587
+ # @return [::String]
1588
+ # @!attribute [rw] universe_domain
1589
+ # The universe domain within which to make requests. This determines the
1590
+ # default endpoint URL. The default value of nil uses the environment
1591
+ # universe (usually the default "googleapis.com" universe).
1592
+ # @return [::String,nil]
1593
+ # @!attribute [rw] logger
1594
+ # A custom logger to use for request/response debug logging, or the value
1595
+ # `:default` (the default) to construct a default logger, or `nil` to
1596
+ # explicitly disable logging.
1597
+ # @return [::Logger,:default,nil]
1598
+ #
1599
+ class Configuration
1600
+ extend ::Gapic::Config
1601
+
1602
+ # @private
1603
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1604
+ DEFAULT_ENDPOINT = "cloudbuild.googleapis.com"
1605
+
1606
+ config_attr :endpoint, nil, ::String, nil
1607
+ config_attr :credentials, nil do |value|
1608
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1609
+ allowed.any? { |klass| klass === value }
1610
+ end
1611
+ config_attr :scope, nil, ::String, ::Array, nil
1612
+ config_attr :lib_name, nil, ::String, nil
1613
+ config_attr :lib_version, nil, ::String, nil
1614
+ config_attr :timeout, nil, ::Numeric, nil
1615
+ config_attr :metadata, nil, ::Hash, nil
1616
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1617
+ config_attr :quota_project, nil, ::String, nil
1618
+ config_attr :universe_domain, nil, ::String, nil
1619
+
1620
+ # @private
1621
+ # Overrides for http bindings for the RPCs of this service
1622
+ # are only used when this service is used as mixin, and only
1623
+ # by the host service.
1624
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1625
+ config_attr :bindings_override, {}, ::Hash, nil
1626
+ config_attr :logger, :default, ::Logger, nil, :default
1627
+
1628
+ # @private
1629
+ def initialize parent_config = nil
1630
+ @parent_config = parent_config unless parent_config.nil?
1631
+
1632
+ yield self if block_given?
1633
+ end
1634
+
1635
+ ##
1636
+ # Configurations for individual RPCs
1637
+ # @return [Rpcs]
1638
+ #
1639
+ def rpcs
1640
+ @rpcs ||= begin
1641
+ parent_rpcs = nil
1642
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1643
+ Rpcs.new parent_rpcs
1644
+ end
1645
+ end
1646
+
1647
+ ##
1648
+ # Configuration RPC class for the RepositoryManager API.
1649
+ #
1650
+ # Includes fields providing the configuration for each RPC in this service.
1651
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1652
+ # the following configuration fields:
1653
+ #
1654
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1655
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1656
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1657
+ # include the following keys:
1658
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1659
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1660
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1661
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1662
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1663
+ # trigger a retry.
1664
+ #
1665
+ class Rpcs
1666
+ ##
1667
+ # RPC-specific configuration for `create_connection`
1668
+ # @return [::Gapic::Config::Method]
1669
+ #
1670
+ attr_reader :create_connection
1671
+ ##
1672
+ # RPC-specific configuration for `get_connection`
1673
+ # @return [::Gapic::Config::Method]
1674
+ #
1675
+ attr_reader :get_connection
1676
+ ##
1677
+ # RPC-specific configuration for `list_connections`
1678
+ # @return [::Gapic::Config::Method]
1679
+ #
1680
+ attr_reader :list_connections
1681
+ ##
1682
+ # RPC-specific configuration for `update_connection`
1683
+ # @return [::Gapic::Config::Method]
1684
+ #
1685
+ attr_reader :update_connection
1686
+ ##
1687
+ # RPC-specific configuration for `delete_connection`
1688
+ # @return [::Gapic::Config::Method]
1689
+ #
1690
+ attr_reader :delete_connection
1691
+ ##
1692
+ # RPC-specific configuration for `create_repository`
1693
+ # @return [::Gapic::Config::Method]
1694
+ #
1695
+ attr_reader :create_repository
1696
+ ##
1697
+ # RPC-specific configuration for `batch_create_repositories`
1698
+ # @return [::Gapic::Config::Method]
1699
+ #
1700
+ attr_reader :batch_create_repositories
1701
+ ##
1702
+ # RPC-specific configuration for `get_repository`
1703
+ # @return [::Gapic::Config::Method]
1704
+ #
1705
+ attr_reader :get_repository
1706
+ ##
1707
+ # RPC-specific configuration for `list_repositories`
1708
+ # @return [::Gapic::Config::Method]
1709
+ #
1710
+ attr_reader :list_repositories
1711
+ ##
1712
+ # RPC-specific configuration for `delete_repository`
1713
+ # @return [::Gapic::Config::Method]
1714
+ #
1715
+ attr_reader :delete_repository
1716
+ ##
1717
+ # RPC-specific configuration for `fetch_read_write_token`
1718
+ # @return [::Gapic::Config::Method]
1719
+ #
1720
+ attr_reader :fetch_read_write_token
1721
+ ##
1722
+ # RPC-specific configuration for `fetch_read_token`
1723
+ # @return [::Gapic::Config::Method]
1724
+ #
1725
+ attr_reader :fetch_read_token
1726
+ ##
1727
+ # RPC-specific configuration for `fetch_linkable_repositories`
1728
+ # @return [::Gapic::Config::Method]
1729
+ #
1730
+ attr_reader :fetch_linkable_repositories
1731
+ ##
1732
+ # RPC-specific configuration for `fetch_git_refs`
1733
+ # @return [::Gapic::Config::Method]
1734
+ #
1735
+ attr_reader :fetch_git_refs
1736
+
1737
+ # @private
1738
+ def initialize parent_rpcs = nil
1739
+ create_connection_config = parent_rpcs.create_connection if parent_rpcs.respond_to? :create_connection
1740
+ @create_connection = ::Gapic::Config::Method.new create_connection_config
1741
+ get_connection_config = parent_rpcs.get_connection if parent_rpcs.respond_to? :get_connection
1742
+ @get_connection = ::Gapic::Config::Method.new get_connection_config
1743
+ list_connections_config = parent_rpcs.list_connections if parent_rpcs.respond_to? :list_connections
1744
+ @list_connections = ::Gapic::Config::Method.new list_connections_config
1745
+ update_connection_config = parent_rpcs.update_connection if parent_rpcs.respond_to? :update_connection
1746
+ @update_connection = ::Gapic::Config::Method.new update_connection_config
1747
+ delete_connection_config = parent_rpcs.delete_connection if parent_rpcs.respond_to? :delete_connection
1748
+ @delete_connection = ::Gapic::Config::Method.new delete_connection_config
1749
+ create_repository_config = parent_rpcs.create_repository if parent_rpcs.respond_to? :create_repository
1750
+ @create_repository = ::Gapic::Config::Method.new create_repository_config
1751
+ batch_create_repositories_config = parent_rpcs.batch_create_repositories if parent_rpcs.respond_to? :batch_create_repositories
1752
+ @batch_create_repositories = ::Gapic::Config::Method.new batch_create_repositories_config
1753
+ get_repository_config = parent_rpcs.get_repository if parent_rpcs.respond_to? :get_repository
1754
+ @get_repository = ::Gapic::Config::Method.new get_repository_config
1755
+ list_repositories_config = parent_rpcs.list_repositories if parent_rpcs.respond_to? :list_repositories
1756
+ @list_repositories = ::Gapic::Config::Method.new list_repositories_config
1757
+ delete_repository_config = parent_rpcs.delete_repository if parent_rpcs.respond_to? :delete_repository
1758
+ @delete_repository = ::Gapic::Config::Method.new delete_repository_config
1759
+ fetch_read_write_token_config = parent_rpcs.fetch_read_write_token if parent_rpcs.respond_to? :fetch_read_write_token
1760
+ @fetch_read_write_token = ::Gapic::Config::Method.new fetch_read_write_token_config
1761
+ fetch_read_token_config = parent_rpcs.fetch_read_token if parent_rpcs.respond_to? :fetch_read_token
1762
+ @fetch_read_token = ::Gapic::Config::Method.new fetch_read_token_config
1763
+ fetch_linkable_repositories_config = parent_rpcs.fetch_linkable_repositories if parent_rpcs.respond_to? :fetch_linkable_repositories
1764
+ @fetch_linkable_repositories = ::Gapic::Config::Method.new fetch_linkable_repositories_config
1765
+ fetch_git_refs_config = parent_rpcs.fetch_git_refs if parent_rpcs.respond_to? :fetch_git_refs
1766
+ @fetch_git_refs = ::Gapic::Config::Method.new fetch_git_refs_config
1767
+
1768
+ yield self if block_given?
1769
+ end
1770
+ end
1771
+ end
1772
+ end
1773
+ end
1774
+ end
1775
+ end
1776
+ end
1777
+ end
1778
+ end