Help Center/ Cloud Application Engine/ API Reference/ CAE API/ Component./ Performing Operations on a Component
Updated on 2025-12-19 GMT+08:00

Performing Operations on a Component

Function

This API is used to perform operations (such as deploy, upgrade, restart, stop, start, scale, configure, and roll back) on a component.

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/applications/{application_id}/components/{component_id}/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. See Obtaining a Project ID.

application_id

Yes

String

Application ID.

component_id

Yes

String

Component ID.

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: Action.

metadata

No

metadata object

Request data.

spec

No

ActionOnComponentSpec object

Table 4 metadata

Parameter

Mandatory

Type

Description

annotations

No

Map<String,String>

Resource information.

name

Yes

String

Action name.

Table 5 ActionOnComponentSpec

Parameter

Mandatory

Type

Description

snapshot_index

No

Integer

Snapshot index.

replica

No

Integer

Number of instances.

source

No

ActionOnComponentSource object

Source data.

startup_timeout

No

Integer

Startup timeout.

runtime

No

String

Runtime.

resource_limit

No

ResourceLimitForUpgrade object

Instance specifications

build

No

ActionOnComponentBuild object

Build data.

Table 6 ActionOnComponentSource

Parameter

Mandatory

Type

Description

code

No

Repo object

Source code repository information.

type

No

String

Definition

Source type.

Range

  • image: image.

  • code: source code.

  • softwarePackage: software package.

Default Value

N/A

sub_type

No

String

Source subtype.

  • If type is code, sub_type indicates a code repository, such as DevCloud (CodeArts), GitLab, GitHub, Gitee, or Bitbucket.

  • If type is softwarePackage, sub_type indicates a software package repository, such as BinObs or BinDevCloud (CodeArts Release Repo).

url

No

String

URL.

  • If type is image, url indicates an image address.

  • If type is code, url indicates a Git address.

  • If type is softwarePackage, url indicates a software package address.

Table 7 Repo

Parameter

Mandatory

Type

Description

auth_name

No

String

Authorization name.

branch

No

String

Branch.

namespace

No

String

Namespace, which must be Base64-encoded.

Table 8 ResourceLimitForUpgrade

Parameter

Mandatory

Type

Description

cpu_limit

No

String

CPU limit.

memory_limit

No

String

Memory limit.

Table 9 ActionOnComponentBuild

Parameter

Mandatory

Type

Description

archive

No

Archive object

Place where build products are archived for management.

parameters

No

Map<String,String>

Additional parameters. Options:

  • base_image: base image address.

  • build_cmd: custom build command.

  • dockerfile_path: custom dockerfile path.

  • dockerfile_content: custom dockerfile content.

  • artifact_name: product to be run after the Java multi-module build. The value ends with .jar.

Table 10 Archive

Parameter

Mandatory

Type

Description

artifact_namespace

No

String

SWR organization for product management.

Response Parameters

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

job_id

String

Job ID.

Example Requests

  • Perform operations (such as deploy, restart, stop, start, and configure) on a component.

    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/action
    
    {
      "api_version" : "v1",
      "kind" : "Action",
      "metadata" : {
        "name" : "deploy/restart/stop/start/configure",
        "annotations" : {
          "version" : "1.0.0"
        }
      }
    }
  • Upgrade the component version to 1.0.1.

    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/action
    
    {
      "api_version" : "v1",
      "kind" : "Action",
      "metadata" : {
        "name" : "upgrade",
        "annotations" : {
          "version" : "1.0.1"
        }
      },
      "spec" : {
        "source" : {
          "type" : "image",
          "url" : "nginx:stable-alpine-perl"
        }
      }
    }
  • Increase the number of instances to 2 for the component.

    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/action
    
    {
      "api_version" : "v1",
      "kind" : "Action",
      "metadata" : {
        "name" : "scale",
        "annotations" : {
          "version" : "1.0.0"
        }
      },
      "spec" : {
        "replica" : 2
      }
    }
  • Roll back the component.

    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/action
    
    {
      "api_version" : "v1",
      "kind" : "Action",
      "metadata" : {
        "name" : "rollback",
        "annotations" : {
          "version" : "1.0.0"
        }
      },
      "spec" : {
        "snapshot_index" : 1
      }
    }

Example Responses

Status code: 200

OK

{
  "job_id" : "xxx"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.