grafeas-client 0.3.0 → 0.4.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +0 -2
  3. data/README.md +4 -4
  4. data/lib/grafeas/client/version.rb +1 -2
  5. metadata +12 -73
  6. data/AUTHENTICATION.md +0 -199
  7. data/lib/grafeas.rb +0 -154
  8. data/lib/grafeas/v1.rb +0 -155
  9. data/lib/grafeas/v1/attestation_pb.rb +0 -27
  10. data/lib/grafeas/v1/build_pb.rb +0 -23
  11. data/lib/grafeas/v1/common_pb.rb +0 -34
  12. data/lib/grafeas/v1/credentials.rb +0 -37
  13. data/lib/grafeas/v1/cvss_pb.rb +0 -67
  14. data/lib/grafeas/v1/deployment_pb.rb +0 -35
  15. data/lib/grafeas/v1/discovery_pb.rb +0 -40
  16. data/lib/grafeas/v1/doc/google/protobuf/any.rb +0 -131
  17. data/lib/grafeas/v1/doc/google/protobuf/empty.rb +0 -29
  18. data/lib/grafeas/v1/doc/google/protobuf/field_mask.rb +0 -222
  19. data/lib/grafeas/v1/doc/google/protobuf/timestamp.rb +0 -113
  20. data/lib/grafeas/v1/doc/google/rpc/status.rb +0 -87
  21. data/lib/grafeas/v1/doc/grafeas/v1/attestation.rb +0 -64
  22. data/lib/grafeas/v1/doc/grafeas/v1/build.rb +0 -44
  23. data/lib/grafeas/v1/doc/grafeas/v1/common.rb +0 -105
  24. data/lib/grafeas/v1/doc/grafeas/v1/cvss.rb +0 -104
  25. data/lib/grafeas/v1/doc/grafeas/v1/deployment.rb +0 -64
  26. data/lib/grafeas/v1/doc/grafeas/v1/discovery.rb +0 -76
  27. data/lib/grafeas/v1/doc/grafeas/v1/grafeas.rb +0 -322
  28. data/lib/grafeas/v1/doc/grafeas/v1/image.rb +0 -79
  29. data/lib/grafeas/v1/doc/grafeas/v1/package.rb +0 -125
  30. data/lib/grafeas/v1/doc/grafeas/v1/provenance.rb +0 -248
  31. data/lib/grafeas/v1/doc/grafeas/v1/vulnerability.rb +0 -214
  32. data/lib/grafeas/v1/grafeas_client.rb +0 -961
  33. data/lib/grafeas/v1/grafeas_client_config.json +0 -96
  34. data/lib/grafeas/v1/grafeas_pb.rb +0 -163
  35. data/lib/grafeas/v1/grafeas_services_pb.rb +0 -86
  36. data/lib/grafeas/v1/image_pb.rb +0 -36
  37. data/lib/grafeas/v1/package_pb.rb +0 -59
  38. data/lib/grafeas/v1/provenance_pb.rb +0 -116
  39. data/lib/grafeas/v1/vulnerability_pb.rb +0 -81
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e504969e496e6f6662a1eaf27d87aba4bd9d65d90f38a66dff51242fbeb53ead
4
- data.tar.gz: 4378648965161f0e7d2a0f31355a78a210b8d96855f2bd85dd9d2766a97dba33
3
+ metadata.gz: 32f403a8c42568fafb8d631b97da01b16db73550f2e9209d02632addf66ff53c
4
+ data.tar.gz: f70857ed0e035e9470ed5a5643d02c54f41a0810f1005264b34815af127c695a
5
5
  SHA512:
6
- metadata.gz: 79e32a498ed07a4ab2cc7ebcea9b5373c151591425e42f2c89529651038d02b8cfa9e303259d10a8bac405412b5a4c93485252880a253479a2bb25bd230565d3
7
- data.tar.gz: 353ad52b2a0401451bea67ea229053c777a2a25d25a4536c90534522780835eb82214a059ab6cd02d5cebe93a85fccc714f4eb447b5ae0dbb5953676f8396fd1
6
+ metadata.gz: ad4c9f09dada5d9991a9809c3491f0cfefde107c98b095bb33f06d180f29a8ac19b18a6d4ee0f557ff2ab1c714a323cf891eb58a54d25d1ee0f8bce591a66156
7
+ data.tar.gz: ad67af4b0703d932c2c399a859d9e7f5019f9214c75ab7c8b568fd11dbedfb1e4b3d737edf1b55defd5cb1f42c859f6b2c1663ad00f9635b5b85ffcb1f940bbf
data/.yardopts CHANGED
@@ -1,11 +1,9 @@
1
1
  --no-private
2
2
  --title=Container Analysis API
