Compute V1 Client - Class AutoscalingPolicy (1.22.1)

Reference documentation and code samples for the Compute V1 Client class AutoscalingPolicy.

Cloud Autoscaler policy.

Generated from protobuf message google.cloud.compute.v1.AutoscalingPolicy

Namespace

Google \ Cloud \ Compute \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
dataarray

Optional. Data for populating the Message object.

↳ cool_down_period_secint

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.

↳ cpu_utilizationAutoscalingPolicyCpuUtilization

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

↳ custom_metric_utilizationsarray<AutoscalingPolicyCustomMetricUtilization>

Configuration parameters of autoscaling based on a custom metric.

↳ load_balancing_utilizationAutoscalingPolicyLoadBalancingUtilization

Configuration parameters of autoscaling based on load balancer.

↳ max_num_replicasint

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.

↳ min_num_replicasint

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.

↳ modestring

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.

↳ scale_in_controlAutoscalingPolicyScaleInControl
↳ scaling_schedulesarray|Google\Protobuf\Internal\MapField

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.

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.

Returns
TypeDescription
int

hasCoolDownPeriodSec

clearCoolDownPeriodSec

setCoolDownPeriodSec

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.

Parameter
NameDescription
varint
Returns
TypeDescription
$this

getCpuUtilization

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

Returns
TypeDescription
AutoscalingPolicyCpuUtilization|null

hasCpuUtilization

clearCpuUtilization

setCpuUtilization

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

Parameter
NameDescription
varAutoscalingPolicyCpuUtilization
Returns
TypeDescription
$this

getCustomMetricUtilizations

Configuration parameters of autoscaling based on a custom metric.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setCustomMetricUtilizations

Configuration parameters of autoscaling based on a custom metric.

Parameter
NameDescription
vararray<AutoscalingPolicyCustomMetricUtilization>
Returns
TypeDescription
$this

getLoadBalancingUtilization

Configuration parameters of autoscaling based on load balancer.

Returns
TypeDescription
AutoscalingPolicyLoadBalancingUtilization|null

hasLoadBalancingUtilization

clearLoadBalancingUtilization

setLoadBalancingUtilization

Configuration parameters of autoscaling based on load balancer.

Parameter
NameDescription
varAutoscalingPolicyLoadBalancingUtilization
Returns
TypeDescription
$this

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.

Returns
TypeDescription
int

hasMaxNumReplicas

clearMaxNumReplicas

setMaxNumReplicas

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.

Parameter
NameDescription
varint
Returns
TypeDescription
$this

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.

Returns
TypeDescription
int

hasMinNumReplicas

clearMinNumReplicas

setMinNumReplicas

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.

Parameter
NameDescription
varint
Returns
TypeDescription
$this

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.

Returns
TypeDescription
string

hasMode

clearMode

setMode

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.

Parameter
NameDescription
varstring
Returns
TypeDescription
$this

getScaleInControl

Generated from protobuf field optional .google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 527670872;

Returns
TypeDescription
AutoscalingPolicyScaleInControl|null

hasScaleInControl

clearScaleInControl

setScaleInControl

Generated from protobuf field optional .google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 527670872;

Parameter
NameDescription
varAutoscalingPolicyScaleInControl
Returns
TypeDescription
$this

getScalingSchedules

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.

Returns
TypeDescription
Google\Protobuf\Internal\MapField

setScalingSchedules

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.

Parameter
NameDescription
vararray|Google\Protobuf\Internal\MapField
Returns
TypeDescription
$this