google-cloud-storage 1.57.0 → 1.57.1
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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +13 -1
- data/CHANGELOG.md +6 -0
- data/OVERVIEW.md +7 -1
- data/lib/google/cloud/storage/credentials.rb +14 -3
- data/lib/google/cloud/storage/version.rb +1 -1
- data/lib/google/cloud/storage.rb +6 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86a7f1131dc71cb9b5db56afce6c3b9e25a9a21544500367cdcd39ac8eb8ef46
|
|
4
|
+
data.tar.gz: 070b6c33b09fb8af9eb8a59f5d074b3b5929fd6d61233f1cf738ac4b6c0809a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c6370f20e62e933a41fbab067870c29c4e28bde041c97e53edb7a9e0280d1a029bf8d6ce238877cf14114b202535e7c9d0407192dbbfb4af8d071d9a3c3f575
|
|
7
|
+
data.tar.gz: 7da8c7b4afed6c3b0504c33c14bac1ce04a43e3740119af18c7c30c4eca540287da4e59798f6358f4e15098ab1476c09dcd9377c988ed063f47ff5846689eb84
|
data/AUTHENTICATION.md
CHANGED
|
@@ -28,6 +28,12 @@ providing **Project ID** and **Service Account Credentials** directly in code.
|
|
|
28
28
|
|
|
29
29
|
**Credentials** are discovered in the following order:
|
|
30
30
|
|
|
31
|
+
> [!WARNING]
|
|
32
|
+
> If you accept a credential configuration (JSON file or Hash) from an
|
|
33
|
+
> external source for authentication to Google Cloud, you must validate it before
|
|
34
|
+
> providing it to a Google API client library. Providing an unvalidated credential
|
|
35
|
+
> configuration to Google APIs can compromise the security of your systems and data.
|
|
36
|
+
|
|
31
37
|
1. Specify credentials in method arguments
|
|
32
38
|
2. Specify credentials in configuration
|
|
33
39
|
3. Discover credentials path in environment variables
|
|
@@ -81,11 +87,17 @@ The **Project ID** and the path to the **Credentials JSON** file can be configur
|
|
|
81
87
|
instead of placing them in environment variables or providing them as arguments.
|
|
82
88
|
|
|
83
89
|
```ruby
|
|
90
|
+
require "googleauth"
|
|
84
91
|
require "google/cloud/storage"
|
|
85
92
|
|
|
93
|
+
credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
94
|
+
json_key_io: ::File.open("/path/to/keyfile.json"),
|
|
95
|
+
scope: "https://www.googleapis.com/auth/devstorage.full_control"
|
|
96
|
+
)
|
|
97
|
+
|
|
86
98
|
Google::Cloud::Storage.configure do |config|
|
|
87
99
|
config.project_id = "my-project-id"
|
|
88
|
-
config.credentials =
|
|
100
|
+
config.credentials = credentials
|
|
89
101
|
end
|
|
90
102
|
|
|
91
103
|
storage = Google::Cloud::Storage.new
|
data/CHANGELOG.md
CHANGED
data/OVERVIEW.md
CHANGED
|
@@ -14,11 +14,17 @@ your code or via environment variables. Read more about the options for
|
|
|
14
14
|
connecting in the {file:AUTHENTICATION.md Authentication Guide}.
|
|
15
15
|
|
|
16
16
|
```ruby
|
|
17
|
+
require "googleauth"
|
|
17
18
|
require "google/cloud/storage"
|
|
18
19
|
|
|
20
|
+
credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
21
|
+
json_key_io: ::File.open("/path/to/keyfile.json"),
|
|
22
|
+
scope: "https://www.googleapis.com/auth/devstorage.full_control"
|
|
23
|
+
)
|
|
24
|
+
|
|
19
25
|
storage = Google::Cloud::Storage.new(
|
|
20
26
|
project_id: "my-project",
|
|
21
|
-
credentials:
|
|
27
|
+
credentials: credentials
|
|
22
28
|
)
|
|
23
29
|
|
|
24
30
|
bucket = storage.bucket "my-bucket"
|
|
@@ -25,18 +25,29 @@ module Google
|
|
|
25
25
|
# Storage API.
|
|
26
26
|
#
|
|
27
27
|
# @example
|
|
28
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
29
|
+
# # on the appropriate credentials class for your environment.
|
|
30
|
+
#
|
|
31
|
+
# require "googleauth"
|
|
28
32
|
# require "google/cloud/storage"
|
|
29
33
|
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
34
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
35
|
+
# json_key_io: ::File.open("/path/to/keyfile.json"),
|
|
36
|
+
# scope: "https://www.googleapis.com/auth/devstorage.full_control"
|
|
37
|
+
# )
|
|
32
38
|
#
|
|
33
39
|
# storage = Google::Cloud::Storage.new(
|
|
34
40
|
# project_id: "my-project",
|
|
35
|
-
# credentials:
|
|
41
|
+
# credentials: credentials
|
|
36
42
|
# )
|
|
37
43
|
#
|
|
38
44
|
# storage.project_id #=> "my-project"
|
|
39
45
|
#
|
|
46
|
+
# @note Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
47
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
48
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
49
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
50
|
+
#
|
|
40
51
|
class Credentials < Google::Auth::Credentials
|
|
41
52
|
SCOPE = ["https://www.googleapis.com/auth/devstorage.full_control"].freeze
|
|
42
53
|
PATH_ENV_VARS = [
|
data/lib/google/cloud/storage.rb
CHANGED
|
@@ -42,9 +42,12 @@ module Google
|
|
|
42
42
|
# @param [String] project_id Project identifier for the Storage service
|
|
43
43
|
# you are connecting to. If not present, the default project for the
|
|
44
44
|
# credentials is used.
|
|
45
|
-
# @param [
|
|
46
|
-
#
|
|
47
|
-
#
|
|
45
|
+
# @param [Google::Auth::Credentials] credentials A Google::Auth::Credentials
|
|
46
|
+
# object. (See {Storage::Credentials})
|
|
47
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of
|
|
48
|
+
# credentials is deprecated. Providing an unvalidated credential
|
|
49
|
+
# configuration to Google APIs can compromise the security of your
|
|
50
|
+
# systems and data.
|
|
48
51
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
|
|
49
52
|
# the set of resources and operations that the connection can access.
|
|
50
53
|
# See [Using OAuth 2.0 to Access Google
|