grafeas-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +11 -0
  3. data/AUTHENTICATION.md +199 -0
  4. data/LICENSE +201 -0
  5. data/README.md +69 -0
  6. data/lib/grafeas-client.rb +16 -0
  7. data/lib/grafeas.rb +150 -0
  8. data/lib/grafeas/v1.rb +147 -0
  9. data/lib/grafeas/v1/attestation_pb.rb +27 -0
  10. data/lib/grafeas/v1/build_pb.rb +23 -0
  11. data/lib/grafeas/v1/common_pb.rb +34 -0
  12. data/lib/grafeas/v1/credentials.rb +37 -0
  13. data/lib/grafeas/v1/cvss_pb.rb +67 -0
  14. data/lib/grafeas/v1/deployment_pb.rb +35 -0
  15. data/lib/grafeas/v1/discovery_pb.rb +40 -0
  16. data/lib/grafeas/v1/doc/google/protobuf/any.rb +131 -0
  17. data/lib/grafeas/v1/doc/google/protobuf/empty.rb +29 -0
  18. data/lib/grafeas/v1/doc/google/protobuf/field_mask.rb +222 -0
  19. data/lib/grafeas/v1/doc/google/protobuf/timestamp.rb +111 -0
  20. data/lib/grafeas/v1/doc/google/rpc/status.rb +87 -0
  21. data/lib/grafeas/v1/doc/grafeas/v1/attestation.rb +64 -0
  22. data/lib/grafeas/v1/doc/grafeas/v1/build.rb +44 -0
  23. data/lib/grafeas/v1/doc/grafeas/v1/common.rb +105 -0
  24. data/lib/grafeas/v1/doc/grafeas/v1/cvss.rb +104 -0
  25. data/lib/grafeas/v1/doc/grafeas/v1/deployment.rb +64 -0
  26. data/lib/grafeas/v1/doc/grafeas/v1/discovery.rb +76 -0
  27. data/lib/grafeas/v1/doc/grafeas/v1/grafeas.rb +322 -0
  28. data/lib/grafeas/v1/doc/grafeas/v1/image.rb +79 -0
  29. data/lib/grafeas/v1/doc/grafeas/v1/package.rb +125 -0
  30. data/lib/grafeas/v1/doc/grafeas/v1/provenance.rb +248 -0
  31. data/lib/grafeas/v1/doc/grafeas/v1/vulnerability.rb +197 -0
  32. data/lib/grafeas/v1/grafeas_client.rb +955 -0
  33. data/lib/grafeas/v1/grafeas_client_config.json +96 -0
  34. data/lib/grafeas/v1/grafeas_pb.rb +163 -0
  35. data/lib/grafeas/v1/grafeas_services_pb.rb +86 -0
  36. data/lib/grafeas/v1/image_pb.rb +36 -0
  37. data/lib/grafeas/v1/package_pb.rb +59 -0
  38. data/lib/grafeas/v1/provenance_pb.rb +116 -0
  39. data/lib/grafeas/v1/vulnerability_pb.rb +80 -0
  40. data/lib/grafeas/version.rb +18 -0
  41. metadata +179 -0
