grafeas-v1 0.1.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +3 -3
  4. data/lib/grafeas/v1/attestation_pb.rb +6 -1
  5. data/lib/grafeas/v1/build_pb.rb +5 -1
  6. data/lib/grafeas/v1/common_pb.rb +13 -0
  7. data/lib/grafeas/v1/compliance_pb.rb +48 -0
  8. data/lib/grafeas/v1/deployment_pb.rb +1 -1
  9. data/lib/grafeas/v1/discovery_pb.rb +2 -2
  10. data/lib/grafeas/v1/dsse_attestation_pb.rb +31 -0
  11. data/lib/grafeas/v1/grafeas/client.rb +390 -136
  12. data/lib/grafeas/v1/grafeas_pb.rb +9 -2
  13. data/lib/grafeas/v1/grafeas_services_pb.rb +1 -1
  14. data/lib/grafeas/v1/intoto_provenance_pb.rb +49 -0
  15. data/lib/grafeas/v1/intoto_statement_pb.rb +31 -0
  16. data/lib/grafeas/v1/package_pb.rb +1 -0
  17. data/lib/grafeas/v1/provenance_pb.rb +1 -1
  18. data/lib/grafeas/v1/slsa_provenance_pb.rb +54 -0
  19. data/lib/grafeas/v1/upgrade_pb.rb +2 -2
  20. data/lib/grafeas/v1/version.rb +1 -1
  21. data/lib/grafeas/v1/vulnerability_pb.rb +13 -2
  22. data/proto_docs/google/api/field_behavior.rb +7 -1
  23. data/proto_docs/grafeas/v1/attestation.rb +21 -0
  24. data/proto_docs/grafeas/v1/build.rb +11 -1
  25. data/proto_docs/grafeas/v1/common.rb +31 -2
  26. data/proto_docs/grafeas/v1/compliance.rb +98 -0
  27. data/proto_docs/grafeas/v1/dsse_attestation.rb +59 -0
  28. data/proto_docs/grafeas/v1/grafeas.rb +15 -0
  29. data/proto_docs/grafeas/v1/intoto_provenance.rb +134 -0
  30. data/proto_docs/grafeas/v1/intoto_statement.rb +65 -0
  31. data/proto_docs/grafeas/v1/package.rb +8 -0
  32. data/proto_docs/grafeas/v1/slsa_provenance.rb +152 -0
  33. data/proto_docs/grafeas/v1/vulnerability.rb +38 -0
  34. metadata +26 -10
@@ -52,13 +52,12 @@ module Grafeas
52
52
  # See {::Grafeas::V1::Grafeas::Client::Configuration}
53
53
  # for a description of the configuration fields.
54
54
  #
55
- # ## Example
55
+ # @example
56
56
  #
57
- # To modify the configuration for all Grafeas clients:
58
- #
59
- # ::Grafeas::V1::Grafeas::Client.configure do |config|
60
- # config.timeout = 10.0
61
- # end
57
+ # # Modify the configuration for all Grafeas clients
58
+ # ::Grafeas::V1::Grafeas::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
62
61
  #
63
62
  # @yield [config] Configure the Client client.
64
63
  # @yieldparam config [Client::Configuration]
@@ -71,33 +70,24 @@ module Grafeas
71
70
  parent_config = while namespace.any?
72
71
  parent_name = namespace.join "::"
73
72
  parent_const = const_get parent_name
74
- break parent_const.configure if parent_const&.respond_to? :configure
73
+ break parent_const.configure if parent_const.respond_to? :configure
75
74
  namespace.pop
76
75
  end
77
76
  default_config = Client::Configuration.new parent_config
78
77
 
79
78
  default_config.rpcs.get_occurrence.timeout = 30.0
80
79
  default_config.rpcs.get_occurrence.retry_policy = {
81
- initial_delay: 0.1,
82
- max_delay: 60.0,
83
- multiplier: 1.3,
84
- retry_codes: [14, 4]
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
85
81
  }
86
82
 
87
83
  default_config.rpcs.list_occurrences.timeout = 30.0
88
84
  default_config.rpcs.list_occurrences.retry_policy = {
89
- initial_delay: 0.1,
90
- max_delay: 60.0,
91
- multiplier: 1.3,
92
- retry_codes: [14, 4]
85
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
93
86
  }
94
87
 
95
88
  default_config.rpcs.delete_occurrence.timeout = 30.0
96
89
  default_config.rpcs.delete_occurrence.retry_policy = {
97
- initial_delay: 0.1,
98
- max_delay: 60.0,
99
- multiplier: 1.3,
100
- retry_codes: [14, 4]
90
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
101
91
  }
102
92
 
103
93
  default_config.rpcs.create_occurrence.timeout = 30.0
@@ -108,34 +98,22 @@ module Grafeas
108
98
 
109
99
  default_config.rpcs.get_occurrence_note.timeout = 30.0
110
100
  default_config.rpcs.get_occurrence_note.retry_policy = {
111
- initial_delay: 0.1,
112
- max_delay: 60.0,
113
- multiplier: 1.3,
114
- retry_codes: [14, 4]
101
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
115
102
  }
116
103
 
117
104
  default_config.rpcs.get_note.timeout = 30.0
