Class: AWS::IAM::UserPolicyCollection

Inherits:
Object
  • Object
show all
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

Attributes included from Core::Model

#config

Instance Method Summary collapse

Methods included from PolicyCollection

#[], #[]=, #clear, #delete, #each, #has_key?, #keys, #to_h, #values, #values_at

Methods included from Core::Collection::Limitable

#each_batch

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.

Parameters:

  • user (User)

    The user that owns this collection.


35
36
37
38
# File 'lib/aws/iam/user_policy_collection.rb', line 35

def initialize user, options = {}
  @user = user
  super
end

Instance Attribute Details

#userUser (readonly)

Returns the user that this collection belongs to.

Returns:

  • (User)

    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