folders

POST /v2/folders/{foldersId}/policies

Changed on

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.

Request

  • Base URL
    https://orgpolicy.googleapis.com
  • Auth
    • OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/cloud-platform
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/cloud-platform
    • or OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/organizationpolicy
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/organizationpolicy

Path parameters

foldersId, string required

Query parameters

$.xgafv, '1' | '2'

V1 error format.

access_token, string

OAuth access token.

alt, 'json' | 'media' | 'proto'

Data format for response.

callback, string

JSONP

fields, string

Selector specifying which fields to include in a partial response.

key, string

API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

oauth_token, string

OAuth 2.0 token for the current user.

prettyPrint, boolean

Returns response with indentations and line breaks.

quotaUser, string

Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

uploadType, string

Legacy upload protocol for media (e.g. "media", "multipart").

upload_protocol, string

Upload protocol for media (e.g. "raw", "multipart").

Request body

GoogleCloudOrgpolicyV2Policy required

Defines an organization policy that is used to specify constraints for configurations of Google Cloud resources.

alternate, GoogleCloudOrgpolicyV2AlternatePolicySpec

Similar to PolicySpec but with an extra 'launch' field for launch reference. The PolicySpec here is specific for dry-run.

dryRunSpec, GoogleCloudOrgpolicyV2PolicySpec

Defines a Google Cloud policy specification that is used to specify constraints for configurations of Google Cloud resources.

etag, string

Optional. An opaque tag indicating the current state of the policy, used for concurrency control. This entity tag (ETag) is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.

name, string

Immutable. The resource name of the policy. Must be one of the following forms, where constraint_name is the name of the constraint that this policy configures: * projects/{project_number}/policies/{constraint_name} * folders/{folder_number}/policies/{constraint_name} * organizations/{organization_number}/policies/{constraint_name} For example, projects/123/policies/compute.disableSerialPortAccess. Note: projects/{project_id}/policies/{constraint_name} is also an acceptable name for API requests, but responses will return the name using the equivalent project number.

spec, GoogleCloudOrgpolicyV2PolicySpec

Defines a Google Cloud policy specification that is used to specify constraints for configurations of Google Cloud resources.

Response

Successful response

GoogleCloudOrgpolicyV2Policy required

Defines an organization policy that is used to specify constraints for configurations of Google Cloud resources.

alternate, GoogleCloudOrgpolicyV2AlternatePolicySpec

Similar to PolicySpec but with an extra 'launch' field for launch reference. The PolicySpec here is specific for dry-run.

dryRunSpec, GoogleCloudOrgpolicyV2PolicySpec

Defines a Google Cloud policy specification that is used to specify constraints for configurations of Google Cloud resources.

etag, string

Optional. An opaque tag indicating the current state of the policy, used for concurrency control. This entity tag (ETag) is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.

name, string

Immutable. The resource name of the policy. Must be one of the following forms, where constraint_name is the name of the constraint that this policy configures: * projects/{project_number}/policies/{constraint_name} * folders/{folder_number}/policies/{constraint_name} * organizations/{organization_number}/policies/{constraint_name} For example, projects/123/policies/compute.disableSerialPortAccess. Note: projects/{project_id}/policies/{constraint_name} is also an acceptable name for API requests, but responses will return the name using the equivalent project number.

spec, GoogleCloudOrgpolicyV2PolicySpec

Defines a Google Cloud policy specification that is used to specify constraints for configurations of Google Cloud resources.

Changes

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/organizationpolicy was removed from the endpoint's security scheme Oauth2

    1 more change in this revision