Skip to content

[Feature][dolphinscheduler-api] Return domain object after creating success #7049

@ouyangyewei429

Description

@ouyangyewei429

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

Third-party integration scenarios often need to maintain the relationship between the product business and DolphinScheduler’s AccessToken, User, Queue, and Project.

In the current CreateXxx API, only the status code is returned, even if the creation is successful, the entity object will not be returned.

Therefore, if you need to obtain The created object information, such as ProjectCode and TenantId, it requires multiple API calls (first call the CreateXxx API first, then call the QueryXxx), and if the entity object can be returned in the CreateXxx API, the times of API calls can be reduced.

Use case

1. Create AccessToken

API: org.apache.dolphinscheduler.api.controller.AccessTokenController#createToken
Expected Response:

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": 3,
        "userId": 5,
        "token": "dba40cd3e522599b7b4de4eb928dc690",
        "expireTime": "9999-12-31T23:59:59.000+0800",
        "createTime": "2021-11-29T19:45:31.000+0800",
        "updateTime": "2021-11-29T19:45:31.000+0800",
        "userName": "u_23456"
    },
    "success": true,
    "failed": false
}

2. Create Queue

API: org.apache.dolphinscheduler.api.controller.QueueController#createQueue
Expected Response:

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": 1,
        "queueName": "default",
        "queue": "default",
        "createTime": null,
        "updateTime": null
    },
    "success": true,
    "failed": false
}

3. Create Tenant

API: org.apache.dolphinscheduler.api.controller.TenantController#createTenant
Expected Response:

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": 6,
        "tenantCode": "t_12345",
        "description": "",
        "queueId": 1,
        "queueName": "default",
        "queue": null,
        "createTime": "2021-11-29 19:42:24",
        "updateTime": "2021-11-29 19:42:24"
    },
    "success": true,
    "failed": false
}

4. Create User

API: org.apache.dolphinscheduler.api.controller.UsersController#createUser
Expected Response:

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": 5,
        "userName": "u_23456",
        "userPassword": "e9335e177b288c7af4af8f1225c3f333",
        "email": "xx@xx.com",
        "phone": null,
        "userType": "GENERAL_USER",
        "tenantId": 6,
        "state": 1,
        "tenantCode": "t_12345",
        "queueName": "default",
        "alertGroup": null,
        "queue": "default",
        "createTime": "2021-11-29 19:42:48",
        "updateTime": "2021-11-29 19:42:48"
    },
    "success": true,
    "failed": false
}

5. Create Project

API: org.apache.dolphinscheduler.api.controller.ProjectController#createProject
Expected Response:

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": 1,
        "userId": 1,
        "userName": "admin",
        "code": 3643998558592,
        "name": "test_user",
        "description": "",
        "createTime": "2021-11-26T11:58:59.000+0800",
        "updateTime": "2021-11-26T11:58:59.000+0800",
        "perm": 0,
        "defCount": 2,
        "instRunningCount": 0
    },
    "success": true,
    "failed": false
}

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions