Class Policy.Builder (2.28.0)

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

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

Protobuf type google.cloud.orgpolicy.v2.Policy

Implements

PolicyOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Policy.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Policy.Builder
Overrides

build()

public Policy build()
Returns
TypeDescription
Policy

buildPartial()

public Policy buildPartial()
Returns
TypeDescription
Policy

clear()

public Policy.Builder clear()
Returns
TypeDescription
Policy.Builder
Overrides

clearAlternate()

public Policy.Builder clearAlternate()

Deprecated.

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

Returns
TypeDescription
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
TypeDescription
Policy.Builder

clearField(Descriptors.FieldDescriptor field)

public Policy.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
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
TypeDescription
Policy.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public Policy.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
Policy.Builder
Overrides

clearSpec()

public Policy.Builder clearSpec()

Basic information about the Organization Policy.

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

Returns
TypeDescription
Policy.Builder

clone()

public Policy.Builder clone()
Returns
TypeDescription
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=204

Deprecated.

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

Returns
TypeDescription
AlternatePolicySpec

The alternate.

getAlternateBuilder()

public AlternatePolicySpec.Builder getAlternateBuilder()

Deprecated.

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

Returns
TypeDescription
AlternatePolicySpec.Builder

getAlternateOrBuilder()

public AlternatePolicySpecOrBuilder getAlternateOrBuilder()

Deprecated.

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

Returns
TypeDescription
AlternatePolicySpecOrBuilder

getDefaultInstanceForType()

public Policy getDefaultInstanceForType()
Returns
TypeDescription
Policy

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
PolicySpecOrBuilder

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
TypeDescription
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
TypeDescription
ByteString

The bytes for name.

getSpec()

public PolicySpec getSpec()

Basic information about the Organization Policy.

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

Returns
TypeDescription
PolicySpec

The spec.

getSpecBuilder()

public PolicySpec.Builder getSpecBuilder()

Basic information about the Organization Policy.

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

Returns
TypeDescription
PolicySpec.Builder

getSpecOrBuilder()

public PolicySpecOrBuilder getSpecOrBuilder()

Basic information about the Organization Policy.

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

Returns
TypeDescription
PolicySpecOrBuilder

hasAlternate() (deprecated)

public boolean hasAlternate()

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

Deprecated.

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
boolean

Whether the spec field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeAlternate(AlternatePolicySpec value)

public Policy.Builder mergeAlternate(AlternatePolicySpec value)

Deprecated.

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

Parameter
NameDescription
valueAlternatePolicySpec
Returns
TypeDescription
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
NameDescription
valuePolicySpec
Returns
TypeDescription
Policy.Builder

mergeFrom(Policy other)

public Policy.Builder mergeFrom(Policy other)
Parameter
NameDescription
otherPolicy
Returns
TypeDescription
Policy.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Policy.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Policy.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public Policy.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
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
NameDescription
valuePolicySpec
Returns
TypeDescription
Policy.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Policy.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Policy.Builder
Overrides

setAlternate(AlternatePolicySpec value)

public Policy.Builder setAlternate(AlternatePolicySpec value)

Deprecated.

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

Parameter
NameDescription
valueAlternatePolicySpec
Returns
TypeDescription
Policy.Builder

setAlternate(AlternatePolicySpec.Builder builderForValue)

public Policy.Builder setAlternate(AlternatePolicySpec.Builder builderForValue)

Deprecated.

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

Parameter
NameDescription
builderForValueAlternatePolicySpec.Builder
Returns
TypeDescription
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
NameDescription
valuePolicySpec
Returns
TypeDescription
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
NameDescription
builderForValuePolicySpec.Builder
Returns
TypeDescription
Policy.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public Policy.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
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
NameDescription
valueString

The name to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
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
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
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
NameDescription
valuePolicySpec
Returns
TypeDescription
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
NameDescription
builderForValuePolicySpec.Builder
Returns
TypeDescription
Policy.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final Policy.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Policy.Builder
Overrides