118
105
  default_config.rpcs.get_note.retry_policy = {
119
- initial_delay: 0.1,
120
- max_delay: 60.0,
121
- multiplier: 1.3,
122
- retry_codes: [14, 4]
106
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
123
107
  }
124
108
 
125
109
  default_config.rpcs.list_notes.timeout = 30.0
126
110
  default_config.rpcs.list_notes.retry_policy = {
127
- initial_delay: 0.1,
128
- max_delay: 60.0,
129
- multiplier: 1.3,
130
- retry_codes: [14, 4]
111
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
131
112
  }
132
113
 
133
114
  default_config.rpcs.delete_note.timeout = 30.0
134
115
  default_config.rpcs.delete_note.retry_policy = {
135
- initial_delay: 0.1,
136
- max_delay: 60.0,
137
- multiplier: 1.3,
138
- retry_codes: [14, 4]
116
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
139
117
  }
140
118
 
141
119
  default_config.rpcs.create_note.timeout = 30.0
@@ -146,10 +124,7 @@ module Grafeas
146
124
 
147
125
  default_config.rpcs.list_note_occurrences.timeout = 30.0
148
126
  default_config.rpcs.list_note_occurrences.retry_policy = {
149
- initial_delay: 0.1,
150
- max_delay: 60.0,
151
- multiplier: 1.3,
152
- retry_codes: [14, 4]
127
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
153
128
  }
154
129
 
155
130
  default_config
@@ -181,19 +156,15 @@ module Grafeas
181
156
  ##
182
157
  # Create a new Grafeas client object.
183
158
  #
184
- # ## Examples
185
- #
186
- # To create a new Grafeas client with the default
187
- # configuration:
159
+ # @example
188
160
  #
189
- # client = ::Grafeas::V1::Grafeas::Client.new
161
+ # # Create a client using the default configuration
162
+ # client = ::Grafeas::V1::Grafeas::Client.new
190
163
  #
191
- # To create a new Grafeas client with a custom
192
- # configuration:
193
- #
194
- # client = ::Grafeas::V1::Grafeas::Client.new do |config|
195
- # config.timeout = 10.0
196
- # end
164
+ # # Create a client using a custom configuration
165
+ # client = ::Grafeas::V1::Grafeas::Client.new do |config|
166
+ # config.timeout = 10.0
167
+ # end
197
168
  #
198
169
  # @yield [config] Configure the Grafeas client.
199
170
  # @yieldparam config [Client::Configuration]
@@ -257,6 +228,21 @@ module Grafeas
257
228
  #
258
229
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
259
230
  #
231
+ # @example Basic example
232
+ # require "grafeas/v1"
233
+ #
234
+ # # Create a client object. The client can be reused for multiple calls.
235
+ # client = Grafeas::V1::Grafeas::Client.new
236
+ #
237
+ # # Create a request. To set request fields, pass in keyword arguments.
238
+ # request = Grafeas::V1::GetOccurrenceRequest.new
239
+ #
240
+ # # Call the get_occurrence method.
241
+ # result = client.get_occurrence request
242
+ #
243
+ # # The returned object is of type Grafeas::V1::Occurrence.
244
+ # p result
245
+ #
260
246
  def get_occurrence request, options = nil
261
247
  raise ::ArgumentError, "request must be provided" if request.nil?
262
248
 
@@ -274,16 +260,20 @@ module Grafeas
274
260
  gapic_version: ::Grafeas::V1::VERSION
275
261
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
276
262
 
277
- header_params = {
278
- "name" => request.name
279
- }
263
+ header_params = {}
264
+ if request.name
265
+ header_params["name"] = request.name
266
+ end
267
+
280
268
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
281
269
  metadata[:"x-goog-request-params"] ||= request_params_header
282
270
 
283
271
  options.apply_defaults timeout: @config.rpcs.get_occurrence.timeout,
284
272
  metadata: metadata,
285
273
  retry_policy: @config.rpcs.get_occurrence.retry_policy
286
- options.apply_defaults metadata: @config.metadata,
274
+
275
+ options.apply_defaults timeout: @config.timeout,
276
+ metadata: @config.metadata,
287
277
  retry_policy: @config.retry_policy
288
278
 
289
279
  @grafeas_stub.call_rpc :get_occurrence, request, options: options do |response, operation|
@@ -331,6 +321,27 @@ module Grafeas
331
321
  #
332
322
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
333
323
  #
324
+ # @example Basic example
325
+ # require "grafeas/v1"
326
+ #
327
+ # # Create a client object. The client can be reused for multiple calls.
328
+ # client = Grafeas::V1::Grafeas::Client.new
329
+ #
330
+ # # Create a request. To set request fields, pass in keyword arguments.
331
+ # request = Grafeas::V1::ListOccurrencesRequest.new
332
+ #
333
+ # # Call the list_occurrences method.
334
+ # result = client.list_occurrences request
335
+ #
336
+ # # The returned object is of type Gapic::PagedEnumerable. You can
337
+ # # iterate over all elements by calling #each, and the enumerable
338
+ # # will lazily make API calls to fetch subsequent pages. Other
339
+ # # methods are also available for managing paging directly.
340
+ # result.each do |response|
341
+ # # Each element is of type ::Grafeas::V1::Occurrence.
342
+ # p response
343
+ # end
344
+ #
334
345
  def list_occurrences request, options = nil
335
346
  raise ::ArgumentError, "request must be provided" if request.nil?
