应用管理与运维平台 ServiceStage-创建并管理应用:操作步骤

时间:2025-02-12 15:02:01

操作步骤

  1. 调用创建应用API创建应用,请求示例如下:

    curl -k -H "Content-Type:application/json;charset=utf8" -H "X-Auth-Token:$Token" -X POST "https://{servicestage_endpoint}/v3/{project_id}/cas/applications" -d ' {    "name": "app-test-application",    "description": "test application",    "enterprise_project_id": "0",    "labels": [        {            "key": "testKey",            "value": "testValue"        }    ]}'

    返回结果:

    {    "id": "2c458700-c8e0-4651-a73b-5219b70a6572",    "name": "app-test-application",    "description": "test application",    "project_id": "063a3158b1a34710b36ad208b9497d00",    "enterprise_project_id": "0",    "creator": "test_user",    "create_time": 1689575641705,    "update_time": 1689575641705,    "unified_model": null,    "labels": [        {            "key": "testKey",            "value": "testValue"        }    ]}

    记录返回结果中加粗显示的应用ID,用于替换后续示例中的{application_id}。

  2. 调用根据应用ID修改应用配置API为应用添加应用环境变量,请求示例如下:

    curl -k -H "Content-Type:application/json;charset=utf8" -H "X-Auth-Token:$Token" -X PUT "https://{servicestage_endpoint}/v3/{project_id}/cas/applications/{application_id}/configuration" -d ' {    "environment_id": "21a43958-f64f-4077-8ae3-3a03bf0111c7",    "configuration": {        "env": [            {                "name": "testName",                "value": "testValue"            }        ]    }}'

    返回结果:

    {    "application_id": "2c458700-c8e0-4651-a73b-5219b70a6572",    "environment_id": "21a43958-f64f-4077-8ae3-3a03bf0111c7",    "configuration": {        "env": [            {                "name": "testName",                "value": "testValue"            }        ]    }}

  3. 调用根据应用ID获取应用详细信息API根据应用ID查询应用详细信息,请求示例如下:

    curl -k -H "Content-Type:application/json;charset=utf8" -H "X-Auth-Token:$token" -X GET "https://{servicestage_endpoint}/v3/{project_id}/cas/applications/{application_id}"

    返回结果:

    {    "id": "2c458700-c8e0-4651-a73b-5219b70a6572",    "name": "app-test-application",    "description": "test application",    "project_id": "063a3158b1a34710b36ad208b9497d00",    "enterprise_project_id": "0",    "creator": "test_user",    "create_time": 1689575641705,    "update_time": 1689575641705,    "unified_model": null,    "labels": [        {            "key": "testKey",            "value": "testValue"        }    ],    "component_count": 0}

support.huaweicloud.com/api-servicestage/servicestage_06_0014.html