Enables the Cron Horizontal Pod Autoscaler (CronHPA) feature for a service.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
eas:CreateServiceCronScaler | create | *All Resources * |
| none |
Request syntax
POST /api/v2/services/{ClusterId}/{ServiceName}/cronscaler HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ClusterId | string | Yes | The region ID of the service. | cn-shanghai |
ServiceName | string | Yes | The service name. For more information about how to query the service name, see ListServices . | foo |
body | object | No | The request body. | |
ScaleJobs | array<object> | Yes | The description of the CronHPA job. | |
object | No | |||
TargetSize | integer | Yes | The number of instances that you want to configure for the CronHPA job. | 1 |
Schedule | string | Yes | The cron expression that is used to configure the execution time of the CronHPA job. For more information about how to configure cron expressions, see Description of special characters in this topic. | 0 18 * * * * |
Name | string | No | The name of the CronHPA job. | scale-job-1 |
ExcludeDates | array | No | The points in time that are excluded when you schedule a CronHPA job. The points in time must be specified by using a cron expression. | |
string | No | The cron expression. For more information about how to configure cron expressions, see Description of special characters in this topic. | * * * * * 0,6 |
Cron expressions
Parameter | Valid value | Valid special character |
---|---|---|
Second | 0-59 | * / , - |
Minute | 0-59 | * / , - |
Hour | 0-23 | * / , - |
Day | 1-31 | * / , - |
Month | 1 to 12 or JAN to DEC | * / , - |
Day of week | 0 to 6 or SUN to SAT | * / , - |
Descriptions of special characters
Asterisk (*) You can use an asterisk (*) to represent all valid values. For example, the cron expression 0 0 0 1 * * represents 00:00 on the first day of each month.
Hyphen (-) You can use a hyphen (-) to represent a range of valid values. For example, the cron expression 0 0 12-14 * * * represents 12:00, 13:00, and 14:00 of each day.
Comma (,) You can use a comma (,) to represent specific valid values. For example, the cron expression 0 0 12,14 * * * represents 12:00 and 14:00 of each day.
Forward slash (/) You can use a forward slash (/) to specify an interval. For example, the cron expression 0 */15 * * * * represents the zeroth, fifteenth, thirtieth, and forty-fifth minutes of each hour. You can use a forward slash (/) together with a hyphen (-) to specify an interval in a specific value range. For example, the cron expression 0 5-40/15 * * * * represents an interval of 15 minutes in the range of fifth to fortieth minutes of every hour. This means that valid time can be 0:05, 0:20, and 0:35.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "40325405-579C-4D82****",
"Message": "Create cron scaler for service [foo] successfully"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2022-02-22 | Add Operation | View Change Details |