336
347
 
@@ -348,16 +359,20 @@ module Grafeas
348
359
  gapic_version: ::Grafeas::V1::VERSION
349
360
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
361
 
351
- header_params = {
352
- "parent" => request.parent
353
- }
362
+ header_params = {}
363
+ if request.parent
364
+ header_params["parent"] = request.parent
365
+ end
366
+
354
367
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
355
368
  metadata[:"x-goog-request-params"] ||= request_params_header
356
369
 
357
370
  options.apply_defaults timeout: @config.rpcs.list_occurrences.timeout,
358
371
  metadata: metadata,
359
372
  retry_policy: @config.rpcs.list_occurrences.retry_policy
360
- options.apply_defaults metadata: @config.metadata,
373
+
374
+ options.apply_defaults timeout: @config.timeout,
375
+ metadata: @config.metadata,
361
376
  retry_policy: @config.retry_policy
362
377
 
363
378
  @grafeas_stub.call_rpc :list_occurrences, request, options: options do |response, operation|
@@ -401,6 +416,21 @@ module Grafeas
401
416
  #
402
417
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
403
418
  #
419
+ # @example Basic example
420
+ # require "grafeas/v1"
421
+ #
422
+ # # Create a client object. The client can be reused for multiple calls.
423
+ # client = Grafeas::V1::Grafeas::Client.new
424
+ #
425
+ # # Create a request. To set request fields, pass in keyword arguments.
426
+ # request = Grafeas::V1::DeleteOccurrenceRequest.new
427
+ #
428
+ # # Call the delete_occurrence method.
429
+ # result = client.delete_occurrence request
430
+ #
431
+ # # The returned object is of type Google::Protobuf::Empty.
432
+ # p result
433
+ #
404
434
  def delete_occurrence request, options = nil
405
435
  raise ::ArgumentError, "request must be provided" if request.nil?
406
436
 
@@ -418,16 +448,20 @@ module Grafeas
418
448
  gapic_version: ::Grafeas::V1::VERSION
419
449
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
420
450
 
421
- header_params = {
422
- "name" => request.name
423
- }
451
+ header_params = {}
452
+ if request.name
453
+ header_params["name"] = request.name
454
+ end
455
+
424
456
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
425
457
  metadata[:"x-goog-request-params"] ||= request_params_header
426
458
 
427
459
  options.apply_defaults timeout: @config.rpcs.delete_occurrence.timeout,
428
460
  metadata: metadata,
429
461
  retry_policy: @config.rpcs.delete_occurrence.retry_policy
430
- options.apply_defaults metadata: @config.metadata,
462
+
463
+ options.apply_defaults timeout: @config.timeout,
464
+ metadata: @config.metadata,
431
465
  retry_policy: @config.retry_policy
432
466
 
433
467
  @grafeas_stub.call_rpc :delete_occurrence, request, options: options do |response, operation|
@@ -470,6 +504,21 @@ module Grafeas
470
504
  #
471
505
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
472
506
  #
507
+ # @example Basic example
508
+ # require "grafeas/v1"
509
+ #
510
+ # # Create a client object. The client can be reused for multiple calls.
511
+ # client = Grafeas::V1::Grafeas::Client.new
512
+ #
513
+ # # Create a request. To set request fields, pass in keyword arguments.
514
+ # request = Grafeas::V1::CreateOccurrenceRequest.new
515
+ #
516
+ # # Call the create_occurrence method.
517
+ # result = client.create_occurrence request
518
+ #
519
+ # # The returned object is of type Grafeas::V1::Occurrence.
520
+ # p result
521
+ #
473
522
  def create_occurrence request, options = nil
474
523
  raise ::ArgumentError, "request must be provided" if request.nil?
475
524
 
@@ -487,16 +536,20 @@ module Grafeas
487
536
  gapic_version: ::Grafeas::V1::VERSION
488
537
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
489
538
 
490
- header_params = {
491
- "parent" => request.parent
492
- }
539
+ header_params = {}
540
+ if request.parent
541
+ header_params["parent"] = request.parent
542
+ end
543
+
493
544
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
494
545
  metadata[:"x-goog-request-params"] ||= request_params_header
495
546
 
496
547
  options.apply_defaults timeout: @config.rpcs.create_occurrence.timeout,
497
548
  metadata: metadata,
498
549
  retry_policy: @config.rpcs.create_occurrence.retry_policy
499
- options.apply_defaults metadata: @config.metadata,
550
+
551
+ options.apply_defaults timeout: @config.timeout,
552
+ metadata: @config.metadata,
500
553
  retry_policy: @config.retry_policy
501
554
 
502
555
  @grafeas_stub.call_rpc :create_occurrence, request, options: options do |response, operation|
@@ -539,6 +592,21 @@ module Grafeas
539
592
  #
540
593
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
541
594
  #
595
+ # @example Basic example
596
+ # require "grafeas/v1"
597
+ #
598
+ # # Create a client object. The client can be reused for multiple calls.
599
+ # client = Grafeas::V1::Grafeas::Client.new
600
+ #
601
+ # # Create a request. To set request fields, pass in keyword arguments.
602
+ # request = Grafeas::V1::BatchCreateOccurrencesRequest.new
603
+ #
604
+ # # Call the batch_create_occurrences method.
605
+ # result = client.batch_create_occurrences request
606
+ #
607
+ # # The returned object is of type Grafeas::V1::BatchCreateOccurrencesResponse.
608
+ # p result
609
+ #
542
610
  def batch_create_occurrences request, options = nil
