Class: AWS::IAM::UserPolicyCollection
- Inherits:
-
Object
- Object
- AWS::IAM::UserPolicyCollection
- Includes:
- PolicyCollection
- Defined in:
- lib/aws/iam/user_policy_collection.rb
Overview
A collection that provides access to the policies associated with an IAM user. The interface mimics a hash containing string keys and values that are instances of Policy. For example:
# add or replace a policy named "ReadOnly"
policy = AWS::IAM::Policy.new do |p|
# ...
end
user.policies["ReadOnly"] = policy
user.policies.has_key?("ReadOnly") # => true
All of the methods for this class are defined in the PolicyCollection module.
Instance Attribute Summary collapse
-
#user ⇒ User
readonly
Returns the user that this collection belongs to.
Attributes included from Core::Model
Instance Method Summary collapse
-
#initialize(user, options = {}) ⇒ UserPolicyCollection
constructor
A new instance of UserPolicyCollection.
Methods included from PolicyCollection
#[], #[]=, #clear, #delete, #each, #has_key?, #keys, #to_h, #values, #values_at
Methods included from Core::Collection::Limitable
Methods included from Core::Collection
#each, #each_batch, #enum, #first, #in_groups_of, #page
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(user, options = {}) ⇒ UserPolicyCollection
Returns a new instance of UserPolicyCollection.
35 36 37 38 |
# File 'lib/aws/iam/user_policy_collection.rb', line 35 def initialize user, = {} @user = user super end |
Instance Attribute Details
#user ⇒ User (readonly)
Returns the user that this collection belongs to.
41 42 43 |
# File 'lib/aws/iam/user_policy_collection.rb', line 41 def user @user end |