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:



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/grafeas/v1/grafeas/client.rb', line 184

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,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool
  )
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:



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

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.



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
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
# File 'lib/grafeas/v1/grafeas/client.rb', line 1248

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.



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
649
650
651
652
653
654
655
656
657
658
659
660
661
662
# File 'lib/grafeas/v1/grafeas/client.rb', line 623

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:



154
155
156
157
# File 'lib/grafeas/v1/grafeas/client.rb', line 154

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.



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
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
# File 'lib/grafeas/v1/grafeas/client.rb', line 1160

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.



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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/grafeas/v1/grafeas/client.rb', line 535

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.



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
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'lib/grafeas/v1/grafeas/client.rb', line 1070

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.



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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/grafeas/v1/grafeas/client.rb', line 447

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.



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
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
# File 'lib/grafeas/v1/grafeas/client.rb', line 886

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.



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
296
297
298
299
300
# File 'lib/grafeas/v1/grafeas/client.rb', line 261

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.



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
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'lib/grafeas/v1/grafeas/client.rb', line 800

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.



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
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
# File 'lib/grafeas/v1/grafeas/client.rb', line 1436

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.



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
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/grafeas/v1/grafeas/client.rb', line 983

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.



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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/grafeas/v1/grafeas/client.rb', line 358

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

#universe_domainString

The effective universe domain

Returns:

  • (String)


164
165
166
# File 'lib/grafeas/v1/grafeas/client.rb', line 164

def universe_domain
  @grafeas_stub.universe_domain
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.



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
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
# File 'lib/grafeas/v1/grafeas/client.rb', line 1338

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.



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
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
# File 'lib/grafeas/v1/grafeas/client.rb', line 713

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