543
611
  raise ::ArgumentError, "request must be provided" if request.nil?
544
612
 
@@ -556,16 +624,20 @@ module Grafeas
556
624
  gapic_version: ::Grafeas::V1::VERSION
557
625
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
558
626
 
559
- header_params = {
560
- "parent" => request.parent
561
- }
627
+ header_params = {}
628
+ if request.parent
629
+ header_params["parent"] = request.parent
630
+ end
631
+
562
632
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
563
633
  metadata[:"x-goog-request-params"] ||= request_params_header
564
634
 
565
635
  options.apply_defaults timeout: @config.rpcs.batch_create_occurrences.timeout,
566
636
  metadata: metadata,
567
637
  retry_policy: @config.rpcs.batch_create_occurrences.retry_policy
568
- options.apply_defaults metadata: @config.metadata,
638
+
639
+ options.apply_defaults timeout: @config.timeout,
640
+ metadata: @config.metadata,
569
641
  retry_policy: @config.retry_policy
570
642
 
571
643
  @grafeas_stub.call_rpc :batch_create_occurrences, request, options: options do |response, operation|
@@ -610,6 +682,21 @@ module Grafeas
610
682
  #
611
683
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
612
684
  #
685
+ # @example Basic example
686
+ # require "grafeas/v1"
687
+ #
688
+ # # Create a client object. The client can be reused for multiple calls.
689
+ # client = Grafeas::V1::Grafeas::Client.new
690
+ #
691
+ # # Create a request. To set request fields, pass in keyword arguments.
692
+ # request = Grafeas::V1::UpdateOccurrenceRequest.new
693
+ #
694
+ # # Call the update_occurrence method.
695
+ # result = client.update_occurrence request
696
+ #
697
+ # # The returned object is of type Grafeas::V1::Occurrence.
698
+ # p result
699
+ #
613
700
  def update_occurrence request, options = nil
614
701
  raise ::ArgumentError, "request must be provided" if request.nil?
615
702
 
@@ -627,16 +714,20 @@ module Grafeas
627
714
  gapic_version: ::Grafeas::V1::VERSION
628
715
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
629
716
 
630
- header_params = {
631
- "name" => request.name
632
- }
717
+ header_params = {}
718
+ if request.name
719
+ header_params["name"] = request.name
720
+ end
721
+
633
722
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
634
723
  metadata[:"x-goog-request-params"] ||= request_params_header
635
724
 
636
725
  options.apply_defaults timeout: @config.rpcs.update_occurrence.timeout,
637
726
  metadata: metadata,
638
727
  retry_policy: @config.rpcs.update_occurrence.retry_policy
639
- options.apply_defaults metadata: @config.metadata,
728
+
729
+ options.apply_defaults timeout: @config.timeout,
730
+ metadata: @config.metadata,
640
731
  retry_policy: @config.retry_policy
641
732
 
642
733
  @grafeas_stub.call_rpc :update_occurrence, request, options: options do |response, operation|
@@ -678,6 +769,21 @@ module Grafeas
678
769
  #
679
770
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
680
771
  #
772
+ # @example Basic example
773
+ # require "grafeas/v1"
774
+ #
775
+ # # Create a client object. The client can be reused for multiple calls.
776
+ # client = Grafeas::V1::Grafeas::Client.new
777
+ #
778
+ # # Create a request. To set request fields, pass in keyword arguments.
779
+ # request = Grafeas::V1::GetOccurrenceNoteRequest.new
780
+ #
781
+ # # Call the get_occurrence_note method.
782
+ # result = client.get_occurrence_note request
783
+ #
784
+ # # The returned object is of type Grafeas::V1::Note.
785
+ # p result
786
+ #
681
787
  def get_occurrence_note request, options = nil
682
788
  raise ::ArgumentError, "request must be provided" if request.nil?
683
789
 
@@ -695,16 +801,20 @@ module Grafeas
695
801
  gapic_version: ::Grafeas::V1::VERSION
696
802
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
697
803
 
698
- header_params = {
699
- "name" => request.name
700
- }
804
+ header_params = {}
805
+ if request.name
806
+ header_params["name"] = request.name
807
+ end
808
+
701
809
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
702
810
  metadata[:"x-goog-request-params"] ||= request_params_header
703
811
 
704
812
  options.apply_defaults timeout: @config.rpcs.get_occurrence_note.timeout,
705
813
  metadata: metadata,
706
814
  retry_policy: @config.rpcs.get_occurrence_note.retry_policy
707
- options.apply_defaults metadata: @config.metadata,
815
+
816
+ options.apply_defaults timeout: @config.timeout,
817
+ metadata: @config.metadata,
708
818
  retry_policy: @config.retry_policy
709
819
 
710
820
  @grafeas_stub.call_rpc :get_occurrence_note, request, options: options do |response, operation|
@@ -745,6 +855,21 @@ module Grafeas
745
855
  #
746
856
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
747
857
  #
