Class AutoscalingPolicy (1.59.0)

public final class AutoscalingPolicy extends GeneratedMessageV3 implements AutoscalingPolicyOrBuilder

Cloud Autoscaler policy.

Protobuf type google.cloud.compute.v1.AutoscalingPolicy

Static Fields

COOL_DOWN_PERIOD_SEC_FIELD_NUMBER

public static final int COOL_DOWN_PERIOD_SEC_FIELD_NUMBER
Field Value
Type Description
int

CPU_UTILIZATION_FIELD_NUMBER

public static final int CPU_UTILIZATION_FIELD_NUMBER
Field Value
Type Description
int

CUSTOM_METRIC_UTILIZATIONS_FIELD_NUMBER

public static final int CUSTOM_METRIC_UTILIZATIONS_FIELD_NUMBER
Field Value
Type Description
int

LOAD_BALANCING_UTILIZATION_FIELD_NUMBER

public static final int LOAD_BALANCING_UTILIZATION_FIELD_NUMBER
Field Value
Type Description
int

MAX_NUM_REPLICAS_FIELD_NUMBER

public static final int MAX_NUM_REPLICAS_FIELD_NUMBER
Field Value
Type Description
int

MIN_NUM_REPLICAS_FIELD_NUMBER

public static final int MIN_NUM_REPLICAS_FIELD_NUMBER
Field Value
Type Description
int

MODE_FIELD_NUMBER

public static final int MODE_FIELD_NUMBER
Field Value
Type Description
int

SCALE_IN_CONTROL_FIELD_NUMBER

public static final int SCALE_IN_CONTROL_FIELD_NUMBER
Field Value
Type Description
int

SCALING_SCHEDULES_FIELD_NUMBER

public static final int SCALING_SCHEDULES_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static AutoscalingPolicy getDefaultInstance()
Returns
Type Description
AutoscalingPolicy

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static AutoscalingPolicy.Builder newBuilder()
Returns
Type Description
AutoscalingPolicy.Builder

newBuilder(AutoscalingPolicy prototype)

public static AutoscalingPolicy.Builder newBuilder(AutoscalingPolicy prototype)
Parameter
Name Description
prototype AutoscalingPolicy
Returns
Type Description
AutoscalingPolicy.Builder

parseDelimitedFrom(InputStream input)

public static AutoscalingPolicy parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static AutoscalingPolicy parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static AutoscalingPolicy parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static AutoscalingPolicy parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static AutoscalingPolicy parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static AutoscalingPolicy parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static AutoscalingPolicy parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static AutoscalingPolicy parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static AutoscalingPolicy parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static AutoscalingPolicy parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static AutoscalingPolicy parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static AutoscalingPolicy parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
AutoscalingPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<AutoscalingPolicy> parser()
Returns
Type Description
Parser<AutoscalingPolicy>

Methods

containsScalingSchedules(String key)

public boolean containsScalingSchedules(String key)

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.

map<string, .google.cloud.compute.v1.AutoscalingPolicyScalingSchedule> scaling_schedules = 355416580;

Parameter
Name Description
key String
Returns
Type Description
boolean

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getCoolDownPeriodSec()

public int getCoolDownPeriodSec()

The number of seconds that your application takes to initialize on a VM instance. This is referred to as the initialization period. Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process.

optional int32 cool_down_period_sec = 107692954;

Returns
Type Description
int

The coolDownPeriodSec.

getCpuUtilization()

public AutoscalingPolicyCpuUtilization getCpuUtilization()

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.

optional .google.cloud.compute.v1.AutoscalingPolicyCpuUtilization cpu_utilization = 381211147;

Returns
Type Description
AutoscalingPolicyCpuUtilization

The cpuUtilization.

getCpuUtilizationOrBuilder()

public AutoscalingPolicyCpuUtilizationOrBuilder getCpuUtilizationOrBuilder()

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.

optional .google.cloud.compute.v1.AutoscalingPolicyCpuUtilization cpu_utilization = 381211147;

Returns
Type Description
AutoscalingPolicyCpuUtilizationOrBuilder

getCustomMetricUtilizations(int index)

