REST Resource: folders.policies

Resource: Policy

Defines a Cloud Organization Policy which is used to specify Constraints for configurations of Cloud Platform resources.

JSON representation
{
  "name": string,
  "spec": {
    object (PolicySpec)
  }
}
Fields
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 which this Policy configures: * projects/{project_number}/policies/{constraint_name} * folders/{folder_id}/policies/{constraint_name} * organizations/{organization_id}/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

object (PolicySpec)

Basic information about the Organization Policy.

PolicySpec

Defines a Cloud Organization PolicySpec which is used to specify Constraints for configurations of Cloud Platform resources.

JSON representation
{
  "etag": string,
  "updateTime": string,
  "rules": [
    {
      object (PolicyRule)
    }
  ],
  "inheritFromParent": boolean,
  "reset": boolean
}
Fields
etag

string

An opaque tag indicating the current version of the Policy, used for concurrency control.

This field is ignored if used in a policies.create request.

When the Policy is returned from either a policies.get or a policies.list request, this etag indicates the version of the current Policy to use when executing a read-modify-write loop.

When the Policy is returned from a policies.getEffectivePolicy request, the etag will be unset.

updateTime

string (Timestamp format)

Output only. The time stamp this was previously updated. This represents the last time a call to policies.create or policies.patch was made for that Policy.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

rules[]

object (PolicyRule)

Up to 10 PolicyRules are allowed.

In Policies for boolean constraints, the following requirements apply: - There must be one and only one PolicyRule where condition is unset. - BooleanPolicyRules with conditions must set enforced to the opposite of the PolicyRule without a condition. - During policy evaluation, PolicyRules with conditions that are true for a target resource take precedence.

inheritFromParent

boolean

Determines the inheritance behavior for this Policy.

If inheritFromParent is true, PolicyRules set higher up in the hierarchy (up to the closest root) are inherited and present in the effective policy. If it is false, then no rules are inherited, and this Policy becomes the new root for evaluation. This field can be set only for Policies which configure list constraints.

reset

boolean

Ignores policies set above this resource and restores the constraintDefault enforcement behavior of the specific Constraint at this resource. This field can be set in policies for either list or boolean constraints. If set, rules must be empty and inheritFromParent must be set to false.

PolicyRule

A rule used to express this policy.

JSON representation
{
  "condition": {
    object (Expr)
  },

  // Union field kind can be only one of the following:
  "values": {
    object (StringValues)
  },
  "allowAll": boolean,
  "denyAll": boolean,
  "enforce": boolean
  // End of list of possible types for union field kind.
}
Fields
condition

object (Expr)

A condition which determines whether this rule is used in the evaluation of the policy. When set, the expression field in the `Expr' must include from 1 to 10 subexpressions, joined by the "||" or "&&" operators. Each subexpression must be of the form "resource.matchTag('/tag_key_short_name, 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id', 'tagValues/value_id')". where key_name and value_name are the resource names for Label Keys and Values. These names are available from the Tag Manager Service. An example expression is: "resource.matchTag('123456789/environment, 'prod')". or "resource.matchTagId('tagKeys/123', 'tagValues/456')".

Union field kind.

kind can be only one of the following:

values

object (StringValues)

List of values to be used for this PolicyRule. This field can be set only in Policies for list constraints.

allowAll

boolean

Setting this to true means that all values are allowed. This field can be set only in Policies for list constraints.

denyAll

boolean

Setting this to true means that all values are denied. This field can be set only in Policies for list constraints.

enforce

boolean

If true, then the Policy is enforced. If false, then any configuration is acceptable. This field can be set only in Policies for boolean constraints.

StringValues

A message that holds specific allowed and denied values. This message can define specific values and subtrees of Cloud Resource Manager resource hierarchy (Organizations, Folders, Projects) that are allowed or denied. This is achieved by using the under: and optional is: prefixes. The under: prefix is used to denote resource subtree values. The is: prefix is used to denote specific values, and is required only if the value contains a ":". Values prefixed with "is:" are treated the same as values with no prefix. Ancestry subtrees must be in one of the following formats: - "projects/", e.g. "projects/tokyo-rain-123" - "folders/", e.g. "folders/1234" - "organizations/", e.g. "organizations/1234" The supportsUnder field of the associated Constraint defines whether ancestry prefixes can be used.

JSON representation
{
  "allowedValues": [
    string
  ],
  "deniedValues": [
    string
  ]
}
Fields
allowedValues[]

string

List of values allowed at this resource.

deniedValues[]

string

List of values denied at this resource.

Expr

Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec.

Example (Comparison):

title: "Summary size limit"
description: "Determines if a summary is less than 100 chars"
expression: "document.summary.size() < 100"

Example (Equality):

title: "Requestor is owner"
description: "Determines if requestor is the document owner"
expression: "document.owner == request.auth.claims.email"

Example (Logic):

title: "Public documents"
description: "Determine whether the document should be publicly visible"
expression: "document.type != 'private' && document.type != 'internal'"

Example (Data Manipulation):

title: "Notification string"
description: "Create a notification string with a timestamp."
expression: "'New message received at ' + string(document.create_time)"

The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.

JSON representation
{
  "expression": string,
  "title": string,
  "description": string,
  "location": string
}
Fields
expression

string

Textual representation of an expression in Common Expression Language syntax.

title

string

Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.

description

string

Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

location

string

Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.

Methods

create

Creates a Policy.

delete

Deletes a Policy.

get

Gets a Policy on a resource.

getEffectivePolicy

Gets the effective Policy on a resource.

list

Retrieves all of the Policies that exist on a particular resource.

patch

Updates a Policy.