Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
165 lines (107 sloc) 4.9 KB

Working with |IAM| Policies with |sdk-php| Version 3

You grant permissions to a user by creating a policy. A policy is a document that lists the actions that a user can perform and the resources those actions can affect. By default, any actions or resources that are not explicitly allowed are denied. Policies can be created and attached to users, groups of users, roles assumed by users, and resources.

The following examples show how to:

Create a Policy

Imports

.. literalinclude::  iam.php.create_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.create_policy.main.txt
   :language: PHP

Attach a Policy to a Role

Imports

.. literalinclude::  iam.php.attach_role_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.attach_role_policy.main.txt
   :language: PHP

Attach a Policy to a User

Imports

.. literalinclude::  iam.php.attach_user_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.attach_user_policy.main.txt
   :language: PHP

Attach a Policy to a Group

Imports

.. literalinclude::  iam.php.attach_group_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.attach_group_policy.main.txt
   :language: PHP

Detach a User Policy

Imports

.. literalinclude::  iam.php.detach_user_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.detach_user_policy.main.txt
   :language: PHP

Detach a Group Policy

Imports

.. literalinclude::  iam.php.detach_group_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.detach_group_policy.main.txt
   :language: PHP

Delete a Policy

Imports

.. literalinclude::  iam.php.delete_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.delete_policy.main.txt
   :language: PHP

Delete a Role Policy

Imports

.. literalinclude::  iam.php.delete_role_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.delete_role_policy.main.txt
   :language: PHP

Delete a User Policy

Imports

.. literalinclude::  iam.php.delete_user_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.delete_user_policy.main.txt
   :language: PHP

Delete a Group Policy

Imports

.. literalinclude::  iam.php.delete_group_policy.import.txt
   :language: PHP

Sample Code

.. literalinclude:: iam.php.delete_group_policy.main.txt
   :language: PHP
You can’t perform that action at this time.