Creating an Application (Recommended)
Function
This API is used to create an application.
Calling Method
For details, see Calling APIs.
URI
POST /v1/applications
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
Content-Type |
Yes |
String |
Definition: Type (or format) of the message body. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
X-Auth-Token |
Yes |
String |
Definition: User token. Obtain a token (the value of the X-Subject-Token response header) by calling the IAM API. Constraints: N/A. Value range: String. Max. 20,000 characters. Default value: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition: Project ID. For details, see Obtaining a Project ID. Constraints: N/A. Value range: 32 characters, including letters and digits. Default value: N/A. |
|
name |
Yes |
String |
Definition: Application name. Constraints: N/A. Value range: 3 to 128 characters, including letters, digits, underscores (_), and hyphens (-). Default value: N/A. |
|
description |
No |
String |
Definition: Application description. Constraints: N/A. Value range: Max. 1,024 characters. Default value: N/A. |
|
group_id |
No |
String |
Definition: Group ID of an application. If no_grouped is transferred, the application is not grouped. Constraints: N/A. Value range: 32 characters, including letters and digits. no_grouped is also supported. Default value: N/A. |
|
is_draft |
Yes |
Boolean |
Definition: Draft or not. Constraints: N/A. Value range: Default value: N/A. |
|
create_type |
Yes |
String |
Definition: Creation type. Constraints: N/A. Value range: Default value: N/A. |
|
slave_cluster_id |
No |
String |
Definition: Slave cluster ID. It is empty by default. When it is empty, the default agent pool is used. Constraints: N/A. Value range: 1 to 32 characters, including letters and digits. Default value: N/A. |
|
trigger |
No |
TaskTriggerVO object |
Definition: Deployment task triggering scenarios. Constraints: trigger_source is mandatory when trigger is set. |
|
arrange_infos |
No |
Array of TaskV2RequestBody objects |
Definition: Deployment application list. Constraints: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
trigger_source |
No |
String |
Definition: Scenario where a deployment task can be executed. Constraints: N/A. Value range: Default value: N/A. |
|
artifact_source_system |
No |
String |
Definition: Pipeline source when a task can be executed only by the pipeline. Constraints: N/A. Value range: Default value: N/A. |
|
artifact_type |
No |
String |
Definition: Artifact repository type when a task can be executed only by the pipeline. Constraints: N/A. Value range: Default value: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
template_id |
No |
String |
Definition: Deployment template ID. Constraints: N/A. Value range: 32 characters, including letters and digits. Default value: N/A. |
|
operation_list |
No |
Array of DeployV2OperationsDO objects |
Definition: Deployment orchestration list. Constraints: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Definition: Action ID. Constraints: N/A. Value range: Digits only. Default value: N/A. |
|
name |
No |
String |
Definition: Action name. Constraints: N/A. Value range: 1 to 128 characters. Default value: N/A. |
|
description |
No |
String |
Definition: Action description. Constraints: N/A. Value range: Max. 1,024 characters. Default value: N/A. |
|
code |
No |
String |
Definition: Action download address. Constraints: N/A. Value range: Max. 102,400 characters. Default value: N/A. |
|
params |
No |
String |
Definition: Detailed definition of actions. Constraints: N/A. Value range: Max. 204,800 characters. Default value: N/A. |
|
entrance |
No |
String |
Definition: Action entry function. Constraints: N/A. Value range: Max. 1,024 characters. Default value: N/A. |
|
version |
No |
String |
Definition: Action version. Constraints: N/A. Value range: Max. 1,024 characters. Default value: N/A. |
|
module_id |
No |
String |
Definition: Action module ID. Constraints: N/A. Value range: Max. 1,024 characters. Default value: N/A. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
status |
String |
Definition: Request status (successful or failed). Value range: |
|
result |
AppBaseResponse object |
Definition: Response body for application basic information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Parameter description: Application ID. Value range: The value consists of 32 characters. Letters and digits are allowed. |
|
name |
String |
Parameter description: Application name. Value range: The value consists of 3-128 characters. Only letters, digits, hyphens (-) and underscores (_) are allowed. |
|
region |
String |
Parameter description: Region to which the application belongs. Value range: N/A |
|
arrange_infos |
Array of TaskBaseBody objects |
Parameter description: Deployment task list. |
Example Requests
This API is used to create an application.
https://{endpoint}/v1/applications
{
"name" : "testApp",
"project_id" : "55837d272adf4eee90319800e2da6961",
"description" : "Create an application using a template.",
"trigger" : {
"trigger_source" : 0,
"artifact_source_system" : "",
"artifact_type" : ""
},
"slave_cluster_id" : "",
"create_type" : "template",
"is_draft" : true,
"arrange_infos" : [ {
"template_id" : "43b36b4678f743568e1ffebfd7f4ce76",
"operation_list" : [ {
"name" : "Application deployment in Kubernetes (CCE cluster) using Manifest",
"description" : "Deploy an application in a CCE cluster with manifest file defining Kubernetes objects. [View operation guide](https://support.huaweicloud.com/en-us/usermanual-deployman/deployman_hlp_1096.html)",
"code" : "https://example.com",
"params" : "[{\"name\":\"datasource\",\"label\":\"Manifest file source\",\"displaySettings\":{\"DevCloud.ControlType\":\"Radio\",\"DevCloud.ControlType.Style\":\"ButtonGroup\",\"DevCloud.ControlType.Radio\":[{\"displayName\":\"CodeArts Artifact\",\"value\":\"1\"},{\"displayName\":\"CodeArts Repo\",\"value\":\"2\"},{\"displayName\":\"obs\",\"value\":\"4\"}],\"DevCloud.ControlType.Default\":{\"displayName\":\"CodeArts Artifact\",\"value\":\"1\",\"icon\":\"img/release.png\"}},\"defaultDisplay\":[{\"displayName\":\"CodeArts Artifact\",\"value\":\"1\"}],\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":true}},{\"name\":\"deployTenant\",\"label\":\"Deployment tenant\",\"displaySettings\":{\"DevCloud.ControlType\":\"Select\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Select\":[{\"displayName\":\"Current Tenant\",\"value\":\"local\"},{\"displayName\":\"Other Tenant\",\"value\":\"other\"}],\"DevCloud.ControlType.Default\":{\"displayName\":\"Current Tenant\",\"value\":\"local\"}},\"defaultDisplay\":[{\"displayName\":\"Current Tenant\",\"value\":\"local\"}],\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":true}},{\"name\":\"use_iam_checkbox\",\"displaySettings\":{\"DevCloud.ControlType\":\"Checkbox\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Checkbox\":[{\"displayName\":\"IAM Authorization\",\"value\":\"0\"}]},\"defaultDisplay\":[{\"displayName\":\"IAM Authorization\",\"value\":\"0\"}],\"visibleRule\":\"deployTenant=local\",\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":false,\"isNotParameter\":true}},{\"name\":\"javaProbeCheckBox\",\"displaySettings\":{\"DevCloud.ControlType\":\"Checkbox\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Checkbox\":[{\"displayName\":\"Configure JAVA Probes\",\"value\":\"0\"}]},\"defaultDisplay\":[{\"displayName\":\"Configure JAVA Probes\",\"value\":\"0\"}],\"visibleRule\":\"not 1=1\",\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":false,\"isNotParameter\":false}},{\"name\":\"controller_enabled_ignore_errors\",\"displaySettings\":{\"DevCloud.ControlType\":\"Checkbox\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Checkbox\":[{\"displayName\":\" Continue Upon Failure\",\"value\":\"0\"}]},\"defaultDisplay\":[{\"displayName\":\" Continue Upon Failure\",\"value\":\"0\"}],\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":false}},{\"name\":\"controller_enabled_overtime\",\"label\":\"Timeout\",\"displaySettings\":{\"DevCloud.ControlType\":\"SingleLineText\",\"DevCloud.ControlType.Style\":null},\"defaultValue\":\"10\",\"validation\":{\"pattern\":\"^([1-9]|[1-2][0-9]|30)$\",\"patternDescription\":\" The time unit is minute. Enter an integer from 1 to 30.\",\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":false}},{\"name\":\"controller_enabled\",\"displaySettings\":{\"DevCloud.ControlType\":\"Hidden\",\"DevCloud.ControlType.Style\":null},\"defaultDisplay\":[{\"displayName\":\"Enable\",\"value\":\"1\"}]},{\"name\":\"visibleRule\",\"displaySettings\":{\"DevCloud.ControlType\":\"Hidden\",\"DevCloud.ControlType.Style\":null},\"defaultValue\":\"{\\\"use_iam_checkbox\\\":{\\\"value\\\":true,\\\"condition\\\":\\\"deployTenant=local\\\"},\\\"controller_enabled_overtime\\\":{\\\"value\\\":true},\\\"javaProbeCheckBox\\\":{\\\"value\\\":true,\\\"condition\\\":\\\"not 1=1\\\"},\\\"datasource\\\":{\\\"value\\\":true},\\\"deployTenant\\\":{\\\"value\\\":true},\\\"controller_enabled_ignore_errors\\\":{\\\"value\\\":true}}\"}]",
"entrance" : "main.yml",
"version" : "2.3.69",
"module_id" : "devcloud2018.k8s-cce-manifest-deployment.k8sdeploy-manifest"
} ]
} ]
}
Example Responses
Status code: 200
OK: The request is successful.
{
"result" : {
"id" : "e700f15965694253940502911220d76b",
"name" : "testApp",
"region" : "region-a",
"is_disable" : false,
"arrange_infos" : [ {
"id" : "3ea35372b6db4d58b187e9a7ee9dc349"
} ]
},
"status" : "success"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK: The request is successful. |
Error Codes
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