google-apis-secretmanager_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,667 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module SecretmanagerV1
23
+ # Secret Manager API
24
+ #
25
+ # Stores sensitive data such as API keys, passwords, and certificates. Provides
26
+ # convenience while improving security.
27
+ #
28
+ # @example
29
+ # require 'google/apis/secretmanager_v1'
30
+ #
31
+ # Secretmanager = Google::Apis::SecretmanagerV1 # Alias the module
32
+ # service = Secretmanager::SecretManagerService.new
33
+ #
34
+ # @see https://cloud.google.com/secret-manager/
35
+ class SecretManagerService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://secretmanager.googleapis.com/', '',
48
+ client_name: 'google-apis-secretmanager_v1',
49
+ client_version: Google::Apis::SecretmanagerV1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Gets information about a location.
54
+ # @param [String] name
55
+ # Resource name for the location.
56
+ # @param [String] fields
57
+ # Selector specifying which fields to include in a partial response.
58
+ # @param [String] quota_user
59
+ # Available to use for quota purposes for server-side applications. Can be any
60
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
61
+ # @param [Google::Apis::RequestOptions] options
62
+ # Request-specific options
63
+ #
64
+ # @yield [result, err] Result & error if block supplied
65
+ # @yieldparam result [Google::Apis::SecretmanagerV1::Location] parsed result object
66
+ # @yieldparam err [StandardError] error object if request failed
67
+ #
68
+ # @return [Google::Apis::SecretmanagerV1::Location]
69
+ #
70
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
71
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
72
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
73
+ def get_project_location(name, fields: nil, quota_user: nil, options: nil, &block)
74
+ command = make_simple_command(:get, 'v1/{+name}', options)
75
+ command.response_representation = Google::Apis::SecretmanagerV1::Location::Representation
76
+ command.response_class = Google::Apis::SecretmanagerV1::Location
77
+ command.params['name'] = name unless name.nil?
78
+ command.query['fields'] = fields unless fields.nil?
79
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
80
+ execute_or_queue_command(command, &block)
81
+ end
82
+
83
+ # Lists information about the supported locations for this service.
84
+ # @param [String] name
85
+ # The resource that owns the locations collection, if applicable.
86
+ # @param [String] filter
87
+ # The standard list filter.
88
+ # @param [Fixnum] page_size
89
+ # The standard list page size.
90
+ # @param [String] page_token
91
+ # The standard list page token.
92
+ # @param [String] fields
93
+ # Selector specifying which fields to include in a partial response.
94
+ # @param [String] quota_user
95
+ # Available to use for quota purposes for server-side applications. Can be any
96
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
97
+ # @param [Google::Apis::RequestOptions] options
98
+ # Request-specific options
99
+ #
100
+ # @yield [result, err] Result & error if block supplied
101
+ # @yieldparam result [Google::Apis::SecretmanagerV1::ListLocationsResponse] parsed result object
102
+ # @yieldparam err [StandardError] error object if request failed
103
+ #
104
+ # @return [Google::Apis::SecretmanagerV1::ListLocationsResponse]
105
+ #
106
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
107
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
108
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
109
+ def list_project_locations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
110
+ command = make_simple_command(:get, 'v1/{+name}/locations', options)
111
+ command.response_representation = Google::Apis::SecretmanagerV1::ListLocationsResponse::Representation
112
+ command.response_class = Google::Apis::SecretmanagerV1::ListLocationsResponse
113
+ command.params['name'] = name unless name.nil?
114
+ command.query['filter'] = filter unless filter.nil?
115
+ command.query['pageSize'] = page_size unless page_size.nil?
116
+ command.query['pageToken'] = page_token unless page_token.nil?
117
+ command.query['fields'] = fields unless fields.nil?
118
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
119
+ execute_or_queue_command(command, &block)
120
+ end
121
+
122
+ # Creates a new SecretVersion containing secret data and attaches it to an
123
+ # existing Secret.
124
+ # @param [String] parent
125
+ # Required. The resource name of the Secret to associate with the SecretVersion
126
+ # in the format `projects/*/secrets/*`.
127
+ # @param [Google::Apis::SecretmanagerV1::AddSecretVersionRequest] add_secret_version_request_object
128
+ # @param [String] fields
129
+ # Selector specifying which fields to include in a partial response.
130
+ # @param [String] quota_user
131
+ # Available to use for quota purposes for server-side applications. Can be any
132
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
133
+ # @param [Google::Apis::RequestOptions] options
134
+ # Request-specific options
135
+ #
136
+ # @yield [result, err] Result & error if block supplied
137
+ # @yieldparam result [Google::Apis::SecretmanagerV1::SecretVersion] parsed result object
138
+ # @yieldparam err [StandardError] error object if request failed
139
+ #
140
+ # @return [Google::Apis::SecretmanagerV1::SecretVersion]
141
+ #
142
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
143
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
144
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
145
+ def add_project_secret_version(parent, add_secret_version_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
146
+ command = make_simple_command(:post, 'v1/{+parent}:addVersion', options)
147
+ command.request_representation = Google::Apis::SecretmanagerV1::AddSecretVersionRequest::Representation
148
+ command.request_object = add_secret_version_request_object
149
+ command.response_representation = Google::Apis::SecretmanagerV1::SecretVersion::Representation
150
+ command.response_class = Google::Apis::SecretmanagerV1::SecretVersion
151
+ command.params['parent'] = parent unless parent.nil?
152
+ command.query['fields'] = fields unless fields.nil?
153
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
154
+ execute_or_queue_command(command, &block)
155
+ end
156
+
157
+ # Creates a new Secret containing no SecretVersions.
158
+ # @param [String] parent
159
+ # Required. The resource name of the project to associate with the Secret, in
160
+ # the format `projects/*`.
161
+ # @param [Google::Apis::SecretmanagerV1::Secret] secret_object
162
+ # @param [String] secret_id
163
+ # Required. This must be unique within the project. A secret ID is a string with
164
+ # a maximum length of 255 characters and can contain uppercase and lowercase
165
+ # letters, numerals, and the hyphen (`-`) and underscore (`_`) characters.
166
+ # @param [String] fields
167
+ # Selector specifying which fields to include in a partial response.
168
+ # @param [String] quota_user
169
+ # Available to use for quota purposes for server-side applications. Can be any
170
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
171
+ # @param [Google::Apis::RequestOptions] options
172
+ # Request-specific options
173
+ #
174
+ # @yield [result, err] Result & error if block supplied
175
+ # @yieldparam result [Google::Apis::SecretmanagerV1::Secret] parsed result object
176
+ # @yieldparam err [StandardError] error object if request failed
177
+ #
178
+ # @return [Google::Apis::SecretmanagerV1::Secret]
179
+ #
180
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
181
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
182
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
183
+ def create_project_secret(parent, secret_object = nil, secret_id: nil, fields: nil, quota_user: nil, options: nil, &block)
184
+ command = make_simple_command(:post, 'v1/{+parent}/secrets', options)
185
+ command.request_representation = Google::Apis::SecretmanagerV1::Secret::Representation
186
+ command.request_object = secret_object
187
+ command.response_representation = Google::Apis::SecretmanagerV1::Secret::Representation
188
+ command.response_class = Google::Apis::SecretmanagerV1::Secret
189
+ command.params['parent'] = parent unless parent.nil?
190
+ command.query['secretId'] = secret_id unless secret_id.nil?
191
+ command.query['fields'] = fields unless fields.nil?
192
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
193
+ execute_or_queue_command(command, &block)
194
+ end
195
+
196
+ # Deletes a Secret.
197
+ # @param [String] name
198
+ # Required. The resource name of the Secret to delete in the format `projects/*/
199
+ # secrets/*`.
200
+ # @param [String] fields
201
+ # Selector specifying which fields to include in a partial response.
202
+ # @param [String] quota_user
203
+ # Available to use for quota purposes for server-side applications. Can be any
204
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
205
+ # @param [Google::Apis::RequestOptions] options
206
+ # Request-specific options
207
+ #
208
+ # @yield [result, err] Result & error if block supplied
209
+ # @yieldparam result [Google::Apis::SecretmanagerV1::Empty] parsed result object
210
+ # @yieldparam err [StandardError] error object if request failed
211
+ #
212
+ # @return [Google::Apis::SecretmanagerV1::Empty]
213
+ #
214
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
215
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
216
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
217
+ def delete_project_secret(name, fields: nil, quota_user: nil, options: nil, &block)
218
+ command = make_simple_command(:delete, 'v1/{+name}', options)
219
+ command.response_representation = Google::Apis::SecretmanagerV1::Empty::Representation
220
+ command.response_class = Google::Apis::SecretmanagerV1::Empty
221
+ command.params['name'] = name unless name.nil?
222
+ command.query['fields'] = fields unless fields.nil?
223
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
224
+ execute_or_queue_command(command, &block)
225
+ end
226
+
227
+ # Gets metadata for a given Secret.
228
+ # @param [String] name
229
+ # Required. The resource name of the Secret, in the format `projects/*/secrets/*`
230
+ # .
231
+ # @param [String] fields
232
+ # Selector specifying which fields to include in a partial response.
233
+ # @param [String] quota_user
234
+ # Available to use for quota purposes for server-side applications. Can be any
235
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
236
+ # @param [Google::Apis::RequestOptions] options
237
+ # Request-specific options
238
+ #
239
+ # @yield [result, err] Result & error if block supplied
240
+ # @yieldparam result [Google::Apis::SecretmanagerV1::Secret] parsed result object
241
+ # @yieldparam err [StandardError] error object if request failed
242
+ #
243
+ # @return [Google::Apis::SecretmanagerV1::Secret]
244
+ #
245
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
246
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
247
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
248
+ def get_project_secret(name, fields: nil, quota_user: nil, options: nil, &block)
249
+ command = make_simple_command(:get, 'v1/{+name}', options)
250
+ command.response_representation = Google::Apis::SecretmanagerV1::Secret::Representation
251
+ command.response_class = Google::Apis::SecretmanagerV1::Secret
252
+ command.params['name'] = name unless name.nil?
253
+ command.query['fields'] = fields unless fields.nil?
254
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
255
+ execute_or_queue_command(command, &block)
256
+ end
257
+
258
+ # Gets the access control policy for a secret. Returns empty policy if the
259
+ # secret exists and does not have a policy set.
260
+ # @param [String] resource
261
+ # REQUIRED: The resource for which the policy is being requested. See the
262
+ # operation documentation for the appropriate value for this field.
263
+ # @param [Fixnum] options_requested_policy_version
264
+ # Optional. The policy format version to be returned. Valid values are 0, 1, and
265
+ # 3. Requests specifying an invalid value will be rejected. Requests for
266
+ # policies with any conditional bindings must specify version 3. Policies
267
+ # without any conditional bindings may specify any valid value or leave the
268
+ # field unset. To learn which resources support conditions in their IAM policies,
269
+ # see the [IAM documentation](https://cloud.google.com/iam/help/conditions/
270
+ # resource-policies).
271
+ # @param [String] fields
272
+ # Selector specifying which fields to include in a partial response.
273
+ # @param [String] quota_user
274
+ # Available to use for quota purposes for server-side applications. Can be any
275
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
276
+ # @param [Google::Apis::RequestOptions] options
277
+ # Request-specific options
278
+ #
279
+ # @yield [result, err] Result & error if block supplied
280
+ # @yieldparam result [Google::Apis::SecretmanagerV1::Policy] parsed result object
281
+ # @yieldparam err [StandardError] error object if request failed
282
+ #
283
+ # @return [Google::Apis::SecretmanagerV1::Policy]
284
+ #
285
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
286
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
287
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
288
+ def get_project_secret_iam_policy(resource, options_requested_policy_version: nil, fields: nil, quota_user: nil, options: nil, &block)
289
+ command = make_simple_command(:get, 'v1/{+resource}:getIamPolicy', options)
290
+ command.response_representation = Google::Apis::SecretmanagerV1::Policy::Representation
291
+ command.response_class = Google::Apis::SecretmanagerV1::Policy
292
+ command.params['resource'] = resource unless resource.nil?
293
+ command.query['options.requestedPolicyVersion'] = options_requested_policy_version unless options_requested_policy_version.nil?
294
+ command.query['fields'] = fields unless fields.nil?
295
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
296
+ execute_or_queue_command(command, &block)
297
+ end
298
+
299
+ # Lists Secrets.
300
+ # @param [String] parent
301
+ # Required. The resource name of the project associated with the Secrets, in the
302
+ # format `projects/*`.
303
+ # @param [Fixnum] page_size
304
+ # Optional. The maximum number of results to be returned in a single page. If
305
+ # set to 0, the server decides the number of results to return. If the number is
306
+ # greater than 25000, it is capped at 25000.
307
+ # @param [String] page_token
308
+ # Optional. Pagination token, returned earlier via ListSecretsResponse.
309
+ # next_page_token.
310
+ # @param [String] fields
311
+ # Selector specifying which fields to include in a partial response.
312
+ # @param [String] quota_user
313
+ # Available to use for quota purposes for server-side applications. Can be any
314
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
315
+ # @param [Google::Apis::RequestOptions] options
316
+ # Request-specific options
317
+ #
318
+ # @yield [result, err] Result & error if block supplied
319
+ # @yieldparam result [Google::Apis::SecretmanagerV1::ListSecretsResponse] parsed result object
320
+ # @yieldparam err [StandardError] error object if request failed
321
+ #
322
+ # @return [Google::Apis::SecretmanagerV1::ListSecretsResponse]
323
+ #
324
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
325
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
326
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
327
+ def list_project_secrets(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
328
+ command = make_simple_command(:get, 'v1/{+parent}/secrets', options)
329
+ command.response_representation = Google::Apis::SecretmanagerV1::ListSecretsResponse::Representation
330
+ command.response_class = Google::Apis::SecretmanagerV1::ListSecretsResponse
331
+ command.params['parent'] = parent unless parent.nil?
332
+ command.query['pageSize'] = page_size unless page_size.nil?
333
+ command.query['pageToken'] = page_token unless page_token.nil?
334
+ command.query['fields'] = fields unless fields.nil?
335
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
336
+ execute_or_queue_command(command, &block)
337
+ end
338
+
339
+ # Updates metadata of an existing Secret.
340
+ # @param [String] name
341
+ # Output only. The resource name of the Secret in the format `projects/*/secrets/
342
+ # *`.
343
+ # @param [Google::Apis::SecretmanagerV1::Secret] secret_object
344
+ # @param [String] update_mask
345
+ # Required. Specifies the fields to be updated.
346
+ # @param [String] fields
347
+ # Selector specifying which fields to include in a partial response.
348
+ # @param [String] quota_user
349
+ # Available to use for quota purposes for server-side applications. Can be any
350
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
351
+ # @param [Google::Apis::RequestOptions] options
352
+ # Request-specific options
353
+ #
354
+ # @yield [result, err] Result & error if block supplied
355
+ # @yieldparam result [Google::Apis::SecretmanagerV1::Secret] parsed result object
356
+ # @yieldparam err [StandardError] error object if request failed
357
+ #
358
+ # @return [Google::Apis::SecretmanagerV1::Secret]
359
+ #
360
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
361
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
362
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
363
+ def patch_project_secret(name, secret_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
364
+ command = make_simple_command(:patch, 'v1/{+name}', options)
365
+ command.request_representation = Google::Apis::SecretmanagerV1::Secret::Representation
366
+ command.request_object = secret_object
367
+ command.response_representation = Google::Apis::SecretmanagerV1::Secret::Representation
368
+ command.response_class = Google::Apis::SecretmanagerV1::Secret
369
+ command.params['name'] = name unless name.nil?
370
+ command.query['updateMask'] = update_mask unless update_mask.nil?
371
+ command.query['fields'] = fields unless fields.nil?
372
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
373
+ execute_or_queue_command(command, &block)
374
+ end
375
+
376
+ # Sets the access control policy on the specified secret. Replaces any existing
377
+ # policy. Permissions on SecretVersions are enforced according to the policy set
378
+ # on the associated Secret.
379
+ # @param [String] resource
380
+ # REQUIRED: The resource for which the policy is being specified. See the
381
+ # operation documentation for the appropriate value for this field.
382
+ # @param [Google::Apis::SecretmanagerV1::SetIamPolicyRequest] set_iam_policy_request_object
383
+ # @param [String] fields
384
+ # Selector specifying which fields to include in a partial response.
385
+ # @param [String] quota_user
386
+ # Available to use for quota purposes for server-side applications. Can be any
387
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
388
+ # @param [Google::Apis::RequestOptions] options
389
+ # Request-specific options
390
+ #
391
+ # @yield [result, err] Result & error if block supplied
392
+ # @yieldparam result [Google::Apis::SecretmanagerV1::Policy] parsed result object
393
+ # @yieldparam err [StandardError] error object if request failed
394
+ #
395
+ # @return [Google::Apis::SecretmanagerV1::Policy]
396
+ #
397
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
398
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
399
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
400
+ def set_secret_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
401
+ command = make_simple_command(:post, 'v1/{+resource}:setIamPolicy', options)
402
+ command.request_representation = Google::Apis::SecretmanagerV1::SetIamPolicyRequest::Representation
403
+ command.request_object = set_iam_policy_request_object
404
+ command.response_representation = Google::Apis::SecretmanagerV1::Policy::Representation
405
+ command.response_class = Google::Apis::SecretmanagerV1::Policy
406
+ command.params['resource'] = resource unless resource.nil?
407
+ command.query['fields'] = fields unless fields.nil?
408
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
409
+ execute_or_queue_command(command, &block)
410
+ end
411
+
412
+ # Returns permissions that a caller has for the specified secret. If the secret
413
+ # does not exist, this call returns an empty set of permissions, not a NOT_FOUND
414
+ # error. Note: This operation is designed to be used for building permission-
415
+ # aware UIs and command-line tools, not for authorization checking. This
416
+ # operation may "fail open" without warning.
417
+ # @param [String] resource
418
+ # REQUIRED: The resource for which the policy detail is being requested. See the
419
+ # operation documentation for the appropriate value for this field.
420
+ # @param [Google::Apis::SecretmanagerV1::TestIamPermissionsRequest] test_iam_permissions_request_object
421
+ # @param [String] fields
422
+ # Selector specifying which fields to include in a partial response.
423
+ # @param [String] quota_user
424
+ # Available to use for quota purposes for server-side applications. Can be any
425
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
426
+ # @param [Google::Apis::RequestOptions] options
427
+ # Request-specific options
428
+ #
429
+ # @yield [result, err] Result & error if block supplied
430
+ # @yieldparam result [Google::Apis::SecretmanagerV1::TestIamPermissionsResponse] parsed result object
431
+ # @yieldparam err [StandardError] error object if request failed
432
+ #
433
+ # @return [Google::Apis::SecretmanagerV1::TestIamPermissionsResponse]
434
+ #
435
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
436
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
437
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
438
+ def test_secret_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
439
+ command = make_simple_command(:post, 'v1/{+resource}:testIamPermissions', options)
440
+ command.request_representation = Google::Apis::SecretmanagerV1::TestIamPermissionsRequest::Representation
441
+ command.request_object = test_iam_permissions_request_object
442
+ command.response_representation = Google::Apis::SecretmanagerV1::TestIamPermissionsResponse::Representation
443
+ command.response_class = Google::Apis::SecretmanagerV1::TestIamPermissionsResponse
444
+ command.params['resource'] = resource unless resource.nil?
445
+ command.query['fields'] = fields unless fields.nil?
446
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
447
+ execute_or_queue_command(command, &block)
448
+ end
449
+
450
+ # Accesses a SecretVersion. This call returns the secret data. `projects/*/
451
+ # secrets/*/versions/latest` is an alias to the `latest` SecretVersion.
452
+ # @param [String] name
453
+ # Required. The resource name of the SecretVersion in the format `projects/*/
454
+ # secrets/*/versions/*`.
455
+ # @param [String] fields
456
+ # Selector specifying which fields to include in a partial response.
457
+ # @param [String] quota_user
458
+ # Available to use for quota purposes for server-side applications. Can be any
459
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
460
+ # @param [Google::Apis::RequestOptions] options
461
+ # Request-specific options
462
+ #
463
+ # @yield [result, err] Result & error if block supplied
464
+ # @yieldparam result [Google::Apis::SecretmanagerV1::AccessSecretVersionResponse] parsed result object
465
+ # @yieldparam err [StandardError] error object if request failed
466
+ #
467
+ # @return [Google::Apis::SecretmanagerV1::AccessSecretVersionResponse]
468
+ #
469
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
470
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
471
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
472
+ def access_project_secret_version(name, fields: nil, quota_user: nil, options: nil, &block)
473
+ command = make_simple_command(:get, 'v1/{+name}:access', options)
474
+ command.response_representation = Google::Apis::SecretmanagerV1::AccessSecretVersionResponse::Representation
475
+ command.response_class = Google::Apis::SecretmanagerV1::AccessSecretVersionResponse
476
+ command.params['name'] = name unless name.nil?
477
+ command.query['fields'] = fields unless fields.nil?
478
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
479
+ execute_or_queue_command(command, &block)
480
+ end
481
+
482
+ # Destroys a SecretVersion. Sets the state of the SecretVersion to DESTROYED and
483
+ # irrevocably destroys the secret data.
484
+ # @param [String] name
485
+ # Required. The resource name of the SecretVersion to destroy in the format `
486
+ # projects/*/secrets/*/versions/*`.
487
+ # @param [Google::Apis::SecretmanagerV1::DestroySecretVersionRequest] destroy_secret_version_request_object
488
+ # @param [String] fields
489
+ # Selector specifying which fields to include in a partial response.
490
+ # @param [String] quota_user
491
+ # Available to use for quota purposes for server-side applications. Can be any
492
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
493
+ # @param [Google::Apis::RequestOptions] options
494
+ # Request-specific options
495
+ #
496
+ # @yield [result, err] Result & error if block supplied
497
+ # @yieldparam result [Google::Apis::SecretmanagerV1::SecretVersion] parsed result object
498
+ # @yieldparam err [StandardError] error object if request failed
499
+ #
500
+ # @return [Google::Apis::SecretmanagerV1::SecretVersion]
501
+ #
502
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
503
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
504
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
505
+ def destroy_secret_version(name, destroy_secret_version_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
506
+ command = make_simple_command(:post, 'v1/{+name}:destroy', options)
507
+ command.request_representation = Google::Apis::SecretmanagerV1::DestroySecretVersionRequest::Representation
508
+ command.request_object = destroy_secret_version_request_object
509
+ command.response_representation = Google::Apis::SecretmanagerV1::SecretVersion::Representation
510
+ command.response_class = Google::Apis::SecretmanagerV1::SecretVersion
511
+ command.params['name'] = name unless name.nil?
512
+ command.query['fields'] = fields unless fields.nil?
513
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
514
+ execute_or_queue_command(command, &block)
515
+ end
516
+
517
+ # Disables a SecretVersion. Sets the state of the SecretVersion to DISABLED.
518
+ # @param [String] name
519
+ # Required. The resource name of the SecretVersion to disable in the format `
520
+ # projects/*/secrets/*/versions/*`.
521
+ # @param [Google::Apis::SecretmanagerV1::DisableSecretVersionRequest] disable_secret_version_request_object
522
+ # @param [String] fields
523
+ # Selector specifying which fields to include in a partial response.
524
+ # @param [String] quota_user
525
+ # Available to use for quota purposes for server-side applications. Can be any
526
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
527
+ # @param [Google::Apis::RequestOptions] options
528
+ # Request-specific options
529
+ #
530
+ # @yield [result, err] Result & error if block supplied
531
+ # @yieldparam result [Google::Apis::SecretmanagerV1::SecretVersion] parsed result object
532
+ # @yieldparam err [StandardError] error object if request failed
533
+ #
534
+ # @return [Google::Apis::SecretmanagerV1::SecretVersion]
535
+ #
536
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
537
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
538
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
539
+ def disable_secret_version(name, disable_secret_version_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
540
+ command = make_simple_command(:post, 'v1/{+name}:disable', options)
541
+ command.request_representation = Google::Apis::SecretmanagerV1::DisableSecretVersionRequest::Representation
542
+ command.request_object = disable_secret_version_request_object
543
+ command.response_representation = Google::Apis::SecretmanagerV1::SecretVersion::Representation
544
+ command.response_class = Google::Apis::SecretmanagerV1::SecretVersion
545
+ command.params['name'] = name unless name.nil?
546
+ command.query['fields'] = fields unless fields.nil?
547
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
548
+ execute_or_queue_command(command, &block)
549
+ end
550
+
551
+ # Enables a SecretVersion. Sets the state of the SecretVersion to ENABLED.
552
+ # @param [String] name
553
+ # Required. The resource name of the SecretVersion to enable in the format `
554
+ # projects/*/secrets/*/versions/*`.
555
+ # @param [Google::Apis::SecretmanagerV1::EnableSecretVersionRequest] enable_secret_version_request_object
556
+ # @param [String] fields
557
+ # Selector specifying which fields to include in a partial response.
558
+ # @param [String] quota_user
559
+ # Available to use for quota purposes for server-side applications. Can be any
560
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
561
+ # @param [Google::Apis::RequestOptions] options
562
+ # Request-specific options
563
+ #
564
+ # @yield [result, err] Result & error if block supplied
565
+ # @yieldparam result [Google::Apis::SecretmanagerV1::SecretVersion] parsed result object
566
+ # @yieldparam err [StandardError] error object if request failed
567
+ #
568
+ # @return [Google::Apis::SecretmanagerV1::SecretVersion]
569
+ #
570
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
571
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
572
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
573
+ def enable_secret_version(name, enable_secret_version_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
574
+ command = make_simple_command(:post, 'v1/{+name}:enable', options)
575
+ command.request_representation = Google::Apis::SecretmanagerV1::EnableSecretVersionRequest::Representation
576
+ command.request_object = enable_secret_version_request_object
577
+ command.response_representation = Google::Apis::SecretmanagerV1::SecretVersion::Representation
578
+ command.response_class = Google::Apis::SecretmanagerV1::SecretVersion
579
+ command.params['name'] = name unless name.nil?
580
+ command.query['fields'] = fields unless fields.nil?
581
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
582
+ execute_or_queue_command(command, &block)
583
+ end
584
+
585
+ # Gets metadata for a SecretVersion. `projects/*/secrets/*/versions/latest` is
586
+ # an alias to the `latest` SecretVersion.
587
+ # @param [String] name
588
+ # Required. The resource name of the SecretVersion in the format `projects/*/
589
+ # secrets/*/versions/*`. `projects/*/secrets/*/versions/latest` is an alias to
590
+ # the `latest` SecretVersion.
591
+ # @param [String] fields
592
+ # Selector specifying which fields to include in a partial response.
593
+ # @param [String] quota_user
594
+ # Available to use for quota purposes for server-side applications. Can be any
595
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
596
+ # @param [Google::Apis::RequestOptions] options
597
+ # Request-specific options
598
+ #
599
+ # @yield [result, err] Result & error if block supplied
600
+ # @yieldparam result [Google::Apis::SecretmanagerV1::SecretVersion] parsed result object
601
+ # @yieldparam err [StandardError] error object if request failed
602
+ #
603
+ # @return [Google::Apis::SecretmanagerV1::SecretVersion]
604
+ #
605
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
606
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
607
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
608
+ def get_project_secret_version(name, fields: nil, quota_user: nil, options: nil, &block)
609
+ command = make_simple_command(:get, 'v1/{+name}', options)
610
+ command.response_representation = Google::Apis::SecretmanagerV1::SecretVersion::Representation
611
+ command.response_class = Google::Apis::SecretmanagerV1::SecretVersion
612
+ command.params['name'] = name unless name.nil?
613
+ command.query['fields'] = fields unless fields.nil?
614
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
615
+ execute_or_queue_command(command, &block)
616
+ end
617
+
618
+ # Lists SecretVersions. This call does not return secret data.
619
+ # @param [String] parent
620
+ # Required. The resource name of the Secret associated with the SecretVersions
621
+ # to list, in the format `projects/*/secrets/*`.
622
+ # @param [Fixnum] page_size
623
+ # Optional. The maximum number of results to be returned in a single page. If
624
+ # set to 0, the server decides the number of results to return. If the number is
625
+ # greater than 25000, it is capped at 25000.
626
+ # @param [String] page_token
627
+ # Optional. Pagination token, returned earlier via ListSecretVersionsResponse.
628
+ # next_page_token][].
629
+ # @param [String] fields
630
+ # Selector specifying which fields to include in a partial response.
631
+ # @param [String] quota_user
632
+ # Available to use for quota purposes for server-side applications. Can be any
633
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
634
+ # @param [Google::Apis::RequestOptions] options
635
+ # Request-specific options
636
+ #
637
+ # @yield [result, err] Result & error if block supplied
638
+ # @yieldparam result [Google::Apis::SecretmanagerV1::ListSecretVersionsResponse] parsed result object
639
+ # @yieldparam err [StandardError] error object if request failed
640
+ #
641
+ # @return [Google::Apis::SecretmanagerV1::ListSecretVersionsResponse]
642
+ #
643
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
644
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
645
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
646
+ def list_project_secret_versions(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
647
+ command = make_simple_command(:get, 'v1/{+parent}/versions', options)
648
+ command.response_representation = Google::Apis::SecretmanagerV1::ListSecretVersionsResponse::Representation
649
+ command.response_class = Google::Apis::SecretmanagerV1::ListSecretVersionsResponse
650
+ command.params['parent'] = parent unless parent.nil?
651
+ command.query['pageSize'] = page_size unless page_size.nil?
652
+ command.query['pageToken'] = page_token unless page_token.nil?
653
+ command.query['fields'] = fields unless fields.nil?
654
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
655
+ execute_or_queue_command(command, &block)
656
+ end
657
+
658
+ protected
659
+
660
+ def apply_command_defaults(command)
661
+ command.query['key'] = key unless key.nil?
662
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
663
+ end
664
+ end
665
+ end
666
+ end
667
+ end