更新时间:2023-11-20 GMT+08:00
分享

获取定时启停规则列表

功能介绍

获取定时启停规则列表。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v1/{project_id}/cae/timer-rules

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取项目ID请参见获取项目ID

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

  • 获取Token,请参考《统一身份认证服务API参考》的“获取用户Token”章节。

  • 请求响应成功后在响应消息头中包含的“X-Subject-Token”的值即为Token值。

最大长度:16384

X-Enterprise-Project-ID

String

企业项目ID。

  • 创建环境时,环境会绑定企业项目ID。

  • 最大长度36字节,带“-”连字符的UUID格式,或者是字符串“0”。

  • 该字段不传(或传为字符串“0”)时,则查询默认企业项目下的资源。

说明:

关于企业项目ID的获取及企业项目特性的详细信息,请参见《企业管理服务用户指南》。

X-Environment-ID

String

环境ID。

  • 获取环境ID,通过《云应用引擎API参考》的“获取环境列表”章节获取环境信息。

  • 请求响应成功后在响应体的items数组中的一个元素即为一个环境的信息,其中id字段即是环境ID。

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

api_version

String

API版本,固定值“v1”,该值不可修改。

枚举值:

  • v1

kind

String

API类型,固定值“TimerRule”,该值不可修改。

枚举值:

  • TimerRule

items

Array of TimerRuleDetails objects

启停规则列表。

表4 TimerRuleDetails

参数

参数类型

描述

id

String

定时启停规则ID,在创建定时启停规则时会忽略。

name

String

定时启停规则名称。

type

String

定时启停规则的类型:stop/start。

status

String

定时启停规则状态(是否开启):on/off。

env_id

String

环境ID。

apps

Array of AppInfo objects

定时启停规则所包含的所有应用,只在生效范围为application的时候需要填写。

components

Array of ComponentInfo objects

在定时启停规则所包含的所有组件,只在生效范围为component的时候需要填写。

component_number

Integer

定时启停规则包含的组件个数,在创建定时启停规则时会忽略。

cron

String

cron表达式。

effective_range

String

定时启停规则生效范围: component/application/environment。

effective_policy

String

定时启停规则的定时类别: onetime/periodic。

last_execution_status

String

上次执行的状态:abnormal/normal/executing,在创建定时启停规则时会忽略。

表5 AppInfo

参数

参数类型

描述

app_id

String

应用ID。

app_name

String

应用名称。

表6 ComponentInfo

参数

参数类型

描述

component_id

String

组件ID。

component_name

String

组件名称。

请求示例

获取定时启停规则列表。

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

响应示例

状态码: 200

请求成功。

{
  "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",
    "apps" : [ {
      "app_id" : "string",
      "app_name" : "string"
    } ]
  }, {
    "id" : "string",
    "name" : "string",
    "type" : "start",
    "env_id" : "string",
    "cron" : "0 48 17 ? * * *",
    "component_number" : 2,
    "status" : "on",
    "last_execution_status" : "abnormal",
    "effective_range" : "environment",
    "effective_policy" : "periodic"
  }, {
    "id" : "string",
    "name" : "string",
    "type" : "stop",
    "env_id" : "string",
    "cron" : "0 16 17 31 1 ? 2023",
    "component_number" : 2,
    "status" : "off",
    "last_execution_status" : "executing",
    "effective_range" : "component",
    "effective_policy" : "onetime",
    "components" : [ {
      "component_id" : "string",
      "component_name" : "string"
    } ]
  } ]
}

状态码

状态码

描述

200

请求成功。

错误码

请参见错误码

分享:

    相关文档

    相关产品