文档首页/ 工业数字模型驱动引擎/ API参考/ 应用示例/ 获取租户在iDME的运行服务清单
更新时间:2024-11-04 GMT+08:00
分享

获取租户在iDME的运行服务清单

操作场景

本章节指导用户通过调用API获取租户在iDME的运行环境清单。

前提条件

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

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

操作步骤

  1. 获取接口相关信息。

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

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

  2. 在Request Header中增加“X-Auth-Token”
  3. 发送“GET https://{iDME Endpoint}/v1/{project_id}/envs”

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

  4. 查看请求响应结果。

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

    {
        "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
    }

    请求异常时,错误码请参见错误码

相关文档