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

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

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

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

Methods

__construct

Constructor.

Parameters
NameDescription
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 Google\Cloud\OrgPolicy\V2\PolicySpec

Basic information about the Organization Policy.

↳ alternate Google\Cloud\OrgPolicy\V2\AlternatePolicySpec

Deprecated.

↳ dry_run_spec Google\Cloud\OrgPolicy\V2\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.

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
TypeDescription
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
NameDescription
var string
Returns
TypeDescription
$this

getSpec

Basic information about the Organization Policy.

Returns
TypeDescription
Google\Cloud\OrgPolicy\V2\PolicySpec|null

hasSpec

clearSpec

setSpec

Basic information about the Organization Policy.

Parameter
NameDescription
var Google\Cloud\OrgPolicy\V2\PolicySpec
Returns
TypeDescription
$this

getAlternate

Deprecated.

Returns
TypeDescription
Google\Cloud\OrgPolicy\V2\AlternatePolicySpec|null

hasAlternate

clearAlternate

setAlternate

Deprecated.

Parameter
NameDescription
var Google\Cloud\OrgPolicy\V2\AlternatePolicySpec
Returns
TypeDescription
$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
TypeDescription
Google\Cloud\OrgPolicy\V2\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
NameDescription
var Google\Cloud\OrgPolicy\V2\PolicySpec
Returns
TypeDescription
$this