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