google-cloud-binary_authorization-v1 0.1.0

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