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:


# Create a client using the default configuration
client = ::Grafeas::V1::Grafeas::Client.new

# Create a client using a custom configuration
client = ::Grafeas::V1::Grafeas::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Grafeas client.

Yield Parameters:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/grafeas/v1/grafeas/client.rb', line 172

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.

Examples:


# 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:



67
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
# File 'lib/grafeas/v1/grafeas/client.rb', line 67

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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::BatchCreateNotesRequest.new

# Call the batch_create_notes method.
result = client.batch_create_notes request

# The returned object is of type Grafeas::V1::BatchCreateNotesResponse.
p result

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.



1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
# File 'lib/grafeas/v1/grafeas/client.rb', line 1233

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 = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::BatchCreateOccurrencesRequest.new

# Call the batch_create_occurrences method.
result = client.batch_create_occurrences request

# The returned object is of type Grafeas::V1::BatchCreateOccurrencesResponse.
p result

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.



608
609
610
611
612
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
# File 'lib/grafeas/v1/grafeas/client.rb', line 608

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 = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  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 timeout:      @config.timeout,
                         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:



151
152
153
154
# File 'lib/grafeas/v1/grafeas/client.rb', line 151

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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::CreateNoteRequest.new

# Call the create_note method.
result = client.create_note request

# The returned object is of type Grafeas::V1::Note.
p result

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.



1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
# File 'lib/grafeas/v1/grafeas/client.rb', line 1145

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 = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::CreateOccurrenceRequest.new

# Call the create_occurrence method.
result = client.create_occurrence request

# The returned object is of type Grafeas::V1::Occurrence.
p result

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.



520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/grafeas/v1/grafeas/client.rb', line 520

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 = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::DeleteNoteRequest.new

# Call the delete_note method.
result = client.delete_note request

# The returned object is of type Google::Protobuf::Empty.
p result

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.



1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
# File 'lib/grafeas/v1/grafeas/client.rb', line 1055

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::DeleteOccurrenceRequest.new

# Call the delete_occurrence method.
result = client.delete_occurrence request

# The returned object is of type Google::Protobuf::Empty.
p result

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.



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/grafeas/v1/grafeas/client.rb', line 432

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::GetNoteRequest.new

# Call the get_note method.
result = client.get_note request

# The returned object is of type Grafeas::V1::Note.
p result

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.



871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
# File 'lib/grafeas/v1/grafeas/client.rb', line 871

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::GetOccurrenceRequest.new

# Call the get_occurrence method.
result = client.get_occurrence request

# The returned object is of type Grafeas::V1::Occurrence.
p result

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.



246
247
248
249
250
251
252
253
254
255
256
257
258
259
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
# File 'lib/grafeas/v1/grafeas/client.rb', line 246

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::GetOccurrenceNoteRequest.new

# Call the get_occurrence_note method.
result = client.get_occurrence_note request

# The returned object is of type Grafeas::V1::Note.
p result

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.



785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/grafeas/v1/grafeas/client.rb', line 785

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::ListNoteOccurrencesRequest.new

# Call the list_note_occurrences method.
result = client.list_note_occurrences request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Grafeas::V1::Occurrence.
  p item
end

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.



1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
# File 'lib/grafeas/v1/grafeas/client.rb', line 1421

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::ListNotesRequest.new

# Call the list_notes method.
result = client.list_notes request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Grafeas::V1::Note.
  p item
end

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.



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
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
# File 'lib/grafeas/v1/grafeas/client.rb', line 968

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 = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::ListOccurrencesRequest.new

# Call the list_occurrences method.
result = client.list_occurrences request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Grafeas::V1::Occurrence.
  p item
end

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.



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
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/grafeas/v1/grafeas/client.rb', line 343

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 = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::UpdateNoteRequest.new

# Call the update_note method.
result = client.update_note request

# The returned object is of type Grafeas::V1::Note.
p result

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.



1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
# File 'lib/grafeas/v1/grafeas/client.rb', line 1323

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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.

Examples:

Basic example

require "grafeas/v1"

# Create a client object. The client can be reused for multiple calls.
client = Grafeas::V1::Grafeas::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Grafeas::V1::UpdateOccurrenceRequest.new

# Call the update_occurrence method.
result = client.update_occurrence request

# The returned object is of type Grafeas::V1::Occurrence.
p result

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.



698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
# File 'lib/grafeas/v1/grafeas/client.rb', line 698

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 = {}
  if request.name
    header_params["name"] = request.name
  end

  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 timeout:      @config.timeout,
                         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