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.
URI
POST /v1/{project_id}/cae/applications/{application_id}/components/{component_id}/action
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
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token.
Maximum characters: 16,384 |
X-Enterprise-Project-ID |
No |
String |
Enterprise project ID.
For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide. |
X-Environment-ID |
Yes |
String |
Environment ID.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
api_version |
Yes |
String |
API version. Fixed value: v1. Enumerated value:
|
kind |
Yes |
String |
API type. Fixed value: Action. Enumerated value:
|
metadata |
No |
metadata object |
Request data. |
spec |
No |
ActionOnComponentSpec object |
Action specifications. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
annotations |
No |
map<string, object> |
Resource information. |
name |
Yes |
String |
Action name. Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
snapshot_index |
No |
Integer |
Snapshot index. |
replica |
No |
Integer |
Number of instances. |
source |
No |
ActionOnComponentSource object |
Source data. |
resource_limit |
No |
ResourceLimitForUpgrade object |
Instance specifications. |
build |
No |
ActionOnComponentBuild object |
Build data. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
code |
No |
Repo object |
Source code repository information. |
type |
No |
String |
Source type. Enumerated values:
|
sub_type |
No |
String |
Source subtype.
Enumerated values:
|
url |
No |
String |
URL.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
auth_name |
No |
String |
Authorization name. |
branch |
No |
String |
Branch. |
namespace |
No |
String |
Namespace, which must be Base64-encoded. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cpu_limit |
No |
String |
CPU limit. Enumerated values:
|
memory_limit |
No |
String |
Memory limit. Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
archive |
No |
Archive object |
Place where build products are archived for management. |
parameters |
No |
map<string, object> |
Additional parameters. Options:
|
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
job_id |
String |
Job ID. |
Example Request
- 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 Response
Status code: 200
The request is successful.
{ "job_id" : "xxx" }
Status Code
Status Code |
Description |
---|---|
200 |
The request is successful. |
Error Code
For details, 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