Google Cloud Org Policy V2 Client - Class Policy (1.1.1)

Reference documentation and code samples for the Google Cloud Org Policy V2 Client class Policy.

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

Generated from protobuf message google.cloud.orgpolicy.v2.Policy

Namespace

Google \ Cloud \ OrgPolicy \ V2

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ 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 PolicySpec

Basic information about the Organization Policy.

↳ alternate AlternatePolicySpec

Deprecated.

↳ dry_run_spec PolicySpec

Dry-run policy. Audit-only policy, can be used to monitor how the policy would have impacted the existing and future resources if it's enforced.

↳ etag string

Optional. An opaque tag indicating the current state of the policy, used for concurrency control. This '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.

getName

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.

Returns
Type Description
string

setName

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.

Parameter
Name Description
var string
Returns
Type Description
$this

getSpec

Basic information about the Organization Policy.

Returns
Type Description
PolicySpec|null

hasSpec

clearSpec

setSpec

Basic information about the Organization Policy.

Parameter
Name Description
var PolicySpec
Returns
Type Description
$this

getAlternate

Deprecated.

Returns
Type Description
AlternatePolicySpec|null

hasAlternate

clearAlternate

setAlternate

Deprecated.

Parameter
Name Description
var AlternatePolicySpec
Returns
Type Description
$this

getDryRunSpec

Dry-run policy.

Audit-only policy, can be used to monitor how the policy would have impacted the existing and future resources if it's enforced.

Returns
Type Description
PolicySpec|null

hasDryRunSpec

clearDryRunSpec

setDryRunSpec

Dry-run policy.

Audit-only policy, can be used to monitor how the policy would have impacted the existing and future resources if it's enforced.

Parameter
Name Description
var PolicySpec
Returns
Type Description
$this

getEtag

Optional. An opaque tag indicating the current state of the policy, used for concurrency control. This '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.

Returns
Type Description
string

setEtag

Optional. An opaque tag indicating the current state of the policy, used for concurrency control. This '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.

Parameter
Name Description
var string
Returns
Type Description
$this