aws-google 0.1.5 → 0.1.6
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/README.md +12 -10
- data/lib/aws/google.rb +3 -0
- data/lib/aws/google/credential_provider.rb +5 -3
- data/lib/aws/google/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00e6b5cf021f6b08503bc04f4359fa58028ebd227d0e12e66308af77f5613ba4
|
4
|
+
data.tar.gz: 971a4987281b9e2971574b590edba32a8522f061997cc20098ffa83e42216dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71812e0486feddadacbff23840630334a9fb29466427542c0da9d2fd36184e3694bea4681ac708c2822fcf43c2ce1829adc530311ede86523359a96c78519205
|
7
|
+
data.tar.gz: d14acf9b9493d55e4ef4b10465a17f6e9cda6fd0bdaef5886a757e078a434ccac9f3faef51689bdc037cb8b5828a947788f0f24640e18039f4365597d1a2805a
|
data/README.md
CHANGED
@@ -48,21 +48,23 @@ your Google Client ID (`accounts.google.com:aud`) and a specific set of Google A
|
|
48
48
|
}
|
49
49
|
```
|
50
50
|
|
51
|
-
- In your Ruby code, construct an `Aws::Google` object by passing
|
51
|
+
- In your Ruby code, construct an `Aws::Google` object by passing the AWS `role_arn`, Google `client_id` and `client_secret`, either as constructor arguments or via the `Aws::Google.config` global defaults:
|
52
52
|
```ruby
|
53
53
|
require 'aws/google'
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
options = {
|
56
|
+
aws_role: 'arn:aws:iam::[AccountID]:role/[Role]',
|
57
|
+
client_id: '123456789012-abcdefghijklmnopqrstuvwzyz0123456.apps.googleusercontent.com',
|
58
|
+
client_secret: '01234567890abcdefghijklmn'
|
59
|
+
}
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
google_client_secret: client_secret
|
63
|
-
)
|
61
|
+
# Pass constructor arguments:
|
62
|
+
credentials = Aws::Google.new(options)
|
63
|
+
puts Aws::STS::Client.new(credentials: credentials).get_caller_identity
|
64
64
|
|
65
|
-
|
65
|
+
# Set global defaults:
|
66
|
+
Aws::Google.config = options
|
67
|
+
puts Aws::STS::Client.new.get_caller_identity
|
66
68
|
```
|
67
69
|
|
68
70
|
- Or, add the properties to your AWS config profile ([`~/.aws/config`](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-where)) to use Google as the AWS credential provider without any changes to your application code:
|
data/lib/aws/google.rb
CHANGED
@@ -27,8 +27,10 @@ module Aws
|
|
27
27
|
include ::Aws::Google::CachedCredentials
|
28
28
|
|
29
29
|
class << self
|
30
|
+
# Use `Aws::Google.config` to set default options for any instance of this provider.
|
30
31
|
attr_accessor :config
|
31
32
|
end
|
33
|
+
self.config = {}
|
32
34
|
|
33
35
|
# @option options [required, String] :role_arn
|
34
36
|
# @option options [String] :policy
|
@@ -43,6 +45,7 @@ module Aws
|
|
43
45
|
# @option options [String] :client_id Google client ID
|
44
46
|
# @option options [String] :client_secret Google client secret
|
45
47
|
def initialize(options = {})
|
48
|
+
options = options.merge(self.class.config)
|
46
49
|
@oauth_attempted = false
|
47
50
|
@assume_role_params = options.slice(
|
48
51
|
*Aws::STS::Client.api.operation(:assume_role_with_web_identity).
|
@@ -24,9 +24,11 @@ module Aws
|
|
24
24
|
def google_credentials_from_config(opts = {})
|
25
25
|
p = opts[:profile] || @profile_name
|
26
26
|
if @config_enabled && @parsed_config
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
google_opts = @parsed_config.
|
28
|
+
fetch(p, {}).fetch('google', {}).
|
29
|
+
transform_keys(&:to_sym)
|
30
|
+
if google_opts.merge(::Aws::Google.config).has_key?(:role_arn)
|
31
|
+
Google.new(google_opts)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
data/lib/aws/google/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Jordan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|