858
+ # @example Basic example
859
+ # require "grafeas/v1"
860
+ #
861
+ # # Create a client object. The client can be reused for multiple calls.
862
+ # client = Grafeas::V1::Grafeas::Client.new
863
+ #
864
+ # # Create a request. To set request fields, pass in keyword arguments.
865
+ # request = Grafeas::V1::GetNoteRequest.new
866
+ #
867
+ # # Call the get_note method.
868
+ # result = client.get_note request
869
+ #
870
+ # # The returned object is of type Grafeas::V1::Note.
871
+ # p result
872
+ #
748
873
  def get_note request, options = nil
749
874
  raise ::ArgumentError, "request must be provided" if request.nil?
750
875
 
@@ -762,16 +887,20 @@ module Grafeas
762
887
  gapic_version: ::Grafeas::V1::VERSION
763
888
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
764
889
 
765
- header_params = {
766
- "name" => request.name
767
- }
890
+ header_params = {}
891
+ if request.name
892
+ header_params["name"] = request.name
893
+ end
894
+
768
895
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
769
896
  metadata[:"x-goog-request-params"] ||= request_params_header
770
897
 
771
898
  options.apply_defaults timeout: @config.rpcs.get_note.timeout,
772
899
  metadata: metadata,
773
900
  retry_policy: @config.rpcs.get_note.retry_policy
774
- options.apply_defaults metadata: @config.metadata,
901
+
902
+ options.apply_defaults timeout: @config.timeout,
903
+ metadata: @config.metadata,
775
904
  retry_policy: @config.retry_policy
776
905
 
777
906
  @grafeas_stub.call_rpc :get_note, request, options: options do |response, operation|
@@ -819,6 +948,27 @@ module Grafeas
819
948
  #
820
949
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
821
950
  #
951
+ # @example Basic example
952
+ # require "grafeas/v1"
953
+ #
954
+ # # Create a client object. The client can be reused for multiple calls.
955
+ # client = Grafeas::V1::Grafeas::Client.new
956
+ #
957
+ # # Create a request. To set request fields, pass in keyword arguments.
958
+ # request = Grafeas::V1::ListNotesRequest.new
959
+ #
960
+ # # Call the list_notes method.
961
+ # result = client.list_notes request
962
+ #
963
+ # # The returned object is of type Gapic::PagedEnumerable. You can
964
+ # # iterate over all elements by calling #each, and the enumerable
965
+ # # will lazily make API calls to fetch subsequent pages. Other
966
+ # # methods are also available for managing paging directly.
967
+ # result.each do |response|
968
+ # # Each element is of type ::Grafeas::V1::Note.
969
+ # p response
970
+ # end
971
+ #
822
972
  def list_notes request, options = nil
823
973
  raise ::ArgumentError, "request must be provided" if request.nil?
824
974
 
@@ -836,16 +986,20 @@ module Grafeas
836
986
  gapic_version: ::Grafeas::V1::VERSION
837
987
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
838
988
 
839
- header_params = {
840
- "parent" => request.parent
841
- }
989
+ header_params = {}
990
+ if request.parent
991
+ header_params["parent"] = request.parent
992
+ end
993
+
842
994
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
843
995
  metadata[:"x-goog-request-params"] ||= request_params_header
844
996
 
845
997
  options.apply_defaults timeout: @config.rpcs.list_notes.timeout,
846
998
  metadata: metadata,
847
999
  retry_policy: @config.rpcs.list_notes.retry_policy
848
- options.apply_defaults metadata: @config.metadata,
1000
+
1001
+ options.apply_defaults timeout: @config.timeout,
1002
+ metadata: @config.metadata,
849
1003
  retry_policy: @config.retry_policy
850
1004
 
851
1005
  @grafeas_stub.call_rpc :list_notes, request, options: options do |response, operation|
@@ -887,6 +1041,21 @@ module Grafeas
887
1041
  #
888
1042
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
889
1043
  #
1044
+ # @example Basic example
1045
+ # require "grafeas/v1"
1046
+ #
1047
+ # # Create a client object. The client can be reused for multiple calls.
1048
+ # client = Grafeas::V1::Grafeas::Client.new
1049
+ #
1050
+ # # Create a request. To set request fields, pass in keyword arguments.
1051
+ # request = Grafeas::V1::DeleteNoteRequest.new
1052
+ #
1053
+ # # Call the delete_note method.
1054
+ # result = client.delete_note request
1055
+ #
1056
+ # # The returned object is of type Google::Protobuf::Empty.
1057
+ # p result
1058
+ #
890
1059
  def delete_note request, options = nil
891
1060
  raise ::ArgumentError, "request must be provided" if request.nil?
892
1061
 
@@ -904,16 +1073,20 @@ module Grafeas
904
1073
  gapic_version: ::Grafeas::V1::VERSION
905
1074
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
906
1075
 
907
- header_params = {
908
- "name" => request.name
909
- }
1076
+ header_params = {}
1077
+ if request.name
1078
+ header_params["name"] = request.name
1079
+ end
1080
+
910
1081
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
911
1082
  metadata[:"x-goog-request-params"] ||= request_params_header
912
1083
 
913
1084
  options.apply_defaults timeout: @config.rpcs.delete_note.timeout,
914
1085
  metadata: metadata,
915
1086
  retry_policy: @config.rpcs.delete_note.retry_policy
