google-cloud-secret_manager-v1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/README.md +24 -0
- data/lib/google-cloud-secret_manager-v1.rb +1 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/secret_manager/v1.rb +19 -0
- data/lib/google/cloud/secret_manager/v1/secret_manager_service.rb +20 -0
- data/lib/google/cloud/secret_manager/v1/secret_manager_service/client.rb +1442 -0
- data/lib/google/cloud/secret_manager/v1/secret_manager_service/credentials.rb +52 -0
- data/lib/google/cloud/secret_manager/v1/secret_manager_service/paths.rb +81 -0
- data/lib/google/cloud/secret_manager/v1/version.rb +28 -0
- data/lib/google/cloud/secretmanager/v1/resources_pb.rb +65 -0
- data/lib/google/cloud/secretmanager/v1/service_pb.rb +100 -0
- data/lib/google/cloud/secretmanager/v1/service_services_pb.rb +112 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/secretmanager/v1/resources.rb +162 -0
- data/proto_docs/google/cloud/secretmanager/v1/service.rb +224 -0
- data/proto_docs/google/iam/v1/iam_policy.rb +79 -0
- data/proto_docs/google/iam/v1/policy.rb +156 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +237 -0
- data/proto_docs/google/protobuf/timestamp.rb +116 -0
- metadata +194 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/secret_manager/v1/secret_manager_service/client"
|
20
|
+
require "google/cloud/secret_manager/v1/secret_manager_service/credentials"
|
@@ -0,0 +1,1442 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/errors"
|
24
|
+
require "google/cloud/secret_manager/v1/version"
|
25
|
+
require "google/cloud/secretmanager/v1/service_pb"
|
26
|
+
require "google/cloud/secret_manager/v1/secret_manager_service/credentials"
|
27
|
+
require "google/cloud/secret_manager/v1/secret_manager_service/paths"
|
28
|
+
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module SecretManager
|
33
|
+
module V1
|
34
|
+
module SecretManagerService
|
35
|
+
# Service that implements SecretManagerService API.
|
36
|
+
class Client
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :secret_manager_service_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the SecretManagerService Client class.
|
44
|
+
#
|
45
|
+
# See {Google::Cloud::SecretManager::V1::SecretManagerService::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# ## Example
|
49
|
+
#
|
50
|
+
# To modify the configuration for all SecretManagerService clients:
|
51
|
+
#
|
52
|
+
# Google::Cloud::SecretManager::V1::SecretManagerService::Client.configure do |config|
|
53
|
+
# config.timeout = 10_000
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# @yield [config] Configure the Client client.
|
57
|
+
# @yieldparam config [Client::Configuration]
|
58
|
+
#
|
59
|
+
# @return [Client::Configuration]
|
60
|
+
#
|
61
|
+
def self.configure
|
62
|
+
@configure ||= begin
|
63
|
+
namespace = ["Google", "Cloud", "SecretManager", "V1"]
|
64
|
+
parent_config = while namespace.any?
|
65
|
+
parent_name = namespace.join "::"
|
66
|
+
parent_const = const_get parent_name
|
67
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
68
|
+
namespace.pop
|
69
|
+
end
|
70
|
+
default_config = Client::Configuration.new parent_config
|
71
|
+
|
72
|
+
default_config.rpcs.list_secrets.timeout = 60.0
|
73
|
+
|
74
|
+
default_config.rpcs.create_secret.timeout = 60.0
|
75
|
+
|
76
|
+
default_config.rpcs.add_secret_version.timeout = 60.0
|
77
|
+
|
78
|
+
default_config.rpcs.get_secret.timeout = 60.0
|
79
|
+
|
80
|
+
default_config.rpcs.update_secret.timeout = 60.0
|
81
|
+
|
82
|
+
default_config.rpcs.delete_secret.timeout = 60.0
|
83
|
+
|
84
|
+
default_config.rpcs.list_secret_versions.timeout = 60.0
|
85
|
+
|
86
|
+
default_config.rpcs.get_secret_version.timeout = 60.0
|
87
|
+
|
88
|
+
default_config.rpcs.access_secret_version.timeout = 60.0
|
89
|
+
default_config.rpcs.access_secret_version.retry_policy = {
|
90
|
+
initial_delay: 1.0,
|
91
|
+
max_delay: 60.0,
|
92
|
+
multiplier: 1.3,
|
93
|
+
retry_codes: ["UNAVAILABLE", "UNKNOWN"]
|
94
|
+
}
|
95
|
+
|
96
|
+
default_config.rpcs.disable_secret_version.timeout = 60.0
|
97
|
+
|
98
|
+
default_config.rpcs.enable_secret_version.timeout = 60.0
|
99
|
+
|
100
|
+
default_config.rpcs.destroy_secret_version.timeout = 60.0
|
101
|
+
|
102
|
+
default_config.rpcs.set_iam_policy.timeout = 60.0
|
103
|
+
|
104
|
+
default_config.rpcs.get_iam_policy.timeout = 60.0
|
105
|
+
|
106
|
+
default_config.rpcs.test_iam_permissions.timeout = 60.0
|
107
|
+
|
108
|
+
default_config
|
109
|
+
end
|
110
|
+
yield @configure if block_given?
|
111
|
+
@configure
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Configure the SecretManagerService Client instance.
|
116
|
+
#
|
117
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
118
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
119
|
+
# should be made on {Client.configure}.
|
120
|
+
#
|
121
|
+
# See {Google::Cloud::SecretManager::V1::SecretManagerService::Client::Configuration}
|
122
|
+
# for a description of the configuration fields.
|
123
|
+
#
|
124
|
+
# @yield [config] Configure the Client client.
|
125
|
+
# @yieldparam config [Client::Configuration]
|
126
|
+
#
|
127
|
+
# @return [Client::Configuration]
|
128
|
+
#
|
129
|
+
def configure
|
130
|
+
yield @config if block_given?
|
131
|
+
@config
|
132
|
+
end
|
133
|
+
|
134
|
+
##
|
135
|
+
# Create a new SecretManagerService client object.
|
136
|
+
#
|
137
|
+
# ## Examples
|
138
|
+
#
|
139
|
+
# To create a new SecretManagerService client with the default
|
140
|
+
# configuration:
|
141
|
+
#
|
142
|
+
# client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new
|
143
|
+
#
|
144
|
+
# To create a new SecretManagerService client with a custom
|
145
|
+
# configuration:
|
146
|
+
#
|
147
|
+
# client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new do |config|
|
148
|
+
# config.timeout = 10_000
|
149
|
+
# end
|
150
|
+
#
|
151
|
+
# @yield [config] Configure the SecretManagerService client.
|
152
|
+
# @yieldparam config [Client::Configuration]
|
153
|
+
#
|
154
|
+
def initialize
|
155
|
+
# These require statements are intentionally placed here to initialize
|
156
|
+
# the gRPC module only when it's required.
|
157
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
158
|
+
require "gapic/grpc"
|
159
|
+
require "google/cloud/secretmanager/v1/service_services_pb"
|
160
|
+
|
161
|
+
# Create the configuration object
|
162
|
+
@config = Configuration.new Client.configure
|
163
|
+
|
164
|
+
# Yield the configuration if needed
|
165
|
+
yield @config if block_given?
|
166
|
+
|
167
|
+
# Create credentials
|
168
|
+
credentials = @config.credentials
|
169
|
+
credentials ||= Credentials.default scope: @config.scope
|
170
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
171
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
172
|
+
end
|
173
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
174
|
+
|
175
|
+
@secret_manager_service_stub = Gapic::ServiceStub.new(
|
176
|
+
Google::Cloud::SecretManager::V1::SecretManagerService::Stub,
|
177
|
+
credentials: credentials,
|
178
|
+
endpoint: @config.endpoint,
|
179
|
+
channel_args: @config.channel_args,
|
180
|
+
interceptors: @config.interceptors
|
181
|
+
)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Service calls
|
185
|
+
|
186
|
+
##
|
187
|
+
# Lists {Google::Cloud::SecretManager::V1::Secret Secrets}.
|
188
|
+
#
|
189
|
+
# @overload list_secrets(request, options = nil)
|
190
|
+
# @param request [Google::Cloud::SecretManager::V1::ListSecretsRequest | Hash]
|
191
|
+
# Lists {Google::Cloud::SecretManager::V1::Secret Secrets}.
|
192
|
+
# @param options [Gapic::CallOptions, Hash]
|
193
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
194
|
+
#
|
195
|
+
# @overload list_secrets(parent: nil, page_size: nil, page_token: nil)
|
196
|
+
# @param parent [String]
|
197
|
+
# Required. The resource name of the project associated with the
|
198
|
+
# {Google::Cloud::SecretManager::V1::Secret Secrets}, in the format `projects/*`.
|
199
|
+
# @param page_size [Integer]
|
200
|
+
# Optional. The maximum number of results to be returned in a single page. If
|
201
|
+
# set to 0, the server decides the number of results to return. If the
|
202
|
+
# number is greater than 25000, it is capped at 25000.
|
203
|
+
# @param page_token [String]
|
204
|
+
# Optional. Pagination token, returned earlier via
|
205
|
+
# {Google::Cloud::SecretManager::V1::ListSecretsResponse#next_page_token ListSecretsResponse.next_page_token}.
|
206
|
+
#
|
207
|
+
#
|
208
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
209
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1::Secret>]
|
210
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
211
|
+
#
|
212
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1::Secret>]
|
213
|
+
#
|
214
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
215
|
+
#
|
216
|
+
def list_secrets request, options = nil
|
217
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
218
|
+
|
219
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::ListSecretsRequest
|
220
|
+
|
221
|
+
# Converts hash and nil to an options object
|
222
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
223
|
+
|
224
|
+
# Customize the options with defaults
|
225
|
+
metadata = @config.rpcs.list_secrets.metadata.to_h
|
226
|
+
|
227
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
228
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
229
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
230
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
231
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
232
|
+
|
233
|
+
header_params = {
|
234
|
+
"parent" => request.parent
|
235
|
+
}
|
236
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
237
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
238
|
+
|
239
|
+
options.apply_defaults timeout: @config.rpcs.list_secrets.timeout,
|
240
|
+
metadata: metadata,
|
241
|
+
retry_policy: @config.rpcs.list_secrets.retry_policy
|
242
|
+
options.apply_defaults metadata: @config.metadata,
|
243
|
+
retry_policy: @config.retry_policy
|
244
|
+
|
245
|
+
@secret_manager_service_stub.call_rpc :list_secrets, request, options: options do |response, operation|
|
246
|
+
response = Gapic::PagedEnumerable.new @secret_manager_service_stub, :list_secrets, request, response, operation, options
|
247
|
+
yield response, operation if block_given?
|
248
|
+
return response
|
249
|
+
end
|
250
|
+
rescue GRPC::BadStatus => e
|
251
|
+
raise Google::Cloud::Error.from_error(e)
|
252
|
+
end
|
253
|
+
|
254
|
+
##
|
255
|
+
# Creates a new {Google::Cloud::SecretManager::V1::Secret Secret} containing no {Google::Cloud::SecretManager::V1::SecretVersion SecretVersions}.
|
256
|
+
#
|
257
|
+
# @overload create_secret(request, options = nil)
|
258
|
+
# @param request [Google::Cloud::SecretManager::V1::CreateSecretRequest | Hash]
|
259
|
+
# Creates a new {Google::Cloud::SecretManager::V1::Secret Secret} containing no {Google::Cloud::SecretManager::V1::SecretVersion SecretVersions}.
|
260
|
+
# @param options [Gapic::CallOptions, Hash]
|
261
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
262
|
+
#
|
263
|
+
# @overload create_secret(parent: nil, secret_id: nil, secret: nil)
|
264
|
+
# @param parent [String]
|
265
|
+
# Required. The resource name of the project to associate with the
|
266
|
+
# {Google::Cloud::SecretManager::V1::Secret Secret}, in the format `projects/*`.
|
267
|
+
# @param secret_id [String]
|
268
|
+
# Required. This must be unique within the project.
|
269
|
+
# @param secret [Google::Cloud::SecretManager::V1::Secret | Hash]
|
270
|
+
# Required. A {Google::Cloud::SecretManager::V1::Secret Secret} with initial field values.
|
271
|
+
#
|
272
|
+
#
|
273
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
274
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::Secret]
|
275
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
276
|
+
#
|
277
|
+
# @return [Google::Cloud::SecretManager::V1::Secret]
|
278
|
+
#
|
279
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
280
|
+
#
|
281
|
+
def create_secret request, options = nil
|
282
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
283
|
+
|
284
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::CreateSecretRequest
|
285
|
+
|
286
|
+
# Converts hash and nil to an options object
|
287
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
288
|
+
|
289
|
+
# Customize the options with defaults
|
290
|
+
metadata = @config.rpcs.create_secret.metadata.to_h
|
291
|
+
|
292
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
293
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
294
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
295
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
296
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
297
|
+
|
298
|
+
header_params = {
|
299
|
+
"parent" => request.parent
|
300
|
+
}
|
301
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
302
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
303
|
+
|
304
|
+
options.apply_defaults timeout: @config.rpcs.create_secret.timeout,
|
305
|
+
metadata: metadata,
|
306
|
+
retry_policy: @config.rpcs.create_secret.retry_policy
|
307
|
+
options.apply_defaults metadata: @config.metadata,
|
308
|
+
retry_policy: @config.retry_policy
|
309
|
+
|
310
|
+
@secret_manager_service_stub.call_rpc :create_secret, request, options: options do |response, operation|
|
311
|
+
yield response, operation if block_given?
|
312
|
+
return response
|
313
|
+
end
|
314
|
+
rescue GRPC::BadStatus => e
|
315
|
+
raise Google::Cloud::Error.from_error(e)
|
316
|
+
end
|
317
|
+
|
318
|
+
##
|
319
|
+
# Creates a new {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} containing secret data and attaches
|
320
|
+
# it to an existing {Google::Cloud::SecretManager::V1::Secret Secret}.
|
321
|
+
#
|
322
|
+
# @overload add_secret_version(request, options = nil)
|
323
|
+
# @param request [Google::Cloud::SecretManager::V1::AddSecretVersionRequest | Hash]
|
324
|
+
# Creates a new {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} containing secret data and attaches
|
325
|
+
# it to an existing {Google::Cloud::SecretManager::V1::Secret Secret}.
|
326
|
+
# @param options [Gapic::CallOptions, Hash]
|
327
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
328
|
+
#
|
329
|
+
# @overload add_secret_version(parent: nil, payload: nil)
|
330
|
+
# @param parent [String]
|
331
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::Secret Secret} to associate with the
|
332
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} in the format `projects/*/secrets/*`.
|
333
|
+
# @param payload [Google::Cloud::SecretManager::V1::SecretPayload | Hash]
|
334
|
+
# Required. The secret payload of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
335
|
+
#
|
336
|
+
#
|
337
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
338
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::SecretVersion]
|
339
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
340
|
+
#
|
341
|
+
# @return [Google::Cloud::SecretManager::V1::SecretVersion]
|
342
|
+
#
|
343
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
344
|
+
#
|
345
|
+
def add_secret_version request, options = nil
|
346
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
347
|
+
|
348
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::AddSecretVersionRequest
|
349
|
+
|
350
|
+
# Converts hash and nil to an options object
|
351
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
352
|
+
|
353
|
+
# Customize the options with defaults
|
354
|
+
metadata = @config.rpcs.add_secret_version.metadata.to_h
|
355
|
+
|
356
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
357
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
358
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
359
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
360
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
361
|
+
|
362
|
+
header_params = {
|
363
|
+
"parent" => request.parent
|
364
|
+
}
|
365
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
366
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
367
|
+
|
368
|
+
options.apply_defaults timeout: @config.rpcs.add_secret_version.timeout,
|
369
|
+
metadata: metadata,
|
370
|
+
retry_policy: @config.rpcs.add_secret_version.retry_policy
|
371
|
+
options.apply_defaults metadata: @config.metadata,
|
372
|
+
retry_policy: @config.retry_policy
|
373
|
+
|
374
|
+
@secret_manager_service_stub.call_rpc :add_secret_version, request, options: options do |response, operation|
|
375
|
+
yield response, operation if block_given?
|
376
|
+
return response
|
377
|
+
end
|
378
|
+
rescue GRPC::BadStatus => e
|
379
|
+
raise Google::Cloud::Error.from_error(e)
|
380
|
+
end
|
381
|
+
|
382
|
+
##
|
383
|
+
# Gets metadata for a given {Google::Cloud::SecretManager::V1::Secret Secret}.
|
384
|
+
#
|
385
|
+
# @overload get_secret(request, options = nil)
|
386
|
+
# @param request [Google::Cloud::SecretManager::V1::GetSecretRequest | Hash]
|
387
|
+
# Gets metadata for a given {Google::Cloud::SecretManager::V1::Secret Secret}.
|
388
|
+
# @param options [Gapic::CallOptions, Hash]
|
389
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
390
|
+
#
|
391
|
+
# @overload get_secret(name: nil)
|
392
|
+
# @param name [String]
|
393
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::Secret Secret}, in the format `projects/*/secrets/*`.
|
394
|
+
#
|
395
|
+
#
|
396
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
397
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::Secret]
|
398
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
399
|
+
#
|
400
|
+
# @return [Google::Cloud::SecretManager::V1::Secret]
|
401
|
+
#
|
402
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
403
|
+
#
|
404
|
+
def get_secret request, options = nil
|
405
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
406
|
+
|
407
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::GetSecretRequest
|
408
|
+
|
409
|
+
# Converts hash and nil to an options object
|
410
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
411
|
+
|
412
|
+
# Customize the options with defaults
|
413
|
+
metadata = @config.rpcs.get_secret.metadata.to_h
|
414
|
+
|
415
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
416
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
417
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
418
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
419
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
420
|
+
|
421
|
+
header_params = {
|
422
|
+
"name" => request.name
|
423
|
+
}
|
424
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
425
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
426
|
+
|
427
|
+
options.apply_defaults timeout: @config.rpcs.get_secret.timeout,
|
428
|
+
metadata: metadata,
|
429
|
+
retry_policy: @config.rpcs.get_secret.retry_policy
|
430
|
+
options.apply_defaults metadata: @config.metadata,
|
431
|
+
retry_policy: @config.retry_policy
|
432
|
+
|
433
|
+
@secret_manager_service_stub.call_rpc :get_secret, request, options: options do |response, operation|
|
434
|
+
yield response, operation if block_given?
|
435
|
+
return response
|
436
|
+
end
|
437
|
+
rescue GRPC::BadStatus => e
|
438
|
+
raise Google::Cloud::Error.from_error(e)
|
439
|
+
end
|
440
|
+
|
441
|
+
##
|
442
|
+
# Updates metadata of an existing {Google::Cloud::SecretManager::V1::Secret Secret}.
|
443
|
+
#
|
444
|
+
# @overload update_secret(request, options = nil)
|
445
|
+
# @param request [Google::Cloud::SecretManager::V1::UpdateSecretRequest | Hash]
|
446
|
+
# Updates metadata of an existing {Google::Cloud::SecretManager::V1::Secret Secret}.
|
447
|
+
# @param options [Gapic::CallOptions, Hash]
|
448
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
449
|
+
#
|
450
|
+
# @overload update_secret(secret: nil, update_mask: nil)
|
451
|
+
# @param secret [Google::Cloud::SecretManager::V1::Secret | Hash]
|
452
|
+
# Required. {Google::Cloud::SecretManager::V1::Secret Secret} with updated field values.
|
453
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
454
|
+
# Required. Specifies the fields to be updated.
|
455
|
+
#
|
456
|
+
#
|
457
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
458
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::Secret]
|
459
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
460
|
+
#
|
461
|
+
# @return [Google::Cloud::SecretManager::V1::Secret]
|
462
|
+
#
|
463
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
464
|
+
#
|
465
|
+
def update_secret request, options = nil
|
466
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
467
|
+
|
468
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::UpdateSecretRequest
|
469
|
+
|
470
|
+
# Converts hash and nil to an options object
|
471
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
472
|
+
|
473
|
+
# Customize the options with defaults
|
474
|
+
metadata = @config.rpcs.update_secret.metadata.to_h
|
475
|
+
|
476
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
477
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
478
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
479
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
480
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
481
|
+
|
482
|
+
header_params = {
|
483
|
+
"secret.name" => request.secret.name
|
484
|
+
}
|
485
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
486
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
487
|
+
|
488
|
+
options.apply_defaults timeout: @config.rpcs.update_secret.timeout,
|
489
|
+
metadata: metadata,
|
490
|
+
retry_policy: @config.rpcs.update_secret.retry_policy
|
491
|
+
options.apply_defaults metadata: @config.metadata,
|
492
|
+
retry_policy: @config.retry_policy
|
493
|
+
|
494
|
+
@secret_manager_service_stub.call_rpc :update_secret, request, options: options do |response, operation|
|
495
|
+
yield response, operation if block_given?
|
496
|
+
return response
|
497
|
+
end
|
498
|
+
rescue GRPC::BadStatus => e
|
499
|
+
raise Google::Cloud::Error.from_error(e)
|
500
|
+
end
|
501
|
+
|
502
|
+
##
|
503
|
+
# Deletes a {Google::Cloud::SecretManager::V1::Secret Secret}.
|
504
|
+
#
|
505
|
+
# @overload delete_secret(request, options = nil)
|
506
|
+
# @param request [Google::Cloud::SecretManager::V1::DeleteSecretRequest | Hash]
|
507
|
+
# Deletes a {Google::Cloud::SecretManager::V1::Secret Secret}.
|
508
|
+
# @param options [Gapic::CallOptions, Hash]
|
509
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
510
|
+
#
|
511
|
+
# @overload delete_secret(name: nil)
|
512
|
+
# @param name [String]
|
513
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::Secret Secret} to delete in the format
|
514
|
+
# `projects/*/secrets/*`.
|
515
|
+
#
|
516
|
+
#
|
517
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
518
|
+
# @yieldparam response [Google::Protobuf::Empty]
|
519
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
520
|
+
#
|
521
|
+
# @return [Google::Protobuf::Empty]
|
522
|
+
#
|
523
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
524
|
+
#
|
525
|
+
def delete_secret request, options = nil
|
526
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
527
|
+
|
528
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::DeleteSecretRequest
|
529
|
+
|
530
|
+
# Converts hash and nil to an options object
|
531
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
532
|
+
|
533
|
+
# Customize the options with defaults
|
534
|
+
metadata = @config.rpcs.delete_secret.metadata.to_h
|
535
|
+
|
536
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
537
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
538
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
539
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
540
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
541
|
+
|
542
|
+
header_params = {
|
543
|
+
"name" => request.name
|
544
|
+
}
|
545
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
546
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
547
|
+
|
548
|
+
options.apply_defaults timeout: @config.rpcs.delete_secret.timeout,
|
549
|
+
metadata: metadata,
|
550
|
+
retry_policy: @config.rpcs.delete_secret.retry_policy
|
551
|
+
options.apply_defaults metadata: @config.metadata,
|
552
|
+
retry_policy: @config.retry_policy
|
553
|
+
|
554
|
+
@secret_manager_service_stub.call_rpc :delete_secret, request, options: options do |response, operation|
|
555
|
+
yield response, operation if block_given?
|
556
|
+
return response
|
557
|
+
end
|
558
|
+
rescue GRPC::BadStatus => e
|
559
|
+
raise Google::Cloud::Error.from_error(e)
|
560
|
+
end
|
561
|
+
|
562
|
+
##
|
563
|
+
# Lists {Google::Cloud::SecretManager::V1::SecretVersion SecretVersions}. This call does not return secret
|
564
|
+
# data.
|
565
|
+
#
|
566
|
+
# @overload list_secret_versions(request, options = nil)
|
567
|
+
# @param request [Google::Cloud::SecretManager::V1::ListSecretVersionsRequest | Hash]
|
568
|
+
# Lists {Google::Cloud::SecretManager::V1::SecretVersion SecretVersions}. This call does not return secret
|
569
|
+
# data.
|
570
|
+
# @param options [Gapic::CallOptions, Hash]
|
571
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
572
|
+
#
|
573
|
+
# @overload list_secret_versions(parent: nil, page_size: nil, page_token: nil)
|
574
|
+
# @param parent [String]
|
575
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::Secret Secret} associated with the
|
576
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion SecretVersions} to list, in the format
|
577
|
+
# `projects/*/secrets/*`.
|
578
|
+
# @param page_size [Integer]
|
579
|
+
# Optional. The maximum number of results to be returned in a single page. If
|
580
|
+
# set to 0, the server decides the number of results to return. If the
|
581
|
+
# number is greater than 25000, it is capped at 25000.
|
582
|
+
# @param page_token [String]
|
583
|
+
# Optional. Pagination token, returned earlier via
|
584
|
+
# ListSecretVersionsResponse.next_page_token][].
|
585
|
+
#
|
586
|
+
#
|
587
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
588
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1::SecretVersion>]
|
589
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
590
|
+
#
|
591
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1::SecretVersion>]
|
592
|
+
#
|
593
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
594
|
+
#
|
595
|
+
def list_secret_versions request, options = nil
|
596
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
597
|
+
|
598
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::ListSecretVersionsRequest
|
599
|
+
|
600
|
+
# Converts hash and nil to an options object
|
601
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
602
|
+
|
603
|
+
# Customize the options with defaults
|
604
|
+
metadata = @config.rpcs.list_secret_versions.metadata.to_h
|
605
|
+
|
606
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
607
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
608
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
609
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
610
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
611
|
+
|
612
|
+
header_params = {
|
613
|
+
"parent" => request.parent
|
614
|
+
}
|
615
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
616
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
617
|
+
|
618
|
+
options.apply_defaults timeout: @config.rpcs.list_secret_versions.timeout,
|
619
|
+
metadata: metadata,
|
620
|
+
retry_policy: @config.rpcs.list_secret_versions.retry_policy
|
621
|
+
options.apply_defaults metadata: @config.metadata,
|
622
|
+
retry_policy: @config.retry_policy
|
623
|
+
|
624
|
+
@secret_manager_service_stub.call_rpc :list_secret_versions, request, options: options do |response, operation|
|
625
|
+
response = Gapic::PagedEnumerable.new @secret_manager_service_stub, :list_secret_versions, request, response, operation, options
|
626
|
+
yield response, operation if block_given?
|
627
|
+
return response
|
628
|
+
end
|
629
|
+
rescue GRPC::BadStatus => e
|
630
|
+
raise Google::Cloud::Error.from_error(e)
|
631
|
+
end
|
632
|
+
|
633
|
+
##
|
634
|
+
# Gets metadata for a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
635
|
+
#
|
636
|
+
# `projects/*/secrets/*/versions/latest` is an alias to the `latest`
|
637
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
638
|
+
#
|
639
|
+
# @overload get_secret_version(request, options = nil)
|
640
|
+
# @param request [Google::Cloud::SecretManager::V1::GetSecretVersionRequest | Hash]
|
641
|
+
# Gets metadata for a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
642
|
+
#
|
643
|
+
# `projects/*/secrets/*/versions/latest` is an alias to the `latest`
|
644
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
645
|
+
# @param options [Gapic::CallOptions, Hash]
|
646
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
647
|
+
#
|
648
|
+
# @overload get_secret_version(name: nil)
|
649
|
+
# @param name [String]
|
650
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} in the format
|
651
|
+
# `projects/*/secrets/*/versions/*`.
|
652
|
+
# `projects/*/secrets/*/versions/latest` is an alias to the `latest`
|
653
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
654
|
+
#
|
655
|
+
#
|
656
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
657
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::SecretVersion]
|
658
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
659
|
+
#
|
660
|
+
# @return [Google::Cloud::SecretManager::V1::SecretVersion]
|
661
|
+
#
|
662
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
663
|
+
#
|
664
|
+
def get_secret_version request, options = nil
|
665
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
666
|
+
|
667
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::GetSecretVersionRequest
|
668
|
+
|
669
|
+
# Converts hash and nil to an options object
|
670
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
671
|
+
|
672
|
+
# Customize the options with defaults
|
673
|
+
metadata = @config.rpcs.get_secret_version.metadata.to_h
|
674
|
+
|
675
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
676
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
677
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
678
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
679
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
680
|
+
|
681
|
+
header_params = {
|
682
|
+
"name" => request.name
|
683
|
+
}
|
684
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
685
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
686
|
+
|
687
|
+
options.apply_defaults timeout: @config.rpcs.get_secret_version.timeout,
|
688
|
+
metadata: metadata,
|
689
|
+
retry_policy: @config.rpcs.get_secret_version.retry_policy
|
690
|
+
options.apply_defaults metadata: @config.metadata,
|
691
|
+
retry_policy: @config.retry_policy
|
692
|
+
|
693
|
+
@secret_manager_service_stub.call_rpc :get_secret_version, request, options: options do |response, operation|
|
694
|
+
yield response, operation if block_given?
|
695
|
+
return response
|
696
|
+
end
|
697
|
+
rescue GRPC::BadStatus => e
|
698
|
+
raise Google::Cloud::Error.from_error(e)
|
699
|
+
end
|
700
|
+
|
701
|
+
##
|
702
|
+
# Accesses a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}. This call returns the secret data.
|
703
|
+
#
|
704
|
+
# `projects/*/secrets/*/versions/latest` is an alias to the `latest`
|
705
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
706
|
+
#
|
707
|
+
# @overload access_secret_version(request, options = nil)
|
708
|
+
# @param request [Google::Cloud::SecretManager::V1::AccessSecretVersionRequest | Hash]
|
709
|
+
# Accesses a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}. This call returns the secret data.
|
710
|
+
#
|
711
|
+
# `projects/*/secrets/*/versions/latest` is an alias to the `latest`
|
712
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
713
|
+
# @param options [Gapic::CallOptions, Hash]
|
714
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
715
|
+
#
|
716
|
+
# @overload access_secret_version(name: nil)
|
717
|
+
# @param name [String]
|
718
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} in the format
|
719
|
+
# `projects/*/secrets/*/versions/*`.
|
720
|
+
#
|
721
|
+
#
|
722
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
723
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::AccessSecretVersionResponse]
|
724
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
725
|
+
#
|
726
|
+
# @return [Google::Cloud::SecretManager::V1::AccessSecretVersionResponse]
|
727
|
+
#
|
728
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
729
|
+
#
|
730
|
+
def access_secret_version request, options = nil
|
731
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
732
|
+
|
733
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::AccessSecretVersionRequest
|
734
|
+
|
735
|
+
# Converts hash and nil to an options object
|
736
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
737
|
+
|
738
|
+
# Customize the options with defaults
|
739
|
+
metadata = @config.rpcs.access_secret_version.metadata.to_h
|
740
|
+
|
741
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
742
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
743
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
744
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
745
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
746
|
+
|
747
|
+
header_params = {
|
748
|
+
"name" => request.name
|
749
|
+
}
|
750
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
751
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
752
|
+
|
753
|
+
options.apply_defaults timeout: @config.rpcs.access_secret_version.timeout,
|
754
|
+
metadata: metadata,
|
755
|
+
retry_policy: @config.rpcs.access_secret_version.retry_policy
|
756
|
+
options.apply_defaults metadata: @config.metadata,
|
757
|
+
retry_policy: @config.retry_policy
|
758
|
+
|
759
|
+
@secret_manager_service_stub.call_rpc :access_secret_version, request, options: options do |response, operation|
|
760
|
+
yield response, operation if block_given?
|
761
|
+
return response
|
762
|
+
end
|
763
|
+
rescue GRPC::BadStatus => e
|
764
|
+
raise Google::Cloud::Error.from_error(e)
|
765
|
+
end
|
766
|
+
|
767
|
+
##
|
768
|
+
# Disables a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
769
|
+
#
|
770
|
+
# Sets the {Google::Cloud::SecretManager::V1::SecretVersion#state state} of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to
|
771
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion::State::DISABLED DISABLED}.
|
772
|
+
#
|
773
|
+
# @overload disable_secret_version(request, options = nil)
|
774
|
+
# @param request [Google::Cloud::SecretManager::V1::DisableSecretVersionRequest | Hash]
|
775
|
+
# Disables a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
776
|
+
#
|
777
|
+
# Sets the {Google::Cloud::SecretManager::V1::SecretVersion#state state} of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to
|
778
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion::State::DISABLED DISABLED}.
|
779
|
+
# @param options [Gapic::CallOptions, Hash]
|
780
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
781
|
+
#
|
782
|
+
# @overload disable_secret_version(name: nil)
|
783
|
+
# @param name [String]
|
784
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to disable in the format
|
785
|
+
# `projects/*/secrets/*/versions/*`.
|
786
|
+
#
|
787
|
+
#
|
788
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
789
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::SecretVersion]
|
790
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
791
|
+
#
|
792
|
+
# @return [Google::Cloud::SecretManager::V1::SecretVersion]
|
793
|
+
#
|
794
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
795
|
+
#
|
796
|
+
def disable_secret_version request, options = nil
|
797
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
798
|
+
|
799
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::DisableSecretVersionRequest
|
800
|
+
|
801
|
+
# Converts hash and nil to an options object
|
802
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
803
|
+
|
804
|
+
# Customize the options with defaults
|
805
|
+
metadata = @config.rpcs.disable_secret_version.metadata.to_h
|
806
|
+
|
807
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
808
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
809
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
810
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
811
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
812
|
+
|
813
|
+
header_params = {
|
814
|
+
"name" => request.name
|
815
|
+
}
|
816
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
817
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
818
|
+
|
819
|
+
options.apply_defaults timeout: @config.rpcs.disable_secret_version.timeout,
|
820
|
+
metadata: metadata,
|
821
|
+
retry_policy: @config.rpcs.disable_secret_version.retry_policy
|
822
|
+
options.apply_defaults metadata: @config.metadata,
|
823
|
+
retry_policy: @config.retry_policy
|
824
|
+
|
825
|
+
@secret_manager_service_stub.call_rpc :disable_secret_version, request, options: options do |response, operation|
|
826
|
+
yield response, operation if block_given?
|
827
|
+
return response
|
828
|
+
end
|
829
|
+
rescue GRPC::BadStatus => e
|
830
|
+
raise Google::Cloud::Error.from_error(e)
|
831
|
+
end
|
832
|
+
|
833
|
+
##
|
834
|
+
# Enables a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
835
|
+
#
|
836
|
+
# Sets the {Google::Cloud::SecretManager::V1::SecretVersion#state state} of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to
|
837
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion::State::ENABLED ENABLED}.
|
838
|
+
#
|
839
|
+
# @overload enable_secret_version(request, options = nil)
|
840
|
+
# @param request [Google::Cloud::SecretManager::V1::EnableSecretVersionRequest | Hash]
|
841
|
+
# Enables a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
842
|
+
#
|
843
|
+
# Sets the {Google::Cloud::SecretManager::V1::SecretVersion#state state} of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to
|
844
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion::State::ENABLED ENABLED}.
|
845
|
+
# @param options [Gapic::CallOptions, Hash]
|
846
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
847
|
+
#
|
848
|
+
# @overload enable_secret_version(name: nil)
|
849
|
+
# @param name [String]
|
850
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to enable in the format
|
851
|
+
# `projects/*/secrets/*/versions/*`.
|
852
|
+
#
|
853
|
+
#
|
854
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
855
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::SecretVersion]
|
856
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
857
|
+
#
|
858
|
+
# @return [Google::Cloud::SecretManager::V1::SecretVersion]
|
859
|
+
#
|
860
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
861
|
+
#
|
862
|
+
def enable_secret_version request, options = nil
|
863
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
864
|
+
|
865
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::EnableSecretVersionRequest
|
866
|
+
|
867
|
+
# Converts hash and nil to an options object
|
868
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
869
|
+
|
870
|
+
# Customize the options with defaults
|
871
|
+
metadata = @config.rpcs.enable_secret_version.metadata.to_h
|
872
|
+
|
873
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
874
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
875
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
876
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
877
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
878
|
+
|
879
|
+
header_params = {
|
880
|
+
"name" => request.name
|
881
|
+
}
|
882
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
883
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
884
|
+
|
885
|
+
options.apply_defaults timeout: @config.rpcs.enable_secret_version.timeout,
|
886
|
+
metadata: metadata,
|
887
|
+
retry_policy: @config.rpcs.enable_secret_version.retry_policy
|
888
|
+
options.apply_defaults metadata: @config.metadata,
|
889
|
+
retry_policy: @config.retry_policy
|
890
|
+
|
891
|
+
@secret_manager_service_stub.call_rpc :enable_secret_version, request, options: options do |response, operation|
|
892
|
+
yield response, operation if block_given?
|
893
|
+
return response
|
894
|
+
end
|
895
|
+
rescue GRPC::BadStatus => e
|
896
|
+
raise Google::Cloud::Error.from_error(e)
|
897
|
+
end
|
898
|
+
|
899
|
+
##
|
900
|
+
# Destroys a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
901
|
+
#
|
902
|
+
# Sets the {Google::Cloud::SecretManager::V1::SecretVersion#state state} of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to
|
903
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion::State::DESTROYED DESTROYED} and irrevocably destroys the
|
904
|
+
# secret data.
|
905
|
+
#
|
906
|
+
# @overload destroy_secret_version(request, options = nil)
|
907
|
+
# @param request [Google::Cloud::SecretManager::V1::DestroySecretVersionRequest | Hash]
|
908
|
+
# Destroys a {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion}.
|
909
|
+
#
|
910
|
+
# Sets the {Google::Cloud::SecretManager::V1::SecretVersion#state state} of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to
|
911
|
+
# {Google::Cloud::SecretManager::V1::SecretVersion::State::DESTROYED DESTROYED} and irrevocably destroys the
|
912
|
+
# secret data.
|
913
|
+
# @param options [Gapic::CallOptions, Hash]
|
914
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
915
|
+
#
|
916
|
+
# @overload destroy_secret_version(name: nil)
|
917
|
+
# @param name [String]
|
918
|
+
# Required. The resource name of the {Google::Cloud::SecretManager::V1::SecretVersion SecretVersion} to destroy in the format
|
919
|
+
# `projects/*/secrets/*/versions/*`.
|
920
|
+
#
|
921
|
+
#
|
922
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
923
|
+
# @yieldparam response [Google::Cloud::SecretManager::V1::SecretVersion]
|
924
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
925
|
+
#
|
926
|
+
# @return [Google::Cloud::SecretManager::V1::SecretVersion]
|
927
|
+
#
|
928
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
929
|
+
#
|
930
|
+
def destroy_secret_version request, options = nil
|
931
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
932
|
+
|
933
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1::DestroySecretVersionRequest
|
934
|
+
|
935
|
+
# Converts hash and nil to an options object
|
936
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
937
|
+
|
938
|
+
# Customize the options with defaults
|
939
|
+
metadata = @config.rpcs.destroy_secret_version.metadata.to_h
|
940
|
+
|
941
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
942
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
943
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
944
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
945
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
946
|
+
|
947
|
+
header_params = {
|
948
|
+
"name" => request.name
|
949
|
+
}
|
950
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
951
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
952
|
+
|
953
|
+
options.apply_defaults timeout: @config.rpcs.destroy_secret_version.timeout,
|
954
|
+
metadata: metadata,
|
955
|
+
retry_policy: @config.rpcs.destroy_secret_version.retry_policy
|
956
|
+
options.apply_defaults metadata: @config.metadata,
|
957
|
+
retry_policy: @config.retry_policy
|
958
|
+
|
959
|
+
@secret_manager_service_stub.call_rpc :destroy_secret_version, request, options: options do |response, operation|
|
960
|
+
yield response, operation if block_given?
|
961
|
+
return response
|
962
|
+
end
|
963
|
+
rescue GRPC::BadStatus => e
|
964
|
+
raise Google::Cloud::Error.from_error(e)
|
965
|
+
end
|
966
|
+
|
967
|
+
##
|
968
|
+
# Sets the access control policy on the specified secret. Replaces any
|
969
|
+
# existing policy.
|
970
|
+
#
|
971
|
+
# Permissions on {Google::Cloud::SecretManager::V1::SecretVersion SecretVersions} are enforced according
|
972
|
+
# to the policy set on the associated {Google::Cloud::SecretManager::V1::Secret Secret}.
|
973
|
+
#
|
974
|
+
# @overload set_iam_policy(request, options = nil)
|
975
|
+
# @param request [Google::Iam::V1::SetIamPolicyRequest | Hash]
|
976
|
+
# Sets the access control policy on the specified secret. Replaces any
|
977
|
+
# existing policy.
|
978
|
+
#
|
979
|
+
# Permissions on {Google::Cloud::SecretManager::V1::SecretVersion SecretVersions} are enforced according
|
980
|
+
# to the policy set on the associated {Google::Cloud::SecretManager::V1::Secret Secret}.
|
981
|
+
# @param options [Gapic::CallOptions, Hash]
|
982
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
983
|
+
#
|
984
|
+
# @overload set_iam_policy(resource: nil, policy: nil)
|
985
|
+
# @param resource [String]
|
986
|
+
# REQUIRED: The resource for which the policy is being specified.
|
987
|
+
# `resource` is usually specified as a path. For example, a Project
|
988
|
+
# resource is specified as `projects/{project}`.
|
989
|
+
# @param policy [Google::Iam::V1::Policy | Hash]
|
990
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
991
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
992
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
993
|
+
# might reject them.
|
994
|
+
#
|
995
|
+
#
|
996
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
997
|
+
# @yieldparam response [Google::Iam::V1::Policy]
|
998
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
999
|
+
#
|
1000
|
+
# @return [Google::Iam::V1::Policy]
|
1001
|
+
#
|
1002
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1003
|
+
#
|
1004
|
+
def set_iam_policy request, options = nil
|
1005
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1006
|
+
|
1007
|
+
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::SetIamPolicyRequest
|
1008
|
+
|
1009
|
+
# Converts hash and nil to an options object
|
1010
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1011
|
+
|
1012
|
+
# Customize the options with defaults
|
1013
|
+
metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
1014
|
+
|
1015
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1016
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1017
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1018
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
1019
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1020
|
+
|
1021
|
+
header_params = {
|
1022
|
+
"resource" => request.resource
|
1023
|
+
}
|
1024
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1025
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1026
|
+
|
1027
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
1028
|
+
metadata: metadata,
|
1029
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
1030
|
+
options.apply_defaults metadata: @config.metadata,
|
1031
|
+
retry_policy: @config.retry_policy
|
1032
|
+
|
1033
|
+
@secret_manager_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
|
1034
|
+
yield response, operation if block_given?
|
1035
|
+
return response
|
1036
|
+
end
|
1037
|
+
rescue GRPC::BadStatus => e
|
1038
|
+
raise Google::Cloud::Error.from_error(e)
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
##
|
1042
|
+
# Gets the access control policy for a secret.
|
1043
|
+
# Returns empty policy if the secret exists and does not have a policy set.
|
1044
|
+
#
|
1045
|
+
# @overload get_iam_policy(request, options = nil)
|
1046
|
+
# @param request [Google::Iam::V1::GetIamPolicyRequest | Hash]
|
1047
|
+
# Gets the access control policy for a secret.
|
1048
|
+
# Returns empty policy if the secret exists and does not have a policy set.
|
1049
|
+
# @param options [Gapic::CallOptions, Hash]
|
1050
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1051
|
+
#
|
1052
|
+
# @overload get_iam_policy(resource: nil)
|
1053
|
+
# @param resource [String]
|
1054
|
+
# REQUIRED: The resource for which the policy is being requested.
|
1055
|
+
# `resource` is usually specified as a path. For example, a Project
|
1056
|
+
# resource is specified as `projects/{project}`.
|
1057
|
+
#
|
1058
|
+
#
|
1059
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1060
|
+
# @yieldparam response [Google::Iam::V1::Policy]
|
1061
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1062
|
+
#
|
1063
|
+
# @return [Google::Iam::V1::Policy]
|
1064
|
+
#
|
1065
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1066
|
+
#
|
1067
|
+
def get_iam_policy request, options = nil
|
1068
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1069
|
+
|
1070
|
+
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::GetIamPolicyRequest
|
1071
|
+
|
1072
|
+
# Converts hash and nil to an options object
|
1073
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1074
|
+
|
1075
|
+
# Customize the options with defaults
|
1076
|
+
metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
1077
|
+
|
1078
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1079
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
1080
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1081
|
+
gapic_version: ::Google::Cloud::SecretManager::V1::VERSION
|
1082
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1083
|
+
|
1084
|
+
header_params = {
|
1085
|
+
"resource" => request.resource
|
1086
|
+
}
|
1087
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1088
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1089
|
+
|
1090
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
1091
|
+
metadata: metadata,
|
1092
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
1093
|
+
options.apply_defaults metadata: @config.metadata,
|
1094
|
+
retry_policy: @config.retry_policy
|
1095
|
+
|
1096
|
+
@secret_manager_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
|
1097
|
+
yield response, operation if block_given?
|
1098
|
+
return response
|
1099
|
+
end
|
1100
|
+
rescue GRPC::BadStatus => e
|
1101
|
+
raise Google::Cloud::Error.from_error(e)
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
##
|
1105
|
+
# Returns permissions that a caller has for the specified secret.
|
1106
|
+
# If the secret does not exist, this call returns an empty set of
|
1107
|
+
# permissions, not a NOT_FOUND error.
|
1108
|
+
#
|
1109
|
+
# Note: This operation is designed to be used for building permission-aware
|
1110
|
+
# UIs and command-line tools, not for authorization checking. This operation
|
1111
|
+
# may "fail open" without warning.
|
1112
|
+
#
|
1113
|
+
# @overload test_iam_permissions(request, options = nil)
|
1114
|
+
# @param request [Google::Iam::V1::TestIamPermissionsRequest | Hash]
|
1115
|
+
# Returns permissions that a caller has for the specified secret.
|
1116
|
+
# If the secret does not exist, this call returns an empty set of
|
1117
|
+
# permissions, not a NOT_FOUND error.
|
1118
|
+
#
|
1119
|
+
# Note: This operation is designed to be used for building permission-aware
|
1120
|
+
# UIs and command-line tools, not for authorization checking. This operation
|
1121
|
+
# may "fail open" without warning.
|
1122
|
+
# @param options [Gapic::CallOptions, Hash]
|
1123
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1124
|
+
#
|
1125
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
1126
|
+
# @param resource [String]
|
1127
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
1128
|
+
# `resource` is usually specified as a path. For example, a Project
|
1129
|
+
# resource is specified as `projects/{project}`.
|
1130
|
+
# @param permissions [Array<String>]
|
1131
|
+
# The set of permissions to check for the `resource`. Permissions with
|
1132
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
1133
|
+
# information see
|
1134
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
1135
|
+
#
|
1136
|
+
#
|
1137
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1138
|
+
# @yieldparam response [Google::Iam::V1::TestIamPermissionsResponse]
|
1139
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1140
|
+
#
|
1141
|
+
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
1142
|
+
#
|
1143
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
1144
|
+
#
|
1145
|
+
def test_iam_permissions request, options = nil
|
1146
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
1147
|
+
|
1148
|
+
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::TestIamPermissionsRequest
|
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
|
+
metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
1155
|
+
|
1156
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1157
|
+
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::SecretManager::V1::VERSION
|
1160
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1161
|
+
|
1162
|
+
header_params = {
|
1163
|
+
"resource" => request.resource
|
1164
|
+
}
|
1165
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1166
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1167
|
+
|
1168
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
1169
|
+
metadata: metadata,
|
1170
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
1171
|
+
options.apply_defaults metadata: @config.metadata,
|
1172
|
+
retry_policy: @config.retry_policy
|
1173
|
+
|
1174
|
+
@secret_manager_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
|
1175
|
+
yield response, operation if block_given?
|
1176
|
+
return response
|
1177
|
+
end
|
1178
|
+
rescue GRPC::BadStatus => e
|
1179
|
+
raise Google::Cloud::Error.from_error(e)
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
##
|
1183
|
+
# Configuration class for the SecretManagerService API.
|
1184
|
+
#
|
1185
|
+
# This class represents the configuration for SecretManagerService,
|
1186
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1187
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1188
|
+
# applied individually to specific RPCs. See
|
1189
|
+
# {Google::Cloud::SecretManager::V1::SecretManagerService::Client::Configuration::Rpcs}
|
1190
|
+
# for a list of RPCs that can be configured independently.
|
1191
|
+
#
|
1192
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1193
|
+
# on construction.
|
1194
|
+
#
|
1195
|
+
# # Examples
|
1196
|
+
#
|
1197
|
+
# To modify the global config, setting the timeout for list_secrets
|
1198
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
1199
|
+
#
|
1200
|
+
# Google::Cloud::SecretManager::V1::SecretManagerService::Client.configure do |config|
|
1201
|
+
# config.timeout = 10_000
|
1202
|
+
# config.rpcs.list_secrets.timeout = 20_000
|
1203
|
+
# end
|
1204
|
+
#
|
1205
|
+
# To apply the above configuration only to a new client:
|
1206
|
+
#
|
1207
|
+
# client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new do |config|
|
1208
|
+
# config.timeout = 10_000
|
1209
|
+
# config.rpcs.list_secrets.timeout = 20_000
|
1210
|
+
# end
|
1211
|
+
#
|
1212
|
+
# @!attribute [rw] endpoint
|
1213
|
+
# The hostname or hostname:port of the service endpoint.
|
1214
|
+
# Defaults to `"secretmanager.googleapis.com"`.
|
1215
|
+
# @return [String]
|
1216
|
+
# @!attribute [rw] credentials
|
1217
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1218
|
+
# * (`String`) The path to a service account key file in JSON format
|
1219
|
+
# * (`Hash`) A service account key as a Hash
|
1220
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1221
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
1222
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1223
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
1224
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1225
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1226
|
+
# * (`nil`) indicating no credentials
|
1227
|
+
# @return [Object]
|
1228
|
+
# @!attribute [rw] scope
|
1229
|
+
# The OAuth scopes
|
1230
|
+
# @return [Array<String>]
|
1231
|
+
# @!attribute [rw] lib_name
|
1232
|
+
# The library name as recorded in instrumentation and logging
|
1233
|
+
# @return [String]
|
1234
|
+
# @!attribute [rw] lib_version
|
1235
|
+
# The library version as recorded in instrumentation and logging
|
1236
|
+
# @return [String]
|
1237
|
+
# @!attribute [rw] channel_args
|
1238
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1239
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1240
|
+
# @return [Hash]
|
1241
|
+
# @!attribute [rw] interceptors
|
1242
|
+
# An array of interceptors that are run before calls are executed.
|
1243
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
1244
|
+
# @!attribute [rw] timeout
|
1245
|
+
# The call timeout in milliseconds.
|
1246
|
+
# @return [Numeric]
|
1247
|
+
# @!attribute [rw] metadata
|
1248
|
+
# Additional gRPC headers to be sent with the call.
|
1249
|
+
# @return [Hash{Symbol=>String}]
|
1250
|
+
# @!attribute [rw] retry_policy
|
1251
|
+
# The retry policy. The value is a hash with the following keys:
|
1252
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1253
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1254
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1255
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1256
|
+
# trigger a retry.
|
1257
|
+
# @return [Hash]
|
1258
|
+
#
|
1259
|
+
class Configuration
|
1260
|
+
extend Gapic::Config
|
1261
|
+
|
1262
|
+
config_attr :endpoint, "secretmanager.googleapis.com", String
|
1263
|
+
config_attr :credentials, nil do |value|
|
1264
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1265
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
1266
|
+
allowed.any? { |klass| klass === value }
|
1267
|
+
end
|
1268
|
+
config_attr :scope, nil, String, Array, nil
|
1269
|
+
config_attr :lib_name, nil, String, nil
|
1270
|
+
config_attr :lib_version, nil, String, nil
|
1271
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
1272
|
+
config_attr :interceptors, nil, Array, nil
|
1273
|
+
config_attr :timeout, nil, Numeric, nil
|
1274
|
+
config_attr :metadata, nil, Hash, nil
|
1275
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
1276
|
+
|
1277
|
+
# @private
|
1278
|
+
def initialize parent_config = nil
|
1279
|
+
@parent_config = parent_config unless parent_config.nil?
|
1280
|
+
|
1281
|
+
yield self if block_given?
|
1282
|
+
end
|
1283
|
+
|
1284
|
+
##
|
1285
|
+
# Configurations for individual RPCs
|
1286
|
+
# @return [Rpcs]
|
1287
|
+
#
|
1288
|
+
def rpcs
|
1289
|
+
@rpcs ||= begin
|
1290
|
+
parent_rpcs = nil
|
1291
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
1292
|
+
Rpcs.new parent_rpcs
|
1293
|
+
end
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
##
|
1297
|
+
# Configuration RPC class for the SecretManagerService API.
|
1298
|
+
#
|
1299
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1300
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1301
|
+
# the following configuration fields:
|
1302
|
+
#
|
1303
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
1304
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1305
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1306
|
+
# include the following keys:
|
1307
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1308
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1309
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1310
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1311
|
+
# trigger a retry.
|
1312
|
+
#
|
1313
|
+
class Rpcs
|
1314
|
+
##
|
1315
|
+
# RPC-specific configuration for `list_secrets`
|
1316
|
+
# @return [Gapic::Config::Method]
|
1317
|
+
#
|
1318
|
+
attr_reader :list_secrets
|
1319
|
+
##
|
1320
|
+
# RPC-specific configuration for `create_secret`
|
1321
|
+
# @return [Gapic::Config::Method]
|
1322
|
+
#
|
1323
|
+
attr_reader :create_secret
|
1324
|
+
##
|
1325
|
+
# RPC-specific configuration for `add_secret_version`
|
1326
|
+
# @return [Gapic::Config::Method]
|
1327
|
+
#
|
1328
|
+
attr_reader :add_secret_version
|
1329
|
+
##
|
1330
|
+
# RPC-specific configuration for `get_secret`
|
1331
|
+
# @return [Gapic::Config::Method]
|
1332
|
+
#
|
1333
|
+
attr_reader :get_secret
|
1334
|
+
##
|
1335
|
+
# RPC-specific configuration for `update_secret`
|
1336
|
+
# @return [Gapic::Config::Method]
|
1337
|
+
#
|
1338
|
+
attr_reader :update_secret
|
1339
|
+
##
|
1340
|
+
# RPC-specific configuration for `delete_secret`
|
1341
|
+
# @return [Gapic::Config::Method]
|
1342
|
+
#
|
1343
|
+
attr_reader :delete_secret
|
1344
|
+
##
|
1345
|
+
# RPC-specific configuration for `list_secret_versions`
|
1346
|
+
# @return [Gapic::Config::Method]
|
1347
|
+
#
|
1348
|
+
attr_reader :list_secret_versions
|
1349
|
+
##
|
1350
|
+
# RPC-specific configuration for `get_secret_version`
|
1351
|
+
# @return [Gapic::Config::Method]
|
1352
|
+
#
|
1353
|
+
attr_reader :get_secret_version
|
1354
|
+
##
|
1355
|
+
# RPC-specific configuration for `access_secret_version`
|
1356
|
+
# @return [Gapic::Config::Method]
|
1357
|
+
#
|
1358
|
+
attr_reader :access_secret_version
|
1359
|
+
##
|
1360
|
+
# RPC-specific configuration for `disable_secret_version`
|
1361
|
+
# @return [Gapic::Config::Method]
|
1362
|
+
#
|
1363
|
+
attr_reader :disable_secret_version
|
1364
|
+
##
|
1365
|
+
# RPC-specific configuration for `enable_secret_version`
|
1366
|
+
# @return [Gapic::Config::Method]
|
1367
|
+
#
|
1368
|
+
attr_reader :enable_secret_version
|
1369
|
+
##
|
1370
|
+
# RPC-specific configuration for `destroy_secret_version`
|
1371
|
+
# @return [Gapic::Config::Method]
|
1372
|
+
#
|
1373
|
+
attr_reader :destroy_secret_version
|
1374
|
+
##
|
1375
|
+
# RPC-specific configuration for `set_iam_policy`
|
1376
|
+
# @return [Gapic::Config::Method]
|
1377
|
+
#
|
1378
|
+
attr_reader :set_iam_policy
|
1379
|
+
##
|
1380
|
+
# RPC-specific configuration for `get_iam_policy`
|
1381
|
+
# @return [Gapic::Config::Method]
|
1382
|
+
#
|
1383
|
+
attr_reader :get_iam_policy
|
1384
|
+
##
|
1385
|
+
# RPC-specific configuration for `test_iam_permissions`
|
1386
|
+
# @return [Gapic::Config::Method]
|
1387
|
+
#
|
1388
|
+
attr_reader :test_iam_permissions
|
1389
|
+
|
1390
|
+
# @private
|
1391
|
+
def initialize parent_rpcs = nil
|
1392
|
+
list_secrets_config = parent_rpcs&.list_secrets if parent_rpcs&.respond_to? :list_secrets
|
1393
|
+
@list_secrets = Gapic::Config::Method.new list_secrets_config
|
1394
|
+
create_secret_config = parent_rpcs&.create_secret if parent_rpcs&.respond_to? :create_secret
|
1395
|
+
@create_secret = Gapic::Config::Method.new create_secret_config
|
1396
|
+
add_secret_version_config = parent_rpcs&.add_secret_version if parent_rpcs&.respond_to? :add_secret_version
|
1397
|
+
@add_secret_version = Gapic::Config::Method.new add_secret_version_config
|
1398
|
+
get_secret_config = parent_rpcs&.get_secret if parent_rpcs&.respond_to? :get_secret
|
1399
|
+
@get_secret = Gapic::Config::Method.new get_secret_config
|
1400
|
+
update_secret_config = parent_rpcs&.update_secret if parent_rpcs&.respond_to? :update_secret
|
1401
|
+
@update_secret = Gapic::Config::Method.new update_secret_config
|
1402
|
+
delete_secret_config = parent_rpcs&.delete_secret if parent_rpcs&.respond_to? :delete_secret
|
1403
|
+
@delete_secret = Gapic::Config::Method.new delete_secret_config
|
1404
|
+
list_secret_versions_config = parent_rpcs&.list_secret_versions if parent_rpcs&.respond_to? :list_secret_versions
|
1405
|
+
@list_secret_versions = Gapic::Config::Method.new list_secret_versions_config
|
1406
|
+
get_secret_version_config = parent_rpcs&.get_secret_version if parent_rpcs&.respond_to? :get_secret_version
|
1407
|
+
@get_secret_version = Gapic::Config::Method.new get_secret_version_config
|
1408
|
+
access_secret_version_config = parent_rpcs&.access_secret_version if parent_rpcs&.respond_to? :access_secret_version
|
1409
|
+
@access_secret_version = Gapic::Config::Method.new access_secret_version_config
|
1410
|
+
disable_secret_version_config = parent_rpcs&.disable_secret_version if parent_rpcs&.respond_to? :disable_secret_version
|
1411
|
+
@disable_secret_version = Gapic::Config::Method.new disable_secret_version_config
|
1412
|
+
enable_secret_version_config = parent_rpcs&.enable_secret_version if parent_rpcs&.respond_to? :enable_secret_version
|
1413
|
+
@enable_secret_version = Gapic::Config::Method.new enable_secret_version_config
|
1414
|
+
destroy_secret_version_config = parent_rpcs&.destroy_secret_version if parent_rpcs&.respond_to? :destroy_secret_version
|
1415
|
+
@destroy_secret_version = Gapic::Config::Method.new destroy_secret_version_config
|
1416
|
+
set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
|
1417
|
+
@set_iam_policy = Gapic::Config::Method.new set_iam_policy_config
|
1418
|
+
get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
|
1419
|
+
@get_iam_policy = Gapic::Config::Method.new get_iam_policy_config
|
1420
|
+
test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
|
1421
|
+
@test_iam_permissions = Gapic::Config::Method.new test_iam_permissions_config
|
1422
|
+
|
1423
|
+
yield self if block_given?
|
1424
|
+
end
|
1425
|
+
end
|
1426
|
+
end
|
1427
|
+
end
|
1428
|
+
end
|
1429
|
+
end
|
1430
|
+
end
|
1431
|
+
end
|
1432
|
+
end
|
1433
|
+
|
1434
|
+
# rubocop:disable Lint/HandleExceptions
|
1435
|
+
|
1436
|
+
# Once client is loaded, load helpers.rb if it exists.
|
1437
|
+
begin
|
1438
|
+
require "google/cloud/secret_manager/v1/secret_manager_service/helpers"
|
1439
|
+
rescue LoadError
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
# rubocop:enable Lint/HandleExceptions
|