Class: AwsMskIamSaslSigner::CLI
- Inherits:
-
Thor
- Object
- Thor
- AwsMskIamSaslSigner::CLI
- Extended by:
- ThorExt::Start
- Defined in:
- lib/aws-msk-iam-sasl-signer/cli.rb
Instance Method Summary collapse
- #generate ⇒ Object
- #generate_from_profile ⇒ Object
- #generate_from_role_arn ⇒ Object
- #version ⇒ Object
Methods included from ThorExt::Start
Instance Method Details
#generate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/aws-msk-iam-sasl-signer/cli.rb', line 18 def generate token_provider = MSKTokenProvider.new(region: [:region]) token = token_provider.generate_auth_token( aws_debug: [:aws_debug] ) puts "Token: #{token.token}" puts "Expiration Time: #{token.expiration_time_ms}" return unless [:aws_debug] puts "Caller Identity: #{token.caller_identity.to_h.to_json}" end |
#generate_from_profile ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/aws-msk-iam-sasl-signer/cli.rb', line 34 def generate_from_profile token_provider = MSKTokenProvider.new(region: [:region]) signed_url, expiration_time_ms = token_provider.generate_auth_token_from_profile([:aws_profile]) puts "Token: #{signed_url}" puts "Expiration Time: #{expiration_time_ms}" end |
#generate_from_role_arn ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/aws-msk-iam-sasl-signer/cli.rb', line 46 def generate_from_role_arn token_provider = MSKTokenProvider.new(region: [:region]) signed_url, expiration_time_ms = token_provider.generate_auth_token_from_role_arn( [:role_arn], [:session_name] ) puts "Token: #{signed_url}" puts "Expiration Time: #{expiration_time_ms}" end |
#version ⇒ Object
11 12 13 |
# File 'lib/aws-msk-iam-sasl-signer/cli.rb', line 11 def version say "signer/#{VERSION} #{RUBY_DESCRIPTION}" end |