grafeas-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +11 -0
- data/AUTHENTICATION.md +199 -0
- data/LICENSE +201 -0
- data/README.md +69 -0
- data/lib/grafeas-client.rb +16 -0
- data/lib/grafeas.rb +150 -0
- data/lib/grafeas/v1.rb +147 -0
- data/lib/grafeas/v1/attestation_pb.rb +27 -0
- data/lib/grafeas/v1/build_pb.rb +23 -0
- data/lib/grafeas/v1/common_pb.rb +34 -0
- data/lib/grafeas/v1/credentials.rb +37 -0
- data/lib/grafeas/v1/cvss_pb.rb +67 -0
- data/lib/grafeas/v1/deployment_pb.rb +35 -0
- data/lib/grafeas/v1/discovery_pb.rb +40 -0
- data/lib/grafeas/v1/doc/google/protobuf/any.rb +131 -0
- data/lib/grafeas/v1/doc/google/protobuf/empty.rb +29 -0
- data/lib/grafeas/v1/doc/google/protobuf/field_mask.rb +222 -0
- data/lib/grafeas/v1/doc/google/protobuf/timestamp.rb +111 -0
- data/lib/grafeas/v1/doc/google/rpc/status.rb +87 -0
- data/lib/grafeas/v1/doc/grafeas/v1/attestation.rb +64 -0
- data/lib/grafeas/v1/doc/grafeas/v1/build.rb +44 -0
- data/lib/grafeas/v1/doc/grafeas/v1/common.rb +105 -0
- data/lib/grafeas/v1/doc/grafeas/v1/cvss.rb +104 -0
- data/lib/grafeas/v1/doc/grafeas/v1/deployment.rb +64 -0
- data/lib/grafeas/v1/doc/grafeas/v1/discovery.rb +76 -0
- data/lib/grafeas/v1/doc/grafeas/v1/grafeas.rb +322 -0
- data/lib/grafeas/v1/doc/grafeas/v1/image.rb +79 -0
- data/lib/grafeas/v1/doc/grafeas/v1/package.rb +125 -0
- data/lib/grafeas/v1/doc/grafeas/v1/provenance.rb +248 -0
- data/lib/grafeas/v1/doc/grafeas/v1/vulnerability.rb +197 -0
- data/lib/grafeas/v1/grafeas_client.rb +955 -0
- data/lib/grafeas/v1/grafeas_client_config.json +96 -0
- data/lib/grafeas/v1/grafeas_pb.rb +163 -0
- data/lib/grafeas/v1/grafeas_services_pb.rb +86 -0
- data/lib/grafeas/v1/image_pb.rb +36 -0
- data/lib/grafeas/v1/package_pb.rb +59 -0
- data/lib/grafeas/v1/provenance_pb.rb +116 -0
- data/lib/grafeas/v1/vulnerability_pb.rb +80 -0
- data/lib/grafeas/version.rb +18 -0
- metadata +179 -0
@@ -0,0 +1,16 @@
|
|
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
|
+
require "grafeas"
|
data/lib/grafeas.rb
ADDED
@@ -0,0 +1,150 @@
|
|
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
|
+
require "google/gax"
|
17
|
+
require "pathname"
|
18
|
+
|
19
|
+
# rubocop:disable LineLength
|
20
|
+
|
21
|
+
##
|
22
|
+
# # Ruby Client for Container Analysis API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
23
|
+
#
|
24
|
+
# [Container Analysis API][Product Documentation]:
|
25
|
+
# An implementation of the Grafeas API, which stores, and enables querying and
|
26
|
+
# retrieval of critical metadata about all of your software artifacts.
|
27
|
+
# - [Product Documentation][]
|
28
|
+
#
|
29
|
+
# ## Quick Start
|
30
|
+
# In order to use this library, you first need to go through the following
|
31
|
+
# steps:
|
32
|
+
#
|
33
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
+
# 3. [Enable the Container Analysis API.](https://console.cloud.google.com/apis/library/grafeas.googleapis.com)
|
36
|
+
# 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
|
+
#
|
38
|
+
# ### Installation
|
39
|
+
# ```
|
40
|
+
# $ gem install grafeas-client
|
41
|
+
# ```
|
42
|
+
#
|
43
|
+
# ### Next Steps
|
44
|
+
# - Read the [Container Analysis API Product documentation][Product Documentation]
|
45
|
+
# to learn more about the product and see How-to Guides.
|
46
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
47
|
+
# to see the full list of Cloud APIs that we cover.
|
48
|
+
#
|
49
|
+
# [Product Documentation]: https://grafeas.io/
|
50
|
+
#
|
51
|
+
# ## Enabling Logging
|
52
|
+
#
|
53
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
54
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
55
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
56
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
57
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
58
|
+
#
|
59
|
+
# Configuring a Ruby stdlib logger:
|
60
|
+
#
|
61
|
+
# ```ruby
|
62
|
+
# require "logger"
|
63
|
+
#
|
64
|
+
# module MyLogger
|
65
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
66
|
+
# def logger
|
67
|
+
# LOGGER
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
72
|
+
# module GRPC
|
73
|
+
# extend MyLogger
|
74
|
+
# end
|
75
|
+
# ```
|
76
|
+
#
|
77
|
+
module Grafeas
|
78
|
+
# rubocop:enable LineLength
|
79
|
+
|
80
|
+
FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("grafeas"))
|
81
|
+
|
82
|
+
AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
|
83
|
+
.select { |file| File.directory?(file) }
|
84
|
+
.select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
|
85
|
+
.select { |dir| File.exist?(dir + ".rb") }
|
86
|
+
.map { |dir| File.basename(dir) }
|
87
|
+
|
88
|
+
##
|
89
|
+
# [Grafeas](https://grafeas.io) API.
|
90
|
+
#
|
91
|
+
# Retrieves analysis results of Cloud components such as Docker container
|
92
|
+
# images.
|
93
|
+
#
|
94
|
+
# Analysis results are stored as a series of occurrences. An `Occurrence`
|
95
|
+
# contains information about a specific analysis instance on a resource. An
|
96
|
+
# occurrence refers to a `Note`. A note contains details describing the
|
97
|
+
# analysis and is generally stored in a separate project, called a `Provider`.
|
98
|
+
# Multiple occurrences can refer to the same note.
|
99
|
+
#
|
100
|
+
# For example, an SSL vulnerability could affect multiple images. In this case,
|
101
|
+
# there would be one note for the vulnerability and an occurrence for each
|
102
|
+
# image with the vulnerability referring to that note.
|
103
|
+
#
|
104
|
+
# @param version [Symbol, String]
|
105
|
+
# The major version of the service to be used. By default :v1
|
106
|
+
# is used.
|
107
|
+
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
|
108
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
109
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
110
|
+
# be many types.
|
111
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
112
|
+
# authenticating requests made by this client.
|
113
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
114
|
+
# credentials for this client.
|
115
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
116
|
+
# credentials for this client.
|
117
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
118
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
119
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
120
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
121
|
+
# metadata for requests, generally, to give OAuth credentials.
|
122
|
+
# @param scopes [Array<String>]
|
123
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
124
|
+
# an updater_proc is supplied.
|
125
|
+
# @param client_config [Hash]
|
126
|
+
# A Hash for call options for each method. See
|
127
|
+
# Google::Gax#construct_settings for the structure of
|
128
|
+
# this data. Falls back to the default config if not specified
|
129
|
+
# or the specified config is missing data points.
|
130
|
+
# @param timeout [Numeric]
|
131
|
+
# The default timeout, in seconds, for calls made through this client.
|
132
|
+
# @param metadata [Hash]
|
133
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
134
|
+
# @param exception_transformer [Proc]
|
135
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
136
|
+
# custom error handling.
|
137
|
+
def self.new(*args, version: :v1, **kwargs)
|
138
|
+
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
139
|
+
raise "The version: #{version} is not available. The available versions " \
|
140
|
+
"are: [#{AVAILABLE_VERSIONS.join(", ")}]"
|
141
|
+
end
|
142
|
+
|
143
|
+
require "#{FILE_DIR}/#{version.to_s.downcase}"
|
144
|
+
version_module = Grafeas
|
145
|
+
.constants
|
146
|
+
.select {|sym| sym.to_s.downcase == version.to_s.downcase}
|
147
|
+
.first
|
148
|
+
Grafeas.const_get(version_module).new(*args, **kwargs)
|
149
|
+
end
|
150
|
+
end
|
data/lib/grafeas/v1.rb
ADDED
@@ -0,0 +1,147 @@
|
|
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
|
+
require "grafeas/v1/grafeas_client"
|
17
|
+
|
18
|
+
module Grafeas
|
19
|
+
# rubocop:disable LineLength
|
20
|
+
|
21
|
+
##
|
22
|
+
# # Ruby Client for Container Analysis API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
23
|
+
#
|
24
|
+
# [Container Analysis API][Product Documentation]:
|
25
|
+
# An implementation of the Grafeas API, which stores, and enables querying and
|
26
|
+
# retrieval of critical metadata about all of your software artifacts.
|
27
|
+
# - [Product Documentation][]
|
28
|
+
#
|
29
|
+
# ## Quick Start
|
30
|
+
# In order to use this library, you first need to go through the following
|
31
|
+
# steps:
|
32
|
+
#
|
33
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
+
# 3. [Enable the Container Analysis API.](https://console.cloud.google.com/apis/library/grafeas.googleapis.com)
|
36
|
+
# 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
|
+
#
|
38
|
+
# ### Installation
|
39
|
+
# ```
|
40
|
+
# $ gem install grafeas-client
|
41
|
+
# ```
|
42
|
+
#
|
43
|
+
# ### Next Steps
|
44
|
+
# - Read the [Container Analysis API Product documentation][Product Documentation]
|
45
|
+
# to learn more about the product and see How-to Guides.
|
46
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
47
|
+
# to see the full list of Cloud APIs that we cover.
|
48
|
+
#
|
49
|
+
# [Product Documentation]: https://grafeas.io/
|
50
|
+
#
|
51
|
+
# ## Enabling Logging
|
52
|
+
#
|
53
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
54
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
55
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
56
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
57
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
58
|
+
#
|
59
|
+
# Configuring a Ruby stdlib logger:
|
60
|
+
#
|
61
|
+
# ```ruby
|
62
|
+
# require "logger"
|
63
|
+
#
|
64
|
+
# module MyLogger
|
65
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
66
|
+
# def logger
|
67
|
+
# LOGGER
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
72
|
+
# module GRPC
|
73
|
+
# extend MyLogger
|
74
|
+
# end
|
75
|
+
# ```
|
76
|
+
#
|
77
|
+
module V1
|
78
|
+
# rubocop:enable LineLength
|
79
|
+
|
80
|
+
##
|
81
|
+
# [Grafeas](https://grafeas.io) API.
|
82
|
+
#
|
83
|
+
# Retrieves analysis results of Cloud components such as Docker container
|
84
|
+
# images.
|
85
|
+
#
|
86
|
+
# Analysis results are stored as a series of occurrences. An `Occurrence`
|
87
|
+
# contains information about a specific analysis instance on a resource. An
|
88
|
+
# occurrence refers to a `Note`. A note contains details describing the
|
89
|
+
# analysis and is generally stored in a separate project, called a `Provider`.
|
90
|
+
# Multiple occurrences can refer to the same note.
|
91
|
+
#
|
92
|
+
# For example, an SSL vulnerability could affect multiple images. In this case,
|
93
|
+
# there would be one note for the vulnerability and an occurrence for each
|
94
|
+
# image with the vulnerability referring to that note.
|
95
|
+
#
|
96
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
97
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
98
|
+
# be many types.
|
99
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
100
|
+
# authenticating requests made by this client.
|
101
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
102
|
+
# credentials for this client.
|
103
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
104
|
+
# credentials for this client.
|
105
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
106
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
107
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
108
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
109
|
+
# metadata for requests, generally, to give OAuth credentials.
|
110
|
+
# @param scopes [Array<String>]
|
111
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
112
|
+
# an updater_proc is supplied.
|
113
|
+
# @param client_config [Hash]
|
114
|
+
# A Hash for call options for each method. See
|
115
|
+
# Google::Gax#construct_settings for the structure of
|
116
|
+
# this data. Falls back to the default config if not specified
|
117
|
+
# or the specified config is missing data points.
|
118
|
+
# @param timeout [Numeric]
|
119
|
+
# The default timeout, in seconds, for calls made through this client.
|
120
|
+
# @param metadata [Hash]
|
121
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
122
|
+
# @param exception_transformer [Proc]
|
123
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
124
|
+
# custom error handling.
|
125
|
+
def self.new \
|
126
|
+
credentials: nil,
|
127
|
+
scopes: nil,
|
128
|
+
client_config: nil,
|
129
|
+
timeout: nil,
|
130
|
+
metadata: nil,
|
131
|
+
exception_transformer: nil,
|
132
|
+
lib_name: nil,
|
133
|
+
lib_version: nil
|
134
|
+
kwargs = {
|
135
|
+
credentials: credentials,
|
136
|
+
scopes: scopes,
|
137
|
+
client_config: client_config,
|
138
|
+
timeout: timeout,
|
139
|
+
metadata: metadata,
|
140
|
+
exception_transformer: exception_transformer,
|
141
|
+
lib_name: lib_name,
|
142
|
+
lib_version: lib_version
|
143
|
+
}.select { |_, v| v != nil }
|
144
|
+
Grafeas::V1::GrafeasClient.new(**kwargs)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: grafeas/v1/attestation.proto
|
3
|
+
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'grafeas/v1/common_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_message "grafeas.v1.AttestationNote" do
|
10
|
+
optional :hint, :message, 1, "grafeas.v1.AttestationNote.Hint"
|
11
|
+
end
|
12
|
+
add_message "grafeas.v1.AttestationNote.Hint" do
|
13
|
+
optional :human_readable_name, :string, 1
|
14
|
+
end
|
15
|
+
add_message "grafeas.v1.AttestationOccurrence" do
|
16
|
+
optional :serialized_payload, :bytes, 1
|
17
|
+
repeated :signatures, :message, 2, "grafeas.v1.Signature"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module Grafeas
|
22
|
+
module V1
|
23
|
+
AttestationNote = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.AttestationNote").msgclass
|
24
|
+
AttestationNote::Hint = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.AttestationNote.Hint").msgclass
|
25
|
+
AttestationOccurrence = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.AttestationOccurrence").msgclass
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: grafeas/v1/build.proto
|
3
|
+
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'grafeas/v1/provenance_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_message "grafeas.v1.BuildNote" do
|
10
|
+
optional :builder_version, :string, 1
|
11
|
+
end
|
12
|
+
add_message "grafeas.v1.BuildOccurrence" do
|
13
|
+
optional :provenance, :message, 1, "grafeas.v1.BuildProvenance"
|
14
|
+
optional :provenance_bytes, :string, 2
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Grafeas
|
19
|
+
module V1
|
20
|
+
BuildNote = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.BuildNote").msgclass
|
21
|
+
BuildOccurrence = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.BuildOccurrence").msgclass
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: grafeas/v1/common.proto
|
3
|
+
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_message "grafeas.v1.RelatedUrl" do
|
9
|
+
optional :url, :string, 1
|
10
|
+
optional :label, :string, 2
|
11
|
+
end
|
12
|
+
add_message "grafeas.v1.Signature" do
|
13
|
+
optional :signature, :bytes, 1
|
14
|
+
optional :public_key_id, :string, 2
|
15
|
+
end
|
16
|
+
add_enum "grafeas.v1.NoteKind" do
|
17
|
+
value :NOTE_KIND_UNSPECIFIED, 0
|
18
|
+
value :VULNERABILITY, 1
|
19
|
+
value :BUILD, 2
|
20
|
+
value :IMAGE, 3
|
21
|
+
value :PACKAGE, 4
|
22
|
+
value :DEPLOYMENT, 5
|
23
|
+
value :DISCOVERY, 6
|
24
|
+
value :ATTESTATION, 7
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module Grafeas
|
29
|
+
module V1
|
30
|
+
RelatedUrl = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.RelatedUrl").msgclass
|
31
|
+
Signature = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.Signature").msgclass
|
32
|
+
NoteKind = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.NoteKind").enummodule
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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
|
+
require "googleauth"
|
17
|
+
|
18
|
+
module Grafeas
|
19
|
+
module V1
|
20
|
+
class Credentials < Google::Auth::Credentials
|
21
|
+
SCOPE = [
|
22
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
23
|
+
].freeze
|
24
|
+
PATH_ENV_VARS = %w(GRAFEAS_CREDENTIALS
|
25
|
+
GRAFEAS_KEYFILE
|
26
|
+
GOOGLE_CLOUD_CREDENTIALS
|
27
|
+
GOOGLE_CLOUD_KEYFILE
|
28
|
+
GCLOUD_KEYFILE)
|
29
|
+
JSON_ENV_VARS = %w(GRAFEAS_CREDENTIALS_JSON
|
30
|
+
GRAFEAS_KEYFILE_JSON
|
31
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
32
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
33
|
+
GCLOUD_KEYFILE_JSON)
|
34
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: grafeas/v1/cvss.proto
|
3
|
+
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_message "grafeas.v1.CVSSv3" do
|
9
|
+
optional :base_score, :float, 1
|
10
|
+
optional :exploitability_score, :float, 2
|
11
|
+
optional :impact_score, :float, 3
|
12
|
+
optional :attack_vector, :enum, 5, "grafeas.v1.CVSSv3.AttackVector"
|
13
|
+
optional :attack_complexity, :enum, 6, "grafeas.v1.CVSSv3.AttackComplexity"
|
14
|
+
optional :privileges_required, :enum, 7, "grafeas.v1.CVSSv3.PrivilegesRequired"
|
15
|
+
optional :user_interaction, :enum, 8, "grafeas.v1.CVSSv3.UserInteraction"
|
16
|
+
optional :scope, :enum, 9, "grafeas.v1.CVSSv3.Scope"
|
17
|
+
optional :confidentiality_impact, :enum, 10, "grafeas.v1.CVSSv3.Impact"
|
18
|
+
optional :integrity_impact, :enum, 11, "grafeas.v1.CVSSv3.Impact"
|
19
|
+
optional :availability_impact, :enum, 12, "grafeas.v1.CVSSv3.Impact"
|
20
|
+
end
|
21
|
+
add_enum "grafeas.v1.CVSSv3.AttackVector" do
|
22
|
+
value :ATTACK_VECTOR_UNSPECIFIED, 0
|
23
|
+
value :ATTACK_VECTOR_NETWORK, 1
|
24
|
+
value :ATTACK_VECTOR_ADJACENT, 2
|
25
|
+
value :ATTACK_VECTOR_LOCAL, 3
|
26
|
+
value :ATTACK_VECTOR_PHYSICAL, 4
|
27
|
+
end
|
28
|
+
add_enum "grafeas.v1.CVSSv3.AttackComplexity" do
|
29
|
+
value :ATTACK_COMPLEXITY_UNSPECIFIED, 0
|
30
|
+
value :ATTACK_COMPLEXITY_LOW, 1
|
31
|
+
value :ATTACK_COMPLEXITY_HIGH, 2
|
32
|
+
end
|
33
|
+
add_enum "grafeas.v1.CVSSv3.PrivilegesRequired" do
|
34
|
+
value :PRIVILEGES_REQUIRED_UNSPECIFIED, 0
|
35
|
+
value :PRIVILEGES_REQUIRED_NONE, 1
|
36
|
+
value :PRIVILEGES_REQUIRED_LOW, 2
|
37
|
+
value :PRIVILEGES_REQUIRED_HIGH, 3
|
38
|
+
end
|
39
|
+
add_enum "grafeas.v1.CVSSv3.UserInteraction" do
|
40
|
+
value :USER_INTERACTION_UNSPECIFIED, 0
|
41
|
+
value :USER_INTERACTION_NONE, 1
|
42
|
+
value :USER_INTERACTION_REQUIRED, 2
|
43
|
+
end
|
44
|
+
add_enum "grafeas.v1.CVSSv3.Scope" do
|
45
|
+
value :SCOPE_UNSPECIFIED, 0
|
46
|
+
value :SCOPE_UNCHANGED, 1
|
47
|
+
value :SCOPE_CHANGED, 2
|
48
|
+
end
|
49
|
+
add_enum "grafeas.v1.CVSSv3.Impact" do
|
50
|
+
value :IMPACT_UNSPECIFIED, 0
|
51
|
+
value :IMPACT_HIGH, 1
|
52
|
+
value :IMPACT_LOW, 2
|
53
|
+
value :IMPACT_NONE, 3
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module Grafeas
|
58
|
+
module V1
|
59
|
+
CVSSv3 = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3").msgclass
|
60
|
+
CVSSv3::AttackVector = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.AttackVector").enummodule
|
61
|
+
CVSSv3::AttackComplexity = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.AttackComplexity").enummodule
|
62
|
+
CVSSv3::PrivilegesRequired = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.PrivilegesRequired").enummodule
|
63
|
+
CVSSv3::UserInteraction = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.UserInteraction").enummodule
|
64
|
+
CVSSv3::Scope = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.Scope").enummodule
|
65
|
+
CVSSv3::Impact = Google::Protobuf::DescriptorPool.generated_pool.lookup("grafeas.v1.CVSSv3.Impact").enummodule
|
66
|
+
end
|
67
|
+
end
|