916
- options.apply_defaults metadata: @config.metadata,
1087
+
1088
+ options.apply_defaults timeout: @config.timeout,
1089
+ metadata: @config.metadata,
917
1090
  retry_policy: @config.retry_policy
918
1091
 
919
1092
  @grafeas_stub.call_rpc :delete_note, request, options: options do |response, operation|
@@ -958,6 +1131,21 @@ module Grafeas
958
1131
  #
959
1132
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
960
1133
  #
1134
+ # @example Basic example
1135
+ # require "grafeas/v1"
1136
+ #
1137
+ # # Create a client object. The client can be reused for multiple calls.
1138
+ # client = Grafeas::V1::Grafeas::Client.new
1139
+ #
1140
+ # # Create a request. To set request fields, pass in keyword arguments.
1141
+ # request = Grafeas::V1::CreateNoteRequest.new
1142
+ #
1143
+ # # Call the create_note method.
1144
+ # result = client.create_note request
1145
+ #
1146
+ # # The returned object is of type Grafeas::V1::Note.
1147
+ # p result
1148
+ #
961
1149
  def create_note request, options = nil
962
1150
  raise ::ArgumentError, "request must be provided" if request.nil?
963
1151
 
@@ -975,16 +1163,20 @@ module Grafeas
975
1163
  gapic_version: ::Grafeas::V1::VERSION
976
1164
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
977
1165
 
978
- header_params = {
979
- "parent" => request.parent
980
- }
1166
+ header_params = {}
1167
+ if request.parent
1168
+ header_params["parent"] = request.parent
1169
+ end
1170
+
981
1171
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
982
1172
  metadata[:"x-goog-request-params"] ||= request_params_header
983
1173
 
984
1174
  options.apply_defaults timeout: @config.rpcs.create_note.timeout,
985
1175
  metadata: metadata,
986
1176
  retry_policy: @config.rpcs.create_note.retry_policy
987
- options.apply_defaults metadata: @config.metadata,
1177
+
1178
+ options.apply_defaults timeout: @config.timeout,
1179
+ metadata: @config.metadata,
988
1180
  retry_policy: @config.retry_policy
989
1181
 
990
1182
  @grafeas_stub.call_rpc :create_note, request, options: options do |response, operation|
@@ -1027,6 +1219,21 @@ module Grafeas
1027
1219
  #
1028
1220
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1029
1221
  #
1222
+ # @example Basic example
1223
+ # require "grafeas/v1"
1224
+ #
1225
+ # # Create a client object. The client can be reused for multiple calls.
1226
+ # client = Grafeas::V1::Grafeas::Client.new
1227
+ #
1228
+ # # Create a request. To set request fields, pass in keyword arguments.
1229
+ # request = Grafeas::V1::BatchCreateNotesRequest.new
1230
+ #
1231
+ # # Call the batch_create_notes method.
1232
+ # result = client.batch_create_notes request
1233
+ #
1234
+ # # The returned object is of type Grafeas::V1::BatchCreateNotesResponse.
1235
+ # p result
1236
+ #
1030
1237
  def batch_create_notes request, options = nil
1031
1238
  raise ::ArgumentError, "request must be provided" if request.nil?
1032
1239
 
@@ -1044,16 +1251,20 @@ module Grafeas
1044
1251
  gapic_version: ::Grafeas::V1::VERSION
1045
1252
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1046
1253
 
1047
- header_params = {
1048
- "parent" => request.parent
1049
- }
1254
+ header_params = {}
1255
+ if request.parent
1256
+ header_params["parent"] = request.parent
1257
+ end
1258
+
1050
1259
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1051
1260
  metadata[:"x-goog-request-params"] ||= request_params_header
1052
1261
 
1053
1262
  options.apply_defaults timeout: @config.rpcs.batch_create_notes.timeout,
1054
1263
  metadata: metadata,
1055
1264
  retry_policy: @config.rpcs.batch_create_notes.retry_policy
1056
- options.apply_defaults metadata: @config.metadata,
1265
+
1266
+ options.apply_defaults timeout: @config.timeout,
1267
+ metadata: @config.metadata,
1057
1268
  retry_policy: @config.retry_policy
1058
1269
 
1059
1270
  @grafeas_stub.call_rpc :batch_create_notes, request, options: options do |response, operation|
@@ -1098,6 +1309,21 @@ module Grafeas
1098
1309
  #
1099
1310
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1100
1311
  #
1312
+ # @example Basic example
1313
+ # require "grafeas/v1"
1314
+ #
1315
+ # # Create a client object. The client can be reused for multiple calls.
1316
+ # client = Grafeas::V1::Grafeas::Client.new
1317
+ #
1318
+ # # Create a request. To set request fields, pass in keyword arguments.
1319
+ # request = Grafeas::V1::UpdateNoteRequest.new
1320
+ #
1321
+ # # Call the update_note method.
1322
+ # result = client.update_note request
1323
+ #
1324
+ # # The returned object is of type Grafeas::V1::Note.
1325
+ # p result
1326
+ #
1101
1327
  def update_note request, options = nil
1102
1328
  raise ::ArgumentError, "request must be provided" if request.nil?
1103
1329
 
@@ -1115,16 +1341,20 @@ module Grafeas
1115
1341
  gapic_version: ::Grafeas::V1::VERSION
1116
1342
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1117
1343
 
