Class OSPolicy.Builder (2.39.0)

public static final class OSPolicy.Builder extends GeneratedMessageV3.Builder<OSPolicy.Builder> implements OSPolicyOrBuilder

An OS policy defines the desired state configuration for a VM.

Protobuf type google.cloud.osconfig.v1.OSPolicy

Implements

OSPolicyOrBuilder

Static Methods

getDescriptor()

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

Methods

addAllResourceGroups(Iterable<? extends OSPolicy.ResourceGroup> values)

public OSPolicy.Builder addAllResourceGroups(Iterable<? extends OSPolicy.ResourceGroup> values)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valuesIterable<? extends com.google.cloud.osconfig.v1.OSPolicy.ResourceGroup>
Returns
TypeDescription
OSPolicy.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

addResourceGroups(OSPolicy.ResourceGroup value)

public OSPolicy.Builder addResourceGroups(OSPolicy.ResourceGroup value)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueOSPolicy.ResourceGroup
Returns
TypeDescription
OSPolicy.Builder

addResourceGroups(OSPolicy.ResourceGroup.Builder builderForValue)

public OSPolicy.Builder addResourceGroups(OSPolicy.ResourceGroup.Builder builderForValue)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
builderForValueOSPolicy.ResourceGroup.Builder
Returns
TypeDescription
OSPolicy.Builder

addResourceGroups(int index, OSPolicy.ResourceGroup value)

public OSPolicy.Builder addResourceGroups(int index, OSPolicy.ResourceGroup value)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameters
NameDescription
indexint
valueOSPolicy.ResourceGroup
Returns
TypeDescription
OSPolicy.Builder

addResourceGroups(int index, OSPolicy.ResourceGroup.Builder builderForValue)

public OSPolicy.Builder addResourceGroups(int index, OSPolicy.ResourceGroup.Builder builderForValue)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameters
NameDescription
indexint
builderForValueOSPolicy.ResourceGroup.Builder
Returns
TypeDescription
OSPolicy.Builder

addResourceGroupsBuilder()

public OSPolicy.ResourceGroup.Builder addResourceGroupsBuilder()

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
OSPolicy.ResourceGroup.Builder

addResourceGroupsBuilder(int index)

public OSPolicy.ResourceGroup.Builder addResourceGroupsBuilder(int index)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
indexint
Returns
TypeDescription
OSPolicy.ResourceGroup.Builder

build()

public OSPolicy build()
Returns
TypeDescription
OSPolicy

buildPartial()

public OSPolicy buildPartial()
Returns
TypeDescription
OSPolicy

clear()

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

clearAllowNoResourceGroupMatch()

public OSPolicy.Builder clearAllowNoResourceGroupMatch()

This flag determines the OS policy compliance status when none of the resource groups within the policy are applicable for a VM. Set this value to true if the policy needs to be reported as compliant even if the policy has nothing to validate or enforce.

bool allow_no_resource_group_match = 5;

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

clearDescription()

public OSPolicy.Builder clearDescription()

Policy description. Length of the description is limited to 1024 characters.

string description = 2;

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public OSPolicy.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
OSPolicy.Builder
Overrides

clearId()

public OSPolicy.Builder clearId()

Required. The id of the OS policy with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-63 characters.
  • Must end with a number or a letter.
  • Must be unique within the assignment.

string id = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

clearMode()

public OSPolicy.Builder clearMode()

Required. Policy mode

.google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearResourceGroups()

public OSPolicy.Builder clearResourceGroups()

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
OSPolicy.Builder

clone()

public OSPolicy.Builder clone()
Returns
TypeDescription
OSPolicy.Builder
Overrides

getAllowNoResourceGroupMatch()

public boolean getAllowNoResourceGroupMatch()

This flag determines the OS policy compliance status when none of the resource groups within the policy are applicable for a VM. Set this value to true if the policy needs to be reported as compliant even if the policy has nothing to validate or enforce.

bool allow_no_resource_group_match = 5;

Returns
TypeDescription
boolean

The allowNoResourceGroupMatch.

getDefaultInstanceForType()

public OSPolicy getDefaultInstanceForType()
Returns
TypeDescription
OSPolicy

getDescription()

public String getDescription()

Policy description. Length of the description is limited to 1024 characters.

string description = 2;

Returns
TypeDescription
String

The description.

getDescriptionBytes()

public ByteString getDescriptionBytes()

Policy description. Length of the description is limited to 1024 characters.

string description = 2;

Returns
TypeDescription
ByteString

The bytes for description.

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getId()

public String getId()

Required. The id of the OS policy with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-63 characters.
  • Must end with a number or a letter.
  • Must be unique within the assignment.

string id = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
String

The id.

getIdBytes()

public ByteString getIdBytes()

Required. The id of the OS policy with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-63 characters.
  • Must end with a number or a letter.
  • Must be unique within the assignment.

string id = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
ByteString

The bytes for id.

getMode()

public OSPolicy.Mode getMode()

Required. Policy mode

.google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
OSPolicy.Mode

