1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|iam] user: add created_at attribute

This commit is contained in:
Pierre Carrier 2013-04-25 17:54:32 +02:00
parent 7b0cd244a8
commit d7a66cf6fe
8 changed files with 31 additions and 20 deletions

View file

@ -92,6 +92,7 @@ module Fog
:path => '/',
:arn => "arn:aws:iam::#{Fog::AWS::Mock.owner_id}:user/#{ukey}",
:access_keys => [],
:created_at => Time.now,
:policies => {}
}
end,

View file

@ -10,6 +10,7 @@ module Fog
attribute :path, :aliases => 'Path'
attribute :arn, :aliases => 'Arn'
attribute :user_id, :aliases => 'UserId'
attribute :created_at, :aliases => 'CreateDate', :type => :time
def save
requires :id

View file

@ -14,6 +14,8 @@ module Fog
case name
when 'Arn', 'UserId', 'UserName', 'Path'
@response['User'][name] = value
when 'CreateDate'
@response['User'][name] = Time.parse(value)
when 'RequestId'
@response[name] = value
end

View file

@ -14,6 +14,8 @@ module Fog
case name
when 'Arn', 'UserId', 'UserName', 'Path'
@user[name] = value
when 'CreateDate'
@user[name] = Time.parse(value)
when 'member'
@response['Users'] << @user
@user = {}

View file

@ -44,10 +44,11 @@ module Fog
Excon::Response.new.tap do |response|
response.status = 200
response.body = { 'User' => {
"UserId" => data[:users][user_name][:user_id],
"Path" => path,
"UserName" => user_name,
"Arn" => (data[:users][user_name][:arn]).strip
"UserId" => data[:users][user_name][:user_id],
"Path" => path,
"UserName" => user_name,
"Arn" => (data[:users][user_name][:arn]).strip,
"CreateDate" => data[:users][user_name][:created_at]
},
'RequestId' => Fog::AWS::Mock.request_id
}

View file

@ -41,10 +41,11 @@ module Fog
) unless self.data[:users].key?(user)
Excon::Response.new.tap do |response|
response.body = {'User' => {
'UserId' => data[:users][user][:user_id],
'Path' => data[:users][user][:path],
'UserName' => user,
'Arn' => (data[:users][user][:arn]).strip
'UserId' => data[:users][user][:user_id],
'Path' => data[:users][user][:path],
'UserName' => user,
'Arn' => (data[:users][user][:arn]).strip,
'CreateDate' => data[:users][user][:created_at]
},
'RequestId' => Fog::AWS::Mock.request_id }
response.status = 200

View file

@ -43,10 +43,11 @@ module Fog
#FIXME: none of the options are currently supported
Excon::Response.new.tap do |response|
response.body = {'Users' => data[:users].map do |user, data|
{ 'UserId' => data[:user_id],
'Path' => data[:path],
'UserName' => user,
'Arn' => (data[:arn]).strip }
{ 'UserId' => data[:user_id],
'Path' => data[:path],
'UserName' => user,
'Arn' => (data[:arn]).strip,
'CreateDate' => data[:created_at]}
end,
'IsTruncated' => false,
'RequestId' => Fog::AWS::Mock.request_id }

View file

@ -6,10 +6,11 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
@user_format = {
'User' => {
'Arn' => String,
'Path' => String,
'UserId' => String,
'UserName' => String
'Arn' => String,
'Path' => String,
'UserId' => String,
'UserName' => String,
'CreateDate' => Time
},
'RequestId' => String
}
@ -20,10 +21,11 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
@users_format = {
'Users' => [{
'Arn' => String,
'Path' => String,
'UserId' => String,
'UserName' => String
'Arn' => String,
'Path' => String,
'UserId' => String,
'UserName' => String,
'CreateDate' => Time
}],
'IsTruncated' => Fog::Boolean,
'RequestId' => String