1118
- header_params = {
1119
- "name" => request.name
1120
- }
1344
+ header_params = {}
1345
+ if request.name
1346
+ header_params["name"] = request.name
1347
+ end
1348
+
1121
1349
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1122
1350
  metadata[:"x-goog-request-params"] ||= request_params_header
1123
1351
 
1124
1352
  options.apply_defaults timeout: @config.rpcs.update_note.timeout,
1125
1353
  metadata: metadata,
1126
1354
  retry_policy: @config.rpcs.update_note.retry_policy
1127
- options.apply_defaults metadata: @config.metadata,
1355
+
1356
+ options.apply_defaults timeout: @config.timeout,
1357
+ metadata: @config.metadata,
1128
1358
  retry_policy: @config.retry_policy
1129
1359
 
1130
1360
  @grafeas_stub.call_rpc :update_note, request, options: options do |response, operation|
@@ -1173,6 +1403,27 @@ module Grafeas
1173
1403
  #
1174
1404
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1175
1405
  #
1406
+ # @example Basic example
1407
+ # require "grafeas/v1"
1408
+ #
1409
+ # # Create a client object. The client can be reused for multiple calls.
1410
+ # client = Grafeas::V1::Grafeas::Client.new
1411
+ #
1412
+ # # Create a request. To set request fields, pass in keyword arguments.
1413
+ # request = Grafeas::V1::ListNoteOccurrencesRequest.new
1414
+ #
1415
+ # # Call the list_note_occurrences method.
1416
+ # result = client.list_note_occurrences request
1417
+ #
1418
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1419
+ # # iterate over all elements by calling #each, and the enumerable
1420
+ # # will lazily make API calls to fetch subsequent pages. Other
1421
+ # # methods are also available for managing paging directly.
1422
+ # result.each do |response|
1423
+ # # Each element is of type ::Grafeas::V1::Occurrence.
1424
+ # p response
1425
+ # end
1426
+ #
1176
1427
  def list_note_occurrences request, options = nil
1177
1428
  raise ::ArgumentError, "request must be provided" if request.nil?
1178
1429
 
@@ -1190,16 +1441,20 @@ module Grafeas
1190
1441
  gapic_version: ::Grafeas::V1::VERSION
1191
1442
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1192
1443
 
1193
- header_params = {
1194
- "name" => request.name
1195
- }
1444
+ header_params = {}
1445
+ if request.name
1446
+ header_params["name"] = request.name
1447
+ end
1448
+
1196
1449
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1197
1450
  metadata[:"x-goog-request-params"] ||= request_params_header
1198
1451
 
1199
1452
  options.apply_defaults timeout: @config.rpcs.list_note_occurrences.timeout,
1200
1453
  metadata: metadata,
1201
1454
  retry_policy: @config.rpcs.list_note_occurrences.retry_policy
1202
- options.apply_defaults metadata: @config.metadata,
1455
+
1456
+ options.apply_defaults timeout: @config.timeout,
1457
+ metadata: @config.metadata,
1203
1458
  retry_policy: @config.retry_policy
1204
1459
 
1205
1460
  @grafeas_stub.call_rpc :list_note_occurrences, request, options: options do |response, operation|
@@ -1224,22 +1479,21 @@ module Grafeas
1224
1479
  # Configuration can be applied globally to all clients, or to a single client
1225
1480
  # on construction.
1226
1481
  #
1227
- # # Examples
1228
- #
1229
- # To modify the global config, setting the timeout for get_occurrence
1230
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1231
- #
1232
- # ::Grafeas::V1::Grafeas::Client.configure do |config|
1233
- # config.timeout = 10.0
1234
- # config.rpcs.get_occurrence.timeout = 20.0
1235
- # end
1482
+ # @example
1236
1483
  #
1237
- # To apply the above configuration only to a new client:
1484
+ # # Modify the global config, setting the timeout for
1485
+ # # get_occurrence to 20 seconds,
1486
+ # # and all remaining timeouts to 10 seconds.
1487
+ # ::Grafeas::V1::Grafeas::Client.configure do |config|
1488
+ # config.timeout = 10.0
1489
+ # config.rpcs.get_occurrence.timeout = 20.0
1490
+ # end
1238
1491
  #
1239
- # client = ::Grafeas::V1::Grafeas::Client.new do |config|
1240
- # config.timeout = 10.0
1241
- # config.rpcs.get_occurrence.timeout = 20.0
1242
- # end
1492
+ # # Apply the above configuration only to a new client.
1493
+ # client = ::Grafeas::V1::Grafeas::Client.new do |config|
1494
+ # config.timeout = 10.0
1495
+ # config.rpcs.get_occurrence.timeout = 20.0
1496
+ # end
1243
1497
  #
1244
1498
  # @!attribute [rw] endpoint
1245
1499
  # The hostname or hostname:port of the service endpoint.
@@ -1303,7 +1557,7 @@ module Grafeas
1303
1557
  config_attr :scope, nil, ::String, ::Array, nil
1304
1558
  config_attr :lib_name, nil, ::String, nil
1305
1559
  config_attr :lib_version, nil, ::String, nil
1306
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1560
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1307
1561
  config_attr :interceptors, nil, ::Array, nil
1308
1562
  config_attr :timeout, nil, ::Numeric, nil
1309
1563
  config_attr :metadata, nil, ::Hash, nil
