gapic-generator 0.47.1 → 0.47.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfab6bf4f7af1c42592258f1821fb073aafa1d0885a7bf889ec78cb42d6cecf1
|
|
4
|
+
data.tar.gz: e521c17b5649fe37213a6623e48fa768386c9df0ce6a24ecbdeaa75e099e6666
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d123027e4026d3f258a71899203f03e1cd799262b0661a77ae7612e19c153417870a6cf2db246ee2267fac5d01a4f50946f577c592c5c918f2e107fb7318811
|
|
7
|
+
data.tar.gz: 057a11d6eb4b385b28bd148045e0075191c12577cdd9d7acbc4610eb57b107d84c157b5db1ab408d5c0cf653ec2fbf52586dacde863c553e25c873cdba07e104
|
data/CHANGELOG.md
CHANGED
|
@@ -37,8 +37,6 @@
|
|
|
37
37
|
# @return [::String,nil]
|
|
38
38
|
# @!attribute [rw] credentials
|
|
39
39
|
# Credentials to send with calls. You may provide any of the following types:
|
|
40
|
-
# * (`String`) The path to a service account key file in JSON format
|
|
41
|
-
# * (`Hash`) A service account key as a Hash
|
|
42
40
|
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
43
41
|
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
44
42
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
@@ -47,7 +45,26 @@
|
|
|
47
45
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
48
46
|
# * (`nil`) indicating no credentials
|
|
49
47
|
#
|
|
50
|
-
# Warning:
|
|
48
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
49
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
50
|
+
# Google APIs can compromise the security of your systems and data.
|
|
51
|
+
#
|
|
52
|
+
# @example
|
|
53
|
+
#
|
|
54
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
55
|
+
# # on the appropriate credentials class for your environment.
|
|
56
|
+
#
|
|
57
|
+
# require "googleauth"
|
|
58
|
+
#
|
|
59
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
60
|
+
# json_key_io: ::File.open("/path/to/keyfile.json")
|
|
61
|
+
# )
|
|
62
|
+
#
|
|
63
|
+
# client = <%= service.client_name_full %>.new do |config|
|
|
64
|
+
# config.credentials = credentials
|
|
65
|
+
# end
|
|
66
|
+
#
|
|
67
|
+
# @note Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
51
68
|
# external source for authentication to Google Cloud, you must validate it before
|
|
52
69
|
# providing it to a Google API client library. Providing an unvalidated credential
|
|
53
70
|
# configuration to Google APIs can compromise the security of your systems and data.
|
|
@@ -16,6 +16,26 @@ class <%= service.client_name_full %>Test < Minitest::Test
|
|
|
16
16
|
|
|
17
17
|
<%- end -%>
|
|
18
18
|
<%= indent render(partial: "service/test/method/configure", locals: { service: service }), 2 %>
|
|
19
|
+
|
|
20
|
+
def test_credentials
|
|
21
|
+
key = OpenSSL::PKey::RSA.new 2048
|
|
22
|
+
cred_json = {
|
|
23
|
+
"private_key" => key.to_pem,
|
|
24
|
+
"client_email" => "app@developer.gserviceaccount.com",
|
|
25
|
+
"type" => "service_account"
|
|
26
|
+
}
|
|
27
|
+
key_file = StringIO.new cred_json.to_json
|
|
28
|
+
creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file })
|
|
29
|
+
|
|
30
|
+
dummy_stub = ClientStub.new nil, nil
|
|
31
|
+
Gapic::ServiceStub.stub :new, dummy_stub do
|
|
32
|
+
client = <%= service.client_name_full %>.new do |config|
|
|
33
|
+
config.credentials = creds
|
|
34
|
+
end
|
|
35
|
+
assert_kind_of <%= service.client_name_full %>, client
|
|
36
|
+
assert_equal creds, client.configure.credentials
|
|
37
|
+
end
|
|
38
|
+
end
|
|
19
39
|
<%- if service.lro? -%>
|
|
20
40
|
|
|
21
41
|
def test_<%= service.lro_client_var %>
|