public AutoscalingPolicyCustomMetricUtilization getCustomMetricUtilizations(int index)

Configuration parameters of autoscaling based on a custom metric.

repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;

Parameter
Name Description
index int
Returns
Type Description
AutoscalingPolicyCustomMetricUtilization

getCustomMetricUtilizationsCount()

public int getCustomMetricUtilizationsCount()

Configuration parameters of autoscaling based on a custom metric.

repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;

Returns
Type Description
int

getCustomMetricUtilizationsList()

public List<AutoscalingPolicyCustomMetricUtilization> getCustomMetricUtilizationsList()

Configuration parameters of autoscaling based on a custom metric.

repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;

Returns
Type Description
List<AutoscalingPolicyCustomMetricUtilization>

getCustomMetricUtilizationsOrBuilder(int index)

public AutoscalingPolicyCustomMetricUtilizationOrBuilder getCustomMetricUtilizationsOrBuilder(int index)

Configuration parameters of autoscaling based on a custom metric.

repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;

Parameter
Name Description
index int
Returns
Type Description
AutoscalingPolicyCustomMetricUtilizationOrBuilder

getCustomMetricUtilizationsOrBuilderList()

public List<? extends AutoscalingPolicyCustomMetricUtilizationOrBuilder> getCustomMetricUtilizationsOrBuilderList()

Configuration parameters of autoscaling based on a custom metric.

repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;

Returns
Type Description
List<? extends com.google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilizationOrBuilder>

getDefaultInstanceForType()

public AutoscalingPolicy getDefaultInstanceForType()
Returns
Type Description
AutoscalingPolicy

getLoadBalancingUtilization()

public AutoscalingPolicyLoadBalancingUtilization getLoadBalancingUtilization()

Configuration parameters of autoscaling based on load balancer.

optional .google.cloud.compute.v1.AutoscalingPolicyLoadBalancingUtilization load_balancing_utilization = 429746403;

Returns
Type Description
AutoscalingPolicyLoadBalancingUtilization

The loadBalancingUtilization.

getLoadBalancingUtilizationOrBuilder()

public AutoscalingPolicyLoadBalancingUtilizationOrBuilder getLoadBalancingUtilizationOrBuilder()

Configuration parameters of autoscaling based on load balancer.

optional .google.cloud.compute.v1.AutoscalingPolicyLoadBalancingUtilization load_balancing_utilization = 429746403;

Returns
Type Description
AutoscalingPolicyLoadBalancingUtilizationOrBuilder

getMaxNumReplicas()

public int getMaxNumReplicas()

The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.

optional int32 max_num_replicas = 62327375;

Returns
Type Description
int

The maxNumReplicas.

getMinNumReplicas()

public int getMinNumReplicas()

The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.

optional int32 min_num_replicas = 535329825;

Returns
Type Description
int

The minNumReplicas.

getMode()

public String getMode()

Defines the operating mode for this policy. The following modes are available: - OFF: Disables the autoscaler but maintains its configuration. - ONLY_SCALE_OUT: Restricts the autoscaler to add VM instances only. - ON: Enables all autoscaler activities according to its policy. For more information, see "Turning off or restricting an autoscaler" Check the Mode enum for the list of possible values.

optional string mode = 3357091;

Returns
Type Description
String

The mode.

getModeBytes()

public ByteString getModeBytes()

Defines the operating mode for this policy. The following modes are available: - OFF: Disables the autoscaler but maintains its configuration. - ONLY_SCALE_OUT: Restricts the autoscaler to add VM instances only. - ON: Enables all autoscaler activities according to its policy. For more information, see "Turning off or restricting an autoscaler" Check the Mode enum for the list of possible values.

optional string mode = 3357091;

Returns
Type Description
ByteString

The bytes for mode.

getParserForType()

public Parser<AutoscalingPolicy> getParserForType()
Returns
Type Description
Parser<AutoscalingPolicy>
Overrides

getScaleInControl()

public AutoscalingPolicyScaleInControl getScaleInControl()

optional .google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 527670872;

Returns
Type Description
AutoscalingPolicyScaleInControl

The scaleInControl.

getScaleInControlOrBuilder()

