Sha256: fdb03792159a7ec4a14c0e4c747657cb23bc649e7c45063d3f1373c80016ad34
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
module Fog module AWS class IAM class User < Fog::Model identity :id, :aliases => 'UserName' attribute :path, :aliases => 'Path' attribute :arn, :aliases => 'Arn' attribute :user_id, :aliases => 'UserId' attribute :created_at, :aliases => 'CreateDate', :type => :time def access_keys requires :id service.access_keys(:username => id) end def destroy requires :id service.delete_user(id) true end def groups service.groups(:username => self.identity) end def policies requires :id service.policies(:username => id) end def password=(password) requires :identity has_password = !!self.password_created_at if has_password && password.nil? service.delete_login_profile(self.identity) elsif has_password service.update_login_profile(self.identity, password) elsif !password.nil? service.create_login_profile(self.identity, password) end end def password_created_at requires :identity service.get_login_profile(self.identity).body["LoginProfile"]["CreateDate"] rescue Fog::AWS::IAM::NotFound nil end def save requires :id data = service.create_user(id, path || '/').body['User'] merge_attributes(data) true end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-aws-0.4.0 | lib/fog/aws/models/iam/user.rb |