Creating a Scheduled Start/Stop Policy
Function
This API is used to create a scheduled start/stop policy.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
POST /v1/{project_id}/cae/timer-rules
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. See Obtaining a Project ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token.
|
|
X-Enterprise-Project-ID |
No |
String |
Enterprise project ID.
NOTE:
For details about how to obtain enterprise project IDs and enterprise project features, see Enterprise Management User Guide.
|
|
X-Environment-ID |
Yes |
String |
Environment ID.
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
api_version |
No |
String |
API version. Fixed value: v1. |
|
kind |
No |
String |
API type. Fixed value: TimerRule. |
|
spec |
No |
UpdateTimerRuleDetails object |
Start/stop policy specifications. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Name of a scheduled start/stop policy. |
|
type |
Yes |
String |
Definition Policy type. Options: stop and start. Range
Default Value N/A |
|
status |
Yes |
String |
Definition Policy status. Options: on and off. Range
Default Value N/A |
|
apps |
No |
Array of AppInfo objects |
Applications to which the scheduled start/stop policy applies. This parameter is mandatory only when effective_range is set to application. |
|
components |
No |
Array of ComponentInfo objects |
Components to which the scheduled start/stop policy applies. This parameter is mandatory only when effective_range is set to component. |
|
cron |
Yes |
String |
Cron expression. |
|
effective_range |
Yes |
String |
Scope to which a policy applies. Options: component, application, and environment. |
|
effective_policy |
Yes |
String |
Trigger mode. Options: onetime and periodic. |
|
timezone_offset |
Yes |
String |
Time zone offset in the scheduled start/stop rule. For example, +8 for Beijing time. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
api_version |
String |
API version. Fixed value: v1. |
|
kind |
String |
API type. Fixed value: TimerRule. |
|
items |
Array of TimerRuleDetails objects |
List of start/stop policies. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
ID of a scheduled start/stop policy. This parameter is ignored during policy creation. |
|
name |
String |
Name of a scheduled start/stop policy. |
|
type |
String |
Definition Policy type. Options: stop and start. Range
Default Value N/A |
|
status |
String |
Definition Policy status. Options: on and off. Range
Default Value N/A |
|
env_id |
String |
Environment ID. |
|
apps |
Array of AppInfo objects |
Applications to which the scheduled start/stop policy applies. This parameter is mandatory only when effective_range is set to application. |
|
components |
Array of ComponentInfo objects |
Components to which the scheduled start/stop policy applies. This parameter is mandatory only when effective_range is set to component. |
|
component_number |
Integer |
Number of components to which a scheduled start/stop policy applies. This parameter is ignored during policy creation. |
|
cron |
String |
Cron expression. |
|
effective_range |
String |
Scope to which a policy applies. Options: component, application, and environment. |
|
effective_policy |
String |
Trigger mode. Options: onetime and periodic. |
|
last_execution_status |
String |
Definition Status of the last execution. Options: abnormal, normal, and waiting. This parameter is ignored during policy creation. Range
Default Value When the scheduled start/stop policy list is obtained, the default value is waiting. In other cases, the default value is not involved. |
|
timezone_offset |
String |
Time zone offset in the scheduled start/stop rule. For example, +8 for Beijing time. |
Example Requests
Create a scheduled start/stop policy: Set name to test, type to start, effective_range to environment, and effective_policy to onetime.
POST https://{endpoint}/v1/{project_id}/cae/timer-rules
{
"api_version" : "v1",
"kind" : "TimerRule",
"spec" : {
"name" : "test",
"type" : "start",
"cron" : "0 55 16 22 2 ? 2023",
"status" : "on",
"env_id" : "c41a8e9f-5447-406a-8783-85885f3870a3",
"effective_range" : "environment",
"effective_policy" : "onetime"
}
}
Example Responses
Status code: 200
OK
{
"api_version": "v1",
"kind": "TimerRule",
"items": [
{
"id": "string",
"name": "string",
"type": "start",
"env_id": "string",
"cron": "0 16 17 31 1 ? 2023",
"component_number": 2,
"status": "off",
"last_execution_status": "normal",
"effective_range": "application",
"effective_policy": "onetime",
"timezone_offset": "+8",
"apps": [
{
"app_id": "string",
"app_name": "string"
}
]
]
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot