google-cloud-bigquery-data_policies-v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1236 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/bigquery/datapolicies/v1/datapolicy_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Bigquery
25
+ module DataPolicies
26
+ module V1
27
+ module DataPolicyService
28
+ ##
29
+ # Client for the DataPolicyService service.
30
+ #
31
+ # Data Policy Service provides APIs for managing the label-policy bindings.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :data_policy_service_stub
38
+
39
+ ##
40
+ # Configure the DataPolicyService Client class.
41
+ #
42
+ # See {::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all DataPolicyService clients
48
+ # ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Bigquery", "DataPolicies", "V1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.create_data_policy.timeout = 60.0
69
+ default_config.rpcs.create_data_policy.retry_policy = {
70
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
71
+ }
72
+
73
+ default_config.rpcs.update_data_policy.timeout = 60.0
74
+ default_config.rpcs.update_data_policy.retry_policy = {
75
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config.rpcs.rename_data_policy.timeout = 60.0
79
+ default_config.rpcs.rename_data_policy.retry_policy = {
80
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
81
+ }
82
+
83
+ default_config.rpcs.delete_data_policy.timeout = 60.0
84
+ default_config.rpcs.delete_data_policy.retry_policy = {
85
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
86
+ }
87
+
88
+ default_config.rpcs.get_data_policy.timeout = 60.0
89
+ default_config.rpcs.get_data_policy.retry_policy = {
90
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
91
+ }
92
+
93
+ default_config.rpcs.list_data_policies.timeout = 60.0
94
+ default_config.rpcs.list_data_policies.retry_policy = {
95
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
96
+ }
97
+
98
+ default_config.rpcs.get_iam_policy.timeout = 60.0
99
+ default_config.rpcs.get_iam_policy.retry_policy = {
100
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
101
+ }
102
+
103
+ default_config.rpcs.set_iam_policy.timeout = 60.0
104
+ default_config.rpcs.set_iam_policy.retry_policy = {
105
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
106
+ }
107
+
108
+ default_config.rpcs.test_iam_permissions.timeout = 60.0
109
+ default_config.rpcs.test_iam_permissions.retry_policy = {
110
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
111
+ }
112
+
113
+ default_config
114
+ end
115
+ yield @configure if block_given?
116
+ @configure
117
+ end
118
+
119
+ ##
120
+ # Configure the DataPolicyService Client instance.
121
+ #
122
+ # The configuration is set to the derived mode, meaning that values can be changed,
123
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
124
+ # should be made on {Client.configure}.
125
+ #
126
+ # See {::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client::Configuration}
127
+ # for a description of the configuration fields.
128
+ #
129
+ # @yield [config] Configure the Client client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ # @return [Client::Configuration]
133
+ #
134
+ def configure
135
+ yield @config if block_given?
136
+ @config
137
+ end
138
+
139
+ ##
140
+ # Create a new DataPolicyService client object.
141
+ #
142
+ # @example
143
+ #
144
+ # # Create a client using the default configuration
145
+ # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
146
+ #
147
+ # # Create a client using a custom configuration
148
+ # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config|
149
+ # config.timeout = 10.0
150
+ # end
151
+ #
152
+ # @yield [config] Configure the DataPolicyService client.
153
+ # @yieldparam config [Client::Configuration]
154
+ #
155
+ def initialize
156
+ # These require statements are intentionally placed here to initialize
157
+ # the gRPC module only when it's required.
158
+ # See https://github.com/googleapis/toolkit/issues/446
159
+ require "gapic/grpc"
160
+ require "google/cloud/bigquery/datapolicies/v1/datapolicy_services_pb"
161
+
162
+ # Create the configuration object
163
+ @config = Configuration.new Client.configure
164
+
165
+ # Yield the configuration if needed
166
+ yield @config if block_given?
167
+
168
+ # Create credentials
169
+ credentials = @config.credentials
170
+ # Use self-signed JWT if the endpoint is unchanged from default,
171
+ # but only if the default endpoint does not have a region prefix.
172
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
173
+ !@config.endpoint.split(".").first.include?("-")
174
+ credentials ||= Credentials.default scope: @config.scope,
175
+ enable_self_signed_jwt: enable_self_signed_jwt
176
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
177
+ credentials = Credentials.new credentials, scope: @config.scope
178
+ end
179
+ @quota_project_id = @config.quota_project
180
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
181
+
182
+ @data_policy_service_stub = ::Gapic::ServiceStub.new(
183
+ ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Stub,
184
+ credentials: credentials,
185
+ endpoint: @config.endpoint,
186
+ channel_args: @config.channel_args,
187
+ interceptors: @config.interceptors
188
+ )
189
+ end
190
+
191
+ # Service calls
192
+
193
+ ##
194
+ # Creates a new data policy under a project with the given `dataPolicyId`
195
+ # (used as the display name), policy tag, and data policy type.
196
+ #
197
+ # @overload create_data_policy(request, options = nil)
198
+ # Pass arguments to `create_data_policy` via a request object, either of type
199
+ # {::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest} or an equivalent Hash.
200
+ #
201
+ # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest, ::Hash]
202
+ # A request object representing the call parameters. Required. To specify no
203
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
204
+ # @param options [::Gapic::CallOptions, ::Hash]
205
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
206
+ #
207
+ # @overload create_data_policy(parent: nil, data_policy: nil)
208
+ # Pass arguments to `create_data_policy` via keyword arguments. Note that at
209
+ # least one keyword argument is required. To specify no parameters, or to keep all
210
+ # the default parameter values, pass an empty Hash as a request object (see above).
211
+ #
212
+ # @param parent [::String]
213
+ # Required. Resource name of the project that the data policy will belong to.
214
+ # The format is `projects/{project_number}/locations/{location_id}`.
215
+ # @param data_policy [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy, ::Hash]
216
+ # Required. The data policy to create. The `name` field does not need to be
217
+ # provided for the data policy creation.
218
+ #
219
+ # @yield [response, operation] Access the result along with the RPC operation
220
+ # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
221
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
222
+ #
223
+ # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
224
+ #
225
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
226
+ #
227
+ # @example Basic example
228
+ # require "google/cloud/bigquery/data_policies/v1"
229
+ #
230
+ # # Create a client object. The client can be reused for multiple calls.
231
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
232
+ #
233
+ # # Create a request. To set request fields, pass in keyword arguments.
234
+ # request = Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new
235
+ #
236
+ # # Call the create_data_policy method.
237
+ # result = client.create_data_policy request
238
+ #
239
+ # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.
240
+ # p result
241
+ #
242
+ def create_data_policy request, options = nil
243
+ raise ::ArgumentError, "request must be provided" if request.nil?
244
+
245
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest
246
+
247
+ # Converts hash and nil to an options object
248
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
249
+
250
+ # Customize the options with defaults
251
+ metadata = @config.rpcs.create_data_policy.metadata.to_h
252
+
253
+ # Set x-goog-api-client and x-goog-user-project headers
254
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
255
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
256
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
257
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
258
+
259
+ header_params = {}
260
+ if request.parent
261
+ header_params["parent"] = request.parent
262
+ end
263
+
264
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
265
+ metadata[:"x-goog-request-params"] ||= request_params_header
266
+
267
+ options.apply_defaults timeout: @config.rpcs.create_data_policy.timeout,
268
+ metadata: metadata,
269
+ retry_policy: @config.rpcs.create_data_policy.retry_policy
270
+
271
+ options.apply_defaults timeout: @config.timeout,
272
+ metadata: @config.metadata,
273
+ retry_policy: @config.retry_policy
274
+
275
+ @data_policy_service_stub.call_rpc :create_data_policy, request, options: options do |response, operation|
276
+ yield response, operation if block_given?
277
+ return response
278
+ end
279
+ rescue ::GRPC::BadStatus => e
280
+ raise ::Google::Cloud::Error.from_error(e)
281
+ end
282
+
283
+ ##
284
+ # Updates the metadata for an existing data policy. The target data policy
285
+ # can be specified by the resource name.
286
+ #
287
+ # @overload update_data_policy(request, options = nil)
288
+ # Pass arguments to `update_data_policy` via a request object, either of type
289
+ # {::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest} or an equivalent Hash.
290
+ #
291
+ # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest, ::Hash]
292
+ # A request object representing the call parameters. Required. To specify no
293
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
294
+ # @param options [::Gapic::CallOptions, ::Hash]
295
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
296
+ #
297
+ # @overload update_data_policy(data_policy: nil, update_mask: nil)
298
+ # Pass arguments to `update_data_policy` via keyword arguments. Note that at
299
+ # least one keyword argument is required. To specify no parameters, or to keep all
300
+ # the default parameter values, pass an empty Hash as a request object (see above).
301
+ #
302
+ # @param data_policy [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy, ::Hash]
303
+ # Required. Update the data policy's metadata.
304
+ #
305
+ # The target data policy is determined by the `name` field.
306
+ # Other fields are updated to the specified values based on the field masks.
307
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
308
+ # The update mask applies to the resource. For the `FieldMask` definition,
309
+ # see
310
+ # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
311
+ # If not set, defaults to all of the fields that are allowed to update.
312
+ #
313
+ # Updates to the `name` and `dataPolicyId` fields are not allowed.
314
+ #
315
+ # @yield [response, operation] Access the result along with the RPC operation
316
+ # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
317
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
318
+ #
319
+ # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
320
+ #
321
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
322
+ #
323
+ # @example Basic example
324
+ # require "google/cloud/bigquery/data_policies/v1"
325
+ #
326
+ # # Create a client object. The client can be reused for multiple calls.
327
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
328
+ #
329
+ # # Create a request. To set request fields, pass in keyword arguments.
330
+ # request = Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest.new
331
+ #
332
+ # # Call the update_data_policy method.
333
+ # result = client.update_data_policy request
334
+ #
335
+ # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.
336
+ # p result
337
+ #
338
+ def update_data_policy request, options = nil
339
+ raise ::ArgumentError, "request must be provided" if request.nil?
340
+
341
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest
342
+
343
+ # Converts hash and nil to an options object
344
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
345
+
346
+ # Customize the options with defaults
347
+ metadata = @config.rpcs.update_data_policy.metadata.to_h
348
+
349
+ # Set x-goog-api-client and x-goog-user-project headers
350
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
352
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
353
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
354
+
355
+ header_params = {}
356
+ if request.data_policy&.name
357
+ header_params["data_policy.name"] = request.data_policy.name
358
+ end
359
+
360
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
361
+ metadata[:"x-goog-request-params"] ||= request_params_header
362
+
363
+ options.apply_defaults timeout: @config.rpcs.update_data_policy.timeout,
364
+ metadata: metadata,
365
+ retry_policy: @config.rpcs.update_data_policy.retry_policy
366
+
367
+ options.apply_defaults timeout: @config.timeout,
368
+ metadata: @config.metadata,
369
+ retry_policy: @config.retry_policy
370
+
371
+ @data_policy_service_stub.call_rpc :update_data_policy, request, options: options do |response, operation|
372
+ yield response, operation if block_given?
373
+ return response
374
+ end
375
+ rescue ::GRPC::BadStatus => e
376
+ raise ::Google::Cloud::Error.from_error(e)
377
+ end
378
+
379
+ ##
380
+ # Renames the id (display name) of the specified data policy.
381
+ #
382
+ # @overload rename_data_policy(request, options = nil)
383
+ # Pass arguments to `rename_data_policy` via a request object, either of type
384
+ # {::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest} or an equivalent Hash.
385
+ #
386
+ # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest, ::Hash]
387
+ # A request object representing the call parameters. Required. To specify no
388
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
389
+ # @param options [::Gapic::CallOptions, ::Hash]
390
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
391
+ #
392
+ # @overload rename_data_policy(name: nil, new_data_policy_id: nil)
393
+ # Pass arguments to `rename_data_policy` via keyword arguments. Note that at
394
+ # least one keyword argument is required. To specify no parameters, or to keep all
395
+ # the default parameter values, pass an empty Hash as a request object (see above).
396
+ #
397
+ # @param name [::String]
398
+ # Required. Resource name of the data policy to rename. The format is
399
+ # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
400
+ # @param new_data_policy_id [::String]
401
+ # Required. The new data policy id.
402
+ #
403
+ # @yield [response, operation] Access the result along with the RPC operation
404
+ # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
405
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
406
+ #
407
+ # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
408
+ #
409
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
410
+ #
411
+ # @example Basic example
412
+ # require "google/cloud/bigquery/data_policies/v1"
413
+ #
414
+ # # Create a client object. The client can be reused for multiple calls.
415
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
416
+ #
417
+ # # Create a request. To set request fields, pass in keyword arguments.
418
+ # request = Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest.new
419
+ #
420
+ # # Call the rename_data_policy method.
421
+ # result = client.rename_data_policy request
422
+ #
423
+ # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.
424
+ # p result
425
+ #
426
+ def rename_data_policy request, options = nil
427
+ raise ::ArgumentError, "request must be provided" if request.nil?
428
+
429
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest
430
+
431
+ # Converts hash and nil to an options object
432
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
433
+
434
+ # Customize the options with defaults
435
+ metadata = @config.rpcs.rename_data_policy.metadata.to_h
436
+
437
+ # Set x-goog-api-client and x-goog-user-project headers
438
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
439
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
440
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
441
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
442
+
443
+ header_params = {}
444
+ if request.name
445
+ header_params["name"] = request.name
446
+ end
447
+
448
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
449
+ metadata[:"x-goog-request-params"] ||= request_params_header
450
+
451
+ options.apply_defaults timeout: @config.rpcs.rename_data_policy.timeout,
452
+ metadata: metadata,
453
+ retry_policy: @config.rpcs.rename_data_policy.retry_policy
454
+
455
+ options.apply_defaults timeout: @config.timeout,
456
+ metadata: @config.metadata,
457
+ retry_policy: @config.retry_policy
458
+
459
+ @data_policy_service_stub.call_rpc :rename_data_policy, request, options: options do |response, operation|
460
+ yield response, operation if block_given?
461
+ return response
462
+ end
463
+ rescue ::GRPC::BadStatus => e
464
+ raise ::Google::Cloud::Error.from_error(e)
465
+ end
466
+
467
+ ##
468
+ # Deletes the data policy specified by its resource name.
469
+ #
470
+ # @overload delete_data_policy(request, options = nil)
471
+ # Pass arguments to `delete_data_policy` via a request object, either of type
472
+ # {::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest} or an equivalent Hash.
473
+ #
474
+ # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest, ::Hash]
475
+ # A request object representing the call parameters. Required. To specify no
476
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
477
+ # @param options [::Gapic::CallOptions, ::Hash]
478
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
479
+ #
480
+ # @overload delete_data_policy(name: nil)
481
+ # Pass arguments to `delete_data_policy` via keyword arguments. Note that at
482
+ # least one keyword argument is required. To specify no parameters, or to keep all
483
+ # the default parameter values, pass an empty Hash as a request object (see above).
484
+ #
485
+ # @param name [::String]
486
+ # Required. Resource name of the data policy to delete. Format is
487
+ # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
488
+ #
489
+ # @yield [response, operation] Access the result along with the RPC operation
490
+ # @yieldparam response [::Google::Protobuf::Empty]
491
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
492
+ #
493
+ # @return [::Google::Protobuf::Empty]
494
+ #
495
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
496
+ #
497
+ # @example Basic example
498
+ # require "google/cloud/bigquery/data_policies/v1"
499
+ #
500
+ # # Create a client object. The client can be reused for multiple calls.
501
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
502
+ #
503
+ # # Create a request. To set request fields, pass in keyword arguments.
504
+ # request = Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest.new
505
+ #
506
+ # # Call the delete_data_policy method.
507
+ # result = client.delete_data_policy request
508
+ #
509
+ # # The returned object is of type Google::Protobuf::Empty.
510
+ # p result
511
+ #
512
+ def delete_data_policy request, options = nil
513
+ raise ::ArgumentError, "request must be provided" if request.nil?
514
+
515
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest
516
+
517
+ # Converts hash and nil to an options object
518
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
519
+
520
+ # Customize the options with defaults
521
+ metadata = @config.rpcs.delete_data_policy.metadata.to_h
522
+
523
+ # Set x-goog-api-client and x-goog-user-project headers
524
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
525
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
526
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
527
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
528
+
529
+ header_params = {}
530
+ if request.name
531
+ header_params["name"] = request.name
532
+ end
533
+
534
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
535
+ metadata[:"x-goog-request-params"] ||= request_params_header
536
+
537
+ options.apply_defaults timeout: @config.rpcs.delete_data_policy.timeout,
538
+ metadata: metadata,
539
+ retry_policy: @config.rpcs.delete_data_policy.retry_policy
540
+
541
+ options.apply_defaults timeout: @config.timeout,
542
+ metadata: @config.metadata,
543
+ retry_policy: @config.retry_policy
544
+
545
+ @data_policy_service_stub.call_rpc :delete_data_policy, request, options: options do |response, operation|
546
+ yield response, operation if block_given?
547
+ return response
548
+ end
549
+ rescue ::GRPC::BadStatus => e
550
+ raise ::Google::Cloud::Error.from_error(e)
551
+ end
552
+
553
+ ##
554
+ # Gets the data policy specified by its resource name.
555
+ #
556
+ # @overload get_data_policy(request, options = nil)
557
+ # Pass arguments to `get_data_policy` via a request object, either of type
558
+ # {::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest} or an equivalent Hash.
559
+ #
560
+ # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest, ::Hash]
561
+ # A request object representing the call parameters. Required. To specify no
562
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
563
+ # @param options [::Gapic::CallOptions, ::Hash]
564
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
565
+ #
566
+ # @overload get_data_policy(name: nil)
567
+ # Pass arguments to `get_data_policy` via keyword arguments. Note that at
568
+ # least one keyword argument is required. To specify no parameters, or to keep all
569
+ # the default parameter values, pass an empty Hash as a request object (see above).
570
+ #
571
+ # @param name [::String]
572
+ # Required. Resource name of the requested data policy. Format is
573
+ # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
574
+ #
575
+ # @yield [response, operation] Access the result along with the RPC operation
576
+ # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
577
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
578
+ #
579
+ # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy]
580
+ #
581
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
582
+ #
583
+ # @example Basic example
584
+ # require "google/cloud/bigquery/data_policies/v1"
585
+ #
586
+ # # Create a client object. The client can be reused for multiple calls.
587
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
588
+ #
589
+ # # Create a request. To set request fields, pass in keyword arguments.
590
+ # request = Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest.new
591
+ #
592
+ # # Call the get_data_policy method.
593
+ # result = client.get_data_policy request
594
+ #
595
+ # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.
596
+ # p result
597
+ #
598
+ def get_data_policy request, options = nil
599
+ raise ::ArgumentError, "request must be provided" if request.nil?
600
+
601
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest
602
+
603
+ # Converts hash and nil to an options object
604
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
605
+
606
+ # Customize the options with defaults
607
+ metadata = @config.rpcs.get_data_policy.metadata.to_h
608
+
609
+ # Set x-goog-api-client and x-goog-user-project headers
610
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
611
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
612
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
613
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
614
+
615
+ header_params = {}
616
+ if request.name
617
+ header_params["name"] = request.name
618
+ end
619
+
620
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
621
+ metadata[:"x-goog-request-params"] ||= request_params_header
622
+
623
+ options.apply_defaults timeout: @config.rpcs.get_data_policy.timeout,
624
+ metadata: metadata,
625
+ retry_policy: @config.rpcs.get_data_policy.retry_policy
626
+
627
+ options.apply_defaults timeout: @config.timeout,
628
+ metadata: @config.metadata,
629
+ retry_policy: @config.retry_policy
630
+
631
+ @data_policy_service_stub.call_rpc :get_data_policy, request, options: options do |response, operation|
632
+ yield response, operation if block_given?
633
+ return response
634
+ end
635
+ rescue ::GRPC::BadStatus => e
636
+ raise ::Google::Cloud::Error.from_error(e)
637
+ end
638
+
639
+ ##
640
+ # List all of the data policies in the specified parent project.
641
+ #
642
+ # @overload list_data_policies(request, options = nil)
643
+ # Pass arguments to `list_data_policies` via a request object, either of type
644
+ # {::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest} or an equivalent Hash.
645
+ #
646
+ # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest, ::Hash]
647
+ # A request object representing the call parameters. Required. To specify no
648
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
649
+ # @param options [::Gapic::CallOptions, ::Hash]
650
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
651
+ #
652
+ # @overload list_data_policies(parent: nil, page_size: nil, page_token: nil, filter: nil)
653
+ # Pass arguments to `list_data_policies` via keyword arguments. Note that at
654
+ # least one keyword argument is required. To specify no parameters, or to keep all
655
+ # the default parameter values, pass an empty Hash as a request object (see above).
656
+ #
657
+ # @param parent [::String]
658
+ # Required. Resource name of the project for which to list data policies.
659
+ # Format is `projects/{project_number}/locations/{location_id}`.
660
+ # @param page_size [::Integer]
661
+ # The maximum number of data policies to return. Must be a value between 1
662
+ # and 1000.
663
+ # If not set, defaults to 50.
664
+ # @param page_token [::String]
665
+ # The `nextPageToken` value returned from a previous list request, if any. If
666
+ # not set, defaults to an empty string.
667
+ # @param filter [::String]
668
+ # Filters the data policies by policy tags that they
669
+ # are associated with. Currently filter only supports
670
+ # "policy<span></span>_tag" based filtering and OR based predicates. Sample
671
+ # filter can be "policy<span></span>_tag:
672
+ # `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
673
+ # wildcard such as "policy<span></span>_tag:
674
+ # `'projects/1/locations/us/taxonomies/2/*'`".
675
+ #
676
+ # @yield [response, operation] Access the result along with the RPC operation
677
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy>]
678
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
679
+ #
680
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy>]
681
+ #
682
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
683
+ #
684
+ # @example Basic example
685
+ # require "google/cloud/bigquery/data_policies/v1"
686
+ #
687
+ # # Create a client object. The client can be reused for multiple calls.
688
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
689
+ #
690
+ # # Create a request. To set request fields, pass in keyword arguments.
691
+ # request = Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest.new
692
+ #
693
+ # # Call the list_data_policies method.
694
+ # result = client.list_data_policies request
695
+ #
696
+ # # The returned object is of type Gapic::PagedEnumerable. You can
697
+ # # iterate over all elements by calling #each, and the enumerable
698
+ # # will lazily make API calls to fetch subsequent pages. Other
699
+ # # methods are also available for managing paging directly.
700
+ # result.each do |response|
701
+ # # Each element is of type ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.
702
+ # p response
703
+ # end
704
+ #
705
+ def list_data_policies request, options = nil
706
+ raise ::ArgumentError, "request must be provided" if request.nil?
707
+
708
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest
709
+
710
+ # Converts hash and nil to an options object
711
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
712
+
713
+ # Customize the options with defaults
714
+ metadata = @config.rpcs.list_data_policies.metadata.to_h
715
+
716
+ # Set x-goog-api-client and x-goog-user-project headers
717
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
718
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
719
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
720
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
721
+
722
+ header_params = {}
723
+ if request.parent
724
+ header_params["parent"] = request.parent
725
+ end
726
+
727
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
728
+ metadata[:"x-goog-request-params"] ||= request_params_header
729
+
730
+ options.apply_defaults timeout: @config.rpcs.list_data_policies.timeout,
731
+ metadata: metadata,
732
+ retry_policy: @config.rpcs.list_data_policies.retry_policy
733
+
734
+ options.apply_defaults timeout: @config.timeout,
735
+ metadata: @config.metadata,
736
+ retry_policy: @config.retry_policy
737
+
738
+ @data_policy_service_stub.call_rpc :list_data_policies, request, options: options do |response, operation|
739
+ response = ::Gapic::PagedEnumerable.new @data_policy_service_stub, :list_data_policies, request, response, operation, options
740
+ yield response, operation if block_given?
741
+ return response
742
+ end
743
+ rescue ::GRPC::BadStatus => e
744
+ raise ::Google::Cloud::Error.from_error(e)
745
+ end
746
+
747
+ ##
748
+ # Gets the IAM policy for the specified data policy.
749
+ #
750
+ # @overload get_iam_policy(request, options = nil)
751
+ # Pass arguments to `get_iam_policy` via a request object, either of type
752
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
753
+ #
754
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
755
+ # A request object representing the call parameters. Required. To specify no
756
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
757
+ # @param options [::Gapic::CallOptions, ::Hash]
758
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
759
+ #
760
+ # @overload get_iam_policy(resource: nil, options: nil)
761
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
762
+ # least one keyword argument is required. To specify no parameters, or to keep all
763
+ # the default parameter values, pass an empty Hash as a request object (see above).
764
+ #
765
+ # @param resource [::String]
766
+ # REQUIRED: The resource for which the policy is being requested.
767
+ # See the operation documentation for the appropriate value for this field.
768
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
769
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
770
+ # `GetIamPolicy`.
771
+ #
772
+ # @yield [response, operation] Access the result along with the RPC operation
773
+ # @yieldparam response [::Google::Iam::V1::Policy]
774
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
775
+ #
776
+ # @return [::Google::Iam::V1::Policy]
777
+ #
778
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
779
+ #
780
+ # @example Basic example
781
+ # require "google/cloud/bigquery/data_policies/v1"
782
+ #
783
+ # # Create a client object. The client can be reused for multiple calls.
784
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
785
+ #
786
+ # # Create a request. To set request fields, pass in keyword arguments.
787
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
788
+ #
789
+ # # Call the get_iam_policy method.
790
+ # result = client.get_iam_policy request
791
+ #
792
+ # # The returned object is of type Google::Iam::V1::Policy.
793
+ # p result
794
+ #
795
+ def get_iam_policy request, options = nil
796
+ raise ::ArgumentError, "request must be provided" if request.nil?
797
+
798
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
799
+
800
+ # Converts hash and nil to an options object
801
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
802
+
803
+ # Customize the options with defaults
804
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
805
+
806
+ # Set x-goog-api-client and x-goog-user-project headers
807
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
808
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
809
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
810
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
811
+
812
+ header_params = {}
813
+ if request.resource
814
+ header_params["resource"] = request.resource
815
+ end
816
+
817
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
818
+ metadata[:"x-goog-request-params"] ||= request_params_header
819
+
820
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
821
+ metadata: metadata,
822
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
823
+
824
+ options.apply_defaults timeout: @config.timeout,
825
+ metadata: @config.metadata,
826
+ retry_policy: @config.retry_policy
827
+
828
+ @data_policy_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
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
+ # Sets the IAM policy for the specified data policy.
838
+ #
839
+ # @overload set_iam_policy(request, options = nil)
840
+ # Pass arguments to `set_iam_policy` via a request object, either of type
841
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
842
+ #
843
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
844
+ # A request object representing the call parameters. Required. To specify no
845
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
846
+ # @param options [::Gapic::CallOptions, ::Hash]
847
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
848
+ #
849
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
850
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
851
+ # least one keyword argument is required. To specify no parameters, or to keep all
852
+ # the default parameter values, pass an empty Hash as a request object (see above).
853
+ #
854
+ # @param resource [::String]
855
+ # REQUIRED: The resource for which the policy is being specified.
856
+ # See the operation documentation for the appropriate value for this field.
857
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
858
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
859
+ # the policy is limited to a few 10s of KB. An empty policy is a
860
+ # valid policy but certain Cloud Platform services (such as Projects)
861
+ # might reject them.
862
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
863
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
864
+ # the fields in the mask will be modified. If no mask is provided, the
865
+ # following default mask is used:
866
+ #
867
+ # `paths: "bindings, etag"`
868
+ #
869
+ # @yield [response, operation] Access the result along with the RPC operation
870
+ # @yieldparam response [::Google::Iam::V1::Policy]
871
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
872
+ #
873
+ # @return [::Google::Iam::V1::Policy]
874
+ #
875
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
876
+ #
877
+ # @example Basic example
878
+ # require "google/cloud/bigquery/data_policies/v1"
879
+ #
880
+ # # Create a client object. The client can be reused for multiple calls.
881
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
882
+ #
883
+ # # Create a request. To set request fields, pass in keyword arguments.
884
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
885
+ #
886
+ # # Call the set_iam_policy method.
887
+ # result = client.set_iam_policy request
888
+ #
889
+ # # The returned object is of type Google::Iam::V1::Policy.
890
+ # p result
891
+ #
892
+ def set_iam_policy request, options = nil
893
+ raise ::ArgumentError, "request must be provided" if request.nil?
894
+
895
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
896
+
897
+ # Converts hash and nil to an options object
898
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
899
+
900
+ # Customize the options with defaults
901
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
902
+
903
+ # Set x-goog-api-client and x-goog-user-project headers
904
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
905
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
906
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
907
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
908
+
909
+ header_params = {}
910
+ if request.resource
911
+ header_params["resource"] = request.resource
912
+ end
913
+
914
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
915
+ metadata[:"x-goog-request-params"] ||= request_params_header
916
+
917
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
918
+ metadata: metadata,
919
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
920
+
921
+ options.apply_defaults timeout: @config.timeout,
922
+ metadata: @config.metadata,
923
+ retry_policy: @config.retry_policy
924
+
925
+ @data_policy_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
926
+ yield response, operation if block_given?
927
+ return response
928
+ end
929
+ rescue ::GRPC::BadStatus => e
930
+ raise ::Google::Cloud::Error.from_error(e)
931
+ end
932
+
933
+ ##
934
+ # Returns the caller's permission on the specified data policy resource.
935
+ #
936
+ # @overload test_iam_permissions(request, options = nil)
937
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
938
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
939
+ #
940
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
941
+ # A request object representing the call parameters. Required. To specify no
942
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
943
+ # @param options [::Gapic::CallOptions, ::Hash]
944
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
945
+ #
946
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
947
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
948
+ # least one keyword argument is required. To specify no parameters, or to keep all
949
+ # the default parameter values, pass an empty Hash as a request object (see above).
950
+ #
951
+ # @param resource [::String]
952
+ # REQUIRED: The resource for which the policy detail is being requested.
953
+ # See the operation documentation for the appropriate value for this field.
954
+ # @param permissions [::Array<::String>]
955
+ # The set of permissions to check for the `resource`. Permissions with
956
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
957
+ # information see
958
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
959
+ #
960
+ # @yield [response, operation] Access the result along with the RPC operation
961
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
962
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
963
+ #
964
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
965
+ #
966
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
967
+ #
968
+ # @example Basic example
969
+ # require "google/cloud/bigquery/data_policies/v1"
970
+ #
971
+ # # Create a client object. The client can be reused for multiple calls.
972
+ # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new
973
+ #
974
+ # # Create a request. To set request fields, pass in keyword arguments.
975
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
976
+ #
977
+ # # Call the test_iam_permissions method.
978
+ # result = client.test_iam_permissions request
979
+ #
980
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
981
+ # p result
982
+ #
983
+ def test_iam_permissions request, options = nil
984
+ raise ::ArgumentError, "request must be provided" if request.nil?
985
+
986
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
987
+
988
+ # Converts hash and nil to an options object
989
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
990
+
991
+ # Customize the options with defaults
992
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
993
+
994
+ # Set x-goog-api-client and x-goog-user-project headers
995
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
996
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
997
+ gapic_version: ::Google::Cloud::Bigquery::DataPolicies::V1::VERSION
998
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
999
+
1000
+ header_params = {}
1001
+ if request.resource
1002
+ header_params["resource"] = request.resource
1003
+ end
1004
+
1005
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1006
+ metadata[:"x-goog-request-params"] ||= request_params_header
1007
+
1008
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1009
+ metadata: metadata,
1010
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1011
+
1012
+ options.apply_defaults timeout: @config.timeout,
1013
+ metadata: @config.metadata,
1014
+ retry_policy: @config.retry_policy
1015
+
1016
+ @data_policy_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
1017
+ yield response, operation if block_given?
1018
+ return response
1019
+ end
1020
+ rescue ::GRPC::BadStatus => e
1021
+ raise ::Google::Cloud::Error.from_error(e)
1022
+ end
1023
+
1024
+ ##
1025
+ # Configuration class for the DataPolicyService API.
1026
+ #
1027
+ # This class represents the configuration for DataPolicyService,
1028
+ # providing control over timeouts, retry behavior, logging, transport
1029
+ # parameters, and other low-level controls. Certain parameters can also be
1030
+ # applied individually to specific RPCs. See
1031
+ # {::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client::Configuration::Rpcs}
1032
+ # for a list of RPCs that can be configured independently.
1033
+ #
1034
+ # Configuration can be applied globally to all clients, or to a single client
1035
+ # on construction.
1036
+ #
1037
+ # @example
1038
+ #
1039
+ # # Modify the global config, setting the timeout for
1040
+ # # create_data_policy to 20 seconds,
1041
+ # # and all remaining timeouts to 10 seconds.
1042
+ # ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.configure do |config|
1043
+ # config.timeout = 10.0
1044
+ # config.rpcs.create_data_policy.timeout = 20.0
1045
+ # end
1046
+ #
1047
+ # # Apply the above configuration only to a new client.
1048
+ # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config|
1049
+ # config.timeout = 10.0
1050
+ # config.rpcs.create_data_policy.timeout = 20.0
1051
+ # end
1052
+ #
1053
+ # @!attribute [rw] endpoint
1054
+ # The hostname or hostname:port of the service endpoint.
1055
+ # Defaults to `"bigquerydatapolicy.googleapis.com"`.
1056
+ # @return [::String]
1057
+ # @!attribute [rw] credentials
1058
+ # Credentials to send with calls. You may provide any of the following types:
1059
+ # * (`String`) The path to a service account key file in JSON format
1060
+ # * (`Hash`) A service account key as a Hash
1061
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1062
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1063
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1064
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1065
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1066
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1067
+ # * (`nil`) indicating no credentials
1068
+ # @return [::Object]
1069
+ # @!attribute [rw] scope
1070
+ # The OAuth scopes
1071
+ # @return [::Array<::String>]
1072
+ # @!attribute [rw] lib_name
1073
+ # The library name as recorded in instrumentation and logging
1074
+ # @return [::String]
1075
+ # @!attribute [rw] lib_version
1076
+ # The library version as recorded in instrumentation and logging
1077
+ # @return [::String]
1078
+ # @!attribute [rw] channel_args
1079
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1080
+ # `GRPC::Core::Channel` object is provided as the credential.
1081
+ # @return [::Hash]
1082
+ # @!attribute [rw] interceptors
1083
+ # An array of interceptors that are run before calls are executed.
1084
+ # @return [::Array<::GRPC::ClientInterceptor>]
1085
+ # @!attribute [rw] timeout
1086
+ # The call timeout in seconds.
1087
+ # @return [::Numeric]
1088
+ # @!attribute [rw] metadata
1089
+ # Additional gRPC headers to be sent with the call.
1090
+ # @return [::Hash{::Symbol=>::String}]
1091
+ # @!attribute [rw] retry_policy
1092
+ # The retry policy. The value is a hash with the following keys:
1093
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1094
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1095
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1096
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1097
+ # trigger a retry.
1098
+ # @return [::Hash]
1099
+ # @!attribute [rw] quota_project
1100
+ # A separate project against which to charge quota.
1101
+ # @return [::String]
1102
+ #
1103
+ class Configuration
1104
+ extend ::Gapic::Config
1105
+
1106
+ config_attr :endpoint, "bigquerydatapolicy.googleapis.com", ::String
1107
+ config_attr :credentials, nil do |value|
1108
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1109
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1110
+ allowed.any? { |klass| klass === value }
1111
+ end
1112
+ config_attr :scope, nil, ::String, ::Array, nil
1113
+ config_attr :lib_name, nil, ::String, nil
1114
+ config_attr :lib_version, nil, ::String, nil
1115
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1116
+ config_attr :interceptors, nil, ::Array, nil
1117
+ config_attr :timeout, nil, ::Numeric, nil
1118
+ config_attr :metadata, nil, ::Hash, nil
1119
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1120
+ config_attr :quota_project, nil, ::String, nil
1121
+
1122
+ # @private
1123
+ def initialize parent_config = nil
1124
+ @parent_config = parent_config unless parent_config.nil?
1125
+
1126
+ yield self if block_given?
1127
+ end
1128
+
1129
+ ##
1130
+ # Configurations for individual RPCs
1131
+ # @return [Rpcs]
1132
+ #
1133
+ def rpcs
1134
+ @rpcs ||= begin
1135
+ parent_rpcs = nil
1136
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1137
+ Rpcs.new parent_rpcs
1138
+ end
1139
+ end
1140
+
1141
+ ##
1142
+ # Configuration RPC class for the DataPolicyService API.
1143
+ #
1144
+ # Includes fields providing the configuration for each RPC in this service.
1145
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1146
+ # the following configuration fields:
1147
+ #
1148
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1149
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1150
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1151
+ # include the following keys:
1152
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1153
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1154
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1155
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1156
+ # trigger a retry.
1157
+ #
1158
+ class Rpcs
1159
+ ##
1160
+ # RPC-specific configuration for `create_data_policy`
1161
+ # @return [::Gapic::Config::Method]
1162
+ #
1163
+ attr_reader :create_data_policy
1164
+ ##
1165
+ # RPC-specific configuration for `update_data_policy`
1166
+ # @return [::Gapic::Config::Method]
1167
+ #
1168
+ attr_reader :update_data_policy
1169
+ ##
1170
+ # RPC-specific configuration for `rename_data_policy`
1171
+ # @return [::Gapic::Config::Method]
1172
+ #
1173
+ attr_reader :rename_data_policy
1174
+ ##
1175
+ # RPC-specific configuration for `delete_data_policy`
1176
+ # @return [::Gapic::Config::Method]
1177
+ #
1178
+ attr_reader :delete_data_policy
1179
+ ##
1180
+ # RPC-specific configuration for `get_data_policy`
1181
+ # @return [::Gapic::Config::Method]
1182
+ #
1183
+ attr_reader :get_data_policy
1184
+ ##
1185
+ # RPC-specific configuration for `list_data_policies`
1186
+ # @return [::Gapic::Config::Method]
1187
+ #
1188
+ attr_reader :list_data_policies
1189
+ ##
1190
+ # RPC-specific configuration for `get_iam_policy`
1191
+ # @return [::Gapic::Config::Method]
1192
+ #
1193
+ attr_reader :get_iam_policy
1194
+ ##
1195
+ # RPC-specific configuration for `set_iam_policy`
1196
+ # @return [::Gapic::Config::Method]
1197
+ #
1198
+ attr_reader :set_iam_policy
1199
+ ##
1200
+ # RPC-specific configuration for `test_iam_permissions`
1201
+ # @return [::Gapic::Config::Method]
1202
+ #
1203
+ attr_reader :test_iam_permissions
1204
+
1205
+ # @private
1206
+ def initialize parent_rpcs = nil
1207
+ create_data_policy_config = parent_rpcs.create_data_policy if parent_rpcs.respond_to? :create_data_policy
1208
+ @create_data_policy = ::Gapic::Config::Method.new create_data_policy_config
1209
+ update_data_policy_config = parent_rpcs.update_data_policy if parent_rpcs.respond_to? :update_data_policy
1210
+ @update_data_policy = ::Gapic::Config::Method.new update_data_policy_config
1211
+ rename_data_policy_config = parent_rpcs.rename_data_policy if parent_rpcs.respond_to? :rename_data_policy
1212
+ @rename_data_policy = ::Gapic::Config::Method.new rename_data_policy_config
1213
+ delete_data_policy_config = parent_rpcs.delete_data_policy if parent_rpcs.respond_to? :delete_data_policy
1214
+ @delete_data_policy = ::Gapic::Config::Method.new delete_data_policy_config
1215
+ get_data_policy_config = parent_rpcs.get_data_policy if parent_rpcs.respond_to? :get_data_policy
1216
+ @get_data_policy = ::Gapic::Config::Method.new get_data_policy_config
1217
+ list_data_policies_config = parent_rpcs.list_data_policies if parent_rpcs.respond_to? :list_data_policies
1218
+ @list_data_policies = ::Gapic::Config::Method.new list_data_policies_config
1219
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1220
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1221
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1222
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1223
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1224
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1225
+
1226
+ yield self if block_given?
1227
+ end
1228
+ end
1229
+ end
1230
+ end
1231
+ end
1232
+ end
1233
+ end
1234
+ end
1235
+ end
1236
+ end