Help Center> ServiceStage> API Reference> Application Management APIs> Components> Modifying Component Information Based on the Component ID

Modifying Component Information Based on the Component ID

Function

This API is used to modify component information based on the component ID.

URI

PUT /v2/{project_id}/cas/applications/{application_id}/components/{component_id}

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Tenant's project ID.

application_id

String

Yes

Application ID.

component_id

String

Yes

Component ID.

Request Parameters

Request parameters

Table 2 Request parameters

Parameter

Type

Mandatory

Description

name

String

No

Application component name.

description

String

No

Description.

source

Object

No

Source of the code or software package. See Table 3.

build

Object

No

Build. See Table 6.

Table 3 source parameters

Parameter

Type

Mandatory

Description

kind

String

Yes

Type. Option: source code or artifact software package.

spec

Object

Yes

For details about the source code, see Table 4. For details about the artifact software package, see Table 5.

Table 4 code spec parameters

Parameter

Type

Mandatory

Description

repo_type

String

Yes

Code repository. Value: GitHub, GitLab, Gitee, or Bitbucket.

repo_url

String

Yes

Code repository URL. Example: https://github.com/example/demo.git.

repo_ref

String

No

Code branch or tag. Default value: master.

repo_auth

String

Yes

Authorization name, which can be obtained from the authorization list.

Table 5 artifact spec parameters

Parameter

Type

Mandatory

Description

storage

String

Yes

Storage mode. Value: swr or obs.

type

String

Yes

Type. Value: package.

url

String

Yes

Source code address of the software package. Example: https://{IP}:20202/xxx/xxx.jar.

auth

String

No

Authentication mode. Value: iam or none. Default value: iam.

Table 6 build parameters

Parameter

Type

Mandatory

Description

parameters

Map<String, Object>

No

See Table 7. This parameter is provided only when no ID is available during build creation.

Table 7 parameters description

Parameter

Type

Mandatory

Description

build_cmd

String

No

Compilation command. By default:

  1. When build.sh exists in the root directory, the command is ./build.sh.
  2. When build.sh does not exist in the root directory, the command varies depending on the operating system (OS). Example:

Java and Tomcat: mvn clean package

Nodejs: npm build

dockerfile_path

String

No

Address of the Docker file. By default, the Docker file is in the root directory (./).

artifact_namespace

String

No

Build archive organization. Default value: cas_{project_id}.

Response Parameters

Response parameters

Table 8 Response parameters

Parameter

Type

Description

id

String

Application component ID.

name

String

Application component name.

status

Integer

Value: 0 or 1.

0: Normal.

1: Being deleted.

runtime

String

Runtime.

category

String

Application component type. Example: Webapp, Microservice, or Common.

sub_category

String

Application component sub-type.

Webapp sub-types include Web, Magento, and Wordpress.

Microservice sub-types include Java Chassis, Go Chassis, and Mesher.

Common sub-type can be empty.

description

String

Description.

pipeline_ids

Array<String>

Pipeline ID list. A maximum of 10 pipeline IDs are supported.

project_id

String

Project ID.

application_id

String

Application ID.

source

Object

Source of the code or software package. See Table 9.

build

Object

Build. See Table 11.

creator

String

Creator.

create_time

Integer

Creation time.

update_time

Integer

Update time.

Table 9 source parameters

Parameter

Type

Description

kind

String

Type

spec

Object

See Table 10.

Table 10 spec parameters

Parameter

Type

Description

storage

String

Storage mode.

type

String

Type

url

String

Source code address of the software package.

auth

String

Authentication mode.

Table 11 build parameters

Parameter

Type

Description

ID

String

Type

parameters

Map<String, Object>

See Table 12.

Table 12 parameters description

Parameter

Type

Description

build_cmd

String

Compilation command.

dockerfile_path

String

Address of the Docker file.

artifact_namespace

String

Build archive organization.

Example

Example request

{
    "name": "string", 
    "description": "string", 
    "source": {
        "kind": "artifact", 
        "spec": {
            "storage": "swr", 
            "type": "package", 
            "url": "{IP}:20202/xxx/xxx.jar", 
            "auth": "iam"
        }
    }, 
    "build": {
        "parameters": {
            "build_cmd": "string", 
            "dockerfile_path": "string", 
            "artifact_namespace": "string"
        }
    }
}

Example response

{
    "id": "string", 
    "name": "string", 
    "runtime": "Tomcat8", 
    "category": "Webapp", 
    "sub_category": "Web", 
    "description": "string", 
    "project_id": "string", 
    "application_id": "string", 
    "source": {
        "kind": "artifact", 
        "spec": {
            "storage": "swr", 
            "type": "package", 
            "url": "{IP}:20202/xxx/xxx.jar", 
            "auth": "iam"
        }
    }, 
    "build": {
        "id": "string", 
        "parameters": {
            "build_cmd": "mvn clean package"
        }
    }, 
    "create_time": 0, 
    "update_time": 0
}

Status Code

Table 13 Status codes

HTTP Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error code must be in the format of SVCSTG.00100.[Error_ID]. Example: SVCSTG.00100400. See Error Codes of Application Management APIs.