Updated on 2025-12-19 GMT+08:00

Modifying a Scheduled Start/Stop Policy

Function

Modify a scheduled start/stop rule.

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

PUT /v1/{project_id}/cae/timer-rules/{timer_rule_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. See Obtaining a Project ID.

timer_rule_id

Yes

String

ID of a scheduled start/stop policy.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

X-Enterprise-Project-ID

No

String

Enterprise project ID.

  • When an environment is created, it will be bound with an enterprise project ID.

  • Enter 0 or up to 36 characters in UUID format with hyphens (-).

  • If this parameter is not specified or is set to 0, resources in the default enterprise project are queried.

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.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

api_version

Yes

String

API version. Fixed value: v1.

kind

Yes

String

API type. Fixed value: TimerRule.

spec

Yes

UpdateTimerRuleDetails object

Specifications.

Table 4 UpdateTimerRuleDetails

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

  • stop

  • start

Default Value

N/A

status

Yes

String

Definition

Policy status. Options: on and off.

Range

  • on

  • off

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.

Table 5 AppInfo

Parameter

Mandatory

Type

Description

app_id

No

String

Application ID.

app_name

No

String

Application name.

Table 6 ComponentInfo

Parameter

Mandatory

Type

Description

component_id

No

String

Component ID.

component_name

No

String

Component name.

Response Parameters

Status code: 204

Request succeeded.

None

Example Requests

Modify a scheduled start/stop policy: Set name to test, type to start, effective_range to component, and effective_policy to onetime.

PUT https://{endpoint}/v1/{project_id}/cae/timer-rules/{rule_id}

{
  "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" : "component",
    "effective_policy" : "onetime",
    "components" : [ {
      "component_id" : "10f7b6be-5dc2-4fb7-b62c-e8f362dfdabf",
      "component_name" : "addd"
    }, {
      "component_id" : "3f3041f9-5063-40c9-94ee-8473517b3956",
      "component_name" : "demo-frontend-1676360408"
    } ]
  }
}

Example Responses

None

Status Codes

Status Code

Description

204

Request succeeded.

Error Codes

See Error Codes.