Class Policy.Builder (2.46.0)

public static final class Policy.Builder extends GeneratedMessageV3.Builder<Policy.Builder> implements PolicyOrBuilder

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

Protobuf type google.cloud.orgpolicy.v2.Policy

Implements

PolicyOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Policy.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Policy.Builder
Overrides

build()

public Policy build()
Returns
Type Description
Policy

buildPartial()

public Policy buildPartial()
Returns
Type Description
Policy

clear()

public Policy.Builder clear()
Returns
Type Description
Policy.Builder
Overrides

clearAlternate() (deprecated)

public Policy.Builder clearAlternate()

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Returns
Type Description
Policy.Builder

clearDryRunSpec()

public Policy.Builder clearDryRunSpec()

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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Returns
Type Description
Policy.Builder

clearEtag()

public Policy.Builder clearEtag()

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.

string etag = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Policy.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public Policy.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
Policy.Builder
Overrides

clearName()

public Policy.Builder clearName()

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.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
Policy.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public Policy.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
Policy.Builder
Overrides

clearSpec()

public Policy.Builder clearSpec()

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Returns
Type Description
Policy.Builder

clone()

public Policy.Builder clone()
Returns
Type Description
Policy.Builder
Overrides

getAlternate() (deprecated)

public AlternatePolicySpec getAlternate()

Deprecated. google.cloud.orgpolicy.v2.Policy.alternate is deprecated. See google/cloud/orgpolicy/v2/orgpolicy.proto;l=270

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Returns
Type Description
AlternatePolicySpec

The alternate.

getAlternateBuilder() (deprecated)

public AlternatePolicySpec.Builder getAlternateBuilder()

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Returns
Type Description
AlternatePolicySpec.Builder

getAlternateOrBuilder() (deprecated)

public AlternatePolicySpecOrBuilder getAlternateOrBuilder()

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Returns
Type Description
AlternatePolicySpecOrBuilder

getDefaultInstanceForType()

public Policy getDefaultInstanceForType()
Returns
Type Description
Policy

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getDryRunSpec()

public PolicySpec 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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Returns
Type Description
PolicySpec

The dryRunSpec.

getDryRunSpecBuilder()

public PolicySpec.Builder getDryRunSpecBuilder()

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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Returns
Type Description
PolicySpec.Builder

getDryRunSpecOrBuilder()

public PolicySpecOrBuilder getDryRunSpecOrBuilder()

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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Returns
Type Description
PolicySpecOrBuilder

getEtag()

public String 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.

string etag = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The etag.

getEtagBytes()

public ByteString getEtagBytes()

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.

string etag = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for etag.

getName()

public String 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.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

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.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
ByteString

The bytes for name.

getSpec()

public PolicySpec getSpec()

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Returns
Type Description
PolicySpec

The spec.

getSpecBuilder()

public PolicySpec.Builder getSpecBuilder()

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Returns
Type Description
PolicySpec.Builder

getSpecOrBuilder()

public PolicySpecOrBuilder getSpecOrBuilder()

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Returns
Type Description
PolicySpecOrBuilder

hasAlternate() (deprecated)

public boolean hasAlternate()

Deprecated. google.cloud.orgpolicy.v2.Policy.alternate is deprecated. See google/cloud/orgpolicy/v2/orgpolicy.proto;l=270

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Returns
Type Description
boolean

Whether the alternate field is set.

hasDryRunSpec()

public boolean hasDryRunSpec()

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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Returns
Type Description
boolean

Whether the dryRunSpec field is set.

hasSpec()

public boolean hasSpec()

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Returns
Type Description
boolean

Whether the spec field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeAlternate(AlternatePolicySpec value) (deprecated)

public Policy.Builder mergeAlternate(AlternatePolicySpec value)

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Parameter
Name Description
value AlternatePolicySpec
Returns
Type Description
Policy.Builder

mergeDryRunSpec(PolicySpec value)

public Policy.Builder mergeDryRunSpec(PolicySpec value)

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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Parameter
Name Description
value PolicySpec
Returns
Type Description
Policy.Builder

mergeFrom(Policy other)

public Policy.Builder mergeFrom(Policy other)
Parameter
Name Description
other Policy
Returns
Type Description
Policy.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Policy.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Policy.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public Policy.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
Policy.Builder
Overrides

mergeSpec(PolicySpec value)

public Policy.Builder mergeSpec(PolicySpec value)

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Parameter
Name Description
value PolicySpec
Returns
Type Description
Policy.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Policy.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Policy.Builder
Overrides

setAlternate(AlternatePolicySpec value) (deprecated)

public Policy.Builder setAlternate(AlternatePolicySpec value)

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Parameter
Name Description
value AlternatePolicySpec
Returns
Type Description
Policy.Builder

setAlternate(AlternatePolicySpec.Builder builderForValue) (deprecated)

public Policy.Builder setAlternate(AlternatePolicySpec.Builder builderForValue)

Deprecated.

.google.cloud.orgpolicy.v2.AlternatePolicySpec alternate = 3 [deprecated = true];

Parameter
Name Description
builderForValue AlternatePolicySpec.Builder
Returns
Type Description
Policy.Builder

setDryRunSpec(PolicySpec value)

public Policy.Builder setDryRunSpec(PolicySpec value)

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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Parameter
Name Description
value PolicySpec
Returns
Type Description
Policy.Builder

setDryRunSpec(PolicySpec.Builder builderForValue)

public Policy.Builder setDryRunSpec(PolicySpec.Builder builderForValue)

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.

.google.cloud.orgpolicy.v2.PolicySpec dry_run_spec = 4;

Parameter
Name Description
builderForValue PolicySpec.Builder
Returns
Type Description
Policy.Builder

setEtag(String value)

public Policy.Builder setEtag(String value)

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.

string etag = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The etag to set.

Returns
Type Description
Policy.Builder

This builder for chaining.

setEtagBytes(ByteString value)

public Policy.Builder setEtagBytes(ByteString value)

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.

string etag = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for etag to set.

Returns
Type Description
Policy.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public Policy.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Policy.Builder
Overrides

setName(String value)

public Policy.Builder setName(String value)

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.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value String

The name to set.

Returns
Type Description
Policy.Builder

This builder for chaining.

setNameBytes(ByteString value)

public Policy.Builder setNameBytes(ByteString value)

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.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value ByteString

The bytes for name to set.

Returns
Type Description
Policy.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public Policy.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
Policy.Builder
Overrides

setSpec(PolicySpec value)

public Policy.Builder setSpec(PolicySpec value)

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Parameter
Name Description
value PolicySpec
Returns
Type Description
Policy.Builder

setSpec(PolicySpec.Builder builderForValue)

public Policy.Builder setSpec(PolicySpec.Builder builderForValue)

Basic information about the Organization Policy.

.google.cloud.orgpolicy.v2.PolicySpec spec = 2;

Parameter
Name Description
builderForValue PolicySpec.Builder
Returns
Type Description
Policy.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final Policy.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Policy.Builder
Overrides