@return [String] Returns the name of this user policy.
@return [User] Returns the user this user policy belongs to.
@param [User] The user this user policy belongs to. @param [String] The name of this user policy.
# File lib/aws/iam/user_policy.rb, line 22 def initialize user, name, options = {} @user = user @name = name super end
Deletes this user policy. @return [nil]
# File lib/aws/iam/user_policy.rb, line 80 def delete client.delete_user_policy(:user_name => user.name, :policy_name => name) nil end
@return [Policy] Returns the actual policy document for this
user policy.
# File lib/aws/iam/user_policy.rb, line 48 def policy response = client.get_user_policy( :user_name => user.name, :policy_name => name) policy = Policy.from_json(URI.decode(response.policy_document)) policy.extend(PolicyProxy) policy.user_policy = self policy end
Replaces or updates the user policy with the given policy document. @param [Policy] policy @return [nil]
# File lib/aws/iam/user_policy.rb, line 64 def policy= policy policy_document = policy.is_a?(String) ? policy : policy.to_json options = {} options[:user_name] = user.name options[:policy_name] = name options[:policy_document] = policy_document client.put_user_policy(options) nil end