Module AWS::IAM::PolicyCollection
In: lib/aws/iam/policy_collection.rb

Shared methods exposing a collection of policy documents associated with an IAM resource (a {User} or a {Group}). Policy collections can be constructed using {Group#policies} and {User#policies}.

Methods

[]   []=   clear   client_opts   delete   delete_policy   each   each_item   get_policy   has_key?   include?   key?   keys   member?   names   put_policy   request_method   resource_name   to_h   values   values_at  

Included Modules

Collection

Public Instance methods

Retrieves a policy document by name.

@param [String] name The name of the policy to retrieve.

@return [Policy] The policy with the given name. If no such

  policy exists, this method returns `nil`.

Adds or replaces a policy document.

@param [String] name The name of the policy document.

@param [Policy,String] document The policy document. This can

  be a JSON string, or any object that responds to `to_json`.
  The {Policy} class provides a convenient way to construct
  policy documents that you can use with AWS IAM.

Removes all policies from the collection.

Deletes a policy by name. This method is idempotent; if no policy exists with the given name, the method does nothing.

@param [String] name The name of the policy document.

@yield [name, policy] The name and document for each policy

  that is associated with the resource.  Like `Hash#each`,
  this method is sensitive to the arity of the provided block;
  if the block takes two arguments, they will be the name and
  document.  If it accepts only one argument, it will be an
  array containing the name and document.

@param [String] name The name of the policy to check.

@return [Boolean] True if there is a policy with the given name.

include?(name)

Alias for has_key?

key?(name)

Alias for has_key?

@return [Enumerator<String>] An enumerator for retrieving all

  the policy names that are currently associated with the
  resource.
member?(name)

Alias for has_key?

names()

Alias for keys

@return [Hash] The contents of the collection as a hash.

@return [Enumerator<Policy>] An enumerator for retrieving all

  the policy documents that are currently associated with the
  resource.

Retrieves multiple policy documents by name. This method makes one request to AWS IAM per argument.

@param names Each argument is the name of a policy to retrieve.

@return [Array<Policy>] An array containing the requested

  policy documents, in the same order as the argument list.
  If a requested policy does not exist, the array member
  corresponding to that argument will be `nil`.

Protected Instance methods

[Validate]