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}.
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.
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.
@return [Enumerator<String>] An enumerator for retrieving all
the policy names that are currently associated with the resource.
@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+.