class Policies extends Resource (View source)

The "policies" collection of methods.

Typical usage is:

 $iamService = new Google\Service\Iam(...);
 $policies = $iamService->policies;

Methods

createPolicy(string $parent, GoogleIamV2Policy $postBody, array $optParams = [])

Creates a policy. (policies.createPolicy)

delete(string $name, array $optParams = [])

Deletes a policy. This action is permanent. (policies.delete)

get(string $name, array $optParams = [])

Gets a policy. (policies.get)

listPolicies(string $parent, array $optParams = [])

Retrieves the policies of the specified kind that are attached to a resource.

update(string $name, GoogleIamV2Policy $postBody, array $optParams = [])

Updates the specified policy. You can update only the rules and the display name for the policy. To update a policy, you should use a read-modify-write loop: 1. Use GetPolicy to read the current version of the policy. 2. Modify the policy as needed. 3. Use UpdatePolicy to write the updated policy. This pattern helps prevent conflicts between concurrent updates. (policies.update)

Details

GoogleLongrunningOperation createPolicy(string $parent, GoogleIamV2Policy $postBody, array $optParams = [])

Creates a policy. (policies.createPolicy)

Parameters

string $parent

Required. The resource that the policy is attached to, along with the kind of policy to create. Format: policies/{attachment_point}/denypolicies The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, /, must be written as %2F. For example, policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy- project/denypolicies. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID.

GoogleIamV2Policy $postBody
array $optParams

Optional parameters.

Return Value

GoogleLongrunningOperation

Exceptions

Exception

GoogleLongrunningOperation delete(string $name, array $optParams = [])

Deletes a policy. This action is permanent. (policies.delete)

Parameters

string $name

Required. The resource name of the policy to delete. Format: policies/{attachment_point}/denypolicies/{policy_id} Use the URL- encoded full resource name, which means that the forward-slash character, /, must be written as %2F. For example, policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy- project/denypolicies/my-policy. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID.

array $optParams

Optional parameters.

Return Value

GoogleLongrunningOperation

Exceptions

Exception

GoogleIamV2Policy get(string $name, array $optParams = [])

Gets a policy. (policies.get)

Parameters

string $name

Required. The resource name of the policy to retrieve. Format: policies/{attachment_point}/denypolicies/{policy_id} Use the URL- encoded full resource name, which means that the forward-slash character, /, must be written as %2F. For example, policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy- project/denypolicies/my-policy. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID.

array $optParams

Optional parameters.

Return Value

GoogleIamV2Policy

Exceptions

Exception

GoogleIamV2ListPoliciesResponse listPolicies(string $parent, array $optParams = [])

Retrieves the policies of the specified kind that are attached to a resource.

The response lists only policy metadata. In particular, policy rules are omitted. (policies.listPolicies)

Parameters

string $parent

Required. The resource that the policy is attached to, along with the kind of policy to list. Format: policies/{attachment_point}/denypolicies The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, /, must be written as %2F. For example, policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy- project/denypolicies. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID.

array $optParams

Optional parameters.

Return Value

GoogleIamV2ListPoliciesResponse

Exceptions

Exception

GoogleLongrunningOperation update(string $name, GoogleIamV2Policy $postBody, array $optParams = [])

Updates the specified policy. You can update only the rules and the display name for the policy. To update a policy, you should use a read-modify-write loop: 1. Use GetPolicy to read the current version of the policy. 2. Modify the policy as needed. 3. Use UpdatePolicy to write the updated policy. This pattern helps prevent conflicts between concurrent updates. (policies.update)

Parameters

string $name

Immutable. The resource name of the Policy, which must be unique. Format: policies/{attachment_point}/denypolicies/{policy_id} The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, /, must be written as %2F. For example, policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy- project/denypolicies/my-deny-policy. For organizations and folders, use the numeric ID in the full resource name. For projects, requests can use the alphanumeric or the numeric ID. Responses always contain the numeric ID.

GoogleIamV2Policy $postBody
array $optParams

Optional parameters.

Return Value

GoogleLongrunningOperation

Exceptions

Exception