@@ -1324,7 +1578,7 @@ module Grafeas
1324
1578
  def rpcs
1325
1579
  @rpcs ||= begin
1326
1580
  parent_rpcs = nil
1327
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1581
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1328
1582
  Rpcs.new parent_rpcs
1329
1583
  end
1330
1584
  end
@@ -1420,33 +1674,33 @@ module Grafeas
1420
1674
 
1421
1675
  # @private
1422
1676
  def initialize parent_rpcs = nil
1423
- get_occurrence_config = parent_rpcs&.get_occurrence if parent_rpcs&.respond_to? :get_occurrence
1677
+ get_occurrence_config = parent_rpcs.get_occurrence if parent_rpcs.respond_to? :get_occurrence
1424
1678
  @get_occurrence = ::Gapic::Config::Method.new get_occurrence_config
1425
- list_occurrences_config = parent_rpcs&.list_occurrences if parent_rpcs&.respond_to? :list_occurrences
1679
+ list_occurrences_config = parent_rpcs.list_occurrences if parent_rpcs.respond_to? :list_occurrences
1426
1680
  @list_occurrences = ::Gapic::Config::Method.new list_occurrences_config
1427
- delete_occurrence_config = parent_rpcs&.delete_occurrence if parent_rpcs&.respond_to? :delete_occurrence
1681
+ delete_occurrence_config = parent_rpcs.delete_occurrence if parent_rpcs.respond_to? :delete_occurrence
1428
1682
  @delete_occurrence = ::Gapic::Config::Method.new delete_occurrence_config
1429
- create_occurrence_config = parent_rpcs&.create_occurrence if parent_rpcs&.respond_to? :create_occurrence
1683
+ create_occurrence_config = parent_rpcs.create_occurrence if parent_rpcs.respond_to? :create_occurrence
1430
1684
  @create_occurrence = ::Gapic::Config::Method.new create_occurrence_config
1431
- batch_create_occurrences_config = parent_rpcs&.batch_create_occurrences if parent_rpcs&.respond_to? :batch_create_occurrences
1685
+ batch_create_occurrences_config = parent_rpcs.batch_create_occurrences if parent_rpcs.respond_to? :batch_create_occurrences
1432
1686
  @batch_create_occurrences = ::Gapic::Config::Method.new batch_create_occurrences_config
1433
- update_occurrence_config = parent_rpcs&.update_occurrence if parent_rpcs&.respond_to? :update_occurrence
1687
+ update_occurrence_config = parent_rpcs.update_occurrence if parent_rpcs.respond_to? :update_occurrence
1434
1688
  @update_occurrence = ::Gapic::Config::Method.new update_occurrence_config
1435
- get_occurrence_note_config = parent_rpcs&.get_occurrence_note if parent_rpcs&.respond_to? :get_occurrence_note
1689
+ get_occurrence_note_config = parent_rpcs.get_occurrence_note if parent_rpcs.respond_to? :get_occurrence_note
1436
1690
  @get_occurrence_note = ::Gapic::Config::Method.new get_occurrence_note_config
1437
- get_note_config = parent_rpcs&.get_note if parent_rpcs&.respond_to? :get_note
1691
+ get_note_config = parent_rpcs.get_note if parent_rpcs.respond_to? :get_note
1438
1692
  @get_note = ::Gapic::Config::Method.new get_note_config
1439
- list_notes_config = parent_rpcs&.list_notes if parent_rpcs&.respond_to? :list_notes
1693
+ list_notes_config = parent_rpcs.list_notes if parent_rpcs.respond_to? :list_notes
1440
1694
  @list_notes = ::Gapic::Config::Method.new list_notes_config
1441
- delete_note_config = parent_rpcs&.delete_note if parent_rpcs&.respond_to? :delete_note
1695
+ delete_note_config = parent_rpcs.delete_note if parent_rpcs.respond_to? :delete_note
1442
1696
  @delete_note = ::Gapic::Config::Method.new delete_note_config
1443
- create_note_config = parent_rpcs&.create_note if parent_rpcs&.respond_to? :create_note
1697
+ create_note_config = parent_rpcs.create_note if parent_rpcs.respond_to? :create_note
1444
1698
  @create_note = ::Gapic::Config::Method.new create_note_config
1445
- batch_create_notes_config = parent_rpcs&.batch_create_notes if parent_rpcs&.respond_to? :batch_create_notes
1699
+ batch_create_notes_config = parent_rpcs.batch_create_notes if parent_rpcs.respond_to? :batch_create_notes
1446
1700
  @batch_create_notes = ::Gapic::Config::Method.new batch_create_notes_config
1447
- update_note_config = parent_rpcs&.update_note if parent_rpcs&.respond_to? :update_note
1701
+ update_note_config = parent_rpcs.update_note if parent_rpcs.respond_to? :update_note
1448
1702
  @update_note = ::Gapic::Config::Method.new update_note_config
1449
- list_note_occurrences_config = parent_rpcs&.list_note_occurrences if parent_rpcs&.respond_to? :list_note_occurrences
1703
+ list_note_occurrences_config = parent_rpcs.list_note_occurrences if parent_rpcs.respond_to? :list_note_occurrences
1450
1704
  @list_note_occurrences = ::Gapic::Config::Method.new list_note_occurrences_config
1451
1705
 
1452
1706
  yield self if block_given?