Class AllocationPolicy (0.15.0)
Note: Some or all of the information on this page might not apply
to Trusted Cloud. For a list of services that are available in
Trusted Cloud, see Services available for
Trusted Cloud .
Version 0.15.0keyboard_arrow_down
public final class AllocationPolicy extends GeneratedMessageV3 implements AllocationPolicyOrBuilder
A Job's resource allocation policy describes when, where, and how compute
resources should be allocated for the Job.
Protobuf type google.cloud.batch.v1.AllocationPolicy
Static Fields
INSTANCES_FIELD_NUMBER
public static final int INSTANCES_FIELD_NUMBER
Field Value
Type
Description
int
LABELS_FIELD_NUMBER
public static final int LABELS_FIELD_NUMBER
Field Value
Type
Description
int
LOCATION_FIELD_NUMBER
public static final int LOCATION_FIELD_NUMBER
Field Value
Type
Description
int
NETWORK_FIELD_NUMBER
public static final int NETWORK_FIELD_NUMBER
Field Value
Type
Description
int
SERVICE_ACCOUNT_FIELD_NUMBER
public static final int SERVICE_ACCOUNT_FIELD_NUMBER
Field Value
Type
Description
int
Static Methods
getDefaultInstance()
public static AllocationPolicy getDefaultInstance ()
getDescriptor()
public static final Descriptors . Descriptor getDescriptor ()
newBuilder()
public static AllocationPolicy . Builder newBuilder ()
newBuilder(AllocationPolicy prototype)
public static AllocationPolicy . Builder newBuilder ( AllocationPolicy prototype )
public static AllocationPolicy parseDelimitedFrom ( InputStream input )
public static AllocationPolicy parseDelimitedFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
parseFrom(byte[] data)
public static AllocationPolicy parseFrom ( byte [] data )
Parameter
Name
Description
data
byte []
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static AllocationPolicy parseFrom ( byte [] data , ExtensionRegistryLite extensionRegistry )
parseFrom(ByteString data)
public static AllocationPolicy parseFrom ( ByteString data )
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static AllocationPolicy parseFrom ( ByteString data , ExtensionRegistryLite extensionRegistry )
public static AllocationPolicy parseFrom ( CodedInputStream input )
public static AllocationPolicy parseFrom ( CodedInputStream input , ExtensionRegistryLite extensionRegistry )
public static AllocationPolicy parseFrom ( InputStream input )
public static AllocationPolicy parseFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
parseFrom(ByteBuffer data)
public static AllocationPolicy parseFrom ( ByteBuffer data )
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static AllocationPolicy parseFrom ( ByteBuffer data , ExtensionRegistryLite extensionRegistry )
parser()
public static Parser<AllocationPolicy> parser ()
Methods
containsLabels(String key)
public boolean containsLabels ( String key )
Labels applied to all VM instances and other resources
created by AllocationPolicy.
Labels could be user provided or system generated.
You can assign up to 64 labels. Google Compute Engine label
restrictions
apply.
Label names that start with "goog-" or "google-" are reserved.
map<string, string> labels = 6;
Parameter
Name
Description
key
String
equals(Object obj)
public boolean equals ( Object obj )
Parameter
Name
Description
obj
Object
Overrides
getDefaultInstanceForType()
public AllocationPolicy getDefaultInstanceForType ()
getInstances(int index)
public AllocationPolicy . InstancePolicyOrTemplate getInstances ( int index )
Describe instances that can be created by this AllocationPolicy.
Only instances[0] is supported now.
repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;
Parameter
Name
Description
index
int
getInstancesCount()
public int getInstancesCount ()
Describe instances that can be created by this AllocationPolicy.
Only instances[0] is supported now.
repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;
Returns
Type
Description
int
getInstancesList()
public List<AllocationPolicy . InstancePolicyOrTemplate > getInstancesList ()
Describe instances that can be created by this AllocationPolicy.
Only instances[0] is supported now.
repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;
getInstancesOrBuilder(int index)
public AllocationPolicy . InstancePolicyOrTemplateOrBuilder getInstancesOrBuilder ( int index )
Describe instances that can be created by this AllocationPolicy.
Only instances[0] is supported now.
repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;
Parameter
Name
Description
index
int
getInstancesOrBuilderList()
public List <? extends AllocationPolicy . InstancePolicyOrTemplateOrBuilder > getInstancesOrBuilderList ()
Describe instances that can be created by this AllocationPolicy.
Only instances[0] is supported now.
repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;
Returns
Type
Description
List <? extends com.google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplateOrBuilder >
getLabels()
public Map<String , String > getLabels ()
getLabelsCount()
public int getLabelsCount ()
Labels applied to all VM instances and other resources
created by AllocationPolicy.
Labels could be user provided or system generated.
You can assign up to 64 labels. Google Compute Engine label
restrictions
apply.
Label names that start with "goog-" or "google-" are reserved.
map<string, string> labels = 6;
Returns
Type
Description
int
getLabelsMap()
public Map<String , String > getLabelsMap ()
Labels applied to all VM instances and other resources
created by AllocationPolicy.
Labels could be user provided or system generated.
You can assign up to 64 labels. Google Compute Engine label
restrictions
apply.
Label names that start with "goog-" or "google-" are reserved.
map<string, string> labels = 6;
getLabelsOrDefault(String key, String defaultValue)
public String getLabelsOrDefault ( String key , String defaultValue )
Labels applied to all VM instances and other resources
created by AllocationPolicy.
Labels could be user provided or system generated.
You can assign up to 64 labels. Google Compute Engine label
restrictions
apply.
Label names that start with "goog-" or "google-" are reserved.
map<string, string> labels = 6;
Returns
Type
Description
String
getLabelsOrThrow(String key)
public String getLabelsOrThrow ( String key )
Labels applied to all VM instances and other resources
created by AllocationPolicy.
Labels could be user provided or system generated.
You can assign up to 64 labels. Google Compute Engine label
restrictions
apply.
Label names that start with "goog-" or "google-" are reserved.
map<string, string> labels = 6;
Parameter
Name
Description
key
String
Returns
Type
Description
String
getLocation()
public AllocationPolicy . LocationPolicy getLocation ()
Location where compute resources should be allocated for the Job.
.google.cloud.batch.v1.AllocationPolicy.LocationPolicy location = 1;
getLocationOrBuilder()
public AllocationPolicy . LocationPolicyOrBuilder getLocationOrBuilder ()
Location where compute resources should be allocated for the Job.
.google.cloud.batch.v1.AllocationPolicy.LocationPolicy location = 1;
getNetwork()
public AllocationPolicy . NetworkPolicy getNetwork ()
The network policy.
.google.cloud.batch.v1.AllocationPolicy.NetworkPolicy network = 7;
getNetworkOrBuilder()
public AllocationPolicy . NetworkPolicyOrBuilder getNetworkOrBuilder ()
The network policy.
.google.cloud.batch.v1.AllocationPolicy.NetworkPolicy network = 7;
getParserForType()
public Parser<AllocationPolicy> getParserForType ()
Overrides
getSerializedSize()
public int getSerializedSize ()
Returns
Type
Description
int
Overrides
getServiceAccount()
public ServiceAccount getServiceAccount ()
Service account that VMs will run as.
.google.cloud.batch.v1.ServiceAccount service_account = 9;
getServiceAccountOrBuilder()
public ServiceAccountOrBuilder getServiceAccountOrBuilder ()
Service account that VMs will run as.
.google.cloud.batch.v1.ServiceAccount service_account = 9;
getUnknownFields()
public final UnknownFieldSet getUnknownFields ()
Overrides
hasLocation()
public boolean hasLocation ()
Location where compute resources should be allocated for the Job.
.google.cloud.batch.v1.AllocationPolicy.LocationPolicy location = 1;
Returns
Type
Description
boolean
Whether the location field is set.
hasNetwork()
public boolean hasNetwork ()
The network policy.
.google.cloud.batch.v1.AllocationPolicy.NetworkPolicy network = 7;
Returns
Type
Description
boolean
Whether the network field is set.
hasServiceAccount()
public boolean hasServiceAccount ()
Service account that VMs will run as.
.google.cloud.batch.v1.ServiceAccount service_account = 9;
Returns
Type
Description
boolean
Whether the serviceAccount field is set.
hashCode()
Returns
Type
Description
int
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessageV3 . FieldAccessorTable internalGetFieldAccessorTable ()
Overrides
internalGetMapField(int number)
protected MapField internalGetMapField ( int number )
Parameter
Name
Description
number
int
Overrides
isInitialized()
public final boolean isInitialized ()
Overrides
newBuilderForType()
public AllocationPolicy . Builder newBuilderForType ()
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected AllocationPolicy . Builder newBuilderForType ( GeneratedMessageV3 . BuilderParent parent )
Overrides
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance ( GeneratedMessageV3 . UnusedPrivateParameter unused )
Returns
Type
Description
Object
Overrides
toBuilder()
public AllocationPolicy . Builder toBuilder ()
writeTo(CodedOutputStream output)
public void writeTo ( CodedOutputStream output )
Overrides
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-19 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-19 UTC."],[],[]]