All Products
Search
Document Center

Platform For AI:CreateServiceCronScaler

Last Updated:Nov 22, 2024

Enables the Cron Horizontal Pod Autoscaler (CronHPA) feature for a service.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
eas:CreateServiceCronScalercreate
*All Resources
*
    none
none

Request syntax

POST /api/v2/services/{ClusterId}/{ServiceName}/cronscaler HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
ClusterIdstringYes

The region ID of the service.

cn-shanghai
ServiceNamestringYes

The service name. For more information about how to query the service name, see ListServices .

foo
bodyobjectNo

The request body.

ScaleJobsarray<object>Yes

The description of the CronHPA job.

objectNo
TargetSizeintegerYes

The number of instances that you want to configure for the CronHPA job.

1
SchedulestringYes

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 * * * *
NamestringNo

The name of the CronHPA job.

scale-job-1
ExcludeDatesarrayNo

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.

stringNo

The cron expression. For more information about how to configure cron expressions, see Description of special characters in this topic.

* * * * * 0,6

Cron expressions

.drawio.png

ParameterValid valueValid special character
Second0-59* / , -
Minute0-59* / , -
Hour0-23* / , -
Day1-31* / , -
Month1 to 12 or JAN to DEC* / , -
Day of week0 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

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

40325405-579C-4D82****
Messagestring

The returned message.

Create cron scaler for service [foo] successfully

Examples

Sample success responses

JSONformat

{
  "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 timeSummary of changesOperation
2022-02-22Add OperationView Change Details