Class GuestPolicies.Assignment.Builder (2.5.2)

public static final class GuestPolicies.Assignment.Builder extends GeneratedMessageV3.Builder<GuestPolicies.Assignment.Builder> implements GuestPolicies.AssignmentOrBuilder

An assignment represents the group or groups of VM instances that the policy applies to. If an assignment is empty, it applies to all VM instances. Otherwise, the targeted VM instances must meet all the criteria specified. So if both labels and zones are specified, the policy applies to VM instances with those labels and in those zones.

Protobuf type google.cloud.osconfig.v1beta.Assignment

Static Methods

getDescriptor()

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

Methods

addAllGroupLabels(Iterable<? extends GuestPolicies.Assignment.GroupLabel> values)

public GuestPolicies.Assignment.Builder addAllGroupLabels(Iterable<? extends GuestPolicies.Assignment.GroupLabel> values)

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Parameter
NameDescription
valuesIterable<? extends com.google.cloud.osconfig.v1beta.GuestPolicies.Assignment.GroupLabel>
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addAllInstanceNamePrefixes(Iterable<String> values)

public GuestPolicies.Assignment.Builder addAllInstanceNamePrefixes(Iterable<String> values)

Targets VM instances whose name starts with one of these prefixes. Like labels, this is another way to group VM instances when targeting configs, for example prefix="prod-". Only supported for project-level policies.

repeated string instance_name_prefixes = 4;

Parameter
NameDescription
valuesIterable<String>

The instanceNamePrefixes to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addAllInstances(Iterable<String> values)

public GuestPolicies.Assignment.Builder addAllInstances(Iterable<String> values)

Targets any of the instances specified. Instances are specified by their URI in the form zones/[ZONE]/instances/[INSTANCE_NAME]. Instance targeting is uncommon and is supported to facilitate the management of changes by the instance or to target specific VM instances for development and testing. Only supported for project-level policies and must reference instances within this project.

repeated string instances = 3;

Parameter
NameDescription
valuesIterable<String>

The instances to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addAllOsTypes(Iterable<? extends GuestPolicies.Assignment.OsType> values)

public GuestPolicies.Assignment.Builder addAllOsTypes(Iterable<? extends GuestPolicies.Assignment.OsType> values)

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Parameter
NameDescription
valuesIterable<? extends com.google.cloud.osconfig.v1beta.GuestPolicies.Assignment.OsType>
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addAllZones(Iterable<String> values)

public GuestPolicies.Assignment.Builder addAllZones(Iterable<String> values)

Targets instances in any of these zones. Leave empty to target instances in any zone. Zonal targeting is uncommon and is supported to facilitate the management of changes by zone.

repeated string zones = 2;

Parameter
NameDescription
valuesIterable<String>

The zones to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addGroupLabels(GuestPolicies.Assignment.GroupLabel value)

public GuestPolicies.Assignment.Builder addGroupLabels(GuestPolicies.Assignment.GroupLabel value)

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Parameter
NameDescription
valueGuestPolicies.Assignment.GroupLabel
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addGroupLabels(GuestPolicies.Assignment.GroupLabel.Builder builderForValue)

public GuestPolicies.Assignment.Builder addGroupLabels(GuestPolicies.Assignment.GroupLabel.Builder builderForValue)

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Parameter
NameDescription
builderForValueGuestPolicies.Assignment.GroupLabel.Builder
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addGroupLabels(int index, GuestPolicies.Assignment.GroupLabel value)

public GuestPolicies.Assignment.Builder addGroupLabels(int index, GuestPolicies.Assignment.GroupLabel value)

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Parameters
NameDescription
indexint
valueGuestPolicies.Assignment.GroupLabel
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addGroupLabels(int index, GuestPolicies.Assignment.GroupLabel.Builder builderForValue)

public GuestPolicies.Assignment.Builder addGroupLabels(int index, GuestPolicies.Assignment.GroupLabel.Builder builderForValue)

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Parameters
NameDescription
indexint
builderForValueGuestPolicies.Assignment.GroupLabel.Builder
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addGroupLabelsBuilder()

public GuestPolicies.Assignment.GroupLabel.Builder addGroupLabelsBuilder()

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Returns
TypeDescription
GuestPolicies.Assignment.GroupLabel.Builder

addGroupLabelsBuilder(int index)

public GuestPolicies.Assignment.GroupLabel.Builder addGroupLabelsBuilder(int index)

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Parameter
NameDescription
indexint
Returns
TypeDescription
GuestPolicies.Assignment.GroupLabel.Builder

addInstanceNamePrefixes(String value)

public GuestPolicies.Assignment.Builder addInstanceNamePrefixes(String value)

Targets VM instances whose name starts with one of these prefixes. Like labels, this is another way to group VM instances when targeting configs, for example prefix="prod-". Only supported for project-level policies.

repeated string instance_name_prefixes = 4;

Parameter
NameDescription
valueString

The instanceNamePrefixes to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addInstanceNamePrefixesBytes(ByteString value)

public GuestPolicies.Assignment.Builder addInstanceNamePrefixesBytes(ByteString value)

Targets VM instances whose name starts with one of these prefixes. Like labels, this is another way to group VM instances when targeting configs, for example prefix="prod-". Only supported for project-level policies.

repeated string instance_name_prefixes = 4;

Parameter
NameDescription
valueByteString

The bytes of the instanceNamePrefixes to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addInstances(String value)

public GuestPolicies.Assignment.Builder addInstances(String value)

