google-cloud-privileged_access_manager-v1 0.a → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/cloud/privileged_access_manager/v1/bindings_override.rb +134 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/client.rb +1895 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/credentials.rb +47 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/operations.rb +809 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/paths.rb +206 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/rest/client.rb +1777 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/rest/operations.rb +944 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/rest/service_stub.rb +1109 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager/rest.rb +73 -0
- data/lib/google/cloud/privileged_access_manager/v1/privileged_access_manager.rb +75 -0
- data/lib/google/cloud/privileged_access_manager/v1/rest.rb +38 -0
- data/lib/google/cloud/privileged_access_manager/v1/version.rb +7 -2
- data/lib/google/cloud/privileged_access_manager/v1.rb +45 -0
- data/lib/google/cloud/privilegedaccessmanager/v1/privilegedaccessmanager_pb.rb +108 -0
- data/lib/google/cloud/privilegedaccessmanager/v1/privilegedaccessmanager_services_pb.rb +121 -0
- data/lib/google-cloud-privileged_access_manager-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +403 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/privilegedaccessmanager/v1/privilegedaccessmanager.rb +966 -0
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- metadata +125 -10
@@ -0,0 +1,1895 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/privilegedaccessmanager/v1/privilegedaccessmanager_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module PrivilegedAccessManager
|
26
|
+
module V1
|
27
|
+
module PrivilegedAccessManager
|
28
|
+
##
|
29
|
+
# Client for the PrivilegedAccessManager service.
|
30
|
+
#
|
31
|
+
# This API allows customers to manage temporary, request based privileged
|
32
|
+
# access to their resources.
|
33
|
+
#
|
34
|
+
# It defines the following resource model:
|
35
|
+
#
|
36
|
+
# * A collection of `Entitlement` resources. An entitlement allows configuring
|
37
|
+
# (among other things):
|
38
|
+
#
|
39
|
+
# * Some kind of privileged access that users can request.
|
40
|
+
# * A set of users called _requesters_ who can request this access.
|
41
|
+
# * A maximum duration for which the access can be requested.
|
42
|
+
# * An optional approval workflow which must be satisfied before access is
|
43
|
+
# granted.
|
44
|
+
#
|
45
|
+
# * A collection of `Grant` resources. A grant is a request by a requester to
|
46
|
+
# get the privileged access specified in an entitlement for some duration.
|
47
|
+
#
|
48
|
+
# After the approval workflow as specified in the entitlement is satisfied,
|
49
|
+
# the specified access is given to the requester. The access is automatically
|
50
|
+
# taken back after the requested duration is over.
|
51
|
+
#
|
52
|
+
class Client
|
53
|
+
# @private
|
54
|
+
API_VERSION = ""
|
55
|
+
|
56
|
+
# @private
|
57
|
+
DEFAULT_ENDPOINT_TEMPLATE = "privilegedaccessmanager.$UNIVERSE_DOMAIN$"
|
58
|
+
|
59
|
+
include Paths
|
60
|
+
|
61
|
+
# @private
|
62
|
+
attr_reader :privileged_access_manager_stub
|
63
|
+
|
64
|
+
##
|
65
|
+
# Configure the PrivilegedAccessManager Client class.
|
66
|
+
#
|
67
|
+
# See {::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client::Configuration}
|
68
|
+
# for a description of the configuration fields.
|
69
|
+
#
|
70
|
+
# @example
|
71
|
+
#
|
72
|
+
# # Modify the configuration for all PrivilegedAccessManager clients
|
73
|
+
# ::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.configure do |config|
|
74
|
+
# config.timeout = 10.0
|
75
|
+
# end
|
76
|
+
#
|
77
|
+
# @yield [config] Configure the Client client.
|
78
|
+
# @yieldparam config [Client::Configuration]
|
79
|
+
#
|
80
|
+
# @return [Client::Configuration]
|
81
|
+
#
|
82
|
+
def self.configure
|
83
|
+
@configure ||= begin
|
84
|
+
namespace = ["Google", "Cloud", "PrivilegedAccessManager", "V1"]
|
85
|
+
parent_config = while namespace.any?
|
86
|
+
parent_name = namespace.join "::"
|
87
|
+
parent_const = const_get parent_name
|
88
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
89
|
+
namespace.pop
|
90
|
+
end
|
91
|
+
default_config = Client::Configuration.new parent_config
|
92
|
+
|
93
|
+
default_config
|
94
|
+
end
|
95
|
+
yield @configure if block_given?
|
96
|
+
@configure
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# Configure the PrivilegedAccessManager Client instance.
|
101
|
+
#
|
102
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
103
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
104
|
+
# should be made on {Client.configure}.
|
105
|
+
#
|
106
|
+
# See {::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client::Configuration}
|
107
|
+
# for a description of the configuration fields.
|
108
|
+
#
|
109
|
+
# @yield [config] Configure the Client client.
|
110
|
+
# @yieldparam config [Client::Configuration]
|
111
|
+
#
|
112
|
+
# @return [Client::Configuration]
|
113
|
+
#
|
114
|
+
def configure
|
115
|
+
yield @config if block_given?
|
116
|
+
@config
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# The effective universe domain
|
121
|
+
#
|
122
|
+
# @return [String]
|
123
|
+
#
|
124
|
+
def universe_domain
|
125
|
+
@privileged_access_manager_stub.universe_domain
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Create a new PrivilegedAccessManager client object.
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
#
|
133
|
+
# # Create a client using the default configuration
|
134
|
+
# client = ::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
135
|
+
#
|
136
|
+
# # Create a client using a custom configuration
|
137
|
+
# client = ::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new do |config|
|
138
|
+
# config.timeout = 10.0
|
139
|
+
# end
|
140
|
+
#
|
141
|
+
# @yield [config] Configure the PrivilegedAccessManager client.
|
142
|
+
# @yieldparam config [Client::Configuration]
|
143
|
+
#
|
144
|
+
def initialize
|
145
|
+
# These require statements are intentionally placed here to initialize
|
146
|
+
# the gRPC module only when it's required.
|
147
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
148
|
+
require "gapic/grpc"
|
149
|
+
require "google/cloud/privilegedaccessmanager/v1/privilegedaccessmanager_services_pb"
|
150
|
+
|
151
|
+
# Create the configuration object
|
152
|
+
@config = Configuration.new Client.configure
|
153
|
+
|
154
|
+
# Yield the configuration if needed
|
155
|
+
yield @config if block_given?
|
156
|
+
|
157
|
+
# Create credentials
|
158
|
+
credentials = @config.credentials
|
159
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
160
|
+
# but only if the default endpoint does not have a region prefix.
|
161
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
162
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
163
|
+
!@config.endpoint.split(".").first.include?("-"))
|
164
|
+
credentials ||= Credentials.default scope: @config.scope,
|
165
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
166
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
167
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
168
|
+
end
|
169
|
+
@quota_project_id = @config.quota_project
|
170
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
171
|
+
|
172
|
+
@operations_client = Operations.new do |config|
|
173
|
+
config.credentials = credentials
|
174
|
+
config.quota_project = @quota_project_id
|
175
|
+
config.endpoint = @config.endpoint
|
176
|
+
config.universe_domain = @config.universe_domain
|
177
|
+
end
|
178
|
+
|
179
|
+
@privileged_access_manager_stub = ::Gapic::ServiceStub.new(
|
180
|
+
::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Stub,
|
181
|
+
credentials: credentials,
|
182
|
+
endpoint: @config.endpoint,
|
183
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
184
|
+
universe_domain: @config.universe_domain,
|
185
|
+
channel_args: @config.channel_args,
|
186
|
+
interceptors: @config.interceptors,
|
187
|
+
channel_pool_config: @config.channel_pool
|
188
|
+
)
|
189
|
+
|
190
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
191
|
+
config.credentials = credentials
|
192
|
+
config.quota_project = @quota_project_id
|
193
|
+
config.endpoint = @privileged_access_manager_stub.endpoint
|
194
|
+
config.universe_domain = @privileged_access_manager_stub.universe_domain
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# Get the associated client for long-running operations.
|
200
|
+
#
|
201
|
+
# @return [::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Operations]
|
202
|
+
#
|
203
|
+
attr_reader :operations_client
|
204
|
+
|
205
|
+
##
|
206
|
+
# Get the associated client for mix-in of the Locations.
|
207
|
+
#
|
208
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
209
|
+
#
|
210
|
+
attr_reader :location_client
|
211
|
+
|
212
|
+
# Service calls
|
213
|
+
|
214
|
+
##
|
215
|
+
# CheckOnboardingStatus reports the onboarding status for a
|
216
|
+
# project/folder/organization. Any findings reported by this API need to be
|
217
|
+
# fixed before PAM can be used on the resource.
|
218
|
+
#
|
219
|
+
# @overload check_onboarding_status(request, options = nil)
|
220
|
+
# Pass arguments to `check_onboarding_status` via a request object, either of type
|
221
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::CheckOnboardingStatusRequest} or an equivalent Hash.
|
222
|
+
#
|
223
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::CheckOnboardingStatusRequest, ::Hash]
|
224
|
+
# A request object representing the call parameters. Required. To specify no
|
225
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
226
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
227
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
228
|
+
#
|
229
|
+
# @overload check_onboarding_status(parent: nil)
|
230
|
+
# Pass arguments to `check_onboarding_status` via keyword arguments. Note that at
|
231
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
232
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
233
|
+
#
|
234
|
+
# @param parent [::String]
|
235
|
+
# Required. The resource for which the onboarding status should be checked.
|
236
|
+
# Should be in one of the following formats:
|
237
|
+
#
|
238
|
+
# * `projects/{project-number|project-id}/locations/{region}`
|
239
|
+
# * `folders/{folder-number}/locations/{region}`
|
240
|
+
# * `organizations/{organization-number}/locations/{region}`
|
241
|
+
#
|
242
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
243
|
+
# @yieldparam response [::Google::Cloud::PrivilegedAccessManager::V1::CheckOnboardingStatusResponse]
|
244
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
245
|
+
#
|
246
|
+
# @return [::Google::Cloud::PrivilegedAccessManager::V1::CheckOnboardingStatusResponse]
|
247
|
+
#
|
248
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
249
|
+
#
|
250
|
+
# @example Basic example
|
251
|
+
# require "google/cloud/privileged_access_manager/v1"
|
252
|
+
#
|
253
|
+
# # Create a client object. The client can be reused for multiple calls.
|
254
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
255
|
+
#
|
256
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
257
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::CheckOnboardingStatusRequest.new
|
258
|
+
#
|
259
|
+
# # Call the check_onboarding_status method.
|
260
|
+
# result = client.check_onboarding_status request
|
261
|
+
#
|
262
|
+
# # The returned object is of type Google::Cloud::PrivilegedAccessManager::V1::CheckOnboardingStatusResponse.
|
263
|
+
# p result
|
264
|
+
#
|
265
|
+
def check_onboarding_status request, options = nil
|
266
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
267
|
+
|
268
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::CheckOnboardingStatusRequest
|
269
|
+
|
270
|
+
# Converts hash and nil to an options object
|
271
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
272
|
+
|
273
|
+
# Customize the options with defaults
|
274
|
+
metadata = @config.rpcs.check_onboarding_status.metadata.to_h
|
275
|
+
|
276
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
277
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
278
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
279
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
280
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
281
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
282
|
+
|
283
|
+
header_params = {}
|
284
|
+
if request.parent
|
285
|
+
header_params["parent"] = request.parent
|
286
|
+
end
|
287
|
+
|
288
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
289
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
290
|
+
|
291
|
+
options.apply_defaults timeout: @config.rpcs.check_onboarding_status.timeout,
|
292
|
+
metadata: metadata,
|
293
|
+
retry_policy: @config.rpcs.check_onboarding_status.retry_policy
|
294
|
+
|
295
|
+
options.apply_defaults timeout: @config.timeout,
|
296
|
+
metadata: @config.metadata,
|
297
|
+
retry_policy: @config.retry_policy
|
298
|
+
|
299
|
+
@privileged_access_manager_stub.call_rpc :check_onboarding_status, request, options: options do |response, operation|
|
300
|
+
yield response, operation if block_given?
|
301
|
+
return response
|
302
|
+
end
|
303
|
+
rescue ::GRPC::BadStatus => e
|
304
|
+
raise ::Google::Cloud::Error.from_error(e)
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# Lists entitlements in a given project/folder/organization and location.
|
309
|
+
#
|
310
|
+
# @overload list_entitlements(request, options = nil)
|
311
|
+
# Pass arguments to `list_entitlements` via a request object, either of type
|
312
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::ListEntitlementsRequest} or an equivalent Hash.
|
313
|
+
#
|
314
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::ListEntitlementsRequest, ::Hash]
|
315
|
+
# A request object representing the call parameters. Required. To specify no
|
316
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
317
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
318
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
319
|
+
#
|
320
|
+
# @overload list_entitlements(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
|
321
|
+
# Pass arguments to `list_entitlements` via keyword arguments. Note that at
|
322
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
323
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
324
|
+
#
|
325
|
+
# @param parent [::String]
|
326
|
+
# Required. The parent which owns the entitlement resources.
|
327
|
+
# @param page_size [::Integer]
|
328
|
+
# Optional. Requested page size. Server may return fewer items than
|
329
|
+
# requested. If unspecified, the server picks an appropriate default.
|
330
|
+
# @param page_token [::String]
|
331
|
+
# Optional. A token identifying a page of results the server should return.
|
332
|
+
# @param filter [::String]
|
333
|
+
# Optional. Filtering results.
|
334
|
+
# @param order_by [::String]
|
335
|
+
# Optional. Hint for how to order the results.
|
336
|
+
#
|
337
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
338
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Entitlement>]
|
339
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
340
|
+
#
|
341
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Entitlement>]
|
342
|
+
#
|
343
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
344
|
+
#
|
345
|
+
# @example Basic example
|
346
|
+
# require "google/cloud/privileged_access_manager/v1"
|
347
|
+
#
|
348
|
+
# # Create a client object. The client can be reused for multiple calls.
|
349
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
350
|
+
#
|
351
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
352
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::ListEntitlementsRequest.new
|
353
|
+
#
|
354
|
+
# # Call the list_entitlements method.
|
355
|
+
# result = client.list_entitlements request
|
356
|
+
#
|
357
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
358
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
359
|
+
# result.each do |item|
|
360
|
+
# # Each element is of type ::Google::Cloud::PrivilegedAccessManager::V1::Entitlement.
|
361
|
+
# p item
|
362
|
+
# end
|
363
|
+
#
|
364
|
+
def list_entitlements request, options = nil
|
365
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
366
|
+
|
367
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::ListEntitlementsRequest
|
368
|
+
|
369
|
+
# Converts hash and nil to an options object
|
370
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
371
|
+
|
372
|
+
# Customize the options with defaults
|
373
|
+
metadata = @config.rpcs.list_entitlements.metadata.to_h
|
374
|
+
|
375
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
376
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
377
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
378
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
379
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
380
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
381
|
+
|
382
|
+
header_params = {}
|
383
|
+
if request.parent
|
384
|
+
header_params["parent"] = request.parent
|
385
|
+
end
|
386
|
+
|
387
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
388
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.rpcs.list_entitlements.timeout,
|
391
|
+
metadata: metadata,
|
392
|
+
retry_policy: @config.rpcs.list_entitlements.retry_policy
|
393
|
+
|
394
|
+
options.apply_defaults timeout: @config.timeout,
|
395
|
+
metadata: @config.metadata,
|
396
|
+
retry_policy: @config.retry_policy
|
397
|
+
|
398
|
+
@privileged_access_manager_stub.call_rpc :list_entitlements, request, options: options do |response, operation|
|
399
|
+
response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :list_entitlements, request, response, operation, options
|
400
|
+
yield response, operation if block_given?
|
401
|
+
return response
|
402
|
+
end
|
403
|
+
rescue ::GRPC::BadStatus => e
|
404
|
+
raise ::Google::Cloud::Error.from_error(e)
|
405
|
+
end
|
406
|
+
|
407
|
+
##
|
408
|
+
# `SearchEntitlements` returns entitlements on which the caller has the
|
409
|
+
# specified access.
|
410
|
+
#
|
411
|
+
# @overload search_entitlements(request, options = nil)
|
412
|
+
# Pass arguments to `search_entitlements` via a request object, either of type
|
413
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::SearchEntitlementsRequest} or an equivalent Hash.
|
414
|
+
#
|
415
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::SearchEntitlementsRequest, ::Hash]
|
416
|
+
# A request object representing the call parameters. Required. To specify no
|
417
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
418
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
419
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
420
|
+
#
|
421
|
+
# @overload search_entitlements(parent: nil, caller_access_type: nil, filter: nil, page_size: nil, page_token: nil)
|
422
|
+
# Pass arguments to `search_entitlements` via keyword arguments. Note that at
|
423
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
424
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
425
|
+
#
|
426
|
+
# @param parent [::String]
|
427
|
+
# Required. The parent which owns the entitlement resources.
|
428
|
+
# @param caller_access_type [::Google::Cloud::PrivilegedAccessManager::V1::SearchEntitlementsRequest::CallerAccessType]
|
429
|
+
# Required. Only entitlements where the calling user has this access are
|
430
|
+
# returned.
|
431
|
+
# @param filter [::String]
|
432
|
+
# Optional. Only entitlements matching this filter are returned in the
|
433
|
+
# response.
|
434
|
+
# @param page_size [::Integer]
|
435
|
+
# Optional. Requested page size. The server may return fewer items than
|
436
|
+
# requested. If unspecified, the server picks an appropriate default.
|
437
|
+
# @param page_token [::String]
|
438
|
+
# Optional. A token identifying a page of results the server should return.
|
439
|
+
#
|
440
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
441
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Entitlement>]
|
442
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
443
|
+
#
|
444
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Entitlement>]
|
445
|
+
#
|
446
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
447
|
+
#
|
448
|
+
# @example Basic example
|
449
|
+
# require "google/cloud/privileged_access_manager/v1"
|
450
|
+
#
|
451
|
+
# # Create a client object. The client can be reused for multiple calls.
|
452
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
453
|
+
#
|
454
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
455
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::SearchEntitlementsRequest.new
|
456
|
+
#
|
457
|
+
# # Call the search_entitlements method.
|
458
|
+
# result = client.search_entitlements request
|
459
|
+
#
|
460
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
461
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
462
|
+
# result.each do |item|
|
463
|
+
# # Each element is of type ::Google::Cloud::PrivilegedAccessManager::V1::Entitlement.
|
464
|
+
# p item
|
465
|
+
# end
|
466
|
+
#
|
467
|
+
def search_entitlements request, options = nil
|
468
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
469
|
+
|
470
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::SearchEntitlementsRequest
|
471
|
+
|
472
|
+
# Converts hash and nil to an options object
|
473
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
474
|
+
|
475
|
+
# Customize the options with defaults
|
476
|
+
metadata = @config.rpcs.search_entitlements.metadata.to_h
|
477
|
+
|
478
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
479
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
480
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
481
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
482
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
483
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
484
|
+
|
485
|
+
header_params = {}
|
486
|
+
if request.parent
|
487
|
+
header_params["parent"] = request.parent
|
488
|
+
end
|
489
|
+
|
490
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
491
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
492
|
+
|
493
|
+
options.apply_defaults timeout: @config.rpcs.search_entitlements.timeout,
|
494
|
+
metadata: metadata,
|
495
|
+
retry_policy: @config.rpcs.search_entitlements.retry_policy
|
496
|
+
|
497
|
+
options.apply_defaults timeout: @config.timeout,
|
498
|
+
metadata: @config.metadata,
|
499
|
+
retry_policy: @config.retry_policy
|
500
|
+
|
501
|
+
@privileged_access_manager_stub.call_rpc :search_entitlements, request, options: options do |response, operation|
|
502
|
+
response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :search_entitlements, request, response, operation, options
|
503
|
+
yield response, operation if block_given?
|
504
|
+
return response
|
505
|
+
end
|
506
|
+
rescue ::GRPC::BadStatus => e
|
507
|
+
raise ::Google::Cloud::Error.from_error(e)
|
508
|
+
end
|
509
|
+
|
510
|
+
##
|
511
|
+
# Gets details of a single entitlement.
|
512
|
+
#
|
513
|
+
# @overload get_entitlement(request, options = nil)
|
514
|
+
# Pass arguments to `get_entitlement` via a request object, either of type
|
515
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::GetEntitlementRequest} or an equivalent Hash.
|
516
|
+
#
|
517
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::GetEntitlementRequest, ::Hash]
|
518
|
+
# A request object representing the call parameters. Required. To specify no
|
519
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
520
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
521
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
522
|
+
#
|
523
|
+
# @overload get_entitlement(name: nil)
|
524
|
+
# Pass arguments to `get_entitlement` via keyword arguments. Note that at
|
525
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
526
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
527
|
+
#
|
528
|
+
# @param name [::String]
|
529
|
+
# Required. Name of the resource.
|
530
|
+
#
|
531
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
532
|
+
# @yieldparam response [::Google::Cloud::PrivilegedAccessManager::V1::Entitlement]
|
533
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
534
|
+
#
|
535
|
+
# @return [::Google::Cloud::PrivilegedAccessManager::V1::Entitlement]
|
536
|
+
#
|
537
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
538
|
+
#
|
539
|
+
# @example Basic example
|
540
|
+
# require "google/cloud/privileged_access_manager/v1"
|
541
|
+
#
|
542
|
+
# # Create a client object. The client can be reused for multiple calls.
|
543
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
544
|
+
#
|
545
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
546
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::GetEntitlementRequest.new
|
547
|
+
#
|
548
|
+
# # Call the get_entitlement method.
|
549
|
+
# result = client.get_entitlement request
|
550
|
+
#
|
551
|
+
# # The returned object is of type Google::Cloud::PrivilegedAccessManager::V1::Entitlement.
|
552
|
+
# p result
|
553
|
+
#
|
554
|
+
def get_entitlement request, options = nil
|
555
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
556
|
+
|
557
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::GetEntitlementRequest
|
558
|
+
|
559
|
+
# Converts hash and nil to an options object
|
560
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
561
|
+
|
562
|
+
# Customize the options with defaults
|
563
|
+
metadata = @config.rpcs.get_entitlement.metadata.to_h
|
564
|
+
|
565
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
566
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
567
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
568
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
569
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
570
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
571
|
+
|
572
|
+
header_params = {}
|
573
|
+
if request.name
|
574
|
+
header_params["name"] = request.name
|
575
|
+
end
|
576
|
+
|
577
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
578
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
579
|
+
|
580
|
+
options.apply_defaults timeout: @config.rpcs.get_entitlement.timeout,
|
581
|
+
metadata: metadata,
|
582
|
+
retry_policy: @config.rpcs.get_entitlement.retry_policy
|
583
|
+
|
584
|
+
options.apply_defaults timeout: @config.timeout,
|
585
|
+
metadata: @config.metadata,
|
586
|
+
retry_policy: @config.retry_policy
|
587
|
+
|
588
|
+
@privileged_access_manager_stub.call_rpc :get_entitlement, request, options: options do |response, operation|
|
589
|
+
yield response, operation if block_given?
|
590
|
+
return response
|
591
|
+
end
|
592
|
+
rescue ::GRPC::BadStatus => e
|
593
|
+
raise ::Google::Cloud::Error.from_error(e)
|
594
|
+
end
|
595
|
+
|
596
|
+
##
|
597
|
+
# Creates a new entitlement in a given project/folder/organization and
|
598
|
+
# location.
|
599
|
+
#
|
600
|
+
# @overload create_entitlement(request, options = nil)
|
601
|
+
# Pass arguments to `create_entitlement` via a request object, either of type
|
602
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::CreateEntitlementRequest} or an equivalent Hash.
|
603
|
+
#
|
604
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::CreateEntitlementRequest, ::Hash]
|
605
|
+
# A request object representing the call parameters. Required. To specify no
|
606
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
607
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
608
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
609
|
+
#
|
610
|
+
# @overload create_entitlement(parent: nil, entitlement_id: nil, entitlement: nil, request_id: nil)
|
611
|
+
# Pass arguments to `create_entitlement` via keyword arguments. Note that at
|
612
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
613
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
614
|
+
#
|
615
|
+
# @param parent [::String]
|
616
|
+
# Required. Name of the parent resource for the entitlement.
|
617
|
+
# Possible formats:
|
618
|
+
#
|
619
|
+
# * `organizations/{organization-number}/locations/{region}`
|
620
|
+
# * `folders/{folder-number}/locations/{region}`
|
621
|
+
# * `projects/{project-id|project-number}/locations/{region}`
|
622
|
+
# @param entitlement_id [::String]
|
623
|
+
# Required. The ID to use for this entitlement. This becomes the last part of
|
624
|
+
# the resource name.
|
625
|
+
#
|
626
|
+
# This value should be 4-63 characters in length, and valid characters are
|
627
|
+
# "[a-z]", "[0-9]", and "-". The first character should be from [a-z].
|
628
|
+
#
|
629
|
+
# This value should be unique among all other entitlements under the
|
630
|
+
# specified `parent`.
|
631
|
+
# @param entitlement [::Google::Cloud::PrivilegedAccessManager::V1::Entitlement, ::Hash]
|
632
|
+
# Required. The resource being created
|
633
|
+
# @param request_id [::String]
|
634
|
+
# Optional. An optional request ID to identify requests. Specify a unique
|
635
|
+
# request ID so that if you must retry your request, the server knows to
|
636
|
+
# ignore the request if it has already been completed. The server guarantees
|
637
|
+
# this for at least 60 minutes after the first request.
|
638
|
+
#
|
639
|
+
# For example, consider a situation where you make an initial request and the
|
640
|
+
# request times out. If you make the request again with the same request
|
641
|
+
# ID, the server can check if original operation with the same request ID
|
642
|
+
# was received, and if so, ignores the second request and returns the
|
643
|
+
# previous operation's response. This prevents clients from accidentally
|
644
|
+
# creating duplicate commitments.
|
645
|
+
#
|
646
|
+
# The request ID must be a valid UUID with the exception that zero UUID is
|
647
|
+
# not supported (00000000-0000-0000-0000-000000000000).
|
648
|
+
#
|
649
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
650
|
+
# @yieldparam response [::Gapic::Operation]
|
651
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
652
|
+
#
|
653
|
+
# @return [::Gapic::Operation]
|
654
|
+
#
|
655
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
656
|
+
#
|
657
|
+
# @example Basic example
|
658
|
+
# require "google/cloud/privileged_access_manager/v1"
|
659
|
+
#
|
660
|
+
# # Create a client object. The client can be reused for multiple calls.
|
661
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
662
|
+
#
|
663
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
664
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::CreateEntitlementRequest.new
|
665
|
+
#
|
666
|
+
# # Call the create_entitlement method.
|
667
|
+
# result = client.create_entitlement request
|
668
|
+
#
|
669
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
670
|
+
# # check the status of an operation, cancel it, or wait for results.
|
671
|
+
# # Here is how to wait for a response.
|
672
|
+
# result.wait_until_done! timeout: 60
|
673
|
+
# if result.response?
|
674
|
+
# p result.response
|
675
|
+
# else
|
676
|
+
# puts "No response received."
|
677
|
+
# end
|
678
|
+
#
|
679
|
+
def create_entitlement request, options = nil
|
680
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
681
|
+
|
682
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::CreateEntitlementRequest
|
683
|
+
|
684
|
+
# Converts hash and nil to an options object
|
685
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
686
|
+
|
687
|
+
# Customize the options with defaults
|
688
|
+
metadata = @config.rpcs.create_entitlement.metadata.to_h
|
689
|
+
|
690
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
691
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
692
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
693
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
694
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
695
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
696
|
+
|
697
|
+
header_params = {}
|
698
|
+
if request.parent
|
699
|
+
header_params["parent"] = request.parent
|
700
|
+
end
|
701
|
+
|
702
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
703
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
704
|
+
|
705
|
+
options.apply_defaults timeout: @config.rpcs.create_entitlement.timeout,
|
706
|
+
metadata: metadata,
|
707
|
+
retry_policy: @config.rpcs.create_entitlement.retry_policy
|
708
|
+
|
709
|
+
options.apply_defaults timeout: @config.timeout,
|
710
|
+
metadata: @config.metadata,
|
711
|
+
retry_policy: @config.retry_policy
|
712
|
+
|
713
|
+
@privileged_access_manager_stub.call_rpc :create_entitlement, request, options: options do |response, operation|
|
714
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
715
|
+
yield response, operation if block_given?
|
716
|
+
return response
|
717
|
+
end
|
718
|
+
rescue ::GRPC::BadStatus => e
|
719
|
+
raise ::Google::Cloud::Error.from_error(e)
|
720
|
+
end
|
721
|
+
|
722
|
+
##
|
723
|
+
# Deletes a single entitlement. This method can only be called when there
|
724
|
+
# are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the
|
725
|
+
# entitlement.
|
726
|
+
#
|
727
|
+
# @overload delete_entitlement(request, options = nil)
|
728
|
+
# Pass arguments to `delete_entitlement` via a request object, either of type
|
729
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::DeleteEntitlementRequest} or an equivalent Hash.
|
730
|
+
#
|
731
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::DeleteEntitlementRequest, ::Hash]
|
732
|
+
# A request object representing the call parameters. Required. To specify no
|
733
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
734
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
735
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
736
|
+
#
|
737
|
+
# @overload delete_entitlement(name: nil, request_id: nil, force: nil)
|
738
|
+
# Pass arguments to `delete_entitlement` via keyword arguments. Note that at
|
739
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
740
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
741
|
+
#
|
742
|
+
# @param name [::String]
|
743
|
+
# Required. Name of the resource.
|
744
|
+
# @param request_id [::String]
|
745
|
+
# Optional. An optional request ID to identify requests. Specify a unique
|
746
|
+
# request ID so that if you must retry your request, the server knows to
|
747
|
+
# ignore the request if it has already been completed. The server guarantees
|
748
|
+
# this for at least 60 minutes after the first request.
|
749
|
+
#
|
750
|
+
# For example, consider a situation where you make an initial request and the
|
751
|
+
# request times out. If you make the request again with the same request
|
752
|
+
# ID, the server can check if original operation with the same request ID
|
753
|
+
# was received, and if so, ignores the second request. This prevents
|
754
|
+
# clients from accidentally creating duplicate commitments.
|
755
|
+
#
|
756
|
+
# The request ID must be a valid UUID with the exception that zero UUID is
|
757
|
+
# not supported (00000000-0000-0000-0000-000000000000).
|
758
|
+
# @param force [::Boolean]
|
759
|
+
# Optional. If set to true, any child grant under this entitlement is also
|
760
|
+
# deleted. (Otherwise, the request only works if the entitlement has no child
|
761
|
+
# grant.)
|
762
|
+
#
|
763
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
764
|
+
# @yieldparam response [::Gapic::Operation]
|
765
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
766
|
+
#
|
767
|
+
# @return [::Gapic::Operation]
|
768
|
+
#
|
769
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
770
|
+
#
|
771
|
+
# @example Basic example
|
772
|
+
# require "google/cloud/privileged_access_manager/v1"
|
773
|
+
#
|
774
|
+
# # Create a client object. The client can be reused for multiple calls.
|
775
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
776
|
+
#
|
777
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
778
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::DeleteEntitlementRequest.new
|
779
|
+
#
|
780
|
+
# # Call the delete_entitlement method.
|
781
|
+
# result = client.delete_entitlement request
|
782
|
+
#
|
783
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
784
|
+
# # check the status of an operation, cancel it, or wait for results.
|
785
|
+
# # Here is how to wait for a response.
|
786
|
+
# result.wait_until_done! timeout: 60
|
787
|
+
# if result.response?
|
788
|
+
# p result.response
|
789
|
+
# else
|
790
|
+
# puts "No response received."
|
791
|
+
# end
|
792
|
+
#
|
793
|
+
def delete_entitlement request, options = nil
|
794
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
795
|
+
|
796
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::DeleteEntitlementRequest
|
797
|
+
|
798
|
+
# Converts hash and nil to an options object
|
799
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
800
|
+
|
801
|
+
# Customize the options with defaults
|
802
|
+
metadata = @config.rpcs.delete_entitlement.metadata.to_h
|
803
|
+
|
804
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
805
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
806
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
807
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
808
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
809
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
810
|
+
|
811
|
+
header_params = {}
|
812
|
+
if request.name
|
813
|
+
header_params["name"] = request.name
|
814
|
+
end
|
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.delete_entitlement.timeout,
|
820
|
+
metadata: metadata,
|
821
|
+
retry_policy: @config.rpcs.delete_entitlement.retry_policy
|
822
|
+
|
823
|
+
options.apply_defaults timeout: @config.timeout,
|
824
|
+
metadata: @config.metadata,
|
825
|
+
retry_policy: @config.retry_policy
|
826
|
+
|
827
|
+
@privileged_access_manager_stub.call_rpc :delete_entitlement, request, options: options do |response, operation|
|
828
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
829
|
+
yield response, operation if block_given?
|
830
|
+
return response
|
831
|
+
end
|
832
|
+
rescue ::GRPC::BadStatus => e
|
833
|
+
raise ::Google::Cloud::Error.from_error(e)
|
834
|
+
end
|
835
|
+
|
836
|
+
##
|
837
|
+
# Updates the entitlement specified in the request. Updated fields in the
|
838
|
+
# entitlement need to be specified in an update mask. The changes made to an
|
839
|
+
# entitlement are applicable only on future grants of the entitlement.
|
840
|
+
# However, if new approvers are added or existing approvers are removed from
|
841
|
+
# the approval workflow, the changes are effective on existing grants.
|
842
|
+
#
|
843
|
+
# The following fields are not supported for updates:
|
844
|
+
#
|
845
|
+
# * All immutable fields
|
846
|
+
# * Entitlement name
|
847
|
+
# * Resource name
|
848
|
+
# * Resource type
|
849
|
+
# * Adding an approval workflow in an entitlement which previously had no
|
850
|
+
# approval workflow.
|
851
|
+
# * Deleting the approval workflow from an entitlement.
|
852
|
+
# * Adding or deleting a step in the approval workflow (only one step is
|
853
|
+
# supported)
|
854
|
+
#
|
855
|
+
# Note that updates are allowed on the list of approvers in an approval
|
856
|
+
# workflow step.
|
857
|
+
#
|
858
|
+
# @overload update_entitlement(request, options = nil)
|
859
|
+
# Pass arguments to `update_entitlement` via a request object, either of type
|
860
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::UpdateEntitlementRequest} or an equivalent Hash.
|
861
|
+
#
|
862
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::UpdateEntitlementRequest, ::Hash]
|
863
|
+
# A request object representing the call parameters. Required. To specify no
|
864
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
865
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
866
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
867
|
+
#
|
868
|
+
# @overload update_entitlement(entitlement: nil, update_mask: nil)
|
869
|
+
# Pass arguments to `update_entitlement` via keyword arguments. Note that at
|
870
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
871
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
872
|
+
#
|
873
|
+
# @param entitlement [::Google::Cloud::PrivilegedAccessManager::V1::Entitlement, ::Hash]
|
874
|
+
# Required. The entitlement resource that is updated.
|
875
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
876
|
+
# Required. The list of fields to update. A field is overwritten if, and only
|
877
|
+
# if, it is in the mask. Any immutable fields set in the mask are ignored by
|
878
|
+
# the server. Repeated fields and map fields are only allowed in the last
|
879
|
+
# position of a `paths` string and overwrite the existing values. Hence an
|
880
|
+
# update to a repeated field or a map should contain the entire list of
|
881
|
+
# values. The fields specified in the update_mask are relative to the
|
882
|
+
# resource and not to the request.
|
883
|
+
# (e.g. `MaxRequestDuration`; *not* `entitlement.MaxRequestDuration`)
|
884
|
+
# A value of '*' for this field refers to full replacement of the resource.
|
885
|
+
#
|
886
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
887
|
+
# @yieldparam response [::Gapic::Operation]
|
888
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
889
|
+
#
|
890
|
+
# @return [::Gapic::Operation]
|
891
|
+
#
|
892
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
893
|
+
#
|
894
|
+
# @example Basic example
|
895
|
+
# require "google/cloud/privileged_access_manager/v1"
|
896
|
+
#
|
897
|
+
# # Create a client object. The client can be reused for multiple calls.
|
898
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
899
|
+
#
|
900
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
901
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::UpdateEntitlementRequest.new
|
902
|
+
#
|
903
|
+
# # Call the update_entitlement method.
|
904
|
+
# result = client.update_entitlement request
|
905
|
+
#
|
906
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
907
|
+
# # check the status of an operation, cancel it, or wait for results.
|
908
|
+
# # Here is how to wait for a response.
|
909
|
+
# result.wait_until_done! timeout: 60
|
910
|
+
# if result.response?
|
911
|
+
# p result.response
|
912
|
+
# else
|
913
|
+
# puts "No response received."
|
914
|
+
# end
|
915
|
+
#
|
916
|
+
def update_entitlement request, options = nil
|
917
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
918
|
+
|
919
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::UpdateEntitlementRequest
|
920
|
+
|
921
|
+
# Converts hash and nil to an options object
|
922
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
923
|
+
|
924
|
+
# Customize the options with defaults
|
925
|
+
metadata = @config.rpcs.update_entitlement.metadata.to_h
|
926
|
+
|
927
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
928
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
929
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
930
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
931
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
932
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
933
|
+
|
934
|
+
header_params = {}
|
935
|
+
if request.entitlement&.name
|
936
|
+
header_params["entitlement.name"] = request.entitlement.name
|
937
|
+
end
|
938
|
+
|
939
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
940
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
941
|
+
|
942
|
+
options.apply_defaults timeout: @config.rpcs.update_entitlement.timeout,
|
943
|
+
metadata: metadata,
|
944
|
+
retry_policy: @config.rpcs.update_entitlement.retry_policy
|
945
|
+
|
946
|
+
options.apply_defaults timeout: @config.timeout,
|
947
|
+
metadata: @config.metadata,
|
948
|
+
retry_policy: @config.retry_policy
|
949
|
+
|
950
|
+
@privileged_access_manager_stub.call_rpc :update_entitlement, request, options: options do |response, operation|
|
951
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
952
|
+
yield response, operation if block_given?
|
953
|
+
return response
|
954
|
+
end
|
955
|
+
rescue ::GRPC::BadStatus => e
|
956
|
+
raise ::Google::Cloud::Error.from_error(e)
|
957
|
+
end
|
958
|
+
|
959
|
+
##
|
960
|
+
# Lists grants for a given entitlement.
|
961
|
+
#
|
962
|
+
# @overload list_grants(request, options = nil)
|
963
|
+
# Pass arguments to `list_grants` via a request object, either of type
|
964
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::ListGrantsRequest} or an equivalent Hash.
|
965
|
+
#
|
966
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::ListGrantsRequest, ::Hash]
|
967
|
+
# A request object representing the call parameters. Required. To specify no
|
968
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
969
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
970
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
971
|
+
#
|
972
|
+
# @overload list_grants(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
|
973
|
+
# Pass arguments to `list_grants` via keyword arguments. Note that at
|
974
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
975
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
976
|
+
#
|
977
|
+
# @param parent [::String]
|
978
|
+
# Required. The parent resource which owns the grants.
|
979
|
+
# @param page_size [::Integer]
|
980
|
+
# Optional. Requested page size. The server may return fewer items than
|
981
|
+
# requested. If unspecified, the server picks an appropriate default.
|
982
|
+
# @param page_token [::String]
|
983
|
+
# Optional. A token identifying a page of results the server should return.
|
984
|
+
# @param filter [::String]
|
985
|
+
# Optional. Filtering results.
|
986
|
+
# @param order_by [::String]
|
987
|
+
# Optional. Hint for how to order the results
|
988
|
+
#
|
989
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
990
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Grant>]
|
991
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
992
|
+
#
|
993
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Grant>]
|
994
|
+
#
|
995
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
996
|
+
#
|
997
|
+
# @example Basic example
|
998
|
+
# require "google/cloud/privileged_access_manager/v1"
|
999
|
+
#
|
1000
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1001
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
1002
|
+
#
|
1003
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1004
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::ListGrantsRequest.new
|
1005
|
+
#
|
1006
|
+
# # Call the list_grants method.
|
1007
|
+
# result = client.list_grants request
|
1008
|
+
#
|
1009
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1010
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1011
|
+
# result.each do |item|
|
1012
|
+
# # Each element is of type ::Google::Cloud::PrivilegedAccessManager::V1::Grant.
|
1013
|
+
# p item
|
1014
|
+
# end
|
1015
|
+
#
|
1016
|
+
def list_grants request, options = nil
|
1017
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1018
|
+
|
1019
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::ListGrantsRequest
|
1020
|
+
|
1021
|
+
# Converts hash and nil to an options object
|
1022
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1023
|
+
|
1024
|
+
# Customize the options with defaults
|
1025
|
+
metadata = @config.rpcs.list_grants.metadata.to_h
|
1026
|
+
|
1027
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1028
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1029
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1030
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
1031
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1032
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1033
|
+
|
1034
|
+
header_params = {}
|
1035
|
+
if request.parent
|
1036
|
+
header_params["parent"] = request.parent
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1040
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1041
|
+
|
1042
|
+
options.apply_defaults timeout: @config.rpcs.list_grants.timeout,
|
1043
|
+
metadata: metadata,
|
1044
|
+
retry_policy: @config.rpcs.list_grants.retry_policy
|
1045
|
+
|
1046
|
+
options.apply_defaults timeout: @config.timeout,
|
1047
|
+
metadata: @config.metadata,
|
1048
|
+
retry_policy: @config.retry_policy
|
1049
|
+
|
1050
|
+
@privileged_access_manager_stub.call_rpc :list_grants, request, options: options do |response, operation|
|
1051
|
+
response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :list_grants, request, response, operation, options
|
1052
|
+
yield response, operation if block_given?
|
1053
|
+
return response
|
1054
|
+
end
|
1055
|
+
rescue ::GRPC::BadStatus => e
|
1056
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
##
|
1060
|
+
# `SearchGrants` returns grants that are related to the calling user in the
|
1061
|
+
# specified way.
|
1062
|
+
#
|
1063
|
+
# @overload search_grants(request, options = nil)
|
1064
|
+
# Pass arguments to `search_grants` via a request object, either of type
|
1065
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::SearchGrantsRequest} or an equivalent Hash.
|
1066
|
+
#
|
1067
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::SearchGrantsRequest, ::Hash]
|
1068
|
+
# A request object representing the call parameters. Required. To specify no
|
1069
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1070
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1071
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1072
|
+
#
|
1073
|
+
# @overload search_grants(parent: nil, caller_relationship: nil, filter: nil, page_size: nil, page_token: nil)
|
1074
|
+
# Pass arguments to `search_grants` via keyword arguments. Note that at
|
1075
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1076
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1077
|
+
#
|
1078
|
+
# @param parent [::String]
|
1079
|
+
# Required. The parent which owns the grant resources.
|
1080
|
+
# @param caller_relationship [::Google::Cloud::PrivilegedAccessManager::V1::SearchGrantsRequest::CallerRelationshipType]
|
1081
|
+
# Required. Only grants which the caller is related to by this relationship
|
1082
|
+
# are returned in the response.
|
1083
|
+
# @param filter [::String]
|
1084
|
+
# Optional. Only grants matching this filter are returned in the response.
|
1085
|
+
# @param page_size [::Integer]
|
1086
|
+
# Optional. Requested page size. The server may return fewer items than
|
1087
|
+
# requested. If unspecified, server picks an appropriate default.
|
1088
|
+
# @param page_token [::String]
|
1089
|
+
# Optional. A token identifying a page of results the server should return.
|
1090
|
+
#
|
1091
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1092
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Grant>]
|
1093
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1094
|
+
#
|
1095
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::PrivilegedAccessManager::V1::Grant>]
|
1096
|
+
#
|
1097
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1098
|
+
#
|
1099
|
+
# @example Basic example
|
1100
|
+
# require "google/cloud/privileged_access_manager/v1"
|
1101
|
+
#
|
1102
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1103
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
1104
|
+
#
|
1105
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1106
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::SearchGrantsRequest.new
|
1107
|
+
#
|
1108
|
+
# # Call the search_grants method.
|
1109
|
+
# result = client.search_grants request
|
1110
|
+
#
|
1111
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1112
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1113
|
+
# result.each do |item|
|
1114
|
+
# # Each element is of type ::Google::Cloud::PrivilegedAccessManager::V1::Grant.
|
1115
|
+
# p item
|
1116
|
+
# end
|
1117
|
+
#
|
1118
|
+
def search_grants request, options = nil
|
1119
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1120
|
+
|
1121
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::SearchGrantsRequest
|
1122
|
+
|
1123
|
+
# Converts hash and nil to an options object
|
1124
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1125
|
+
|
1126
|
+
# Customize the options with defaults
|
1127
|
+
metadata = @config.rpcs.search_grants.metadata.to_h
|
1128
|
+
|
1129
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1130
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1131
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1132
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
1133
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1134
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1135
|
+
|
1136
|
+
header_params = {}
|
1137
|
+
if request.parent
|
1138
|
+
header_params["parent"] = request.parent
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1142
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1143
|
+
|
1144
|
+
options.apply_defaults timeout: @config.rpcs.search_grants.timeout,
|
1145
|
+
metadata: metadata,
|
1146
|
+
retry_policy: @config.rpcs.search_grants.retry_policy
|
1147
|
+
|
1148
|
+
options.apply_defaults timeout: @config.timeout,
|
1149
|
+
metadata: @config.metadata,
|
1150
|
+
retry_policy: @config.retry_policy
|
1151
|
+
|
1152
|
+
@privileged_access_manager_stub.call_rpc :search_grants, request, options: options do |response, operation|
|
1153
|
+
response = ::Gapic::PagedEnumerable.new @privileged_access_manager_stub, :search_grants, request, response, operation, options
|
1154
|
+
yield response, operation if block_given?
|
1155
|
+
return response
|
1156
|
+
end
|
1157
|
+
rescue ::GRPC::BadStatus => e
|
1158
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1159
|
+
end
|
1160
|
+
|
1161
|
+
##
|
1162
|
+
# Get details of a single grant.
|
1163
|
+
#
|
1164
|
+
# @overload get_grant(request, options = nil)
|
1165
|
+
# Pass arguments to `get_grant` via a request object, either of type
|
1166
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::GetGrantRequest} or an equivalent Hash.
|
1167
|
+
#
|
1168
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::GetGrantRequest, ::Hash]
|
1169
|
+
# A request object representing the call parameters. Required. To specify no
|
1170
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1171
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1172
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1173
|
+
#
|
1174
|
+
# @overload get_grant(name: nil)
|
1175
|
+
# Pass arguments to `get_grant` via keyword arguments. Note that at
|
1176
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1177
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1178
|
+
#
|
1179
|
+
# @param name [::String]
|
1180
|
+
# Required. Name of the resource.
|
1181
|
+
#
|
1182
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1183
|
+
# @yieldparam response [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1184
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1185
|
+
#
|
1186
|
+
# @return [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1187
|
+
#
|
1188
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1189
|
+
#
|
1190
|
+
# @example Basic example
|
1191
|
+
# require "google/cloud/privileged_access_manager/v1"
|
1192
|
+
#
|
1193
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1194
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
1195
|
+
#
|
1196
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1197
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::GetGrantRequest.new
|
1198
|
+
#
|
1199
|
+
# # Call the get_grant method.
|
1200
|
+
# result = client.get_grant request
|
1201
|
+
#
|
1202
|
+
# # The returned object is of type Google::Cloud::PrivilegedAccessManager::V1::Grant.
|
1203
|
+
# p result
|
1204
|
+
#
|
1205
|
+
def get_grant request, options = nil
|
1206
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1207
|
+
|
1208
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::GetGrantRequest
|
1209
|
+
|
1210
|
+
# Converts hash and nil to an options object
|
1211
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1212
|
+
|
1213
|
+
# Customize the options with defaults
|
1214
|
+
metadata = @config.rpcs.get_grant.metadata.to_h
|
1215
|
+
|
1216
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1217
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1218
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1219
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
1220
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1221
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1222
|
+
|
1223
|
+
header_params = {}
|
1224
|
+
if request.name
|
1225
|
+
header_params["name"] = request.name
|
1226
|
+
end
|
1227
|
+
|
1228
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1229
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1230
|
+
|
1231
|
+
options.apply_defaults timeout: @config.rpcs.get_grant.timeout,
|
1232
|
+
metadata: metadata,
|
1233
|
+
retry_policy: @config.rpcs.get_grant.retry_policy
|
1234
|
+
|
1235
|
+
options.apply_defaults timeout: @config.timeout,
|
1236
|
+
metadata: @config.metadata,
|
1237
|
+
retry_policy: @config.retry_policy
|
1238
|
+
|
1239
|
+
@privileged_access_manager_stub.call_rpc :get_grant, request, options: options do |response, operation|
|
1240
|
+
yield response, operation if block_given?
|
1241
|
+
return response
|
1242
|
+
end
|
1243
|
+
rescue ::GRPC::BadStatus => e
|
1244
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1245
|
+
end
|
1246
|
+
|
1247
|
+
##
|
1248
|
+
# Creates a new grant in a given project and location.
|
1249
|
+
#
|
1250
|
+
# @overload create_grant(request, options = nil)
|
1251
|
+
# Pass arguments to `create_grant` via a request object, either of type
|
1252
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::CreateGrantRequest} or an equivalent Hash.
|
1253
|
+
#
|
1254
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::CreateGrantRequest, ::Hash]
|
1255
|
+
# A request object representing the call parameters. Required. To specify no
|
1256
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1257
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1258
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1259
|
+
#
|
1260
|
+
# @overload create_grant(parent: nil, grant: nil, request_id: nil)
|
1261
|
+
# Pass arguments to `create_grant` via keyword arguments. Note that at
|
1262
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1263
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1264
|
+
#
|
1265
|
+
# @param parent [::String]
|
1266
|
+
# Required. Name of the parent entitlement for which this grant is being
|
1267
|
+
# requested.
|
1268
|
+
# @param grant [::Google::Cloud::PrivilegedAccessManager::V1::Grant, ::Hash]
|
1269
|
+
# Required. The resource being created.
|
1270
|
+
# @param request_id [::String]
|
1271
|
+
# Optional. An optional request ID to identify requests. Specify a unique
|
1272
|
+
# request ID so that if you must retry your request, the server knows to
|
1273
|
+
# ignore the request if it has already been completed. The server guarantees
|
1274
|
+
# this for at least 60 minutes after the first request.
|
1275
|
+
#
|
1276
|
+
# For example, consider a situation where you make an initial request and the
|
1277
|
+
# request times out. If you make the request again with the same request
|
1278
|
+
# ID, the server can check if original operation with the same request ID
|
1279
|
+
# was received, and if so, ignores the second request. This prevents
|
1280
|
+
# clients from accidentally creating duplicate commitments.
|
1281
|
+
#
|
1282
|
+
# The request ID must be a valid UUID with the exception that zero UUID is
|
1283
|
+
# not supported (00000000-0000-0000-0000-000000000000).
|
1284
|
+
#
|
1285
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1286
|
+
# @yieldparam response [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1287
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1288
|
+
#
|
1289
|
+
# @return [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1290
|
+
#
|
1291
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1292
|
+
#
|
1293
|
+
# @example Basic example
|
1294
|
+
# require "google/cloud/privileged_access_manager/v1"
|
1295
|
+
#
|
1296
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1297
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
1298
|
+
#
|
1299
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1300
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::CreateGrantRequest.new
|
1301
|
+
#
|
1302
|
+
# # Call the create_grant method.
|
1303
|
+
# result = client.create_grant request
|
1304
|
+
#
|
1305
|
+
# # The returned object is of type Google::Cloud::PrivilegedAccessManager::V1::Grant.
|
1306
|
+
# p result
|
1307
|
+
#
|
1308
|
+
def create_grant request, options = nil
|
1309
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1310
|
+
|
1311
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::CreateGrantRequest
|
1312
|
+
|
1313
|
+
# Converts hash and nil to an options object
|
1314
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1315
|
+
|
1316
|
+
# Customize the options with defaults
|
1317
|
+
metadata = @config.rpcs.create_grant.metadata.to_h
|
1318
|
+
|
1319
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1320
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1321
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1322
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
1323
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1324
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1325
|
+
|
1326
|
+
header_params = {}
|
1327
|
+
if request.parent
|
1328
|
+
header_params["parent"] = request.parent
|
1329
|
+
end
|
1330
|
+
|
1331
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1332
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1333
|
+
|
1334
|
+
options.apply_defaults timeout: @config.rpcs.create_grant.timeout,
|
1335
|
+
metadata: metadata,
|
1336
|
+
retry_policy: @config.rpcs.create_grant.retry_policy
|
1337
|
+
|
1338
|
+
options.apply_defaults timeout: @config.timeout,
|
1339
|
+
metadata: @config.metadata,
|
1340
|
+
retry_policy: @config.retry_policy
|
1341
|
+
|
1342
|
+
@privileged_access_manager_stub.call_rpc :create_grant, request, options: options do |response, operation|
|
1343
|
+
yield response, operation if block_given?
|
1344
|
+
return response
|
1345
|
+
end
|
1346
|
+
rescue ::GRPC::BadStatus => e
|
1347
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1348
|
+
end
|
1349
|
+
|
1350
|
+
##
|
1351
|
+
# `ApproveGrant` is used to approve a grant. This method can only be called
|
1352
|
+
# on a grant when it's in the `APPROVAL_AWAITED` state. This operation can't
|
1353
|
+
# be undone.
|
1354
|
+
#
|
1355
|
+
# @overload approve_grant(request, options = nil)
|
1356
|
+
# Pass arguments to `approve_grant` via a request object, either of type
|
1357
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::ApproveGrantRequest} or an equivalent Hash.
|
1358
|
+
#
|
1359
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::ApproveGrantRequest, ::Hash]
|
1360
|
+
# A request object representing the call parameters. Required. To specify no
|
1361
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1362
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1363
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1364
|
+
#
|
1365
|
+
# @overload approve_grant(name: nil, reason: nil)
|
1366
|
+
# Pass arguments to `approve_grant` via keyword arguments. Note that at
|
1367
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1368
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1369
|
+
#
|
1370
|
+
# @param name [::String]
|
1371
|
+
# Required. Name of the grant resource which is being approved.
|
1372
|
+
# @param reason [::String]
|
1373
|
+
# Optional. The reason for approving this grant. This is required if the
|
1374
|
+
# `require_approver_justification` field of the `ManualApprovals` workflow
|
1375
|
+
# used in this grant is true.
|
1376
|
+
#
|
1377
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1378
|
+
# @yieldparam response [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1379
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1380
|
+
#
|
1381
|
+
# @return [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1382
|
+
#
|
1383
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1384
|
+
#
|
1385
|
+
# @example Basic example
|
1386
|
+
# require "google/cloud/privileged_access_manager/v1"
|
1387
|
+
#
|
1388
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1389
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
1390
|
+
#
|
1391
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1392
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::ApproveGrantRequest.new
|
1393
|
+
#
|
1394
|
+
# # Call the approve_grant method.
|
1395
|
+
# result = client.approve_grant request
|
1396
|
+
#
|
1397
|
+
# # The returned object is of type Google::Cloud::PrivilegedAccessManager::V1::Grant.
|
1398
|
+
# p result
|
1399
|
+
#
|
1400
|
+
def approve_grant request, options = nil
|
1401
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1402
|
+
|
1403
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::ApproveGrantRequest
|
1404
|
+
|
1405
|
+
# Converts hash and nil to an options object
|
1406
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1407
|
+
|
1408
|
+
# Customize the options with defaults
|
1409
|
+
metadata = @config.rpcs.approve_grant.metadata.to_h
|
1410
|
+
|
1411
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1412
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1413
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1414
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
1415
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1416
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1417
|
+
|
1418
|
+
header_params = {}
|
1419
|
+
if request.name
|
1420
|
+
header_params["name"] = request.name
|
1421
|
+
end
|
1422
|
+
|
1423
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1424
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1425
|
+
|
1426
|
+
options.apply_defaults timeout: @config.rpcs.approve_grant.timeout,
|
1427
|
+
metadata: metadata,
|
1428
|
+
retry_policy: @config.rpcs.approve_grant.retry_policy
|
1429
|
+
|
1430
|
+
options.apply_defaults timeout: @config.timeout,
|
1431
|
+
metadata: @config.metadata,
|
1432
|
+
retry_policy: @config.retry_policy
|
1433
|
+
|
1434
|
+
@privileged_access_manager_stub.call_rpc :approve_grant, request, options: options do |response, operation|
|
1435
|
+
yield response, operation if block_given?
|
1436
|
+
return response
|
1437
|
+
end
|
1438
|
+
rescue ::GRPC::BadStatus => e
|
1439
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
##
|
1443
|
+
# `DenyGrant` is used to deny a grant. This method can only be called on a
|
1444
|
+
# grant when it's in the `APPROVAL_AWAITED` state. This operation can't be
|
1445
|
+
# undone.
|
1446
|
+
#
|
1447
|
+
# @overload deny_grant(request, options = nil)
|
1448
|
+
# Pass arguments to `deny_grant` via a request object, either of type
|
1449
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::DenyGrantRequest} or an equivalent Hash.
|
1450
|
+
#
|
1451
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::DenyGrantRequest, ::Hash]
|
1452
|
+
# A request object representing the call parameters. Required. To specify no
|
1453
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1454
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1455
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1456
|
+
#
|
1457
|
+
# @overload deny_grant(name: nil, reason: nil)
|
1458
|
+
# Pass arguments to `deny_grant` via keyword arguments. Note that at
|
1459
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1460
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1461
|
+
#
|
1462
|
+
# @param name [::String]
|
1463
|
+
# Required. Name of the grant resource which is being denied.
|
1464
|
+
# @param reason [::String]
|
1465
|
+
# Optional. The reason for denying this grant. This is required if
|
1466
|
+
# `require_approver_justification` field of the `ManualApprovals` workflow
|
1467
|
+
# used in this grant is true.
|
1468
|
+
#
|
1469
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1470
|
+
# @yieldparam response [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1471
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1472
|
+
#
|
1473
|
+
# @return [::Google::Cloud::PrivilegedAccessManager::V1::Grant]
|
1474
|
+
#
|
1475
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1476
|
+
#
|
1477
|
+
# @example Basic example
|
1478
|
+
# require "google/cloud/privileged_access_manager/v1"
|
1479
|
+
#
|
1480
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1481
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
1482
|
+
#
|
1483
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1484
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::DenyGrantRequest.new
|
1485
|
+
#
|
1486
|
+
# # Call the deny_grant method.
|
1487
|
+
# result = client.deny_grant request
|
1488
|
+
#
|
1489
|
+
# # The returned object is of type Google::Cloud::PrivilegedAccessManager::V1::Grant.
|
1490
|
+
# p result
|
1491
|
+
#
|
1492
|
+
def deny_grant request, options = nil
|
1493
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1494
|
+
|
1495
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::DenyGrantRequest
|
1496
|
+
|
1497
|
+
# Converts hash and nil to an options object
|
1498
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1499
|
+
|
1500
|
+
# Customize the options with defaults
|
1501
|
+
metadata = @config.rpcs.deny_grant.metadata.to_h
|
1502
|
+
|
1503
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1504
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1505
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1506
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
1507
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1508
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1509
|
+
|
1510
|
+
header_params = {}
|
1511
|
+
if request.name
|
1512
|
+
header_params["name"] = request.name
|
1513
|
+
end
|
1514
|
+
|
1515
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1516
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1517
|
+
|
1518
|
+
options.apply_defaults timeout: @config.rpcs.deny_grant.timeout,
|
1519
|
+
metadata: metadata,
|
1520
|
+
retry_policy: @config.rpcs.deny_grant.retry_policy
|
1521
|
+
|
1522
|
+
options.apply_defaults timeout: @config.timeout,
|
1523
|
+
metadata: @config.metadata,
|
1524
|
+
retry_policy: @config.retry_policy
|
1525
|
+
|
1526
|
+
@privileged_access_manager_stub.call_rpc :deny_grant, request, options: options do |response, operation|
|
1527
|
+
yield response, operation if block_given?
|
1528
|
+
return response
|
1529
|
+
end
|
1530
|
+
rescue ::GRPC::BadStatus => e
|
1531
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1532
|
+
end
|
1533
|
+
|
1534
|
+
##
|
1535
|
+
# `RevokeGrant` is used to immediately revoke access for a grant. This method
|
1536
|
+
# can be called when the grant is in a non-terminal state.
|
1537
|
+
#
|
1538
|
+
# @overload revoke_grant(request, options = nil)
|
1539
|
+
# Pass arguments to `revoke_grant` via a request object, either of type
|
1540
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::RevokeGrantRequest} or an equivalent Hash.
|
1541
|
+
#
|
1542
|
+
# @param request [::Google::Cloud::PrivilegedAccessManager::V1::RevokeGrantRequest, ::Hash]
|
1543
|
+
# A request object representing the call parameters. Required. To specify no
|
1544
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1545
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1546
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1547
|
+
#
|
1548
|
+
# @overload revoke_grant(name: nil, reason: nil)
|
1549
|
+
# Pass arguments to `revoke_grant` via keyword arguments. Note that at
|
1550
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1551
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1552
|
+
#
|
1553
|
+
# @param name [::String]
|
1554
|
+
# Required. Name of the grant resource which is being revoked.
|
1555
|
+
# @param reason [::String]
|
1556
|
+
# Optional. The reason for revoking this grant.
|
1557
|
+
#
|
1558
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1559
|
+
# @yieldparam response [::Gapic::Operation]
|
1560
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1561
|
+
#
|
1562
|
+
# @return [::Gapic::Operation]
|
1563
|
+
#
|
1564
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1565
|
+
#
|
1566
|
+
# @example Basic example
|
1567
|
+
# require "google/cloud/privileged_access_manager/v1"
|
1568
|
+
#
|
1569
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1570
|
+
# client = Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new
|
1571
|
+
#
|
1572
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1573
|
+
# request = Google::Cloud::PrivilegedAccessManager::V1::RevokeGrantRequest.new
|
1574
|
+
#
|
1575
|
+
# # Call the revoke_grant method.
|
1576
|
+
# result = client.revoke_grant request
|
1577
|
+
#
|
1578
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
1579
|
+
# # check the status of an operation, cancel it, or wait for results.
|
1580
|
+
# # Here is how to wait for a response.
|
1581
|
+
# result.wait_until_done! timeout: 60
|
1582
|
+
# if result.response?
|
1583
|
+
# p result.response
|
1584
|
+
# else
|
1585
|
+
# puts "No response received."
|
1586
|
+
# end
|
1587
|
+
#
|
1588
|
+
def revoke_grant request, options = nil
|
1589
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1590
|
+
|
1591
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PrivilegedAccessManager::V1::RevokeGrantRequest
|
1592
|
+
|
1593
|
+
# Converts hash and nil to an options object
|
1594
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1595
|
+
|
1596
|
+
# Customize the options with defaults
|
1597
|
+
metadata = @config.rpcs.revoke_grant.metadata.to_h
|
1598
|
+
|
1599
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1600
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1601
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1602
|
+
gapic_version: ::Google::Cloud::PrivilegedAccessManager::V1::VERSION
|
1603
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1604
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1605
|
+
|
1606
|
+
header_params = {}
|
1607
|
+
if request.name
|
1608
|
+
header_params["name"] = request.name
|
1609
|
+
end
|
1610
|
+
|
1611
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1612
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1613
|
+
|
1614
|
+
options.apply_defaults timeout: @config.rpcs.revoke_grant.timeout,
|
1615
|
+
metadata: metadata,
|
1616
|
+
retry_policy: @config.rpcs.revoke_grant.retry_policy
|
1617
|
+
|
1618
|
+
options.apply_defaults timeout: @config.timeout,
|
1619
|
+
metadata: @config.metadata,
|
1620
|
+
retry_policy: @config.retry_policy
|
1621
|
+
|
1622
|
+
@privileged_access_manager_stub.call_rpc :revoke_grant, request, options: options do |response, operation|
|
1623
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1624
|
+
yield response, operation if block_given?
|
1625
|
+
return response
|
1626
|
+
end
|
1627
|
+
rescue ::GRPC::BadStatus => e
|
1628
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1629
|
+
end
|
1630
|
+
|
1631
|
+
##
|
1632
|
+
# Configuration class for the PrivilegedAccessManager API.
|
1633
|
+
#
|
1634
|
+
# This class represents the configuration for PrivilegedAccessManager,
|
1635
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1636
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1637
|
+
# applied individually to specific RPCs. See
|
1638
|
+
# {::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client::Configuration::Rpcs}
|
1639
|
+
# for a list of RPCs that can be configured independently.
|
1640
|
+
#
|
1641
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1642
|
+
# on construction.
|
1643
|
+
#
|
1644
|
+
# @example
|
1645
|
+
#
|
1646
|
+
# # Modify the global config, setting the timeout for
|
1647
|
+
# # check_onboarding_status to 20 seconds,
|
1648
|
+
# # and all remaining timeouts to 10 seconds.
|
1649
|
+
# ::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.configure do |config|
|
1650
|
+
# config.timeout = 10.0
|
1651
|
+
# config.rpcs.check_onboarding_status.timeout = 20.0
|
1652
|
+
# end
|
1653
|
+
#
|
1654
|
+
# # Apply the above configuration only to a new client.
|
1655
|
+
# client = ::Google::Cloud::PrivilegedAccessManager::V1::PrivilegedAccessManager::Client.new do |config|
|
1656
|
+
# config.timeout = 10.0
|
1657
|
+
# config.rpcs.check_onboarding_status.timeout = 20.0
|
1658
|
+
# end
|
1659
|
+
#
|
1660
|
+
# @!attribute [rw] endpoint
|
1661
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
1662
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
1663
|
+
# @return [::String,nil]
|
1664
|
+
# @!attribute [rw] credentials
|
1665
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1666
|
+
# * (`String`) The path to a service account key file in JSON format
|
1667
|
+
# * (`Hash`) A service account key as a Hash
|
1668
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1669
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1670
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1671
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1672
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1673
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1674
|
+
# * (`nil`) indicating no credentials
|
1675
|
+
# @return [::Object]
|
1676
|
+
# @!attribute [rw] scope
|
1677
|
+
# The OAuth scopes
|
1678
|
+
# @return [::Array<::String>]
|
1679
|
+
# @!attribute [rw] lib_name
|
1680
|
+
# The library name as recorded in instrumentation and logging
|
1681
|
+
# @return [::String]
|
1682
|
+
# @!attribute [rw] lib_version
|
1683
|
+
# The library version as recorded in instrumentation and logging
|
1684
|
+
# @return [::String]
|
1685
|
+
# @!attribute [rw] channel_args
|
1686
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1687
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1688
|
+
# @return [::Hash]
|
1689
|
+
# @!attribute [rw] interceptors
|
1690
|
+
# An array of interceptors that are run before calls are executed.
|
1691
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
1692
|
+
# @!attribute [rw] timeout
|
1693
|
+
# The call timeout in seconds.
|
1694
|
+
# @return [::Numeric]
|
1695
|
+
# @!attribute [rw] metadata
|
1696
|
+
# Additional gRPC headers to be sent with the call.
|
1697
|
+
# @return [::Hash{::Symbol=>::String}]
|
1698
|
+
# @!attribute [rw] retry_policy
|
1699
|
+
# The retry policy. The value is a hash with the following keys:
|
1700
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1701
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1702
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1703
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1704
|
+
# trigger a retry.
|
1705
|
+
# @return [::Hash]
|
1706
|
+
# @!attribute [rw] quota_project
|
1707
|
+
# A separate project against which to charge quota.
|
1708
|
+
# @return [::String]
|
1709
|
+
# @!attribute [rw] universe_domain
|
1710
|
+
# The universe domain within which to make requests. This determines the
|
1711
|
+
# default endpoint URL. The default value of nil uses the environment
|
1712
|
+
# universe (usually the default "googleapis.com" universe).
|
1713
|
+
# @return [::String,nil]
|
1714
|
+
#
|
1715
|
+
class Configuration
|
1716
|
+
extend ::Gapic::Config
|
1717
|
+
|
1718
|
+
# @private
|
1719
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
1720
|
+
DEFAULT_ENDPOINT = "privilegedaccessmanager.googleapis.com"
|
1721
|
+
|
1722
|
+
config_attr :endpoint, nil, ::String, nil
|
1723
|
+
config_attr :credentials, nil do |value|
|
1724
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1725
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
1726
|
+
allowed.any? { |klass| klass === value }
|
1727
|
+
end
|
1728
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1729
|
+
config_attr :lib_name, nil, ::String, nil
|
1730
|
+
config_attr :lib_version, nil, ::String, nil
|
1731
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1732
|
+
config_attr :interceptors, nil, ::Array, nil
|
1733
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1734
|
+
config_attr :metadata, nil, ::Hash, nil
|
1735
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1736
|
+
config_attr :quota_project, nil, ::String, nil
|
1737
|
+
config_attr :universe_domain, nil, ::String, nil
|
1738
|
+
|
1739
|
+
# @private
|
1740
|
+
def initialize parent_config = nil
|
1741
|
+
@parent_config = parent_config unless parent_config.nil?
|
1742
|
+
|
1743
|
+
yield self if block_given?
|
1744
|
+
end
|
1745
|
+
|
1746
|
+
##
|
1747
|
+
# Configurations for individual RPCs
|
1748
|
+
# @return [Rpcs]
|
1749
|
+
#
|
1750
|
+
def rpcs
|
1751
|
+
@rpcs ||= begin
|
1752
|
+
parent_rpcs = nil
|
1753
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1754
|
+
Rpcs.new parent_rpcs
|
1755
|
+
end
|
1756
|
+
end
|
1757
|
+
|
1758
|
+
##
|
1759
|
+
# Configuration for the channel pool
|
1760
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
1761
|
+
#
|
1762
|
+
def channel_pool
|
1763
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
1764
|
+
end
|
1765
|
+
|
1766
|
+
##
|
1767
|
+
# Configuration RPC class for the PrivilegedAccessManager API.
|
1768
|
+
#
|
1769
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1770
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1771
|
+
# the following configuration fields:
|
1772
|
+
#
|
1773
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1774
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1775
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1776
|
+
# include the following keys:
|
1777
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1778
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1779
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1780
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1781
|
+
# trigger a retry.
|
1782
|
+
#
|
1783
|
+
class Rpcs
|
1784
|
+
##
|
1785
|
+
# RPC-specific configuration for `check_onboarding_status`
|
1786
|
+
# @return [::Gapic::Config::Method]
|
1787
|
+
#
|
1788
|
+
attr_reader :check_onboarding_status
|
1789
|
+
##
|
1790
|
+
# RPC-specific configuration for `list_entitlements`
|
1791
|
+
# @return [::Gapic::Config::Method]
|
1792
|
+
#
|
1793
|
+
attr_reader :list_entitlements
|
1794
|
+
##
|
1795
|
+
# RPC-specific configuration for `search_entitlements`
|
1796
|
+
# @return [::Gapic::Config::Method]
|
1797
|
+
#
|
1798
|
+
attr_reader :search_entitlements
|
1799
|
+
##
|
1800
|
+
# RPC-specific configuration for `get_entitlement`
|
1801
|
+
# @return [::Gapic::Config::Method]
|
1802
|
+
#
|
1803
|
+
attr_reader :get_entitlement
|
1804
|
+
##
|
1805
|
+
# RPC-specific configuration for `create_entitlement`
|
1806
|
+
# @return [::Gapic::Config::Method]
|
1807
|
+
#
|
1808
|
+
attr_reader :create_entitlement
|
1809
|
+
##
|
1810
|
+
# RPC-specific configuration for `delete_entitlement`
|
1811
|
+
# @return [::Gapic::Config::Method]
|
1812
|
+
#
|
1813
|
+
attr_reader :delete_entitlement
|
1814
|
+
##
|
1815
|
+
# RPC-specific configuration for `update_entitlement`
|
1816
|
+
# @return [::Gapic::Config::Method]
|
1817
|
+
#
|
1818
|
+
attr_reader :update_entitlement
|
1819
|
+
##
|
1820
|
+
# RPC-specific configuration for `list_grants`
|
1821
|
+
# @return [::Gapic::Config::Method]
|
1822
|
+
#
|
1823
|
+
attr_reader :list_grants
|
1824
|
+
##
|
1825
|
+
# RPC-specific configuration for `search_grants`
|
1826
|
+
# @return [::Gapic::Config::Method]
|
1827
|
+
#
|
1828
|
+
attr_reader :search_grants
|
1829
|
+
##
|
1830
|
+
# RPC-specific configuration for `get_grant`
|
1831
|
+
# @return [::Gapic::Config::Method]
|
1832
|
+
#
|
1833
|
+
attr_reader :get_grant
|
1834
|
+
##
|
1835
|
+
# RPC-specific configuration for `create_grant`
|
1836
|
+
# @return [::Gapic::Config::Method]
|
1837
|
+
#
|
1838
|
+
attr_reader :create_grant
|
1839
|
+
##
|
1840
|
+
# RPC-specific configuration for `approve_grant`
|
1841
|
+
# @return [::Gapic::Config::Method]
|
1842
|
+
#
|
1843
|
+
attr_reader :approve_grant
|
1844
|
+
##
|
1845
|
+
# RPC-specific configuration for `deny_grant`
|
1846
|
+
# @return [::Gapic::Config::Method]
|
1847
|
+
#
|
1848
|
+
attr_reader :deny_grant
|
1849
|
+
##
|
1850
|
+
# RPC-specific configuration for `revoke_grant`
|
1851
|
+
# @return [::Gapic::Config::Method]
|
1852
|
+
#
|
1853
|
+
attr_reader :revoke_grant
|
1854
|
+
|
1855
|
+
# @private
|
1856
|
+
def initialize parent_rpcs = nil
|
1857
|
+
check_onboarding_status_config = parent_rpcs.check_onboarding_status if parent_rpcs.respond_to? :check_onboarding_status
|
1858
|
+
@check_onboarding_status = ::Gapic::Config::Method.new check_onboarding_status_config
|
1859
|
+
list_entitlements_config = parent_rpcs.list_entitlements if parent_rpcs.respond_to? :list_entitlements
|
1860
|
+
@list_entitlements = ::Gapic::Config::Method.new list_entitlements_config
|
1861
|
+
search_entitlements_config = parent_rpcs.search_entitlements if parent_rpcs.respond_to? :search_entitlements
|
1862
|
+
@search_entitlements = ::Gapic::Config::Method.new search_entitlements_config
|
1863
|
+
get_entitlement_config = parent_rpcs.get_entitlement if parent_rpcs.respond_to? :get_entitlement
|
1864
|
+
@get_entitlement = ::Gapic::Config::Method.new get_entitlement_config
|
1865
|
+
create_entitlement_config = parent_rpcs.create_entitlement if parent_rpcs.respond_to? :create_entitlement
|
1866
|
+
@create_entitlement = ::Gapic::Config::Method.new create_entitlement_config
|
1867
|
+
delete_entitlement_config = parent_rpcs.delete_entitlement if parent_rpcs.respond_to? :delete_entitlement
|
1868
|
+
@delete_entitlement = ::Gapic::Config::Method.new delete_entitlement_config
|
1869
|
+
update_entitlement_config = parent_rpcs.update_entitlement if parent_rpcs.respond_to? :update_entitlement
|
1870
|
+
@update_entitlement = ::Gapic::Config::Method.new update_entitlement_config
|
1871
|
+
list_grants_config = parent_rpcs.list_grants if parent_rpcs.respond_to? :list_grants
|
1872
|
+
@list_grants = ::Gapic::Config::Method.new list_grants_config
|
1873
|
+
search_grants_config = parent_rpcs.search_grants if parent_rpcs.respond_to? :search_grants
|
1874
|
+
@search_grants = ::Gapic::Config::Method.new search_grants_config
|
1875
|
+
get_grant_config = parent_rpcs.get_grant if parent_rpcs.respond_to? :get_grant
|
1876
|
+
@get_grant = ::Gapic::Config::Method.new get_grant_config
|
1877
|
+
create_grant_config = parent_rpcs.create_grant if parent_rpcs.respond_to? :create_grant
|
1878
|
+
@create_grant = ::Gapic::Config::Method.new create_grant_config
|
1879
|
+
approve_grant_config = parent_rpcs.approve_grant if parent_rpcs.respond_to? :approve_grant
|
1880
|
+
@approve_grant = ::Gapic::Config::Method.new approve_grant_config
|
1881
|
+
deny_grant_config = parent_rpcs.deny_grant if parent_rpcs.respond_to? :deny_grant
|
1882
|
+
@deny_grant = ::Gapic::Config::Method.new deny_grant_config
|
1883
|
+
revoke_grant_config = parent_rpcs.revoke_grant if parent_rpcs.respond_to? :revoke_grant
|
1884
|
+
@revoke_grant = ::Gapic::Config::Method.new revoke_grant_config
|
1885
|
+
|
1886
|
+
yield self if block_given?
|
1887
|
+
end
|
1888
|
+
end
|
1889
|
+
end
|
1890
|
+
end
|
1891
|
+
end
|
1892
|
+
end
|
1893
|
+
end
|
1894
|
+
end
|
1895
|
+
end
|