Class: Grafeas::V1::Grafeas::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/grafeas/v1/grafeas/client.rb

Overview

Client for the Grafeas service.

Grafeas API.

Retrieves analysis results of Cloud components such as Docker container images.

Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.

For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#note_path, #occurrence_path, #project_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new Grafeas client object.

Examples

To create a new Grafeas client with the default configuration:

client = ::Grafeas::V1::Grafeas::Client.new

To create a new Grafeas client with a custom configuration:

client = ::Grafeas::V1::Grafeas::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Grafeas client.

Yield Parameters:



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/grafeas/v1/grafeas/client.rb', line 201

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "grafeas/v1/grafeas_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @grafeas_stub = ::Gapic::ServiceStub.new(
    ::Grafeas::V1::Grafeas::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the Grafeas Client class.

See Configuration for a description of the configuration fields.

Example

To modify the configuration for all Grafeas clients:

::Grafeas::V1::Grafeas::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/grafeas/v1/grafeas/client.rb', line 68

def self.configure
  @configure ||= begin
    namespace = ["Grafeas", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const&.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.get_occurrence.timeout = 30.0
    default_config.rpcs.get_occurrence.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config.rpcs.list_occurrences.timeout = 30.0
    default_config.rpcs.list_occurrences.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config.rpcs.delete_occurrence.timeout = 30.0
    default_config.rpcs.delete_occurrence.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config.rpcs.create_occurrence.timeout = 30.0

    default_config.rpcs.batch_create_occurrences.timeout = 30.0

    default_config.rpcs.update_occurrence.timeout = 30.0

    default_config.rpcs.get_occurrence_note.timeout = 30.0
    default_config.rpcs.get_occurrence_note.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config.rpcs.get_note.timeout = 30.0
    default_config.rpcs.get_note.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config.rpcs.list_notes.timeout = 30.0
    default_config.rpcs.list_notes.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config.rpcs.delete_note.timeout = 30.0
    default_config.rpcs.delete_note.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config.rpcs.create_note.timeout = 30.0

    default_config.rpcs.batch_create_notes.timeout = 30.0

    default_config.rpcs.update_note.timeout = 30.0

    default_config.rpcs.list_note_occurrences.timeout = 30.0
    default_config.rpcs.list_note_occurrences.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [14, 4]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#batch_create_notes(request, options = nil) ⇒ ::Grafeas::V1::BatchCreateNotesResponse #batch_create_notes(parent: nil, notes: nil) ⇒ ::Grafeas::V1::BatchCreateNotesResponse

Creates new notes in batch.

Overloads:

  • #batch_create_notes(request, options = nil) ⇒ ::Grafeas::V1::BatchCreateNotesResponse

    Pass arguments to batch_create_notes via a request object, either of type BatchCreateNotesRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::BatchCreateNotesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #batch_create_notes(parent: nil, notes: nil) ⇒ ::Grafeas::V1::BatchCreateNotesResponse

    Pass arguments to batch_create_notes via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The name of the project in the form of projects/[PROJECT_ID], under which the notes are to be created.

    • notes (::Hash{::String => ::Grafeas::V1::Note, ::Hash}) (defaults to: nil)

      The notes to create. Max allowed length is 1000.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
# File 'lib/grafeas/v1/grafeas/client.rb', line 1030

def batch_create_notes request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::BatchCreateNotesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.batch_create_notes..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.batch_create_notes.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.batch_create_notes.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :batch_create_notes, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#batch_create_occurrences(request, options = nil) ⇒ ::Grafeas::V1::BatchCreateOccurrencesResponse #batch_create_occurrences(parent: nil, occurrences: nil) ⇒ ::Grafeas::V1::BatchCreateOccurrencesResponse

Creates new occurrences in batch.

Overloads:

  • #batch_create_occurrences(request, options = nil) ⇒ ::Grafeas::V1::BatchCreateOccurrencesResponse

    Pass arguments to batch_create_occurrences via a request object, either of type BatchCreateOccurrencesRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::BatchCreateOccurrencesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #batch_create_occurrences(parent: nil, occurrences: nil) ⇒ ::Grafeas::V1::BatchCreateOccurrencesResponse

    Pass arguments to batch_create_occurrences via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The name of the project in the form of projects/[PROJECT_ID], under which the occurrences are to be created.

    • occurrences (::Array<::Grafeas::V1::Occurrence, ::Hash>) (defaults to: nil)

      The occurrences to create. Max allowed length is 1000.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/grafeas/v1/grafeas/client.rb', line 542

def batch_create_occurrences request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::BatchCreateOccurrencesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.batch_create_occurrences..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.batch_create_occurrences.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.batch_create_occurrences.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :batch_create_occurrences, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

Configure the Grafeas Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



176
177
178
179
# File 'lib/grafeas/v1/grafeas/client.rb', line 176

def configure
  yield @config if block_given?
  @config
end

#create_note(request, options = nil) ⇒ ::Grafeas::V1::Note #create_note(parent: nil, note_id: nil, note: nil) ⇒ ::Grafeas::V1::Note

Creates a new note.

Overloads:

  • #create_note(request, options = nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to create_note via a request object, either of type CreateNoteRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::CreateNoteRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_note(parent: nil, note_id: nil, note: nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to create_note via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The name of the project in the form of projects/[PROJECT_ID], under which the note is to be created.

    • note_id (::String) (defaults to: nil)

      The ID to use for this note.

    • note (::Grafeas::V1::Note, ::Hash) (defaults to: nil)

      The note to create.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# File 'lib/grafeas/v1/grafeas/client.rb', line 961

def create_note request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::CreateNoteRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_note..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_note.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_note.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :create_note, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_occurrence(request, options = nil) ⇒ ::Grafeas::V1::Occurrence #create_occurrence(parent: nil, occurrence: nil) ⇒ ::Grafeas::V1::Occurrence

Creates a new occurrence.

Overloads:

  • #create_occurrence(request, options = nil) ⇒ ::Grafeas::V1::Occurrence

    Pass arguments to create_occurrence via a request object, either of type CreateOccurrenceRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::CreateOccurrenceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_occurrence(parent: nil, occurrence: nil) ⇒ ::Grafeas::V1::Occurrence

    Pass arguments to create_occurrence via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The name of the project in the form of projects/[PROJECT_ID], under which the occurrence is to be created.

    • occurrence (::Grafeas::V1::Occurrence, ::Hash) (defaults to: nil)

      The occurrence to create.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'lib/grafeas/v1/grafeas/client.rb', line 473

def create_occurrence request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::CreateOccurrenceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_occurrence..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_occurrence.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_occurrence.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :create_occurrence, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_note(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_note(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes the specified note.

Overloads:

  • #delete_note(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_note via a request object, either of type DeleteNoteRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::DeleteNoteRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_note(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_note via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
# File 'lib/grafeas/v1/grafeas/client.rb', line 890

def delete_note request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::DeleteNoteRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_note..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_note.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_note.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :delete_note, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_occurrence(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_occurrence(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.

Overloads:

  • #delete_occurrence(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_occurrence via a request object, either of type DeleteOccurrenceRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::DeleteOccurrenceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_occurrence(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_occurrence via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/grafeas/v1/grafeas/client.rb', line 404

def delete_occurrence request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::DeleteOccurrenceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_occurrence..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_occurrence.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_occurrence.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :delete_occurrence, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_note(request, options = nil) ⇒ ::Grafeas::V1::Note #get_note(name: nil) ⇒ ::Grafeas::V1::Note

Gets the specified note.

Overloads:

  • #get_note(request, options = nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to get_note via a request object, either of type Grafeas::V1::GetNoteRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::GetNoteRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_note(name: nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to get_note via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/grafeas/v1/grafeas/client.rb', line 748

def get_note request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::GetNoteRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_note..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_note.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_note.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :get_note, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_occurrence(request, options = nil) ⇒ ::Grafeas::V1::Occurrence #get_occurrence(name: nil) ⇒ ::Grafeas::V1::Occurrence

Gets the specified occurrence.

Overloads:

  • #get_occurrence(request, options = nil) ⇒ ::Grafeas::V1::Occurrence

    Pass arguments to get_occurrence via a request object, either of type Grafeas::V1::GetOccurrenceRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::GetOccurrenceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_occurrence(name: nil) ⇒ ::Grafeas::V1::Occurrence

    Pass arguments to get_occurrence via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/grafeas/v1/grafeas/client.rb', line 260

def get_occurrence request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::GetOccurrenceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_occurrence..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_occurrence.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_occurrence.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :get_occurrence, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_occurrence_note(request, options = nil) ⇒ ::Grafeas::V1::Note #get_occurrence_note(name: nil) ⇒ ::Grafeas::V1::Note

Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.

Overloads:

  • #get_occurrence_note(request, options = nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to get_occurrence_note via a request object, either of type Grafeas::V1::GetOccurrenceNoteRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::GetOccurrenceNoteRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_occurrence_note(name: nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to get_occurrence_note via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/grafeas/v1/grafeas/client.rb', line 681

def get_occurrence_note request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::GetOccurrenceNoteRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_occurrence_note..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_occurrence_note.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_occurrence_note.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :get_occurrence_note, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_note_occurrences(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence> #list_note_occurrences(name: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence>

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

Overloads:

  • #list_note_occurrences(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence>

    Pass arguments to list_note_occurrences via a request object, either of type ListNoteOccurrencesRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::ListNoteOccurrencesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_note_occurrences(name: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence>

    Pass arguments to list_note_occurrences via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the note to list occurrences for in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    • filter (::String) (defaults to: nil)

      The filter expression.

    • page_size (::Integer) (defaults to: nil)

      Number of occurrences to return in the list.

    • page_token (::String) (defaults to: nil)

      Token to provide to skip to a particular spot in the list.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
# File 'lib/grafeas/v1/grafeas/client.rb', line 1176

def list_note_occurrences request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::ListNoteOccurrencesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_note_occurrences..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_note_occurrences.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_note_occurrences.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :list_note_occurrences, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @grafeas_stub, :list_note_occurrences, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_notes(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Note> #list_notes(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Note>

Lists notes for the specified project.

Overloads:

  • #list_notes(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Note>

    Pass arguments to list_notes via a request object, either of type ListNotesRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::ListNotesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_notes(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Note>

    Pass arguments to list_notes via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The name of the project to list notes for in the form of projects/[PROJECT_ID].

    • filter (::String) (defaults to: nil)

      The filter expression.

    • page_size (::Integer) (defaults to: nil)

      Number of notes to return in the list. Must be positive. Max allowed page size is 1000. If not specified, page size defaults to 20.

    • page_token (::String) (defaults to: nil)

      Token to provide to skip to a particular spot in the list.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::PagedEnumerable<::Grafeas::V1::Note>)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
# File 'lib/grafeas/v1/grafeas/client.rb', line 822

def list_notes request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::ListNotesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_notes..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_notes.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_notes.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :list_notes, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @grafeas_stub, :list_notes, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_occurrences(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence> #list_occurrences(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence>

Lists occurrences for the specified project.

Overloads:

  • #list_occurrences(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence>

    Pass arguments to list_occurrences via a request object, either of type ListOccurrencesRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::ListOccurrencesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_occurrences(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Grafeas::V1::Occurrence>

    Pass arguments to list_occurrences via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      The name of the project to list occurrences for in the form of projects/[PROJECT_ID].

    • filter (::String) (defaults to: nil)

      The filter expression.

    • page_size (::Integer) (defaults to: nil)

      Number of occurrences to return in the list. Must be positive. Max allowed page size is 1000. If not specified, page size defaults to 20.

    • page_token (::String) (defaults to: nil)

      Token to provide to skip to a particular spot in the list.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/grafeas/v1/grafeas/client.rb', line 334

def list_occurrences request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::ListOccurrencesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_occurrences..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_occurrences.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_occurrences.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :list_occurrences, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @grafeas_stub, :list_occurrences, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_note(request, options = nil) ⇒ ::Grafeas::V1::Note #update_note(name: nil, note: nil, update_mask: nil) ⇒ ::Grafeas::V1::Note

Updates the specified note.

Overloads:

  • #update_note(request, options = nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to update_note via a request object, either of type UpdateNoteRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::UpdateNoteRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_note(name: nil, note: nil, update_mask: nil) ⇒ ::Grafeas::V1::Note

    Pass arguments to update_note via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    • note (::Grafeas::V1::Note, ::Hash) (defaults to: nil)

      The updated note.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The fields to update.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
# File 'lib/grafeas/v1/grafeas/client.rb', line 1101

def update_note request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::UpdateNoteRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_note..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_note.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_note.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :update_note, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_occurrence(request, options = nil) ⇒ ::Grafeas::V1::Occurrence #update_occurrence(name: nil, occurrence: nil, update_mask: nil) ⇒ ::Grafeas::V1::Occurrence

Updates the specified occurrence.

Overloads:

  • #update_occurrence(request, options = nil) ⇒ ::Grafeas::V1::Occurrence

    Pass arguments to update_occurrence via a request object, either of type UpdateOccurrenceRequest or an equivalent Hash.

    Parameters:

    • request (::Grafeas::V1::UpdateOccurrenceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_occurrence(name: nil, occurrence: nil, update_mask: nil) ⇒ ::Grafeas::V1::Occurrence

    Pass arguments to update_occurrence via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    • occurrence (::Grafeas::V1::Occurrence, ::Hash) (defaults to: nil)

      The updated occurrence.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The fields to update.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
# File 'lib/grafeas/v1/grafeas/client.rb', line 613

def update_occurrence request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Grafeas::V1::UpdateOccurrenceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_occurrence..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Grafeas::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_occurrence.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_occurrence.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @grafeas_stub.call_rpc :update_occurrence, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end