@@ -0,0 +1,197 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Grafeas
17
+ module V1
18
+ # A security vulnerability that can be found in resources.
19
+ # @!attribute [rw] cvss_score
20
+ # @return [Float]
21
+ # The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10
22
+ # where 0 indicates low severity and 10 indicates high severity.
23
+ # @!attribute [rw] severity
24
+ # @return [Grafeas::V1::Severity]
25
+ # The note provider assigned severity of this vulnerability.
26
+ # @!attribute [rw] details
27
+ # @return [Array<Grafeas::V1::VulnerabilityNote::Detail>]
28
+ # Details of all known distros and packages affected by this vulnerability.
29
+ # @!attribute [rw] cvss_v3
30
+ # @return [Grafeas::V1::CVSSv3]
31
+ # The full description of the CVSSv3 for this vulnerability.
32
+ # @!attribute [rw] windows_details
33
+ # @return [Array<Grafeas::V1::VulnerabilityNote::WindowsDetail>]
34
+ # Windows details get their own format because the information format and
35
+ # model don't match a normal detail. Specifically Windows updates are done as
36
+ # patches, thus Windows vulnerabilities really are a missing package, rather
37
+ # than a package being at an incorrect version.
38
+ class VulnerabilityNote
39
+ # A detail for a distro and package affected by this vulnerability and its
40
+ # associated fix (if one is available).
41
+ # @!attribute [rw] severity_name
42
+ # @return [String]
43
+ # The distro assigned severity of this vulnerability.
44
+ # @!attribute [rw] description
45
+ # @return [String]
46
+ # A vendor-specific description of this vulnerability.
47
+ # @!attribute [rw] package_type
48
+ # @return [String]
49
+ # The type of package; whether native or non native (e.g., ruby gems,
50
+ # node.js packages, etc.).
51
+ # @!attribute [rw] affected_cpe_uri
52
+ # @return [String]
53
+ # Required. The [CPE URI](https://cpe.mitre.org/specification/) this
54
+ # vulnerability affects.
55
+ # @!attribute [rw] affected_package
56
+ # @return [String]
57
+ # Required. The package this vulnerability affects.
58
+ # @!attribute [rw] min_affected_version
59
+ # @return [Grafeas::V1::Version]
60
+ # Required. The minimum version of the package this vulnerability affects.
61
+ # @!attribute [rw] fixed_cpe_uri
62
+ # @return [String]
63
+ # The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability
64
+ # was fixed in. It is possible for this to be different from the
65
+ # affected_cpe_uri.
66
+ # @!attribute [rw] fixed_package
67
+ # @return [String]
68
+ # The package this vulnerability was fixed in. It is possible for this to
69
+ # be different from the affected_package.
70
+ # @!attribute [rw] fixed_version
71
+ # @return [Grafeas::V1::Version]
72
+ # Required. The version of the package this vulnerability was fixed in.
73
+ # Setting this to VersionKind.MAXIMUM means no fix is yet available.
74
+ # @!attribute [rw] is_obsolete
75
+ # @return [true, false]
76
+ # Whether this detail is obsolete. Occurrences are expected not to point to
77
+ # obsolete details.
78
+ class Detail; end
79
+
80
+ # @!attribute [rw] cpe_uri
81
+ # @return [String]
82
+ # Required. The [CPE URI](https://cpe.mitre.org/specification/) this
83
+ # vulnerability affects.
84
+ # @!attribute [rw] name
85
+ # @return [String]
86
+ # Required. The name of this vulnerability.
87
+ # @!attribute [rw] description
88
+ # @return [String]
89
+ # The description of this vulnerability.
90
+ # @!attribute [rw] fixing_kbs
91
+ # @return [Array<Grafeas::V1::VulnerabilityNote::WindowsDetail::KnowledgeBase>]
92
+ # Required. The names of the KBs which have hotfixes to mitigate this
93
+ # vulnerability. Note that there may be multiple hotfixes (and thus
94
+ # multiple KBs) that mitigate a given vulnerability. Currently any listed
95
+ # KBs presence is considered a fix.
96
+ class WindowsDetail
97
+ # @!attribute [rw] name
98
+ # @return [String]
99
+ # The KB name (generally of the form KB[0-9]+ (e.g., KB123456)).
100
+ # @!attribute [rw] url
101
+ # @return [String]
102
+ # A link to the KB in the [Windows update catalog]
103
+ # (https://www.catalog.update.microsoft.com/).
104
+ class KnowledgeBase; end
105
+ end
106
+ end
107
+
108
+ # An occurrence of a severity vulnerability on a resource.
109
+ # @!attribute [rw] type
110
+ # @return [String]
111
+ # The type of package; whether native or non native (e.g., ruby gems, node.js
112
+ # packages, etc.).
113
+ # @!attribute [rw] severity
114
+ # @return [Grafeas::V1::Severity]
115
+ # Output only. The note provider assigned severity of this vulnerability.
116
+ # @!attribute [rw] cvss_score
117
+ # @return [Float]
118
+ # Output only. The CVSS score of this vulnerability. CVSS score is on a
119
+ # scale of 0 - 10 where 0 indicates low severity and 10 indicates high
120
+ # severity.
121
+ # @!attribute [rw] package_issue
122
+ # @return [Array<Grafeas::V1::VulnerabilityOccurrence::PackageIssue>]
123
+ # Required. The set of affected locations and their fixes (if available)
124
+ # within the associated resource.
125
+ # @!attribute [rw] short_description
126
+ # @return [String]
127
+ # Output only. A one sentence description of this vulnerability.
128
+ # @!attribute [rw] long_description
129
+ # @return [String]
130
+ # Output only. A detailed description of this vulnerability.
131
+ # @!attribute [rw] related_urls
132
+ # @return [Array<Grafeas::V1::RelatedUrl>]
133
+ # Output only. URLs related to this vulnerability.
134
+ # @!attribute [rw] effective_severity
135
+ # @return [Grafeas::V1::Severity]
136
+ # The distro assigned severity for this vulnerability when it is available,
137
+ # and note provider assigned severity when distro has not yet assigned a
138
+ # severity for this vulnerability.
139
+ # @!attribute [rw] fix_available
140
+ # @return [true, false]
141
+ # Output only. Whether at least one of the affected packages has a fix
142
+ # available.
143
+ class VulnerabilityOccurrence
144
+ # A detail for a distro and package this vulnerability occurrence was found
145
+ # in and its associated fix (if one is available).
146
+ # @!attribute [rw] affected_cpe_uri
147
+ # @return [String]
148
+ # Required. The [CPE URI](https://cpe.mitre.org/specification/) this
149
+ # vulnerability was found in.
150
+ # @!attribute [rw] affected_package
151
+ # @return [String]
152
+ # Required. The package this vulnerability was found in.
153
+ # @!attribute [rw] min_affected_version
154
+ # @return [Grafeas::V1::Version]
155
+ # Required. The minimum version of the package this vulnerability exists
156
+ # in.
157
+ # @!attribute [rw] fixed_cpe_uri
158
+ # @return [String]
159
+ # The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability
160
+ # was fixed in. It is possible for this to be different from the
161
+ # affected_cpe_uri.
162
+ # @!attribute [rw] fixed_package
163
+ # @return [String]
164
+ # The package this vulnerability was fixed in. It is possible for this to
165
+ # be different from the affected_package.
166
+ # @!attribute [rw] fixed_version
167
+ # @return [Grafeas::V1::Version]
168
+ # Required. The version of the package this vulnerability was fixed in.
169
+ # Setting this to VersionKind.MAXIMUM means no fix is yet available.
170
+ # @!attribute [rw] fix_available
171
+ # @return [true, false]
172
+ # Output only. Whether a fix is available for this package.
173
+ class PackageIssue; end
174
+ end
175
+
176
+ # Note provider assigned severity/impact ranking.
177
+ module Severity
178
+ # Unknown.
179
+ SEVERITY_UNSPECIFIED = 0
180
+
181
+ # Minimal severity.
182
+ MINIMAL = 1
183
+
184
+ # Low severity.
185
+ LOW = 2
186
+
187
+ # Medium severity.
188
+ MEDIUM = 3
189
+
190
+ # High severity.
191
+ HIGH = 4
192
+
193
+ # Critical severity.
194
+ CRITICAL = 5
195
+ end
196
+ end
197
+ end
@@ -0,0 +1,955 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/grafeas/v1/grafeas.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+
22
+
23
+ require "json"
24
+ require "pathname"
25
+
26
+ require "google/gax"
27
+
28
+ require "grafeas/v1/grafeas_pb"
29
+ require "grafeas/v1/credentials"
30
+ require "grafeas/version"
31
+
32
+ module Grafeas
33
+ module V1
34
+ # [Grafeas](https://grafeas.io) API.
35
+ #
36
+ # Retrieves analysis results of Cloud components such as Docker container
37
+ # images.
38
+ #
39
+ # Analysis results are stored as a series of occurrences. An `Occurrence`
40
+ # contains information about a specific analysis instance on a resource. An
41
+ # occurrence refers to a `Note`. A note contains details describing the
42
+ # analysis and is generally stored in a separate project, called a `Provider`.
43
+ # Multiple occurrences can refer to the same note.
44
+ #
45
+ # For example, an SSL vulnerability could affect multiple images. In this case,
46
+ # there would be one note for the vulnerability and an occurrence for each
47
+ # image with the vulnerability referring to that note.
48
+ #
49
+ # @!attribute [r] grafeas_stub
50
+ # @return [Grafeas::V1::GrafeasService::Stub]
51
+ class GrafeasClient
52
+ # @private
53
+ attr_reader :grafeas_stub
54
+
55
+ # The default address of the service.
56
+ SERVICE_ADDRESS = "containeranalysis.googleapis.com".freeze
57
+
58
+ # The default port of the service.
59
+ DEFAULT_SERVICE_PORT = 443
60
+
61
+ # The default set of gRPC interceptors.
62
+ GRPC_INTERCEPTORS = []
63
+
64
+ DEFAULT_TIMEOUT = 30
65
+
66
+ PAGE_DESCRIPTORS = {
67
+ "list_occurrences" => Google::Gax::PageDescriptor.new(
68
+ "page_token",
69
+ "next_page_token",
70
+ "occurrences"),
71
+ "list_notes" => Google::Gax::PageDescriptor.new(
72
+ "page_token",
73
+ "next_page_token",
74
+ "notes"),
75
+ "list_note_occurrences" => Google::Gax::PageDescriptor.new(
76
+ "page_token",
77
+ "next_page_token",
78
+ "occurrences")
79
+ }.freeze
80
+
81
+ private_constant :PAGE_DESCRIPTORS
82
+
83
+ # The scopes needed to make gRPC calls to all of the methods defined in
84
+ # this service.
85
+ ALL_SCOPES = [
86
+ "https://www.googleapis.com/auth/cloud-platform"
87
+ ].freeze
88
+
89
+
90
+ NOTE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
91
+ "projects/{project}/notes/{note}"
92
+ )
93
+
94
+ private_constant :NOTE_PATH_TEMPLATE
95
+
96
+ OCCURRENCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
97
+ "projects/{project}/occurrences/{occurrence}"
98
+ )
99
+
100
+ private_constant :OCCURRENCE_PATH_TEMPLATE
101
+
102
+ PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
103
+ "projects/{project}"
104
+ )
105
+
106
+ private_constant :PROJECT_PATH_TEMPLATE
107
+
108
+ # Returns a fully-qualified note resource name string.
109
+ # @param project [String]
110
+ # @param note [String]
111
+ # @return [String]
112
+ def self.note_path project, note
113
+ NOTE_PATH_TEMPLATE.render(
114
+ :"project" => project,
115
+ :"note" => note
116
+ )
117
+ end
118
+
119
+ # Returns a fully-qualified occurrence resource name string.
120
+ # @param project [String]
121
+ # @param occurrence [String]
122
+ # @return [String]
123
+ def self.occurrence_path project, occurrence
124
+ OCCURRENCE_PATH_TEMPLATE.render(
125
+ :"project" => project,
126
+ :"occurrence" => occurrence
127
+ )
128
+ end
129
+
130
+ # Returns a fully-qualified project resource name string.
131
+ # @param project [String]
132
+ # @return [String]
133
+ def self.project_path project
134
+ PROJECT_PATH_TEMPLATE.render(
135
+ :"project" => project
136
+ )
137
+ end
138
+
139
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
140
+ # Provides the means for authenticating requests made by the client. This parameter can
141
+ # be many types.
142
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
143
+ # authenticating requests made by this client.
144
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
145
+ # credentials for this client.
146
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
147
+ # credentials for this client.
148
+ # A `GRPC::Core::Channel` will be used to make calls through.
149
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
150
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
151
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
152
+ # metadata for requests, generally, to give OAuth credentials.
153
+ # @param scopes [Array<String>]
154
+ # The OAuth scopes for this service. This parameter is ignored if
155
+ # an updater_proc is supplied.
156
+ # @param client_config [Hash]
157
+ # A Hash for call options for each method. See
158
+ # Google::Gax#construct_settings for the structure of
159
+ # this data. Falls back to the default config if not specified
160
+ # or the specified config is missing data points.
161
+ # @param timeout [Numeric]
162
+ # The default timeout, in seconds, for calls made through this client.
163
+ # @param metadata [Hash]
164
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
165
+ # @param exception_transformer [Proc]
166
+ # An optional proc that intercepts any exceptions raised during an API call to inject
167
+ # custom error handling.
168
+ def initialize \
169
+ credentials: nil,
170
+ scopes: ALL_SCOPES,
171
+ client_config: {},
172
+ timeout: DEFAULT_TIMEOUT,
173
+ metadata: nil,
174
+ exception_transformer: nil,
175
+ lib_name: nil,
176
+ lib_version: ""
177
+ # These require statements are intentionally placed here to initialize
178
+ # the gRPC module only when it's required.
179
+ # See https://github.com/googleapis/toolkit/issues/446
180
+ require "google/gax/grpc"
181
+ require "grafeas/v1/grafeas_services_pb"
182
+
183
+ credentials ||= Grafeas::V1::Credentials.default
184
+
185
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
186
+ updater_proc = Grafeas::V1::Credentials.new(credentials).updater_proc
187
+ end
188
+ if credentials.is_a?(GRPC::Core::Channel)
189
+ channel = credentials
190
+ end
191
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
192
+ chan_creds = credentials
193
+ end
194
+ if credentials.is_a?(Proc)
195
+ updater_proc = credentials
196
+ end
197
+ if credentials.is_a?(Google::Auth::Credentials)
198
+ updater_proc = credentials.updater_proc
199
+ end
200
+
201
+ package_version = Grafeas::VERSION
202
+
203
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
204
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
205
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
206
+ google_api_client << " grpc/#{GRPC::VERSION}"
207
+ google_api_client.freeze
208
+
209
+ headers = { :"x-goog-api-client" => google_api_client }
210
+ headers.merge!(metadata) unless metadata.nil?
211
+ client_config_file = Pathname.new(__dir__).join(
212
+ "grafeas_client_config.json"
213
+ )
214
+ defaults = client_config_file.open do |f|
215
+ Google::Gax.construct_settings(
216
+ "grafeas.v1.Grafeas",
217
+ JSON.parse(f.read),
218
+ client_config,
219
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
220
+ timeout,
221
+ page_descriptors: PAGE_DESCRIPTORS,
222
+ errors: Google::Gax::Grpc::API_ERRORS,
223
+ metadata: headers
224
+ )
225
+ end
226
+
227
+ # Allow overriding the service path/port in subclasses.
228
+ service_path = self.class::SERVICE_ADDRESS
229
+ port = self.class::DEFAULT_SERVICE_PORT
230
+ interceptors = self.class::GRPC_INTERCEPTORS
231
+ @grafeas_stub = Google::Gax::Grpc.create_stub(
232
+ service_path,
233
+ port,
234
+ chan_creds: chan_creds,
235
+ channel: channel,
236
+ updater_proc: updater_proc,
237
+ scopes: scopes,
238
+ interceptors: interceptors,
239
+ &Grafeas::V1::GrafeasService::Stub.method(:new)
240
+ )
241
+
242
+ @get_occurrence = Google::Gax.create_api_call(
243
+ @grafeas_stub.method(:get_occurrence),
244
+ defaults["get_occurrence"],
245
+ exception_transformer: exception_transformer,
246
+ params_extractor: proc do |request|
247
+ {'name' => request.name}
248
+ end
249
+ )
250
+ @list_occurrences = Google::Gax.create_api_call(
251
+ @grafeas_stub.method(:list_occurrences),
252
+ defaults["list_occurrences"],
253
+ exception_transformer: exception_transformer,
254
+ params_extractor: proc do |request|
255
+ {'parent' => request.parent}
256
+ end
257
+ )
258
+ @delete_occurrence = Google::Gax.create_api_call(
259
+ @grafeas_stub.method(:delete_occurrence),
260
+ defaults["delete_occurrence"],
261
+ exception_transformer: exception_transformer,
262
+ params_extractor: proc do |request|
263
+ {'name' => request.name}
264
+ end
265
+ )
266
+ @create_occurrence = Google::Gax.create_api_call(
267
+ @grafeas_stub.method(:create_occurrence),
268
+ defaults["create_occurrence"],
269
+ exception_transformer: exception_transformer,
270
+ params_extractor: proc do |request|
271
+ {'parent' => request.parent}
272
+ end
273
+ )
274
+ @batch_create_occurrences = Google::Gax.create_api_call(
275
+ @grafeas_stub.method(:batch_create_occurrences),
276
+ defaults["batch_create_occurrences"],
277
+ exception_transformer: exception_transformer,
278
+ params_extractor: proc do |request|
279
+ {'parent' => request.parent}
280
+ end
281
+ )
282
+ @update_occurrence = Google::Gax.create_api_call(
283
+ @grafeas_stub.method(:update_occurrence),
284
+ defaults["update_occurrence"],
285
+ exception_transformer: exception_transformer,
286
+ params_extractor: proc do |request|
287
+ {'name' => request.name}
288
+ end
289
+ )
290
+ @get_occurrence_note = Google::Gax.create_api_call(
291
+ @grafeas_stub.method(:get_occurrence_note),
292
+ defaults["get_occurrence_note"],
293
+ exception_transformer: exception_transformer,
294
+ params_extractor: proc do |request|
295
+ {'name' => request.name}
296
+ end
297
+ )
298
+ @get_note = Google::Gax.create_api_call(
299
+ @grafeas_stub.method(:get_note),
300
+ defaults["get_note"],
301
+ exception_transformer: exception_transformer,
302
+ params_extractor: proc do |request|
303
+ {'name' => request.name}
304
+ end
305
+ )
306
+ @list_notes = Google::Gax.create_api_call(
307
+ @grafeas_stub.method(:list_notes),
308
+ defaults["list_notes"],
309
+ exception_transformer: exception_transformer,
310
+ params_extractor: proc do |request|
311
+ {'parent' => request.parent}
312
+ end
313
+ )
314
+ @delete_note = Google::Gax.create_api_call(
315
+ @grafeas_stub.method(:delete_note),
316
+ defaults["delete_note"],
317
+ exception_transformer: exception_transformer,
318
+ params_extractor: proc do |request|
319
+ {'name' => request.name}
320
+ end
321
+ )
322
+ @create_note = Google::Gax.create_api_call(
323
+ @grafeas_stub.method(:create_note),
324
+ defaults["create_note"],
325
+ exception_transformer: exception_transformer,
326
+ params_extractor: proc do |request|
327
+ {'parent' => request.parent}
328
+ end
329
+ )
330
+ @batch_create_notes = Google::Gax.create_api_call(
331
+ @grafeas_stub.method(:batch_create_notes),
332
+ defaults["batch_create_notes"],
333
+ exception_transformer: exception_transformer,
334
+ params_extractor: proc do |request|
335
+ {'parent' => request.parent}
336
+ end
337
+ )
338
+ @update_note = Google::Gax.create_api_call(
339
+ @grafeas_stub.method(:update_note),
340
+ defaults["update_note"],
341
+ exception_transformer: exception_transformer,
342
+ params_extractor: proc do |request|
343
+ {'name' => request.name}
344
+ end
345
+ )
346
+ @list_note_occurrences = Google::Gax.create_api_call(
347
+ @grafeas_stub.method(:list_note_occurrences),
348
+ defaults["list_note_occurrences"],
349
+ exception_transformer: exception_transformer,
350
+ params_extractor: proc do |request|
351
+ {'name' => request.name}
352
+ end
353
+ )
354
+ end
355
+
356
+ # Service calls
357
+
358
+ # Gets the specified occurrence.
359
+ #
360
+ # @param name [String]
361
+ # The name of the occurrence in the form of
362
+ # `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
363
+ # @param options [Google::Gax::CallOptions]
364
+ # Overrides the default settings for this call, e.g, timeout,
365
+ # retries, etc.
366
+ # @yield [result, operation] Access the result along with the RPC operation
367
+ # @yieldparam result [Grafeas::V1::Occurrence]
368
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
369
+ # @return [Grafeas::V1::Occurrence]
370
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
371
+ # @example
372
+ # require "grafeas"
373
+ #
374
+ # grafeas_client = Grafeas.new(version: :v1)
375
+ # formatted_name = Grafeas::V1::GrafeasClient.occurrence_path("[PROJECT]", "[OCCURRENCE]")
376
+ # response = grafeas_client.get_occurrence(formatted_name)
377
+
378
+ def get_occurrence \
379
+ name,
380
+ options: nil,
381
+ &block
382
+ req = {
383
+ name: name
384
+ }.delete_if { |_, v| v.nil? }
385
+ req = Google::Gax::to_proto(req, Grafeas::V1::GetOccurrenceRequest)
386
+ @get_occurrence.call(req, options, &block)
387
+ end
388
+
389
+ # Lists occurrences for the specified project.
390
+ #
391
+ # @param parent [String]
392
+ # The name of the project to list occurrences for in the form of
393
+ # `projects/[PROJECT_ID]`.
394
+ # @param filter [String]
395
+ # The filter expression.
396
+ # @param page_size [Integer]
397
+ # The maximum number of resources contained in the underlying API
398
+ # response. If page streaming is performed per-resource, this
399
+ # parameter does not affect the return value. If page streaming is
400
+ # performed per-page, this determines the maximum number of
401
+ # resources in a page.
402
+ # @param options [Google::Gax::CallOptions]
403
+ # Overrides the default settings for this call, e.g, timeout,
404
+ # retries, etc.
405
+ # @yield [result, operation] Access the result along with the RPC operation
406
+ # @yieldparam result [Google::Gax::PagedEnumerable<Grafeas::V1::Occurrence>]
407
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
408
+ # @return [Google::Gax::PagedEnumerable<Grafeas::V1::Occurrence>]
409
+ # An enumerable of Grafeas::V1::Occurrence instances.
410
+ # See Google::Gax::PagedEnumerable documentation for other
411
+ # operations such as per-page iteration or access to the response
412
+ # object.
413
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
414
+ # @example
415
+ # require "grafeas"
416
+ #
417
+ # grafeas_client = Grafeas.new(version: :v1)
418
+ # formatted_parent = Grafeas::V1::GrafeasClient.project_path("[PROJECT]")
419
+ #
420
+ # # Iterate over all results.
421
+ # grafeas_client.list_occurrences(formatted_parent).each do |element|
422
+ # # Process element.
423
+ # end
424
+ #
425
+ # # Or iterate over results one page at a time.
426
+ # grafeas_client.list_occurrences(formatted_parent).each_page do |page|
427
+ # # Process each page at a time.
428
+ # page.each do |element|
429
+ # # Process element.
430
+ # end
431
+ # end
432
+
433
+ def list_occurrences \
434
+ parent,
435
+ filter: nil,
436
+ page_size: nil,
437
+ options: nil,
438
+ &block
439
+ req = {
440
+ parent: parent,
441
+ filter: filter,
442
+ page_size: page_size
443
+ }.delete_if { |_, v| v.nil? }
444
+ req = Google::Gax::to_proto(req, Grafeas::V1::ListOccurrencesRequest)
445
+ @list_occurrences.call(req, options, &block)
446
+ end
447
+
448
+ # Deletes the specified occurrence. For example, use this method to delete an
449
+ # occurrence when the occurrence is no longer applicable for the given
450
+ # resource.
451
+ #
452
+ # @param name [String]
453
+ # The name of the occurrence in the form of
454
+ # `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
455
+ # @param options [Google::Gax::CallOptions]
456
+ # Overrides the default settings for this call, e.g, timeout,
457
+ # retries, etc.
458
+ # @yield [result, operation] Access the result along with the RPC operation
459
+ # @yieldparam result []
460
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
461
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
462
+ # @example
463
+ # require "grafeas"
464
+ #
465
+ # grafeas_client = Grafeas.new(version: :v1)
466
+ # formatted_name = Grafeas::V1::GrafeasClient.occurrence_path("[PROJECT]", "[OCCURRENCE]")
467
+ # grafeas_client.delete_occurrence(formatted_name)
468
+
469
+ def delete_occurrence \
470
+ name,
471
+ options: nil,
472
+ &block
473
+ req = {
474
+ name: name
475
+ }.delete_if { |_, v| v.nil? }
476
+ req = Google::Gax::to_proto(req, Grafeas::V1::DeleteOccurrenceRequest)
477
+ @delete_occurrence.call(req, options, &block)
478
+ nil
479
+ end
480
+
481
+ # Creates a new occurrence.
482
+ #
483
+ # @param parent [String]
484
+ # The name of the project in the form of `projects/[PROJECT_ID]`, under which
485
+ # the occurrence is to be created.
486
+ # @param occurrence [Grafeas::V1::Occurrence | Hash]
487
+ # The occurrence to create.
488
+ # A hash of the same form as `Grafeas::V1::Occurrence`
489
+ # can also be provided.
490
+ # @param options [Google::Gax::CallOptions]
491
+ # Overrides the default settings for this call, e.g, timeout,
492
+ # retries, etc.
493
+ # @yield [result, operation] Access the result along with the RPC operation
494
+ # @yieldparam result [Grafeas::V1::Occurrence]
495
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
496
+ # @return [Grafeas::V1::Occurrence]
497
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
498
+ # @example
499
+ # require "grafeas"
500
+ #
501
+ # grafeas_client = Grafeas.new(version: :v1)
502
+ # formatted_parent = Grafeas::V1::GrafeasClient.project_path("[PROJECT]")
503
+ #
504
+ # # TODO: Initialize `occurrence`:
505
+ # occurrence = {}
506
+ # response = grafeas_client.create_occurrence(formatted_parent, occurrence)
507
+
508
+ def create_occurrence \
509
+ parent,
510
+ occurrence,
511
+ options: nil,
512
+ &block
513
+ req = {
514
+ parent: parent,
515
+ occurrence: occurrence
516
+ }.delete_if { |_, v| v.nil? }
517
+ req = Google::Gax::to_proto(req, Grafeas::V1::CreateOccurrenceRequest)
518
+ @create_occurrence.call(req, options, &block)
519
+ end
520
+
521
+ # Creates new occurrences in batch.
522
+ #
523
+ # @param parent [String]
524
+ # The name of the project in the form of `projects/[PROJECT_ID]`, under which
525
+ # the occurrences are to be created.
526
+ # @param occurrences [Array<Grafeas::V1::Occurrence | Hash>]
527
+ # The occurrences to create. Max allowed length is 1000.
528
+ # A hash of the same form as `Grafeas::V1::Occurrence`
529
+ # can also be provided.
530
+ # @param options [Google::Gax::CallOptions]
531
+ # Overrides the default settings for this call, e.g, timeout,
532
+ # retries, etc.
533
+ # @yield [result, operation] Access the result along with the RPC operation
534
+ # @yieldparam result [Grafeas::V1::BatchCreateOccurrencesResponse]
535
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
536
+ # @return [Grafeas::V1::BatchCreateOccurrencesResponse]
537
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
538
+ # @example
539
+ # require "grafeas"
540
+ #
541
+ # grafeas_client = Grafeas.new(version: :v1)
542
+ # formatted_parent = Grafeas::V1::GrafeasClient.project_path("[PROJECT]")
543
+ #
544
+ # # TODO: Initialize `occurrences`:
545
+ # occurrences = []
546
+ # response = grafeas_client.batch_create_occurrences(formatted_parent, occurrences)
547
+
548
+ def batch_create_occurrences \
549
+ parent,
550
+ occurrences,
551
+ options: nil,
552
+ &block
553
+ req = {
554
+ parent: parent,
555
+ occurrences: occurrences
556
+ }.delete_if { |_, v| v.nil? }
557
+ req = Google::Gax::to_proto(req, Grafeas::V1::BatchCreateOccurrencesRequest)
558
+ @batch_create_occurrences.call(req, options, &block)
559
+ end
560
+
561
+ # Updates the specified occurrence.
562
+ #
563
+ # @param name [String]
564
+ # The name of the occurrence in the form of
565
+ # `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
566
+ # @param occurrence [Grafeas::V1::Occurrence | Hash]
567
+ # The updated occurrence.
568
+ # A hash of the same form as `Grafeas::V1::Occurrence`
569
+ # can also be provided.
570
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
571
+ # The fields to update.
572
+ # A hash of the same form as `Google::Protobuf::FieldMask`
573
+ # can also be provided.
574
+ # @param options [Google::Gax::CallOptions]
575
+ # Overrides the default settings for this call, e.g, timeout,
576
+ # retries, etc.
577
+ # @yield [result, operation] Access the result along with the RPC operation
578
+ # @yieldparam result [Grafeas::V1::Occurrence]
579
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
580
+ # @return [Grafeas::V1::Occurrence]
581
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
582
+ # @example
583
+ # require "grafeas"
584
+ #
585
+ # grafeas_client = Grafeas.new(version: :v1)
586
+ # formatted_name = Grafeas::V1::GrafeasClient.occurrence_path("[PROJECT]", "[OCCURRENCE]")
587
+ #
588
+ # # TODO: Initialize `occurrence`:
589
+ # occurrence = {}
590
+ # response = grafeas_client.update_occurrence(formatted_name, occurrence)
591
+
592
+ def update_occurrence \
593
+ name,
594
+ occurrence,
595
+ update_mask: nil,
596
+ options: nil,
597
+ &block
598
+ req = {
599
+ name: name,
600
+ occurrence: occurrence,
601
+ update_mask: update_mask
602
+ }.delete_if { |_, v| v.nil? }
603
+ req = Google::Gax::to_proto(req, Grafeas::V1::UpdateOccurrenceRequest)
604
+ @update_occurrence.call(req, options, &block)
605
+ end
606
+
607
+ # Gets the note attached to the specified occurrence. Consumer projects can
608
+ # use this method to get a note that belongs to a provider project.
609
+ #
610
+ # @param name [String]
611
+ # The name of the occurrence in the form of
612
+ # `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
613
+ # @param options [Google::Gax::CallOptions]
614
+ # Overrides the default settings for this call, e.g, timeout,
615
+ # retries, etc.
616
+ # @yield [result, operation] Access the result along with the RPC operation
617
+ # @yieldparam result [Grafeas::V1::Note]
618
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
619
+ # @return [Grafeas::V1::Note]
620
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
621
+ # @example
622
+ # require "grafeas"
623
+ #
624
+ # grafeas_client = Grafeas.new(version: :v1)
625
+ # formatted_name = Grafeas::V1::GrafeasClient.occurrence_path("[PROJECT]", "[OCCURRENCE]")
626
+ # response = grafeas_client.get_occurrence_note(formatted_name)
627
+
628
+ def get_occurrence_note \
629
+ name,
630
+ options: nil,
631
+ &block
632
+ req = {
633
+ name: name
634
+ }.delete_if { |_, v| v.nil? }
635
+ req = Google::Gax::to_proto(req, Grafeas::V1::GetOccurrenceNoteRequest)
636
+ @get_occurrence_note.call(req, options, &block)
637
+ end
638
+
639
+ # Gets the specified note.
640
+ #
641
+ # @param name [String]
642
+ # The name of the note in the form of
643
+ # `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
644
+ # @param options [Google::Gax::CallOptions]
645
+ # Overrides the default settings for this call, e.g, timeout,
646
+ # retries, etc.
647
+ # @yield [result, operation] Access the result along with the RPC operation
648
+ # @yieldparam result [Grafeas::V1::Note]
649
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
650
+ # @return [Grafeas::V1::Note]
651
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
652
+ # @example
653
+ # require "grafeas"
654
+ #
655
+ # grafeas_client = Grafeas.new(version: :v1)
656
+ # formatted_name = Grafeas::V1::GrafeasClient.note_path("[PROJECT]", "[NOTE]")
657
+ # response = grafeas_client.get_note(formatted_name)
658
+
659
+ def get_note \
660
+ name,
661
+ options: nil,
662
+ &block
663
+ req = {
664
+ name: name
665
+ }.delete_if { |_, v| v.nil? }
666
+ req = Google::Gax::to_proto(req, Grafeas::V1::GetNoteRequest)
667
+ @get_note.call(req, options, &block)
668
+ end
669
+
670
+ # Lists notes for the specified project.
671
+ #
672
+ # @param parent [String]
673
+ # The name of the project to list notes for in the form of
674
+ # `projects/[PROJECT_ID]`.
675
+ # @param filter [String]
676
+ # The filter expression.
677
+ # @param page_size [Integer]
678
+ # The maximum number of resources contained in the underlying API
679
+ # response. If page streaming is performed per-resource, this
680
+ # parameter does not affect the return value. If page streaming is
681
+ # performed per-page, this determines the maximum number of
682
+ # resources in a page.
683
+ # @param options [Google::Gax::CallOptions]
684
+ # Overrides the default settings for this call, e.g, timeout,
685
+ # retries, etc.
686
+ # @yield [result, operation] Access the result along with the RPC operation
687
+ # @yieldparam result [Google::Gax::PagedEnumerable<Grafeas::V1::Note>]
688
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
689
+ # @return [Google::Gax::PagedEnumerable<Grafeas::V1::Note>]
690
+ # An enumerable of Grafeas::V1::Note instances.
691
+ # See Google::Gax::PagedEnumerable documentation for other
692
+ # operations such as per-page iteration or access to the response
693
+ # object.
694
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
695
+ # @example
696
+ # require "grafeas"
697
+ #
698
+ # grafeas_client = Grafeas.new(version: :v1)
699
+ # formatted_parent = Grafeas::V1::GrafeasClient.project_path("[PROJECT]")
700
+ #
701
+ # # Iterate over all results.
702
+ # grafeas_client.list_notes(formatted_parent).each do |element|
703
+ # # Process element.
704
+ # end
705
+ #
706
+ # # Or iterate over results one page at a time.
707
+ # grafeas_client.list_notes(formatted_parent).each_page do |page|
708
+ # # Process each page at a time.
709
+ # page.each do |element|
710
+ # # Process element.
711
+ # end
712
+ # end
713
+
714
+ def list_notes \
715
+ parent,
716
+ filter: nil,
717
+ page_size: nil,
718
+ options: nil,
719
+ &block
720
+ req = {
721
+ parent: parent,
722
+ filter: filter,
723
+ page_size: page_size
724
+ }.delete_if { |_, v| v.nil? }
725
+ req = Google::Gax::to_proto(req, Grafeas::V1::ListNotesRequest)
726
+ @list_notes.call(req, options, &block)
727
+ end
728
+
729
+ # Deletes the specified note.
730
+ #
731
+ # @param name [String]
732
+ # The name of the note in the form of
733
+ # `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
734
+ # @param options [Google::Gax::CallOptions]
735
+ # Overrides the default settings for this call, e.g, timeout,
736
+ # retries, etc.
737
+ # @yield [result, operation] Access the result along with the RPC operation
738
+ # @yieldparam result []
739
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
740
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
741
+ # @example
742
+ # require "grafeas"
743
+ #
744
+ # grafeas_client = Grafeas.new(version: :v1)
745
+ # formatted_name = Grafeas::V1::GrafeasClient.note_path("[PROJECT]", "[NOTE]")
746
+ # grafeas_client.delete_note(formatted_name)
747
+
748
+ def delete_note \
749
+ name,
750
+ options: nil,
751
+ &block
752
+ req = {
753
+ name: name
754
+ }.delete_if { |_, v| v.nil? }
755
+ req = Google::Gax::to_proto(req, Grafeas::V1::DeleteNoteRequest)
756
+ @delete_note.call(req, options, &block)
757
+ nil
758
+ end
759
+
760
+ # Creates a new note.
761
+ #
762
+ # @param parent [String]
763
+ # The name of the project in the form of `projects/[PROJECT_ID]`, under which
764
+ # the note is to be created.
765
+ # @param note_id [String]
766
+ # The ID to use for this note.
767
+ # @param note [Grafeas::V1::Note | Hash]
768
+ # The note to create.
769
+ # A hash of the same form as `Grafeas::V1::Note`
770
+ # can also be provided.
771
+ # @param options [Google::Gax::CallOptions]
772
+ # Overrides the default settings for this call, e.g, timeout,
773
+ # retries, etc.
774
+ # @yield [result, operation] Access the result along with the RPC operation
775
+ # @yieldparam result [Grafeas::V1::Note]
776
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
777
+ # @return [Grafeas::V1::Note]
778
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
779
+ # @example
780
+ # require "grafeas"
781
+ #
782
+ # grafeas_client = Grafeas.new(version: :v1)
783
+ # formatted_parent = Grafeas::V1::GrafeasClient.project_path("[PROJECT]")
784
+ #
785
+ # # TODO: Initialize `note_id`:
786
+ # note_id = ''
787
+ #
788
+ # # TODO: Initialize `note`:
789
+ # note = {}
790
+ # response = grafeas_client.create_note(formatted_parent, note_id, note)
791
+
792
+ def create_note \
793
+ parent,
794
+ note_id,
795
+ note,
796
+ options: nil,
797
+ &block
798
+ req = {
799
+ parent: parent,
800
+ note_id: note_id,
801
+ note: note
802
+ }.delete_if { |_, v| v.nil? }
803
+ req = Google::Gax::to_proto(req, Grafeas::V1::CreateNoteRequest)
804
+ @create_note.call(req, options, &block)
805
+ end
806
+
807
+ # Creates new notes in batch.
808
+ #
809
+ # @param parent [String]
810
+ # The name of the project in the form of `projects/[PROJECT_ID]`, under which
811
+ # the notes are to be created.
812
+ # @param notes [Hash{String => Grafeas::V1::Note | Hash}]
813
+ # The notes to create. Max allowed length is 1000.
814
+ # A hash of the same form as `Grafeas::V1::Note`
815
+ # can also be provided.
816
+ # @param options [Google::Gax::CallOptions]
817
+ # Overrides the default settings for this call, e.g, timeout,
818
+ # retries, etc.
819
+ # @yield [result, operation] Access the result along with the RPC operation
820
+ # @yieldparam result [Grafeas::V1::BatchCreateNotesResponse]
821
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
822
+ # @return [Grafeas::V1::BatchCreateNotesResponse]
823
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
824
+ # @example
825
+ # require "grafeas"
826
+ #
827
+ # grafeas_client = Grafeas.new(version: :v1)
828
+ # formatted_parent = Grafeas::V1::GrafeasClient.project_path("[PROJECT]")
829
+ #
830
+ # # TODO: Initialize `notes`:
831
+ # notes = {}
832
+ # response = grafeas_client.batch_create_notes(formatted_parent, notes)
833
+
834
+ def batch_create_notes \
835
+ parent,
836
+ notes,
837
+ options: nil,
838
+ &block
839
+ req = {
840
+ parent: parent,
841
+ notes: notes
842
+ }.delete_if { |_, v| v.nil? }
843
+ req = Google::Gax::to_proto(req, Grafeas::V1::BatchCreateNotesRequest)
844
+ @batch_create_notes.call(req, options, &block)
845
+ end
846
+
847
+ # Updates the specified note.
848
+ #
849
+ # @param name [String]
850
+ # The name of the note in the form of
851
+ # `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
852
+ # @param note [Grafeas::V1::Note | Hash]
853
+ # The updated note.
854
+ # A hash of the same form as `Grafeas::V1::Note`
855
+ # can also be provided.
856
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
857
+ # The fields to update.
858
+ # A hash of the same form as `Google::Protobuf::FieldMask`
859
+ # can also be provided.
860
+ # @param options [Google::Gax::CallOptions]
861
+ # Overrides the default settings for this call, e.g, timeout,
862
+ # retries, etc.
863
+ # @yield [result, operation] Access the result along with the RPC operation
864
+ # @yieldparam result [Grafeas::V1::Note]
865
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
866
+ # @return [Grafeas::V1::Note]
867
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
868
+ # @example
869
+ # require "grafeas"
870
+ #
871
+ # grafeas_client = Grafeas.new(version: :v1)
872
+ # formatted_name = Grafeas::V1::GrafeasClient.note_path("[PROJECT]", "[NOTE]")
873
+ #
874
+ # # TODO: Initialize `note`:
875
+ # note = {}
876
+ # response = grafeas_client.update_note(formatted_name, note)
877
+
878
+ def update_note \
879
+ name,
880
+ note,
881
+ update_mask: nil,
882
+ options: nil,
883
+ &block
884
+ req = {
885
+ name: name,
886
+ note: note,
887
+ update_mask: update_mask
888
+ }.delete_if { |_, v| v.nil? }
889
+ req = Google::Gax::to_proto(req, Grafeas::V1::UpdateNoteRequest)
890
+ @update_note.call(req, options, &block)
891
+ end
892
+
893
+ # Lists occurrences referencing the specified note. Provider projects can use
894
+ # this method to get all occurrences across consumer projects referencing the
895
+ # specified note.
896
+ #
897
+ # @param name [String]
898
+ # The name of the note to list occurrences for in the form of
899
+ # `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
900
+ # @param filter [String]
901
+ # The filter expression.
902
+ # @param page_size [Integer]
903
+ # The maximum number of resources contained in the underlying API
904
+ # response. If page streaming is performed per-resource, this
905
+ # parameter does not affect the return value. If page streaming is
906
+ # performed per-page, this determines the maximum number of
907
+ # resources in a page.
908
+ # @param options [Google::Gax::CallOptions]
909
+ # Overrides the default settings for this call, e.g, timeout,
910
+ # retries, etc.
911
+ # @yield [result, operation] Access the result along with the RPC operation
912
+ # @yieldparam result [Google::Gax::PagedEnumerable<Grafeas::V1::Occurrence>]
913
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
914
+ # @return [Google::Gax::PagedEnumerable<Grafeas::V1::Occurrence>]
915
+ # An enumerable of Grafeas::V1::Occurrence instances.
916
+ # See Google::Gax::PagedEnumerable documentation for other
917
+ # operations such as per-page iteration or access to the response
918
+ # object.
919
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
920
+ # @example
921
+ # require "grafeas"
922
+ #
923
+ # grafeas_client = Grafeas.new(version: :v1)
924
+ # formatted_name = Grafeas::V1::GrafeasClient.note_path("[PROJECT]", "[NOTE]")
925
+ #
926
+ # # Iterate over all results.
927
+ # grafeas_client.list_note_occurrences(formatted_name).each do |element|
928
+ # # Process element.
929
+ # end
930
+ #
931
+ # # Or iterate over results one page at a time.
932
+ # grafeas_client.list_note_occurrences(formatted_name).each_page do |page|
933
+ # # Process each page at a time.
934
+ # page.each do |element|
935
+ # # Process element.
936
+ # end
937
+ # end
938
+
939
+ def list_note_occurrences \
940
+ name,
941
+ filter: nil,
942
+ page_size: nil,
943
+ options: nil,
944
+ &block
945
+ req = {
946
+ name: name,
947
+ filter: filter,
948
+ page_size: page_size
949
+ }.delete_if { |_, v| v.nil? }
950
+ req = Google::Gax::to_proto(req, Grafeas::V1::ListNoteOccurrencesRequest)
951
+ @list_note_occurrences.call(req, options, &block)
952
+ end
953
+ end
954
+ end
955
+ end