文档首页> 云应用引擎 CAE> API参考> CAE API> 组件> 获取组件事件列表
更新时间:2023-12-27 GMT+08:00
分享

获取组件事件列表

功能介绍

获取组件事件列表。

调试

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

URI

GET /v1/{project_id}/cae/applications/{application_id}/components/{component_id}/events

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

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

application_id

String

应用ID。

component_id

String

组件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类型,固定值“ComponentEvent”,该值不可修改。

枚举值:

  • ComponentEvent

items

Array of EventItem objects

事件项。

表4 EventItem

参数

参数类型

描述

name

String

事件名称。

involved_object_kind

String

涉及对象类型。

枚举值:

  • Component

  • ComponentInstance

  • ComponentScaling

involved_object

String

涉及对象。

message

String

组件事件信息。

created_at

String

创建时间。

updated_at

String

更新时间。

status

String

组件事件状态。

枚举值:

  • Warning

  • Normal

count

Integer

事件发生次数。

请求示例

获取组件事件列表。

GET https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/events

响应示例

状态码: 200

请求成功。

{
  "api_version" : "v1",
  "kind" : "ComponentEvent",
  "items" : [ {
    "name" : "ScalingReplicaSet",
    "message" : "Scaled up replica set test-image-5787bf845c to 1",
    "status" : "Normal",
    "count" : 1,
    "involved_object" : "test-image",
    "involved_object_kind" : "Component",
    "created_at" : "2023-02-16T17:35:04+08:00",
    "updated_at" : "2023-02-16T17:35:04+08:00"
  }, {
    "name" : "Scheduled",
    "message" : "Successfully assigned 79c4xxxf5f3a4xxxda92601xxx64b1e8c-test/test-image-5787bf845c-wzz99 to 172.xx.xx.xxx",
    "status" : "Normal",
    "count" : 0,
    "involved_object" : "test-image-5787bf845c-wzz99",
    "involved_object_kind" : "ComponentInstance",
    "created_at" : "2023-02-16T17:35:04+08:00",
    "updated_at" : "2023-02-16T17:35:04+08:00"
  }, {
    "name" : "SuccessfulMountVolume",
    "message" : "Successfully mounted volumes for pod \"test-image-5787bf845c-wzz99_79c4xxxf5f3a4xxxda92601xxx64b1e8c-test(d59a645b-730d-4a1a-951f-822a71dcdb9d)\"",
    "status" : "Normal",
    "count" : 2,
    "involved_object" : "test-image-5787bf845c-wzz99",
    "involved_object_kind" : "ComponentInstance",
    "created_at" : "2023-02-16T17:35:04+08:00",
    "updated_at" : "2023-02-16T17:35:06+08:00"
  }, {
    "name" : "Pulled",
    "message" : "Container image \"nginx:stable-alpine-perl\" already present on machine",
    "status" : "Normal",
    "count" : 1,
    "involved_object" : "test-image-5787bf845c-wzz99",
    "involved_object_kind" : "ComponentInstance",
    "created_at" : "2023-02-16T17:35:05+08:00",
    "updated_at" : "2023-02-16T17:35:05+08:00"
  }, {
    "name" : "SuccessfulCreate",
    "message" : "Created container test-image",
    "status" : "Normal",
    "count" : 1,
    "involved_object" : "test-image-5787bf845c-wzz99",
    "involved_object_kind" : "ComponentInstance",
    "created_at" : "2023-02-16T17:35:05+08:00",
    "updated_at" : "2023-02-16T17:35:05+08:00"
  }, {
    "name" : "Started",
    "message" : "Started container test-image",
    "status" : "Normal",
    "count" : 1,
    "involved_object" : "test-image-5787bf845c-wzz99",
    "involved_object_kind" : "ComponentInstance",
    "created_at" : "2023-02-16T17:35:05+08:00",
    "updated_at" : "2023-02-16T17:35:05+08:00"
  } ]
}

状态码

状态码

描述

200

请求成功。

错误码

请参见错误码

分享:

    相关文档

    相关产品