美文网首页
openStack API测试

openStack API测试

作者: denok | 来源:发表于2023-03-11 14:34 被阅读0次

先访问你的dashboard确认你的鉴权地址:


鉴权地址

postman构建请求:


请求
请求
{
    "auth": {
        "identity": {
            "methods": ["password"],
            "password": {
                "user": {
                    "domain": {
                        "name": "Default"
                    },
                    "name": "admin",
                    "password": "nvframe"
                }
            }
        },
        "scope": {
            "project": {
                "domain": {
                    "name": "Default"
                },
                "name": "admin"
            }
        }
    }
}

响应:

{
    "token": {
        "is_domain": false,
        "methods": [
            "password"
        ],
        "roles": [
            {
                "id": "cb597116df024e14a7505d1f6fc1493a",
                "name": "reader"
            },
            {
                "id": "0d5dd712d4224ae8a29f09ab3b15ccd2",
                "name": "admin"
            },
            {
                "id": "aaf727fa2fd54525a212af47e28ebcad",
                "name": "member"
            }
        ],
        "expires_at": "2023-03-12T07:06:15.000000Z",
        "project": {
            "domain": {
                "id": "default",
                "name": "Default"
            },
            "id": "e69163760474442b97e9941b70e91a7b",
            "name": "admin"
        },
        "user": {
            "password_expires_at": null,
            "domain": {
                "id": "default",
                "name": "Default"
            },
            "id": "3a529e6e19b144bab3143f28e6a56591",
            "name": "admin"
        },
        "audit_ids": [
            "TDB5fhKxTPmvJG32mm0S5g"
        ],
        "issued_at": "2023-03-12T06:06:15.000000Z"
    }
}

但是实际上我们要拿的是返回的HEADERS里面的X-Subject-Token:


TOKEN

请求列表:


需要这个部分

postman请求:


请求样例
请求headers构建:
X-Auth-Token:值则是刚刚获取的X-Subject-Token。

以后每次请求都需要带上这句token。
返回:

{
    "servers": [
        {
            "id": "89825dd6-a6ce-46e6-bf6b-6c28bd3cd73c",
            "links": [
                {
                    "href": "http://192.168.0.80:8774/v2.1/servers/89825dd6-a6ce-46e6-bf6b-6c28bd3cd73c",
                    "rel": "self"
                },
                {
                    "href": "http://192.168.0.80:8774/servers/89825dd6-a6ce-46e6-bf6b-6c28bd3cd73c",
                    "rel": "bookmark"
                }
            ],
            "name": "cirros"
        },
        {
            "id": "5b94fced-a76d-4f5d-b6ea-3465c36314cf",
            "links": [
                {
                    "href": "http://192.168.0.80:8774/v2.1/servers/5b94fced-a76d-4f5d-b6ea-3465c36314cf",
                    "rel": "self"
                },
                {
                    "href": "http://192.168.0.80:8774/servers/5b94fced-a76d-4f5d-b6ea-3465c36314cf",
                    "rel": "bookmark"
                }
            ],
            "name": "cirros"
        }
    ]
}

这些API:
身份相关(域、项目、用户、组、角色)
参考https://docs.openstack.org/api-ref/identity/v3/
镜像相关
参考https://docs.openstack.org/api-ref/image/v2/index.html

参考:https://www.cnblogs.com/goldsunshine/p/8119209.html

相关文章

网友评论

      本文标题:openStack API测试

      本文链接:https://www.haomeiwen.com/subject/llyxrdtx.html