更新时间:2024-11-04 GMT+08:00
分享

部署应用

操作场景

本接口用于部署工业数字模型驱动引擎(Industrial Digital Model Engine,简称iDME)应用。

前提条件

  • 已开通工业数字模型驱动引擎(Industrial Digital Model Engine,简称iDME),并根据开通区域确定调用API的Endpoint,详细信息请参见地区与终端节点
  • 当您使用Token认证方式完成认证鉴权时,需要获取用户Token并在调用接口时增加“X-Auth-Token”到业务接口请求消息头中。Token认证,具体操作请参考认证鉴权

    通过IAM服务获取到的Token有效期为24小时,需要使用同一个Token鉴权时,可以先将Token缓存,避免频繁调用。

涉及接口

部署应用涉及以下接口:

操作步骤

  1. 获取待部署的应用ID。

    1. 接口相关信息

      URI格式:GET /v1/{project_id}/apps

      详情请参见获取租户下的应用清单

    2. 请求示例
      GET https://{iDME Endpoint}/v1/{project_id}/apps

      {project_id}请从获取项目ID获取。

    3. 响应示例
      {
          "result": [
              {
                  "id": "44145d41ae294e111111eafd4da32ea8",
                  "project_id": "cf49a20d85294c93b1111111ca9454bc",
                  "mark_for_delete": 0,
                  "create_by": "59779076d1dc********c91c2c54bd7a",
                  "create_time": 1690427901000,
                  "update_by": "59779076d1dc********c91c2c54bd7a",
                  "update_time": 1690427901000,
                  "name_cn": "TestApp",
                  "name_en": "TestApp",
                  "desc_cn": "",
                  "desc_en": "",
                  "database_type": "mysql",
                  "environment": "beta",
                  "owners": [
                      "user_1",
                      "idme_container1"
                  ]
              },
              {
                  "id": "c787dcd484944ad11111dd18693e4eb2",
                  "project_id": "cf49a20d85294c93b1111111ca9454bc",
                  "mark_for_delete": 0,
                  "create_by": "59779076d1dc********c91c2c54bd7a",
                  "create_time": 1689622165000,
                  "update_by": "59779076d1dc********c91c2c54bd7a",
                  "update_time": 1689622165000,
                  "name_cn": "工业产品问卷调查",
                  "name_en": "Questionnaire_Survey",
                  "desc_cn": "",
                  "desc_en": "",
                  "database_type": "mysql",
                  "environment": "dev",
                  "owners": [
                      "dme-console"
                  ]
              }
          ],
          "page_num": 1,
          "page_size": 500,
          "total_size": 2,
          "total_pages": 1
      }

  2. 获取待部署的运行服务。

    1. 接口相关信息

      URI格式:GET /v1/{project_id}/envs

      详情请参见获取运行服务清单

    2. 请求示例
      GET /v1/{project_id}/envs
    3. 响应示例

      为篇幅起见,这里只展示部分内容。请求成功时,响应参数如下:

      {
          "result": [
              {
                  "project_id": "cf49a20d85294c93b1111111ca9454bc",
                  "region_id": "cn-north-4",
                  "env_id": "2f25874d-43d4-453c-91f7-3898f397ac22",
                  "env_name": "MySQLTest1",
                  "env_status": "RUNNING",
                  "env_type": "CLOUD_BASIC",
                  "env_app_link_status": "RUNNING",
                  "env_conf_info": "基础版 数据建模引擎 节点*1",
                  "env_app_link_id": "e2ad5c196eb5420657d3cb9eff8c0874",
                  "app_id": "c787dcd484944ad11111dd18693e4eb2",
                  "app_version": "500d48b0724a1111b6dfb4da338d342f_1690974321079",
                  "app_name_en": "Questionnaire_Survey",
                  "app_name_cn": "工业产品问卷调查",
                  "app_environment": "dev",
                  "enabled": false,
                  "last_deploy_time": 1691026735000,
                  "deploy_user_id": "16ee111111111b2c971d8d50ff9d0d42",
                  "charging_mode": "prePaid",
                  "create_time": 1690252391000,
                  "resource_id": "2f25874d-43d4-453c-91f7-3898f397ac22",
                  "resource_spec_code": "dme.instance.basic.standard",
                  "org_code": "9190086000001158862",
                  "org_name": "idme-test",
                  "app_login_url": "https://orgid-test.huaweiapaas.com/oauth2/authorize?response_type=cod******",
                  "app_create_time": 1690496417000,
                  "database_type": "mysql"
              },
              {
                  "project_id": "cf49a20d85294c93b1111111ca9454bc",
                  "region_id": "cn-north-4",
                  "env_id": "5dc54ff9-f659-4ac2-b6f3-fe18227ea05e",
                  "env_name": "测试体验版计费因子",
                  "env_status": "RUNNING",
                  "env_type": "CLOUD_TRIAL",
                  "env_app_link_status": "DEPLOYING",
                  "env_conf_info": "体验版 数据建模引擎 节点*1",
                  "app_id": "44145d41ae294e111111eafd4da32ea8",
                  "app_version": "44f5e16ea3554492a3aad3cff7039152_1690278188344",
                  "app_name_en": "TestApp",
                  "app_name_cn": "TestApp",
                  "app_environment": "dev",
                  "enabled": false,
                  "last_deploy_time": 1691100385000,
                  "deploy_user_id": "7e06441a333849c7bbca280992edd835",
                  "charging_mode": "postPaid",
                  "create_time": 1687650507000,
                  "resource_id": "5dc54ff9-f659-4ac2-b6f3-fe18227ea05e",
                  "resource_spec_code": "dme.instance.trial",
                  "org_code": null,
                  "org_name": null,
                  "app_login_url": null,
                  "app_create_time": 1690236458000,
                  "security_group_id": "test"
              }
          ],
          "page_num": 1,
          "page_size": 500,
          "total_size": 5,
          "total_pages": 1
      }

  3. 部署应用。

    1. 接口相关信息

      URI格式:POST /v1/{project_id}/envs/{env_id}/apps/{app_id}/deploy

      详情请参见部署应用

    2. 请求示例
      PUT https://{iDME Endpoint}/v1/cf49a20d85294c93b1111111ca9454bc/envs/2f25874d-43d4-453c-91f7-3898f397ac22/apps/c787dcd484944ad11111dd18693e4eb2/deploy

      Body:

      {
          "version": "500d48b0724a4445b6dfb4da338d342f_1690974321079",
          "org_code": "9190086000001158862",
          "org_name": "idme-test"
      }
    3. 响应示例

      状态码为200。

相关文档