Targets any of the instances specified. Instances are specified by their URI in the form zones/[ZONE]/instances/[INSTANCE_NAME]. Instance targeting is uncommon and is supported to facilitate the management of changes by the instance or to target specific VM instances for development and testing. Only supported for project-level policies and must reference instances within this project.

repeated string instances = 3;

Parameter
NameDescription
valueString

The instances to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addInstancesBytes(ByteString value)

public GuestPolicies.Assignment.Builder addInstancesBytes(ByteString value)

Targets any of the instances specified. Instances are specified by their URI in the form zones/[ZONE]/instances/[INSTANCE_NAME]. Instance targeting is uncommon and is supported to facilitate the management of changes by the instance or to target specific VM instances for development and testing. Only supported for project-level policies and must reference instances within this project.

repeated string instances = 3;

Parameter
NameDescription
valueByteString

The bytes of the instances to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addOsTypes(GuestPolicies.Assignment.OsType value)

public GuestPolicies.Assignment.Builder addOsTypes(GuestPolicies.Assignment.OsType value)

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Parameter
NameDescription
valueGuestPolicies.Assignment.OsType
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addOsTypes(GuestPolicies.Assignment.OsType.Builder builderForValue)

public GuestPolicies.Assignment.Builder addOsTypes(GuestPolicies.Assignment.OsType.Builder builderForValue)

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Parameter
NameDescription
builderForValueGuestPolicies.Assignment.OsType.Builder
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addOsTypes(int index, GuestPolicies.Assignment.OsType value)

public GuestPolicies.Assignment.Builder addOsTypes(int index, GuestPolicies.Assignment.OsType value)

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Parameters
NameDescription
indexint
valueGuestPolicies.Assignment.OsType
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addOsTypes(int index, GuestPolicies.Assignment.OsType.Builder builderForValue)

public GuestPolicies.Assignment.Builder addOsTypes(int index, GuestPolicies.Assignment.OsType.Builder builderForValue)

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Parameters
NameDescription
indexint
builderForValueGuestPolicies.Assignment.OsType.Builder
Returns
TypeDescription
GuestPolicies.Assignment.Builder

addOsTypesBuilder()

public GuestPolicies.Assignment.OsType.Builder addOsTypesBuilder()

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Returns
TypeDescription
GuestPolicies.Assignment.OsType.Builder

addOsTypesBuilder(int index)

public GuestPolicies.Assignment.OsType.Builder addOsTypesBuilder(int index)

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Parameter
NameDescription
indexint
Returns
TypeDescription
GuestPolicies.Assignment.OsType.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

addZones(String value)

public GuestPolicies.Assignment.Builder addZones(String value)

Targets instances in any of these zones. Leave empty to target instances in any zone. Zonal targeting is uncommon and is supported to facilitate the management of changes by zone.

repeated string zones = 2;

Parameter
NameDescription
valueString

The zones to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

addZonesBytes(ByteString value)

public GuestPolicies.Assignment.Builder addZonesBytes(ByteString value)

Targets instances in any of these zones. Leave empty to target instances in any zone. Zonal targeting is uncommon and is supported to facilitate the management of changes by zone.

repeated string zones = 2;

Parameter
NameDescription
valueByteString

The bytes of the zones to add.

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

build()

public GuestPolicies.Assignment build()
Returns
TypeDescription
GuestPolicies.Assignment

buildPartial()

public GuestPolicies.Assignment buildPartial()
Returns
TypeDescription
GuestPolicies.Assignment

clear()

public GuestPolicies.Assignment.Builder clear()
Returns
TypeDescription
GuestPolicies.Assignment.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

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

clearGroupLabels()

public GuestPolicies.Assignment.Builder clearGroupLabels()

Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging".

repeated .google.cloud.osconfig.v1beta.Assignment.GroupLabel group_labels = 1;

Returns
TypeDescription
GuestPolicies.Assignment.Builder

clearInstanceNamePrefixes()

public GuestPolicies.Assignment.Builder clearInstanceNamePrefixes()

Targets VM instances whose name starts with one of these prefixes. Like labels, this is another way to group VM instances when targeting configs, for example prefix="prod-". Only supported for project-level policies.

repeated string instance_name_prefixes = 4;

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

clearInstances()

public GuestPolicies.Assignment.Builder clearInstances()

Targets any of the instances specified. Instances are specified by their URI in the form zones/[ZONE]/instances/[INSTANCE_NAME]. Instance targeting is uncommon and is supported to facilitate the management of changes by the instance or to target specific VM instances for development and testing. Only supported for project-level policies and must reference instances within this project.

repeated string instances = 3;

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearOsTypes()

public GuestPolicies.Assignment.Builder clearOsTypes()

Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included.

repeated .google.cloud.osconfig.v1beta.Assignment.OsType os_types = 5;

Returns
TypeDescription
GuestPolicies.Assignment.Builder

clearZones()

public GuestPolicies.Assignment.Builder clearZones()

Targets instances in any of these zones. Leave empty to target instances in any zone. Zonal targeting is uncommon and is supported to facilitate the management of changes by zone.

repeated string zones = 2;

Returns
TypeDescription
GuestPolicies.Assignment.Builder

This builder for chaining.

clone()

public GuestPolicies.Assignment.Builder clone()
Returns
TypeDescription
GuestPolicies.Assignment.Builder
Overrides

getDefaultInstanceForType()

public GuestPolicies.Assignment getDefaultInstanceForType()
Returns
TypeDescription
GuestPolicies.Assignment

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getGroupLabels(int index)