Class: Fog::AWS::IAM::AccessKeys

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/aws/models/iam/access_keys.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AccessKeys

Returns a new instance of AccessKeys.



10
11
12
13
# File 'lib/fog/aws/models/iam/access_keys.rb', line 10

def initialize(attributes = {})
  @username = attributes[:username]
  super
end

Instance Method Details

#allObject



15
16
17
18
19
20
# File 'lib/fog/aws/models/iam/access_keys.rb', line 15

def all
  data = service.list_access_keys('UserName'=> @username).body['AccessKeys']
  # AWS response doesn't contain the UserName, this injects it
  data.each {|access_key| access_key['UserName'] = @username }
  load(data)
end

#get(identity) ⇒ Object



22
23
24
# File 'lib/fog/aws/models/iam/access_keys.rb', line 22

def get(identity)
  self.all.select {|access_key| access_key.id == identity}.first
end

#new(attributes = {}) ⇒ Object



26
27
28
# File 'lib/fog/aws/models/iam/access_keys.rb', line 26

def new(attributes = {})
  super({ :username => @username }.merge!(attributes))
end