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