-
Notifications
You must be signed in to change notification settings - Fork 17
/
BasicTargetTrackingScalingPolicyProps.go
100 lines (97 loc) · 4.49 KB
/
BasicTargetTrackingScalingPolicyProps.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package awsapplicationautoscaling
import (
"github.com/aws/aws-cdk-go/awscdk/v2"
"github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch"
)
// Properties for a Target Tracking policy that include the metric but exclude the target.
//
// Example:
// import "github.com/aws/aws-cdk-go/awscdk"
//
// var code code
//
//
// handler := lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
// Runtime: lambda.Runtime_PYTHON_3_7(),
// Handler: jsii.String("index.handler"),
// Code: Code,
//
// ReservedConcurrentExecutions: jsii.Number(2),
// })
//
// fnVer := handler.currentVersion
//
// target := appscaling.NewScalableTarget(this, jsii.String("ScalableTarget"), &ScalableTargetProps{
// ServiceNamespace: appscaling.ServiceNamespace_LAMBDA,
// MaxCapacity: jsii.Number(100),
// MinCapacity: jsii.Number(10),
// ResourceId: fmt.Sprintf("function:%v:%v", handler.FunctionName, fnVer.Version),
// ScalableDimension: jsii.String("lambda:function:ProvisionedConcurrency"),
// })
//
// target.ScaleToTrackMetric(jsii.String("PceTracking"), &BasicTargetTrackingScalingPolicyProps{
// TargetValue: jsii.Number(0.9),
// PredefinedMetric: appscaling.PredefinedMetric_LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION,
// })
//
type BasicTargetTrackingScalingPolicyProps struct {
// Indicates whether scale in by the target tracking policy is disabled.
//
// If the value is true, scale in is disabled and the target tracking policy
// won't remove capacity from the scalable resource. Otherwise, scale in is
// enabled and the target tracking policy can remove capacity from the
// scalable resource.
// Default: false.
//
DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"`
// A name for the scaling policy.
// Default: - Automatically generated name.
//
PolicyName *string `field:"optional" json:"policyName" yaml:"policyName"`
// Period after a scale in activity completes before another scale in activity can start.
// Default: Duration.seconds(300) for the following scalable targets: ECS services,
// Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
// Amazon SageMaker endpoint variants, Custom resources. For all other scalable
// targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
// global secondary indexes, Amazon Comprehend document classification endpoints,
// Lambda provisioned concurrency.
//
ScaleInCooldown awscdk.Duration `field:"optional" json:"scaleInCooldown" yaml:"scaleInCooldown"`
// Period after a scale out activity completes before another scale out activity can start.
// Default: Duration.seconds(300) for the following scalable targets: ECS services,
// Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
// Amazon SageMaker endpoint variants, Custom resources. For all other scalable
// targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
// global secondary indexes, Amazon Comprehend document classification endpoints,
// Lambda provisioned concurrency.
//
ScaleOutCooldown awscdk.Duration `field:"optional" json:"scaleOutCooldown" yaml:"scaleOutCooldown"`
// The target value for the metric.
TargetValue *float64 `field:"required" json:"targetValue" yaml:"targetValue"`
// A custom metric for application autoscaling.
//
// The metric must track utilization. Scaling out will happen if the metric is higher than
// the target value, scaling in will happen in the metric is lower than the target value.
//
// Exactly one of customMetric or predefinedMetric must be specified.
// Default: - No custom metric.
//
CustomMetric awscloudwatch.IMetric `field:"optional" json:"customMetric" yaml:"customMetric"`
// A predefined metric for application autoscaling.
//
// The metric must track utilization. Scaling out will happen if the metric is higher than
// the target value, scaling in will happen in the metric is lower than the target value.
//
// Exactly one of customMetric or predefinedMetric must be specified.
// Default: - No predefined metrics.
//
PredefinedMetric PredefinedMetric `field:"optional" json:"predefinedMetric" yaml:"predefinedMetric"`
// Identify the resource associated with the metric type.
//
// Only used for predefined metric ALBRequestCountPerTarget.
//
// Example value: `app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>`.
// Default: - No resource label.
//
ResourceLabel *string `field:"optional" json:"resourceLabel" yaml:"resourceLabel"`
}