xcat2 / xcat-inventory

An inventory tool for xcat cluster
8 stars 16 forks source link

add secrets api get and delete method #198

Closed bybai closed 5 years ago

bybai commented 5 years ago

For task https://github.ibm.com/xcat2/task_management/issues/145

Description: add secrets api get and delete method

UT: 1.

/inventory/secrets GET get secrets list defined in store
~]# curl -X GET "http://10.4.41.7:5000/api/v2/security/secrets" -H  "accept: application/json"
[
    {
        "kind": "xcat",
        "spec": {
            "username": "xxxx",
            "password": "cluster"
        },
        "id": "xcat_xxxx"
    },
    {
        "kind": "xcat",
        "spec": {
            "password": "cluster"
        },
        "id": "xcat"
    },
    {
        "kind": "xcat",
        "spec": {
            "username": "root",
            "password": "cluster"
        },
        "id": "xcat_root"
    },
    {
        "kind": "test",
        "spec": {
            "username": "xxx",
            "password": "cluster"
        },
        "id": "test_xxx"
    },
    {
        "kind": "omapi",
        "spec": {
            "username": "xcat_key",
            "password": "TlU1QmhxV3A5RlFVNDFQRm5iUzk5MlV4VWMwUFZ5UU8="
        },
        "id": "omapi_xcat_key"
    },
    {
        "kind": "system",
        "spec": {
            "username": "root",
            "password": "cluster"
        },
        "id": "system_root"
    }
]
2. /inventory/secrets/{id} GET get specified secret resource
]# curl -X GET "http://10.4.41.7:5000/api/v2/security/secrets/xcat_root" -H  "accept: application/json"
[
    {
        "kind": "xcat",
        "spec": {
            "username": "root",
            "password": "cluster"
        },
        "id": "xcat_root"
    }
]

]# curl -X GET "http://10.4.41.7:5000/api/v2/security/secrets/xcat" -H  "accept: application/json"
[
    {
        "kind": "xcat",
        "spec": {
            "password": "cluster"
        },
        "id": "xcat"
    }
]

3. delete

/inventory/secrets/{id} Delete delete a specified type of user secrets object

curl -X DELETE "http://10.4.41.7:5000/api/v2/security/secrets/xcat_xx" -H "accept: application/json"