Skip to content

Commit 904e4f0

Browse files
committed
test!
1 parent 707a598 commit 904e4f0

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ gem "lograge"
5353
gem "sentry-rails"
5454
gem "sentry-ruby"
5555

56+
# For getting information about the AWS EC2 host credentials
57+
gem "aws-sdk-core"
58+
5659
group :development, :test do
5760
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
5861
gem "debug", platforms: %i[mri mingw x64_mingw]

Gemfile.lock

+11
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ GEM
7777
acts_as_list (1.1.0)
7878
activerecord (>= 4.2)
7979
ast (2.4.2)
80+
aws-eventstream (1.3.0)
81+
aws-partitions (1.867.0)
82+
aws-sdk-core (3.190.0)
83+
aws-eventstream (~> 1, >= 1.3.0)
84+
aws-partitions (~> 1, >= 1.651.0)
85+
aws-sigv4 (~> 1.8)
86+
jmespath (~> 1, >= 1.6.1)
87+
aws-sigv4 (1.8.0)
88+
aws-eventstream (~> 1, >= 1.0.2)
8089
bootsnap (1.17.0)
8190
msgpack (~> 1.2)
8291
brakeman (6.1.0)
@@ -144,6 +153,7 @@ GEM
144153
irb (1.10.1)
145154
rdoc
146155
reline (>= 0.3.8)
156+
jmespath (1.6.2)
147157
json (2.6.3)
148158
language_server-protocol (3.17.0.3)
149159
lograge (0.14.0)
@@ -321,6 +331,7 @@ PLATFORMS
321331

322332
DEPENDENCIES
323333
acts_as_list
334+
aws-sdk-core
324335
bootsnap
325336
brakeman
326337
bundler-audit

lib/tasks/access_tokens.rake

+17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1+
require "aws-sdk-core"
2+
13
namespace :access_tokens do
4+
task :get_caller_identity => :environment do
5+
sts = Aws::STS::Client.new
6+
caller_identity = sts.get_caller_identity
7+
puts caller_identity
8+
9+
caller_arn = caller_identity[:arn]
10+
caller_arn = Aws::ARNParser.parse(caller_arn)
11+
puts caller_arn.inspect
12+
13+
=begin
14+
/arn:aws:sts::#{caller_identity[:account]}:(user/(?<user_name>)|assumed-role/(?<role_name>)/(?<role_session_name>)|federated-user/(?<federated_user_name>))
15+
puts caller_identity
16+
=end
17+
end
18+
219
desc "Add a pre-generated token, using the SHA256 hex digest"
320
task :insert, %i[token_digest] => :environment do |_, args|
421
usage_message = "usage: rails access_tokens:insert[<token_digest>]".freeze

0 commit comments

Comments
 (0)