public AutoscalingPolicyScaleInControlOrBuilder getScaleInControlOrBuilder()

optional .google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 527670872;

Returns
Type Description
AutoscalingPolicyScaleInControlOrBuilder

getScalingSchedules() (deprecated)

public Map<String,AutoscalingPolicyScalingSchedule> getScalingSchedules()
Returns
Type Description
Map<String,AutoscalingPolicyScalingSchedule>

getScalingSchedulesCount()

public int getScalingSchedulesCount()

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.

map<string, .google.cloud.compute.v1.AutoscalingPolicyScalingSchedule> scaling_schedules = 355416580;

Returns
Type Description
int

getScalingSchedulesMap()

public Map<String,AutoscalingPolicyScalingSchedule> getScalingSchedulesMap()

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.

map<string, .google.cloud.compute.v1.AutoscalingPolicyScalingSchedule> scaling_schedules = 355416580;

Returns
Type Description
Map<String,AutoscalingPolicyScalingSchedule>

getScalingSchedulesOrDefault(String key, AutoscalingPolicyScalingSchedule defaultValue)

public AutoscalingPolicyScalingSchedule getScalingSchedulesOrDefault(String key, AutoscalingPolicyScalingSchedule defaultValue)

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.

map<string, .google.cloud.compute.v1.AutoscalingPolicyScalingSchedule> scaling_schedules = 355416580;

Parameters
Name Description
key String
defaultValue AutoscalingPolicyScalingSchedule
Returns
Type Description
AutoscalingPolicyScalingSchedule

getScalingSchedulesOrThrow(String key)

public AutoscalingPolicyScalingSchedule getScalingSchedulesOrThrow(String key)

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.

map<string, .google.cloud.compute.v1.AutoscalingPolicyScalingSchedule> scaling_schedules = 355416580;

Parameter
Name Description
key String
Returns
Type Description
AutoscalingPolicyScalingSchedule

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

hasCoolDownPeriodSec()

public boolean hasCoolDownPeriodSec()

The number of seconds that your application takes to initialize on a VM instance. This is referred to as the initialization period. Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process.

optional int32 cool_down_period_sec = 107692954;

Returns
Type Description
boolean

Whether the coolDownPeriodSec field is set.

hasCpuUtilization()

public boolean hasCpuUtilization()

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.

optional .google.cloud.compute.v1.AutoscalingPolicyCpuUtilization cpu_utilization = 381211147;

Returns
Type Description
boolean

Whether the cpuUtilization field is set.

hasLoadBalancingUtilization()

public boolean hasLoadBalancingUtilization()

Configuration parameters of autoscaling based on load balancer.

optional .google.cloud.compute.v1.AutoscalingPolicyLoadBalancingUtilization load_balancing_utilization = 429746403;

Returns
Type Description
boolean

Whether the loadBalancingUtilization field is set.

hasMaxNumReplicas()

public boolean hasMaxNumReplicas()

The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.

optional int32 max_num_replicas = 62327375;

Returns
Type Description
boolean

Whether the maxNumReplicas field is set.

hasMinNumReplicas()

public boolean hasMinNumReplicas()

The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.

optional int32 min_num_replicas = 535329825;

Returns
Type Description
boolean

Whether the minNumReplicas field is set.

hasMode()

public boolean hasMode()

Defines the operating mode for this policy. The following modes are available: - OFF: Disables the autoscaler but maintains its configuration. - ONLY_SCALE_OUT: Restricts the autoscaler to add VM instances only. - ON: Enables all autoscaler activities according to its policy. For more information, see "Turning off or restricting an autoscaler" Check the Mode enum for the list of possible values.

optional string mode = 3357091;

Returns
Type Description
boolean

Whether the mode field is set.

hasScaleInControl()

public boolean hasScaleInControl()

optional .google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 527670872;

Returns
Type Description
boolean

Whether the scaleInControl field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public AutoscalingPolicy.Builder newBuilderForType()
Returns
Type Description
AutoscalingPolicy.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected AutoscalingPolicy.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
AutoscalingPolicy.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public AutoscalingPolicy.Builder toBuilder()
Returns
Type Description
AutoscalingPolicy.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException