Method: folders.policies.create

Creates a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the policy already exists on the given Google Cloud resource.

HTTP request

POST https://orgpolicy.googleapis.com/v2/{parent=folders/*}/policies

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Required. The Google Cloud resource that will parent the new policy. Must be in one of the following forms:

  • projects/{project_number}
  • projects/{projectId}
  • folders/{folder_id}
  • organizations/{organization_id}

Authorization requires the following IAM permission on the specified resource parent:

  • orgpolicy.policies.create

Request body

The request body contains an instance of Policy.

Response body

If successful, the response body contains a newly created instance of Policy.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.