Class: Awscli::Iam::Profiles

Inherits:
Object
  • Object
show all
Defined in:
lib/awscli/iam.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Profiles

Returns a new instance of Profiles.



422
423
424
# File 'lib/awscli/iam.rb', line 422

def initialize(connection)
  @conn = connection
end

Instance Method Details

#create(profilename, path) ⇒ Object



444
445
446
447
448
# File 'lib/awscli/iam.rb', line 444

def create(profilename, path)
  @conn.create_instance_profile(profilename, path)
rescue Fog::AWS::IAM::NotFound, Fog::AWS::IAM::Error
  puts "[Error]: #{$!}"
end

#delete(profilename) ⇒ Object



450
451
452
453
454
# File 'lib/awscli/iam.rb', line 450

def delete(profilename)
  @conn.delete_instance_profile(profilename)
rescue Fog::AWS::IAM::NotFound, Fog::AWS::IAM::Error
  puts "[Error]: #{$!}"
end

#listObject



426
427
428
429
# File 'lib/awscli/iam.rb', line 426

def list
  profiles = @conn.list_instance_profiles.body['InstanceProfiles']
  Formatador.display_table(profiles, %w(Arn InstanceProfileName InstanceProfileId Path Roles))
end

#list_for_role(rolename) ⇒ Object



431
432
433
434
435
436
# File 'lib/awscli/iam.rb', line 431

def list_for_role(rolename)
  profiles = @conn.list_instance_profiles_for_role(rolename).body['InstanceProfiles']
  Formatador.display_table(profiles, %w(Arn InstanceProfileName InstanceProfileId Path Roles))
rescue Fog::AWS::IAM::NotFound, Fog::AWS::IAM::Error
  puts "[Error]: #{$!}"
end

#remove_role_from_instance_profile(rolename, profilename) ⇒ Object



438
439
440
441
442
# File 'lib/awscli/iam.rb', line 438

def remove_role_from_instance_profile(rolename, profilename)
  @conn.remove_role_from_instance_profile(rolename, profilename)
rescue Fog::AWS::IAM::NotFound, Fog::AWS::IAM::Error
  puts "[Error]: #{$!}"
end