The mode.

getModeValue()

public int getModeValue()

Required. Policy mode

.google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
int

The enum numeric value on the wire for mode.

getResourceGroups(int index)

public OSPolicy.ResourceGroup getResourceGroups(int index)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
indexint
Returns
TypeDescription
OSPolicy.ResourceGroup

getResourceGroupsBuilder(int index)

public OSPolicy.ResourceGroup.Builder getResourceGroupsBuilder(int index)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
indexint
Returns
TypeDescription
OSPolicy.ResourceGroup.Builder

getResourceGroupsBuilderList()

public List<OSPolicy.ResourceGroup.Builder> getResourceGroupsBuilderList()

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
List<Builder>

getResourceGroupsCount()

public int getResourceGroupsCount()

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
int

getResourceGroupsList()

public List<OSPolicy.ResourceGroup> getResourceGroupsList()

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
List<ResourceGroup>

getResourceGroupsOrBuilder(int index)

public OSPolicy.ResourceGroupOrBuilder getResourceGroupsOrBuilder(int index)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
indexint
Returns
TypeDescription
OSPolicy.ResourceGroupOrBuilder

getResourceGroupsOrBuilderList()

public List<? extends OSPolicy.ResourceGroupOrBuilder> getResourceGroupsOrBuilderList()

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
List<? extends com.google.cloud.osconfig.v1.OSPolicy.ResourceGroupOrBuilder>

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(OSPolicy other)

public OSPolicy.Builder mergeFrom(OSPolicy other)
Parameter
NameDescription
otherOSPolicy
Returns
TypeDescription
OSPolicy.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

public OSPolicy.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
OSPolicy.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

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

removeResourceGroups(int index)

public OSPolicy.Builder removeResourceGroups(int index)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
indexint
Returns
TypeDescription
OSPolicy.Builder

setAllowNoResourceGroupMatch(boolean value)

public OSPolicy.Builder setAllowNoResourceGroupMatch(boolean value)

This flag determines the OS policy compliance status when none of the resource groups within the policy are applicable for a VM. Set this value to true if the policy needs to be reported as compliant even if the policy has nothing to validate or enforce.

bool allow_no_resource_group_match = 5;

Parameter
NameDescription
valueboolean

The allowNoResourceGroupMatch to set.

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

setDescription(String value)

public OSPolicy.Builder setDescription(String value)

Policy description. Length of the description is limited to 1024 characters.

string description = 2;

Parameter
NameDescription
valueString

The description to set.

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

setDescriptionBytes(ByteString value)

public OSPolicy.Builder setDescriptionBytes(ByteString value)

Policy description. Length of the description is limited to 1024 characters.

string description = 2;

Parameter
NameDescription
valueByteString

The bytes for description to set.

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setId(String value)

public OSPolicy.Builder setId(String value)

Required. The id of the OS policy with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-63 characters.
  • Must end with a number or a letter.
  • Must be unique within the assignment.

string id = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueString

The id to set.

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

setIdBytes(ByteString value)

public OSPolicy.Builder setIdBytes(ByteString value)

Required. The id of the OS policy with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-63 characters.
  • Must end with a number or a letter.
  • Must be unique within the assignment.

string id = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueByteString

The bytes for id to set.

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

setMode(OSPolicy.Mode value)

public OSPolicy.Builder setMode(OSPolicy.Mode value)

Required. Policy mode

.google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueOSPolicy.Mode

The mode to set.

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

setModeValue(int value)

public OSPolicy.Builder setModeValue(int value)

Required. Policy mode

.google.cloud.osconfig.v1.OSPolicy.Mode mode = 3 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueint

The enum numeric value on the wire for mode to set.

Returns
TypeDescription
OSPolicy.Builder

This builder for chaining.

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

public OSPolicy.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
OSPolicy.Builder
Overrides

setResourceGroups(int index, OSPolicy.ResourceGroup value)

public OSPolicy.Builder setResourceGroups(int index, OSPolicy.ResourceGroup value)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameters
NameDescription
indexint
valueOSPolicy.ResourceGroup
Returns
TypeDescription
OSPolicy.Builder

setResourceGroups(int index, OSPolicy.ResourceGroup.Builder builderForValue)

public OSPolicy.Builder setResourceGroups(int index, OSPolicy.ResourceGroup.Builder builderForValue)

Required. List of resource groups for the policy. For a particular VM, resource groups are evaluated in the order specified and the first resource group that is applicable is selected and the rest are ignored.

If none of the resource groups are applicable for a VM, the VM is considered to be non-compliant w.r.t this policy. This behavior can be toggled by the flag allow_no_resource_group_match

repeated .google.cloud.osconfig.v1.OSPolicy.ResourceGroup resource_groups = 4 [(.google.api.field_behavior) = REQUIRED];

Parameters
NameDescription
indexint
builderForValueOSPolicy.ResourceGroup.Builder
Returns
TypeDescription
OSPolicy.Builder

setUnknownFields(UnknownFieldSet unknownFields)

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