3
- --exclude _pb\.rb$
4
3
  --markup markdown
5
4
  --markup-provider redcarpet
6
5
 
7
6
  ./lib/**/*.rb
8
7
  -
9
8
  README.md
10
- AUTHENTICATION.md
11
9
  LICENSE
data/README.md CHANGED
@@ -13,11 +13,11 @@ steps:
13
13
  1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
14
14
  2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
15
15
  3. [Enable the Container Analysis API.](https://console.cloud.google.com/apis/library/grafeas.googleapis.com)
16
- 4. [Setup Authentication.](https://googleapis.dev/ruby/grafeas-client/latest/file.AUTHENTICATION.html)
16
+ 4. [Setup Authentication.](https://googleapis.dev/ruby/grafeas/latest/file.AUTHENTICATION.html)
17
17
 
18
18
  ### Installation
19
19
  ```
20
- $ gem install grafeas-client
20
+ $ gem install grafeas
21
21
  ```
22
22
 
23
23
  ### Next Steps
@@ -59,11 +59,11 @@ end
59
59
 
60
60
  ## Supported Ruby Versions
61
61
 
62
- This library is supported on Ruby 2.3+.
62
+ This library is supported on Ruby 2.4+.
63
63
 
64
64
  Google provides official support for Ruby versions that are actively supported
65
65
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
66
- in security maintenance, and not end of life. Currently, this means Ruby 2.3
66
+ in security maintenance, and not end of life. Currently, this means Ruby 2.4
67
67
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
68
68
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
69
69
  about the Ruby support schedule.
@@ -15,7 +15,6 @@
15
15
 
16
16
  module Grafeas
17
17
  module Client
18
- VERSION = "0.3.0".freeze
18
+ VERSION = "0.4.0".freeze
19
19
  end
20
- VERSION = Client::VERSION
21
20
  end
metadata CHANGED
@@ -1,57 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grafeas-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-02 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: google-gax
14
+ name: grafeas
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '0.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '0.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: grpc-google-iam-v1
28
+ name: google-style
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.9
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.6.9
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.10'
33
+ version: 1.24.0
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '5.10'
40
+ version: 1.24.0
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: redcarpet
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +52,6 @@ dependencies:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
54
  version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.64.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.64.0
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: simplecov
85
57
  requirement: !ruby/object:Gem::Requirement
@@ -115,49 +87,16 @@ extensions: []
115
87
  extra_rdoc_files: []
116
88
  files:
117
89
  - ".yardopts"
118
- - AUTHENTICATION.md
119
90
  - LICENSE
120
91
  - README.md
121
92
  - lib/grafeas-client.rb
122
- - lib/grafeas.rb
123
93
  - lib/grafeas/client/version.rb
124
- - lib/grafeas/v1.rb
125
- - lib/grafeas/v1/attestation_pb.rb
126
- - lib/grafeas/v1/build_pb.rb
127
- - lib/grafeas/v1/common_pb.rb
128
- - lib/grafeas/v1/credentials.rb
129
- - lib/grafeas/v1/cvss_pb.rb
130
- - lib/grafeas/v1/deployment_pb.rb
131
- - lib/grafeas/v1/discovery_pb.rb
132
- - lib/grafeas/v1/doc/google/protobuf/any.rb
133
- - lib/grafeas/v1/doc/google/protobuf/empty.rb
134
- - lib/grafeas/v1/doc/google/protobuf/field_mask.rb
135
- - lib/grafeas/v1/doc/google/protobuf/timestamp.rb
136
- - lib/grafeas/v1/doc/google/rpc/status.rb
137
- - lib/grafeas/v1/doc/grafeas/v1/attestation.rb
138
- - lib/grafeas/v1/doc/grafeas/v1/build.rb
139
- - lib/grafeas/v1/doc/grafeas/v1/common.rb
140
- - lib/grafeas/v1/doc/grafeas/v1/cvss.rb
141
- - lib/grafeas/v1/doc/grafeas/v1/deployment.rb
142
- - lib/grafeas/v1/doc/grafeas/v1/discovery.rb
143
- - lib/grafeas/v1/doc/grafeas/v1/grafeas.rb
144
- - lib/grafeas/v1/doc/grafeas/v1/image.rb
145
- - lib/grafeas/v1/doc/grafeas/v1/package.rb
146
- - lib/grafeas/v1/doc/grafeas/v1/provenance.rb
147
- - lib/grafeas/v1/doc/grafeas/v1/vulnerability.rb
148
- - lib/grafeas/v1/grafeas_client.rb
149
- - lib/grafeas/v1/grafeas_client_config.json
150
- - lib/grafeas/v1/grafeas_pb.rb
151
- - lib/grafeas/v1/grafeas_services_pb.rb
152
- - lib/grafeas/v1/image_pb.rb
153
- - lib/grafeas/v1/package_pb.rb
154
- - lib/grafeas/v1/provenance_pb.rb
155
- - lib/grafeas/v1/vulnerability_pb.rb
156
94
  homepage: https://github.com/googleapis/googleapis
157
95
  licenses:
158
96
  - Apache-2.0
159
97
  metadata: {}
160
- post_install_message:
98
+ post_install_message: grafeas-client is now grafeas, please change the gem name in
99
+ your dependencies
161
100
  rdoc_options: []
162
101
  require_paths:
163
102
  - lib
@@ -165,14 +104,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
104
  requirements:
166
105
  - - ">="
167
106
  - !ruby/object:Gem::Version
168
- version: 2.0.0
107
+ version: '2.4'
169
108
  required_rubygems_version: !ruby/object:Gem::Requirement
170
109
  requirements:
171
110
  - - ">="
172
111
  - !ruby/object:Gem::Version
173
112
  version: '0'
174
113
  requirements: []
175
- rubygems_version: 3.0.4
114
+ rubygems_version: 3.0.6
176
115
  signing_key:
177
116
  specification_version: 4
178
117
  summary: API Client library for the Grafeas API
@@ -1,199 +0,0 @@
1
- # Authentication
2
-
3
- In general, the grafeas-client library uses [Service
4
- Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
- credentials to connect to Google Cloud services. When running within [Google
6
- Cloud Platform environments](#google-cloud-platform-environments)
7
- the credentials will be discovered automatically. When running on other
8
- environments, the Service Account credentials can be specified by providing the
9
- path to the [JSON
10
- keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
11
- the account (or the JSON itself) in [environment
12
- variables](#environment-variables). Additionally, Cloud SDK credentials can also
13
- be discovered automatically, but this is only recommended during development.
14
-
15
- ## Quickstart
16
-
17
- 1. [Create a service account and credentials](#creating-a-service-account).
18
- 2. Set the [environment variable](#environment-variables).
19
-
20
- ```sh
21
- export GRAFEAS_CREDENTIALS=/path/to/json`
22
- ```
23
-
24
- 3. Initialize the client.
25
-
26
- ```ruby
27
- require "grafeas"
28
-
29
- client = Grafeas.new
30
- ```
31
-
32
- ## Project and Credential Lookup
33
-
34
- The grafeas-client library aims to make authentication
35
- as simple as possible, and provides several mechanisms to configure your system
36
- without providing **Project ID** and **Service Account Credentials** directly in
37
- code.
38
-
39
- **Project ID** is discovered in the following order:
40
-
41
- 1. Specify project ID in method arguments
42
- 2. Specify project ID in configuration
43
- 3. Discover project ID in environment variables
44
- 4. Discover GCE project ID
45
- 5. Discover project ID in credentials JSON
46
-
47
- **Credentials** are discovered in the following order:
48
-
49
- 1. Specify credentials in method arguments
50
- 2. Specify credentials in configuration
51
- 3. Discover credentials path in environment variables
52
- 4. Discover credentials JSON in environment variables
53
- 5. Discover credentials file in the Cloud SDK's path
54
- 6. Discover GCE credentials
55
-
56
- ### Google Cloud Platform environments
57
-
58
- While running on Google Cloud Platform environments such as Google Compute
59
- Engine, Google App Engine and Google Kubernetes Engine, no extra work is needed.
60
- The **Project ID** and **Credentials** and are discovered automatically. Code
61
- should be written as if already authenticated. Just be sure when you [set up the
62
- GCE instance][gce-how-to], you add the correct scopes for the APIs you want to
63
- access. For example:
64
-
65
- * **All APIs**
66
- * `https://www.googleapis.com/auth/cloud-platform`
67
- * `https://www.googleapis.com/auth/cloud-platform.read-only`
68
- * **BigQuery**
69
- * `https://www.googleapis.com/auth/bigquery`
70
- * `https://www.googleapis.com/auth/bigquery.insertdata`
71
- * **Compute Engine**
72
- * `https://www.googleapis.com/auth/compute`
73
- * **Datastore**
74
- * `https://www.googleapis.com/auth/datastore`
75
- * `https://www.googleapis.com/auth/userinfo.email`
76
- * **DNS**
77
- * `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
78
- * **Pub/Sub**
79
- * `https://www.googleapis.com/auth/pubsub`
80
- * **Storage**
81
- * `https://www.googleapis.com/auth/devstorage.full_control`
82
- * `https://www.googleapis.com/auth/devstorage.read_only`
83
- * `https://www.googleapis.com/auth/devstorage.read_write`
84
-
85
- ### Environment Variables
86
-
87
- The **Project ID** and **Credentials JSON** can be placed in environment
88
- variables instead of declaring them directly in code. Each service has its own
89
- environment variable, allowing for different service accounts to be used for
90
- different services. (See the READMEs for the individual service gems for
91
- details.) The path to the **Credentials JSON** file can be stored in the
92
- environment variable, or the **Credentials JSON** itself can be stored for
93
- environments such as Docker containers where writing files is difficult or not
94
- encouraged.
95
-
96
- The environment variables that grafeas-client checks for project ID are:
97
-
98
- 1. `GRAFEAS_PROJECT`
99
- 2. `GOOGLE_CLOUD_PROJECT`
100
-
101
- The environment variables that grafeas-client checks for credentials are configured on {Grafeas::V1::Credentials}:
102
-
103
- 1. `GRAFEAS_CREDENTIALS` - Path to JSON file, or JSON contents
104
- 2. `GRAFEAS_KEYFILE` - Path to JSON file, or JSON contents
105
- 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
106
- 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
107
- 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
108
-
109
- ```ruby
110
- require "grafeas"
111
-
112
- ENV["GRAFEAS_PROJECT"] = "my-project-id"
113
- ENV["GRAFEAS_CREDENTIALS"] = "path/to/keyfile.json"
114
-
115
- client = Grafeas.new
116
- ```
117
-
118
- ### Configuration
119
-
120
- The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
121
-
122
- ```ruby
123
- require "grafeas"
124
-
125
- Grafeas.configure do |config|
126
- config.project_id = "my-project-id"
127
- config.credentials = "path/to/keyfile.json"
128
- end
129
-
130
- client = Grafeas.new
131
- ```
132
-
133
- ### Cloud SDK
134
-
135
- This option allows for an easy way to authenticate during development. If
136
- credentials are not provided in code or in environment variables, then Cloud SDK
137
- credentials are discovered.
138
-
139
- To configure your system for this, simply:
140
-
141
- 1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
142
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
143
- 3. Write code as if already authenticated.
144
-
145
- **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
146
- *should* only be used during development.
147
-
148
- [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
149
- [dev-console]: https://console.cloud.google.com/project
150
-
151
- [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
152
-
153
- [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
154
- [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
155
- [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
156
-
157
- ## Creating a Service Account
158
-
159
- Google Cloud requires a **Project ID** and **Service Account Credentials** to
160
- connect to the APIs. You will use the **Project ID** and **JSON key file** to
161
- connect to most services with grafeas-client.
162
-
163
- If you are not running this client within [Google Cloud Platform
164
- environments](#google-cloud-platform-environments), you need a Google
165
- Developers service account.
166
-
167
- 1. Visit the [Google Developers Console][dev-console].
168
- 1. Create a new project or click on an existing project.
169
- 1. Activate the slide-out navigation tray and select **API Manager**. From
170
- here, you will enable the APIs that your application requires.
171
-
172
- ![Enable the APIs that your application requires][enable-apis]
173
-
174
- *Note: You may need to enable billing in order to use these services.*
175
-
176
- 1. Select **Credentials** from the side navigation.
177
-
178
- You should see a screen like one of the following.
179
-
180
- ![Create a new service account][create-new-service-account]
181
-
182
- ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
183
-
184
- Find the "Add credentials" drop down and select "Service account" to be
185
- guided through downloading a new JSON key file.
186
-
187
- If you want to re-use an existing service account, you can easily generate a
188
- new key file. Just select the account you wish to re-use, and click "Generate
189
- new JSON key":
190
-
191
- ![Re-use an existing service account][reuse-service-account]
192
-
193
- The key file you download will be used by this library to authenticate API
194
- requests and should be stored in a secure location.
195
-
196
- ## Troubleshooting
197
-
198
- If you're having trouble authenticating you can ask for help by following the
199
- {file:TROUBLESHOOTING.md Troubleshooting Guide}.
@@ -1,154 +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
- 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.dev/ruby/grafeas-client/latest/file.AUTHENTICATION.html)
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.dev/ruby/google-cloud-logging/latest)
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 service_address [String]
135
- # Override for the service hostname, or `nil` to leave as the default.
136
- # @param service_port [Integer]
137
- # Override for the service port, or `nil` to leave as the default.
138
- # @param exception_transformer [Proc]
139
- # An optional proc that intercepts any exceptions raised during an API call to inject
140
- # custom error handling.
141
- def self.new(*args, version: :v1, **kwargs)
142
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
143
- raise "The version: #{version} is not available. The available versions " \
144
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
145
- end
146
-
147
- require "#{FILE_DIR}/#{version.to_s.downcase}"
148
- version_module = Grafeas
149
- .constants
150
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
151
- .first
152
- Grafeas.const_get(version_module).new(*args, **kwargs)
153
- end
154
- end