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

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

Instance Attribute Summary

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #inspect, #load, model, #model, #reload, #table, #to_json

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ AccessKeys

Returns a new instance of AccessKeys.



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

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

Instance Method Details

#allObject



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

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



24
25
26
# File 'lib/fog/aws/models/iam/access_keys.rb', line 24

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

#new(attributes = {}) ⇒ Object



28
29
30
# File 'lib/fog/aws/models/iam/access_keys.rb', line 28

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