google-cloud-secret_manager-v1beta2 0.a → 0.1.0

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