Class GuestPolicies.Assignment.Builder (2.6.0)

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
value