google-cloud-binary_authorization-v1 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +2 -2
  4. data/lib/google/cloud/binary_authorization/v1/binauthz_management_service/client.rb +4 -6
  5. data/lib/google/cloud/binary_authorization/v1/binauthz_management_service/rest/client.rb +835 -0
  6. data/lib/google/cloud/binary_authorization/v1/binauthz_management_service/rest/service_stub.rb +464 -0
  7. data/lib/google/cloud/binary_authorization/v1/binauthz_management_service/rest.rb +58 -0
  8. data/lib/google/cloud/binary_authorization/v1/binauthz_management_service.rb +7 -1
  9. data/lib/google/cloud/binary_authorization/v1/rest.rb +39 -0
  10. data/lib/google/cloud/binary_authorization/v1/system_policy/rest/client.rb +345 -0
  11. data/lib/google/cloud/binary_authorization/v1/system_policy/rest/service_stub.rb +107 -0
  12. data/lib/google/cloud/binary_authorization/v1/system_policy/rest.rb +52 -0
  13. data/lib/google/cloud/binary_authorization/v1/system_policy.rb +7 -1
  14. data/lib/google/cloud/binary_authorization/v1/validation_helper/rest/client.rb +356 -0
  15. data/lib/google/cloud/binary_authorization/v1/validation_helper/rest/service_stub.rb +108 -0
  16. data/lib/google/cloud/binary_authorization/v1/validation_helper/rest.rb +51 -0
  17. data/lib/google/cloud/binary_authorization/v1/validation_helper.rb +7 -1
  18. data/lib/google/cloud/binary_authorization/v1/version.rb +1 -1
  19. data/lib/google/cloud/binary_authorization/v1.rb +7 -2
  20. data/lib/google/cloud/binaryauthorization/v1/resources_pb.rb +0 -1
  21. data/proto_docs/google/api/client.rb +318 -0
  22. data/proto_docs/google/api/launch_stage.rb +71 -0
  23. data/proto_docs/google/protobuf/duration.rb +98 -0
  24. metadata +23 -8
