class Miasma::Contrib::Aws::Api::Iam

IAM helper class

Constants

API_SERVICE

Service name of the API

API_VERSION

Supported version of the IAM API

Public Instance Methods

connect() click to toggle source
# File lib/miasma-aws/api/iam.rb, line 18
def connect
  super
  service_name = self.class::API_SERVICE.downcase
  self.aws_host = [
    service_name,
    api_endpoint,
  ].join(".")
end
user_info() click to toggle source

Fetch current user information

# File lib/miasma-aws/api/iam.rb, line 28
def user_info
  result = request(
    :path => "/",
    :params => {
      "Action" => "GetUser",
    },
  ).get(:body, "GetUserResponse", "GetUserResult", "User")
  Smash.new(
    :user_id => result["UserId"],
    :path => result["Path"],
    :username => result["UserName"],
    :arn => result["Arn"],
    :created => result["CreateDate"],
    :password_last_used => result["PasswordLastUsed"],
    :account_id => result["Arn"].split(":")[4],
  )
end