@@ -0,0 +1,835 @@
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/binaryauthorization/v1/service_pb"
21
+ require "google/cloud/binary_authorization/v1/binauthz_management_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module BinaryAuthorization
26
+ module V1
27
+ module BinauthzManagementService
28
+ module Rest
29
+ ##
30
+ # REST client for the BinauthzManagementService service.
31
+ #
32
+ # Google Cloud Management Service for Binary Authorization admission policies
33
+ # and attestation authorities.
34
+ #
35
+ # This API implements a REST model with the following objects:
36
+ #
37
+ # * {::Google::Cloud::BinaryAuthorization::V1::Policy Policy}
38
+ # * {::Google::Cloud::BinaryAuthorization::V1::Attestor Attestor}
39
+ #
40
+ class Client
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :binauthz_management_service_stub
45
+
46
+ ##
47
+ # Configure the BinauthzManagementService Client class.
48
+ #
49
+ # See {::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all BinauthzManagementService clients
55
+ # ::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "BinaryAuthorization", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.rpcs.get_policy.timeout = 600.0
76
+ default_config.rpcs.get_policy.retry_policy = {
77
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
78
+ }
79
+
80
+ default_config.rpcs.update_policy.timeout = 600.0
81
+ default_config.rpcs.update_policy.retry_policy = {
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
83
+ }
84
+
85
+ default_config.rpcs.create_attestor.timeout = 600.0
86
+
87
+ default_config.rpcs.get_attestor.timeout = 600.0
88
+ default_config.rpcs.get_attestor.retry_policy = {
89
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
90
+ }
91
+
92
+ default_config.rpcs.update_attestor.timeout = 600.0
93
+ default_config.rpcs.update_attestor.retry_policy = {
94
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
95
+ }
96
+
97
+ default_config.rpcs.list_attestors.timeout = 600.0
98
+ default_config.rpcs.list_attestors.retry_policy = {
99
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
100
+ }
101
+
102
+ default_config.rpcs.delete_attestor.timeout = 600.0
103
+ default_config.rpcs.delete_attestor.retry_policy = {
104
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
105
+ }
106
+
107
+ default_config
108
+ end
109
+ yield @configure if block_given?
110
+ @configure
111
+ end
112
+
113
+ ##
114
+ # Configure the BinauthzManagementService Client instance.
115
+ #
116
+ # The configuration is set to the derived mode, meaning that values can be changed,
117
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
118
+ # should be made on {Client.configure}.
119
+ #
120
+ # See {::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client::Configuration}
121
+ # for a description of the configuration fields.
122
+ #
123
+ # @yield [config] Configure the Client client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ # @return [Client::Configuration]
127
+ #
128
+ def configure
129
+ yield @config if block_given?
130
+ @config
131
+ end
132
+
133
+ ##
134
+ # Create a new BinauthzManagementService REST client object.
135
+ #
136
+ # @example
137
+ #
138
+ # # Create a client using the default configuration
139
+ # client = ::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new
140
+ #
141
+ # # Create a client using a custom configuration
142
+ # client = ::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new do |config|
143
+ # config.timeout = 10.0
144
+ # end
145
+ #
146
+ # @yield [config] Configure the BinauthzManagementService client.
147
+ # @yieldparam config [Client::Configuration]
148
+ #
149
+ def initialize
150
+ # Create the configuration object
151
+ @config = Configuration.new Client.configure
152
+
153
+ # Yield the configuration if needed
154
+ yield @config if block_given?
155
+
156
+ # Create credentials
157
+ credentials = @config.credentials
158
+ # Use self-signed JWT if the endpoint is unchanged from default,
159
+ # but only if the default endpoint does not have a region prefix.
160
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
161
+ !@config.endpoint.split(".").first.include?("-")
162
+ credentials ||= Credentials.default scope: @config.scope,
163
+ enable_self_signed_jwt: enable_self_signed_jwt
164
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
165
+ credentials = Credentials.new credentials, scope: @config.scope
166
+ end
167
+
168
+ @quota_project_id = @config.quota_project
169
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
170
+
171
+ @binauthz_management_service_stub = ::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
172
+ end
173
+
174
+ # Service calls
175
+
176
+ ##
177
+ # A {::Google::Cloud::BinaryAuthorization::V1::Policy policy} specifies the {::Google::Cloud::BinaryAuthorization::V1::Attestor attestors} that must attest to
178
+ # a container image, before the project is allowed to deploy that
179
+ # image. There is at most one policy per project. All image admission
180
+ # requests are permitted if a project has no policy.
181
+ #
182
+ # Gets the {::Google::Cloud::BinaryAuthorization::V1::Policy policy} for this project. Returns a default
183
+ # {::Google::Cloud::BinaryAuthorization::V1::Policy policy} if the project does not have one.
184
+ #
185
+ # @overload get_policy(request, options = nil)
186
+ # Pass arguments to `get_policy` via a request object, either of type
187
+ # {::Google::Cloud::BinaryAuthorization::V1::GetPolicyRequest} or an equivalent Hash.
188
+ #
189
+ # @param request [::Google::Cloud::BinaryAuthorization::V1::GetPolicyRequest, ::Hash]
190
+ # A request object representing the call parameters. Required. To specify no
191
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
192
+ # @param options [::Gapic::CallOptions, ::Hash]
193
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
194
+ #
195
+ # @overload get_policy(name: nil)
196
+ # Pass arguments to `get_policy` via keyword arguments. Note that at
197
+ # least one keyword argument is required. To specify no parameters, or to keep all
198
+ # the default parameter values, pass an empty Hash as a request object (see above).
199
+ #
200
+ # @param name [::String]
201
+ # Required. The resource name of the {::Google::Cloud::BinaryAuthorization::V1::Policy policy} to retrieve,
202
+ # in the format `projects/*/policy`.
203
+ # @yield [result, operation] Access the result along with the TransportOperation object
204
+ # @yieldparam result [::Google::Cloud::BinaryAuthorization::V1::Policy]
205
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
206
+ #
207
+ # @return [::Google::Cloud::BinaryAuthorization::V1::Policy]
208
+ #
209
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
210
+ def get_policy request, options = nil
211
+ raise ::ArgumentError, "request must be provided" if request.nil?
212
+
213
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::GetPolicyRequest
214
+
215
+ # Converts hash and nil to an options object
216
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
217
+
218
+ # Customize the options with defaults
219
+ call_metadata = @config.rpcs.get_policy.metadata.to_h
220
+
221
+ # Set x-goog-api-client and x-goog-user-project headers
222
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
223
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
224
+ gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION,
225
+ transports_version_send: [:rest]
226
+
227
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
228
+
229
+ options.apply_defaults timeout: @config.rpcs.get_policy.timeout,
230
+ metadata: call_metadata,
231
+ retry_policy: @config.rpcs.get_policy.retry_policy
232
+
233
+ options.apply_defaults timeout: @config.timeout,
234
+ metadata: @config.metadata,
235
+ retry_policy: @config.retry_policy
236
+
237
+ @binauthz_management_service_stub.get_policy request, options do |result, operation|
238
+ yield result, operation if block_given?
239
+ return result
240
+ end
241
+ rescue ::Gapic::Rest::Error => e
242
+ raise ::Google::Cloud::Error.from_error(e)
243
+ end
244
+
245
+ ##
246
+ # Creates or updates a project's {::Google::Cloud::BinaryAuthorization::V1::Policy policy}, and returns a copy of the
247
+ # new {::Google::Cloud::BinaryAuthorization::V1::Policy policy}. A policy is always updated as a whole, to avoid race
248
+ # conditions with concurrent policy enforcement (or management!)
249
+ # requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT
250
+ # if the request is malformed.
251
+ #
252
+ # @overload update_policy(request, options = nil)
253
+ # Pass arguments to `update_policy` via a request object, either of type
254
+ # {::Google::Cloud::BinaryAuthorization::V1::UpdatePolicyRequest} or an equivalent Hash.
255
+ #
256
+ # @param request [::Google::Cloud::BinaryAuthorization::V1::UpdatePolicyRequest, ::Hash]
257
+ # A request object representing the call parameters. Required. To specify no
258
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
259
+ # @param options [::Gapic::CallOptions, ::Hash]
260
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
261
+ #
262
+ # @overload update_policy(policy: nil)
263
+ # Pass arguments to `update_policy` via keyword arguments. Note that at
264
+ # least one keyword argument is required. To specify no parameters, or to keep all
265
+ # the default parameter values, pass an empty Hash as a request object (see above).
266
+ #
267
+ # @param policy [::Google::Cloud::BinaryAuthorization::V1::Policy, ::Hash]
268
+ # Required. A new or updated {::Google::Cloud::BinaryAuthorization::V1::Policy policy} value. The service will
269
+ # overwrite the {::Google::Cloud::BinaryAuthorization::V1::Policy#name policy name} field with the resource name in
270
+ # the request URL, in the format `projects/*/policy`.
271
+ # @yield [result, operation] Access the result along with the TransportOperation object
272
+ # @yieldparam result [::Google::Cloud::BinaryAuthorization::V1::Policy]
273
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
274
+ #
275
+ # @return [::Google::Cloud::BinaryAuthorization::V1::Policy]
276
+ #
277
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
278
+ def update_policy request, options = nil
279
+ raise ::ArgumentError, "request must be provided" if request.nil?
280
+
281
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::UpdatePolicyRequest
282
+
283
+ # Converts hash and nil to an options object
284
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
285
+
286
+ # Customize the options with defaults
287
+ call_metadata = @config.rpcs.update_policy.metadata.to_h
288
+
289
+ # Set x-goog-api-client and x-goog-user-project headers
290
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
291
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
292
+ gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION,
293
+ transports_version_send: [:rest]
294
+
295
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
296
+
297
+ options.apply_defaults timeout: @config.rpcs.update_policy.timeout,
298
+ metadata: call_metadata,
299
+ retry_policy: @config.rpcs.update_policy.retry_policy
300
+
301
+ options.apply_defaults timeout: @config.timeout,
302
+ metadata: @config.metadata,
303
+ retry_policy: @config.retry_policy
304
+
305
+ @binauthz_management_service_stub.update_policy request, options do |result, operation|
306
+ yield result, operation if block_given?
307
+ return result
308
+ end
309
+ rescue ::Gapic::Rest::Error => e
310
+ raise ::Google::Cloud::Error.from_error(e)
311
+ end
312
+
313
+ ##
314
+ # Creates an {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor}, and returns a copy of the new
315
+ # {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor}. Returns NOT_FOUND if the project does not exist,
316
+ # INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the
317
+ # {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor} already exists.
318
+ #
319
+ # @overload create_attestor(request, options = nil)
320
+ # Pass arguments to `create_attestor` via a request object, either of type
321
+ # {::Google::Cloud::BinaryAuthorization::V1::CreateAttestorRequest} or an equivalent Hash.
322
+ #
323
+ # @param request [::Google::Cloud::BinaryAuthorization::V1::CreateAttestorRequest, ::Hash]
324
+ # A request object representing the call parameters. Required. To specify no
325
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
326
+ # @param options [::Gapic::CallOptions, ::Hash]
327
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
328
+ #
329
+ # @overload create_attestor(parent: nil, attestor_id: nil, attestor: nil)
330
+ # Pass arguments to `create_attestor` via keyword arguments. Note that at
331
+ # least one keyword argument is required. To specify no parameters, or to keep all
332
+ # the default parameter values, pass an empty Hash as a request object (see above).
333
+ #
334
+ # @param parent [::String]
335
+ # Required. The parent of this {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor}.
336
+ # @param attestor_id [::String]
337
+ # Required. The {::Google::Cloud::BinaryAuthorization::V1::Attestor attestors} ID.
338
+ # @param attestor [::Google::Cloud::BinaryAuthorization::V1::Attestor, ::Hash]
339
+ # Required. The initial {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor} value. The service will
340
+ # overwrite the {::Google::Cloud::BinaryAuthorization::V1::Attestor#name attestor name} field with the resource name,
341
+ # in the format `projects/*/attestors/*`.
342
+ # @yield [result, operation] Access the result along with the TransportOperation object
343
+ # @yieldparam result [::Google::Cloud::BinaryAuthorization::V1::Attestor]
344
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
345
+ #
346
+ # @return [::Google::Cloud::BinaryAuthorization::V1::Attestor]
347
+ #
348
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
349
+ def create_attestor request, options = nil
350
+ raise ::ArgumentError, "request must be provided" if request.nil?
351
+
352
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::CreateAttestorRequest
353
+
354
+ # Converts hash and nil to an options object
355
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
356
+
357
+ # Customize the options with defaults
358
+ call_metadata = @config.rpcs.create_attestor.metadata.to_h
359
+
360
+ # Set x-goog-api-client and x-goog-user-project headers
361
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
362
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
363
+ gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION,
364
+ transports_version_send: [:rest]
365
+
366
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
367
+
368
+ options.apply_defaults timeout: @config.rpcs.create_attestor.timeout,
369
+ metadata: call_metadata,
370
+ retry_policy: @config.rpcs.create_attestor.retry_policy
371
+
372
+ options.apply_defaults timeout: @config.timeout,
373
+ metadata: @config.metadata,
374
+ retry_policy: @config.retry_policy
375
+
376
+ @binauthz_management_service_stub.create_attestor request, options do |result, operation|
377
+ yield result, operation if block_given?
378
+ return result
379
+ end
380
+ rescue ::Gapic::Rest::Error => e
381
+ raise ::Google::Cloud::Error.from_error(e)
382
+ end
383
+
384
+ ##
385
+ # Gets an {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor}.
386
+ # Returns NOT_FOUND if the {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor} does not exist.
387
+ #
388
+ # @overload get_attestor(request, options = nil)
389
+ # Pass arguments to `get_attestor` via a request object, either of type
390
+ # {::Google::Cloud::BinaryAuthorization::V1::GetAttestorRequest} or an equivalent Hash.
391
+ #
392
+ # @param request [::Google::Cloud::BinaryAuthorization::V1::GetAttestorRequest, ::Hash]
393
+ # A request object representing the call parameters. Required. To specify no
394
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
395
+ # @param options [::Gapic::CallOptions, ::Hash]
396
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
397
+ #
398
+ # @overload get_attestor(name: nil)
399
+ # Pass arguments to `get_attestor` via keyword arguments. Note that at
400
+ # least one keyword argument is required. To specify no parameters, or to keep all
401
+ # the default parameter values, pass an empty Hash as a request object (see above).
402
+ #
403
+ # @param name [::String]
404
+ # Required. The name of the {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor} to retrieve, in the format
405
+ # `projects/*/attestors/*`.
406
+ # @yield [result, operation] Access the result along with the TransportOperation object
407
+ # @yieldparam result [::Google::Cloud::BinaryAuthorization::V1::Attestor]
408
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
409
+ #
410
+ # @return [::Google::Cloud::BinaryAuthorization::V1::Attestor]
411
+ #
412
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
413
+ def get_attestor request, options = nil
414
+ raise ::ArgumentError, "request must be provided" if request.nil?
415
+
416
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::GetAttestorRequest
417
+
418
+ # Converts hash and nil to an options object
419
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
420
+
421
+ # Customize the options with defaults
422
+ call_metadata = @config.rpcs.get_attestor.metadata.to_h
423
+
424
+ # Set x-goog-api-client and x-goog-user-project headers
425
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
426
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
427
+ gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION,
428
+ transports_version_send: [:rest]
429
+
430
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ options.apply_defaults timeout: @config.rpcs.get_attestor.timeout,
433
+ metadata: call_metadata,
434
+ retry_policy: @config.rpcs.get_attestor.retry_policy
435
+
436
+ options.apply_defaults timeout: @config.timeout,
437
+ metadata: @config.metadata,
438
+ retry_policy: @config.retry_policy
439
+
440
+ @binauthz_management_service_stub.get_attestor request, options do |result, operation|
441
+ yield result, operation if block_given?
442
+ return result
443
+ end
444
+ rescue ::Gapic::Rest::Error => e
445
+ raise ::Google::Cloud::Error.from_error(e)
446
+ end
447
+
448
+ ##
449
+ # Updates an {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor}.
450
+ # Returns NOT_FOUND if the {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor} does not exist.
451
+ #
452
+ # @overload update_attestor(request, options = nil)
453
+ # Pass arguments to `update_attestor` via a request object, either of type
454
+ # {::Google::Cloud::BinaryAuthorization::V1::UpdateAttestorRequest} or an equivalent Hash.
455
+ #
456
+ # @param request [::Google::Cloud::BinaryAuthorization::V1::UpdateAttestorRequest, ::Hash]
457
+ # A request object representing the call parameters. Required. To specify no
458
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
459
+ # @param options [::Gapic::CallOptions, ::Hash]
460
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
461
+ #
462
+ # @overload update_attestor(attestor: nil)
463
+ # Pass arguments to `update_attestor` via keyword arguments. Note that at
464
+ # least one keyword argument is required. To specify no parameters, or to keep all
465
+ # the default parameter values, pass an empty Hash as a request object (see above).
466
+ #
467
+ # @param attestor [::Google::Cloud::BinaryAuthorization::V1::Attestor, ::Hash]
468
+ # Required. The updated {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor} value. The service will
469
+ # overwrite the {::Google::Cloud::BinaryAuthorization::V1::Attestor#name attestor name} field with the resource name
470
+ # in the request URL, in the format `projects/*/attestors/*`.
471
+ # @yield [result, operation] Access the result along with the TransportOperation object
472
+ # @yieldparam result [::Google::Cloud::BinaryAuthorization::V1::Attestor]
473
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
474
+ #
475
+ # @return [::Google::Cloud::BinaryAuthorization::V1::Attestor]
476
+ #
477
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
478
+ def update_attestor request, options = nil
479
+ raise ::ArgumentError, "request must be provided" if request.nil?
480
+
481
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::UpdateAttestorRequest
482
+
483
+ # Converts hash and nil to an options object
484
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
485
+
486
+ # Customize the options with defaults
487
+ call_metadata = @config.rpcs.update_attestor.metadata.to_h
488
+
489
+ # Set x-goog-api-client and x-goog-user-project headers
490
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
491
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
492
+ gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION,
493
+ transports_version_send: [:rest]
494
+
495
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
496
+
497
+ options.apply_defaults timeout: @config.rpcs.update_attestor.timeout,
498
+ metadata: call_metadata,
499
+ retry_policy: @config.rpcs.update_attestor.retry_policy
500
+
501
+ options.apply_defaults timeout: @config.timeout,
502
+ metadata: @config.metadata,
503
+ retry_policy: @config.retry_policy
504
+
505
+ @binauthz_management_service_stub.update_attestor request, options do |result, operation|
506
+ yield result, operation if block_given?
507
+ return result
508
+ end
509
+ rescue ::Gapic::Rest::Error => e
510
+ raise ::Google::Cloud::Error.from_error(e)
511
+ end
512
+
513
+ ##
514
+ # Lists {::Google::Cloud::BinaryAuthorization::V1::Attestor attestors}.
515
+ # Returns INVALID_ARGUMENT if the project does not exist.
516
+ #
517
+ # @overload list_attestors(request, options = nil)
518
+ # Pass arguments to `list_attestors` via a request object, either of type
519
+ # {::Google::Cloud::BinaryAuthorization::V1::ListAttestorsRequest} or an equivalent Hash.
520
+ #
521
+ # @param request [::Google::Cloud::BinaryAuthorization::V1::ListAttestorsRequest, ::Hash]
522
+ # A request object representing the call parameters. Required. To specify no
523
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
524
+ # @param options [::Gapic::CallOptions, ::Hash]
525
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
526
+ #
527
+ # @overload list_attestors(parent: nil, page_size: nil, page_token: nil)
528
+ # Pass arguments to `list_attestors` via keyword arguments. Note that at
529
+ # least one keyword argument is required. To specify no parameters, or to keep all
530
+ # the default parameter values, pass an empty Hash as a request object (see above).
531
+ #
532
+ # @param parent [::String]
533
+ # Required. The resource name of the project associated with the
534
+ # {::Google::Cloud::BinaryAuthorization::V1::Attestor attestors}, in the format `projects/*`.
535
+ # @param page_size [::Integer]
536
+ # Requested page size. The server may return fewer results than requested. If
537
+ # unspecified, the server will pick an appropriate default.
538
+ # @param page_token [::String]
539
+ # A token identifying a page of results the server should return. Typically,
540
+ # this is the value of {::Google::Cloud::BinaryAuthorization::V1::ListAttestorsResponse#next_page_token ListAttestorsResponse.next_page_token} returned
541
+ # from the previous call to the `ListAttestors` method.
542
+ # @yield [result, operation] Access the result along with the TransportOperation object
543
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::BinaryAuthorization::V1::Attestor>]
544
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
545
+ #
546
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::BinaryAuthorization::V1::Attestor>]
547
+ #
548
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
549
+ def list_attestors request, options = nil
550
+ raise ::ArgumentError, "request must be provided" if request.nil?
551
+
552
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::ListAttestorsRequest
553
+
554
+ # Converts hash and nil to an options object
555
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
556
+
557
+ # Customize the options with defaults
558
+ call_metadata = @config.rpcs.list_attestors.metadata.to_h
559
+
560
+ # Set x-goog-api-client and x-goog-user-project headers
561
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
562
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
563
+ gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION,
564
+ transports_version_send: [:rest]
565
+
566
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
567
+
568
+ options.apply_defaults timeout: @config.rpcs.list_attestors.timeout,
569
+ metadata: call_metadata,
570
+ retry_policy: @config.rpcs.list_attestors.retry_policy
571
+
572
+ options.apply_defaults timeout: @config.timeout,
573
+ metadata: @config.metadata,
574
+ retry_policy: @config.retry_policy
575
+
576
+ @binauthz_management_service_stub.list_attestors request, options do |result, operation|
577
+ result = ::Gapic::Rest::PagedEnumerable.new @binauthz_management_service_stub, :list_attestors, "attestors", request, result, options
578
+ yield result, operation if block_given?
579
+ return result
580
+ end
581
+ rescue ::Gapic::Rest::Error => e
582
+ raise ::Google::Cloud::Error.from_error(e)
583
+ end
584
+
585
+ ##
586
+ # Deletes an {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor}. Returns NOT_FOUND if the
587
+ # {::Google::Cloud::BinaryAuthorization::V1::Attestor attestor} does not exist.
588
+ #
589
+ # @overload delete_attestor(request, options = nil)
590
+ # Pass arguments to `delete_attestor` via a request object, either of type
591
+ # {::Google::Cloud::BinaryAuthorization::V1::DeleteAttestorRequest} or an equivalent Hash.
592
+ #
593
+ # @param request [::Google::Cloud::BinaryAuthorization::V1::DeleteAttestorRequest, ::Hash]
594
+ # A request object representing the call parameters. Required. To specify no
595
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
596
+ # @param options [::Gapic::CallOptions, ::Hash]
597
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
598
+ #
599
+ # @overload delete_attestor(name: nil)
600
+ # Pass arguments to `delete_attestor` via keyword arguments. Note that at
601
+ # least one keyword argument is required. To specify no parameters, or to keep all
602
+ # the default parameter values, pass an empty Hash as a request object (see above).
603
+ #
604
+ # @param name [::String]
605
+ # Required. The name of the {::Google::Cloud::BinaryAuthorization::V1::Attestor attestors} to delete, in the format
606
+ # `projects/*/attestors/*`.
607
+ # @yield [result, operation] Access the result along with the TransportOperation object
608
+ # @yieldparam result [::Google::Protobuf::Empty]
609
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
610
+ #
611
+ # @return [::Google::Protobuf::Empty]
612
+ #
613
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
614
+ def delete_attestor request, options = nil
615
+ raise ::ArgumentError, "request must be provided" if request.nil?
616
+
617
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BinaryAuthorization::V1::DeleteAttestorRequest
618
+
619
+ # Converts hash and nil to an options object
620
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
621
+
622
+ # Customize the options with defaults
623
+ call_metadata = @config.rpcs.delete_attestor.metadata.to_h
624
+
625
+ # Set x-goog-api-client and x-goog-user-project headers
626
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
627
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
628
+ gapic_version: ::Google::Cloud::BinaryAuthorization::V1::VERSION,
629
+ transports_version_send: [:rest]
630
+
631
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
632
+
633
+ options.apply_defaults timeout: @config.rpcs.delete_attestor.timeout,
634
+ metadata: call_metadata,
635
+ retry_policy: @config.rpcs.delete_attestor.retry_policy
636
+
637
+ options.apply_defaults timeout: @config.timeout,
638
+ metadata: @config.metadata,
639
+ retry_policy: @config.retry_policy
640
+
641
+ @binauthz_management_service_stub.delete_attestor request, options do |result, operation|
642
+ yield result, operation if block_given?
643
+ return result
644
+ end
645
+ rescue ::Gapic::Rest::Error => e
646
+ raise ::Google::Cloud::Error.from_error(e)
647
+ end
648
+
649
+ ##
650
+ # Configuration class for the BinauthzManagementService REST API.
651
+ #
652
+ # This class represents the configuration for BinauthzManagementService REST,
653
+ # providing control over timeouts, retry behavior, logging, transport
654
+ # parameters, and other low-level controls. Certain parameters can also be
655
+ # applied individually to specific RPCs. See
656
+ # {::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client::Configuration::Rpcs}
657
+ # for a list of RPCs that can be configured independently.
658
+ #
659
+ # Configuration can be applied globally to all clients, or to a single client
660
+ # on construction.
661
+ #
662
+ # @example
663
+ #
664
+ # # Modify the global config, setting the timeout for
665
+ # # get_policy to 20 seconds,
666
+ # # and all remaining timeouts to 10 seconds.
667
+ # ::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.configure do |config|
668
+ # config.timeout = 10.0
669
+ # config.rpcs.get_policy.timeout = 20.0
670
+ # end
671
+ #
672
+ # # Apply the above configuration only to a new client.
673
+ # client = ::Google::Cloud::BinaryAuthorization::V1::BinauthzManagementService::Rest::Client.new do |config|
674
+ # config.timeout = 10.0
675
+ # config.rpcs.get_policy.timeout = 20.0
676
+ # end
677
+ #
678
+ # @!attribute [rw] endpoint
679
+ # The hostname or hostname:port of the service endpoint.
680
+ # Defaults to `"binaryauthorization.googleapis.com"`.
681
+ # @return [::String]
682
+ # @!attribute [rw] credentials
683
+ # Credentials to send with calls. You may provide any of the following types:
684
+ # * (`String`) The path to a service account key file in JSON format
685
+ # * (`Hash`) A service account key as a Hash
686
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
687
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
688
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
689
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
690
+ # * (`nil`) indicating no credentials
691
+ # @return [::Object]
692
+ # @!attribute [rw] scope
693
+ # The OAuth scopes
694
+ # @return [::Array<::String>]
695
+ # @!attribute [rw] lib_name
696
+ # The library name as recorded in instrumentation and logging
697
+ # @return [::String]
698
+ # @!attribute [rw] lib_version
699
+ # The library version as recorded in instrumentation and logging
700
+ # @return [::String]
701
+ # @!attribute [rw] timeout
702
+ # The call timeout in seconds.
703
+ # @return [::Numeric]
704
+ # @!attribute [rw] metadata
705
+ # Additional headers to be sent with the call.
706
+ # @return [::Hash{::Symbol=>::String}]
707
+ # @!attribute [rw] retry_policy
708
+ # The retry policy. The value is a hash with the following keys:
709
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
710
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
711
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
712
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
713
+ # trigger a retry.
714
+ # @return [::Hash]
715
+ # @!attribute [rw] quota_project
716
+ # A separate project against which to charge quota.
717
+ # @return [::String]
718
+ #
719
+ class Configuration
720
+ extend ::Gapic::Config
721
+
722
+ config_attr :endpoint, "binaryauthorization.googleapis.com", ::String
723
+ config_attr :credentials, nil do |value|
724
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
725
+ allowed.any? { |klass| klass === value }
726
+ end
727
+ config_attr :scope, nil, ::String, ::Array, nil
728
+ config_attr :lib_name, nil, ::String, nil
729
+ config_attr :lib_version, nil, ::String, nil
730
+ config_attr :timeout, nil, ::Numeric, nil
731
+ config_attr :metadata, nil, ::Hash, nil
732
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
733
+ config_attr :quota_project, nil, ::String, nil
734
+
735
+ # @private
736
+ def initialize parent_config = nil
737
+ @parent_config = parent_config unless parent_config.nil?
738
+
739
+ yield self if block_given?
740
+ end
741
+
742
+ ##
743
+ # Configurations for individual RPCs
744
+ # @return [Rpcs]
745
+ #
746
+ def rpcs
747
+ @rpcs ||= begin
748
+ parent_rpcs = nil
749
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
750
+ Rpcs.new parent_rpcs
751
+ end
752
+ end
753
+
754
+ ##
755
+ # Configuration RPC class for the BinauthzManagementService API.
756
+ #
757
+ # Includes fields providing the configuration for each RPC in this service.
758
+ # Each configuration object is of type `Gapic::Config::Method` and includes
759
+ # the following configuration fields:
760
+ #
761
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
762
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
763
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
764
+ # include the following keys:
765
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
766
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
767
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
768
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
769
+ # trigger a retry.
770
+ #
771
+ class Rpcs
772
+ ##
773
+ # RPC-specific configuration for `get_policy`
774
+ # @return [::Gapic::Config::Method]
775
+ #
776
+ attr_reader :get_policy
777
+ ##
778
+ # RPC-specific configuration for `update_policy`
779
+ # @return [::Gapic::Config::Method]
780
+ #
781
+ attr_reader :update_policy
782
+ ##
783
+ # RPC-specific configuration for `create_attestor`
784
+ # @return [::Gapic::Config::Method]
785
+ #
786
+ attr_reader :create_attestor
787
+ ##
788
+ # RPC-specific configuration for `get_attestor`
789
+ # @return [::Gapic::Config::Method]
790
+ #
791
+ attr_reader :get_attestor
792
+ ##
793
+ # RPC-specific configuration for `update_attestor`
794
+ # @return [::Gapic::Config::Method]
795
+ #
796
+ attr_reader :update_attestor
797
+ ##
798
+ # RPC-specific configuration for `list_attestors`
799
+ # @return [::Gapic::Config::Method]
800
+ #
801
+ attr_reader :list_attestors
802
+ ##
803
+ # RPC-specific configuration for `delete_attestor`
804
+ # @return [::Gapic::Config::Method]
805
+ #
806
+ attr_reader :delete_attestor
807
+
808
+ # @private
809
+ def initialize parent_rpcs = nil
810
+ get_policy_config = parent_rpcs.get_policy if parent_rpcs.respond_to? :get_policy
811
+ @get_policy = ::Gapic::Config::Method.new get_policy_config
812
+ update_policy_config = parent_rpcs.update_policy if parent_rpcs.respond_to? :update_policy
813
+ @update_policy = ::Gapic::Config::Method.new update_policy_config
814
+ create_attestor_config = parent_rpcs.create_attestor if parent_rpcs.respond_to? :create_attestor
815
+ @create_attestor = ::Gapic::Config::Method.new create_attestor_config
816
+ get_attestor_config = parent_rpcs.get_attestor if parent_rpcs.respond_to? :get_attestor
817
+ @get_attestor = ::Gapic::Config::Method.new get_attestor_config
818
+ update_attestor_config = parent_rpcs.update_attestor if parent_rpcs.respond_to? :update_attestor
819
+ @update_attestor = ::Gapic::Config::Method.new update_attestor_config
820
+ list_attestors_config = parent_rpcs.list_attestors if parent_rpcs.respond_to? :list_attestors
821
+ @list_attestors = ::Gapic::Config::Method.new list_attestors_config
822
+ delete_attestor_config = parent_rpcs.delete_attestor if parent_rpcs.respond_to? :delete_attestor
823
+ @delete_attestor = ::Gapic::Config::Method.new delete_attestor_config
824
+
825
+ yield self if block_given?
826
+ end
827
+ end
828
+ end
829
+ end
830
+ end
831
+ end
832
+ end
833
+ end
834
+ end
835
+ end