【OpenStack(Train版)安装部署(十四)】之Keystone的API测试,报错处理

本文章由公号【开发小鸽】发布!欢迎关注!!!


老规矩–妹妹镇楼:

1.OpenStack Rest API介绍

        在OpenStack云中,使用OpenStack API来启动服务器云主机,创建镜像、给实例和镜像分配元数据、创建存储容器和对象以及完成其他相关的动作。


2.Identity鉴权服务的API使用

(1)概述

        Identity 服务生成允许访问 OpenStack 服务 REST API 的身份验证令牌。客户端通过向身份验证服务提供其有效凭据来获取此令牌和其他服务 API 的 URL 端点。

        每次向 OpenStack 服务发出 REST API 请求时,您都会在 X-Auth-Token 请求标头中提供身份验证令牌。与大多数 OpenStack 项目一样,OpenStack Identity 通过基于基于角色的访问控制 (RBAC) 方法定义策略规则来保护其 API。

        身份服务配置文件设置存储这些规则的 JSON 策略文件的名称和位置。

        所有的API服务都需要设置用户名和密码才能够通过keystone的鉴权服务,因此首先对Identity鉴权服务进行测试使用。查看OpenStack官网的API文档:
在这里插入图片描述


(2)错误响应码对应的原因

Bad Request (400) 身份服务未能按预期解析请求。发生以下错误之一:
        • 缺少必需的属性。
        • 指定了不允许的属性,例如基本 CRUD 操作中 POST 请求的 ID。
        • 指定了意外数据类型的属性。

Unauthorized (401) 发生以下错误之一:
        • 未执行身份验证。
        • 指定的X-Auth-Token标头无效。
        • 身份验证凭据无效。
        • 并非所有 MFA 规则都得到满足。
        • 指定的Openstack-Auth-Receipt标头无效。

Forbidden (403) 身份已成功通过身份验证,但无权执行请求的操作。

Not Found (404) 操作失败,因为无法通过 ID 找到引用的实体。对于 POST 请求,引用的实体可能在请求正文中而不是在资源路径中指定。

Conflict (409) POST 或 PATCH 操作失败。例如,客户端尝试更新实体的唯一属性,该属性与同一集合中的另一个实体的属性冲突。或者,客户端对具有用户定义的唯一属性的集合发出两次创建操作。例如,客户端/users为用户实体的唯一的、用户定义的名称属性发出了两次POST 请求。


(3)获取用户的登录token信息

        身份服务生成令牌以换取身份验证凭据。令牌代表经过身份验证的用户身份,并且可以选择授予对特定项目、域或部署系统的授权。身份验证请求的正文必须包含指定身份验证方法的有效负载,这些方法通常只是password或 token、凭据以及可选的授权范围。您可以将令牌的范围限定到项目、域、部署系统,或者令牌可以是无范围的。您不能将令牌作用于多个作用域目标。令牌具有 ID,身份 API 在X-Subject-Token响应标头中返回这些 ID 。

获取身份验证令牌后,您可以:
        • 向其他 OpenStack 服务发出 REST API 请求。您在X-Auth-Token请求标头中提供身份验证令牌的 ID 。
        • 验证您的身份验证令牌并列出您的令牌允许您访问的域、项目、角色和端点。
        • 使用您的令牌请求范围为不同域和项目的另一个令牌。
        • 强制立即撤销令牌。
        • 列出已撤销的公钥基础设施 (PKI) 令牌。

        查看获取token的api,需要传递哪些参数以及会获取哪些response参数:

在这里插入图片描述

设置访问的API如下所示:
        http://192.168.112.146:5000/v3/auth/tokens
        需要传入如下的参数,可以看到是设置验证方式是密码,设置用户名,密码,domain名称:

{
    "auth": {
        "identity": {
            "methods": [
                "password"
            ],
            "password": {
                "user": {
                    "name": "admin",
                    "domain": {
                        "name": "Default"
                    },
                    "password": "ADMIN_PASS"
                }
            }
        }
    }
}

        查看返回的response消息的header,得到该用户的token信息:

X-Subject-Token gAAAAABhW8OcJeKBuuyRZF2S8J92YaUjmSeRyAf2fbtSyidOkoKHeFR9l8rW2VTiutUgzDSnGBMNN-PKkZEju2El_bT_ZzmLmNwfod5fib8UAiNmrIWR0Fd00EwB5kY_5FJbe9jwefNJJl0Jw_l5Ry0GTRGBE3sPFQ

(4)获取token对应的服务目录

在这里插入图片描述

        此调用返回请求中提供的 X-Auth-Token 的服务目录,即使令牌本身不包含目录。

传入参数如下所示:
在这里插入图片描述

得到的响应如下所示:

{
    "error": {
        "code": 403,
        "message": "You are not authorized to perform the requested action.",
        "title": "Forbidden"
    }
}

        ???????403错误?没有角色权限吗?我这个不是admin用户吗?干干干!!!


(5)获取token对应的项目范围

在这里插入图片描述

        此调用返回可根据请求中提供的 X-Auth-Token 确定范围的项目列表。响应的结构与为用户列出项目完全相同。

        传入的参数如下所示:

在这里插入图片描述

        得到的响应如下所示,可以看到得到的就是这个admin用户对应的admin项目:

{
    "links": {
        "self": "http://192.168.112.146:5000/v3/auth/projects",
        "previous": null,
        "next": null
    },
    "projects": [
        {
            "is_domain": false,
            "description": "Bootstrap project for initializing the cloud.",
            "links": {
                "self": "http://192.168.112.146:5000/v3/projects/a7d812868cb74f1a978035530f55f1d0"
            },
            "tags": [],
            "enabled": true,
            "id": "a7d812868cb74f1a978035530f55f1d0",
            "parent_id": "default",
            "options": {},
            "domain_id": "default",
            "name": "admin"
        }
    ]
}

(6)获取token对应的domain域

在这里插入图片描述

        此调用返回可根据请求中提供的 X-Auth-Token 确定范围的域列表。结构与列出域相同。

        传入的参数如下所示:

在这里插入图片描述

        得到的响应如下所示,可以看到就是默认的Default域:

{
    "domains": [],
    "links": {
        "self": "http://192.168.112.146:5000/v3/auth/domains",
        "previous": null,
        "next": null
    }
}

(7)获取某个用户的程序凭证信息

在这里插入图片描述

        传入参数如下所示:
在这里插入图片描述

        得到的响应如下所示,可以看到admin用户并没有任何的程序凭证:

{
    "links": {
        "self": "http://192.168.112.146:5000/v3/users/9942eb4321644336a0c7383d9f1c2bed/application_credentials",
        "previous": null,
        "next": null
    },
    "application_credentials": []
}

(8)获取某个用户的访问规则

在这里插入图片描述

        传入的参数如下所示:

在这里插入图片描述

        得到的响应如下所示,没有任何的访问规则:

{
    "links": {
        "self": "http://192.168.112.146:5000/v3/users/9942eb4321644336a0c7383d9f1c2bed/access_rules",
        "previous": null,
        "next": null
    },
    "access_rules": []
}

(9)获取所有的项目信息

在这里插入图片描述

        传入参数:
在这里插入图片描述

        得到响应,可以看到403错误,这可能是因为没有访问的权限:

{
    "error": {
        "code": 403,
        "message": "You are not authorized to perform the requested action: identity:list_projects.",
        "title": "Forbidden"
    }
}

(10)创建用户的程序凭证信息

        为当前令牌范围内的项目上的用户创建应用程序凭据。
在这里插入图片描述

        由于admin用户权限不够,因此为admin用户添加新的访问规则,传入如下的参数:

{
    "application_credential": {
        "name": "nova",
        "description": "Application credential for monitoring.",
        "access_rules": [
            {
                "path": "/v3/**",
                "method": "GET",
                "service": "nova"
            }
        ],
        "unrestricted": false
    }
}

(11)解决403报错问题

        使用admin用户访问某些请求时会出现如下的错误:

{"error": {"message": "You are not authorized to perform the requested action: identity:list_users", "code": 403, "title": "Forbidden"}}

        可以看到,是admin用户没有权限访问到某些请求,这是为什么呢?我们这里通过命令查看用户admin的信息,并尝试为admin用户添加project和role:

[root@controller ~]# openstack user show admin
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | a379733146e442eeb0dbecc390922ed0 |
| enabled   | True                             |
| id        | 840931be05dc4e36945bc8d1a6d0fe1c |
| name      | admin                            |
+-----------+----------------------------------+
(可能是admin用户的权限和角色不是太明确)
##重新设置admin用户的项目和角色##
[root@controller ~]# openstack user set --project admin admin
[root@controller ~]# openstack role add --project admin --user admin admin
[root@controller ~]# openstack user show admin
+--------------------+----------------------------------+
| Field              | Value                            |
+--------------------+----------------------------------+
| default_project_id | fda820529c814812a7ab5fdcb878b291 |
| domain_id          | a379733146e442eeb0dbecc390922ed0 |
| enabled            | True                             |
| id                 | 840931be05dc4e36945bc8d1a6d0fe1c |
| name               | admin                            |
+--------------------+----------------------------------+

        在此之后,重新获取token,重新进行访问:
在这里插入图片描述

        得到的响应如下所示,可以看到将所有的role信息查询出来了:

{
    "links": {
        "self": "http://192.168.112.146:5000/v3/roles",
        "previous": null,
        "next": null
    },
    "roles": [
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/303658bc49594790a63775e8bf992c07"
            },
            "options": {},
            "id": "303658bc49594790a63775e8bf992c07",
            "domain_id": null,
            "name": "member"
        },
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/cec37c653079484295efdf8b69d63bf9"
            },
            "options": {},
            "id": "cec37c653079484295efdf8b69d63bf9",
            "domain_id": null,
            "name": "admin"
        },
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/d469d83419024ea7b7a0c9f731fc96e5"
            },
            "options": {},
            "id": "d469d83419024ea7b7a0c9f731fc96e5",
            "domain_id": null,
            "name": "user"
        },
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/f959f0964ed04b94816e2ee111d13034"
            },
            "options": {},
            "id": "f959f0964ed04b94816e2ee111d13034",
            "domain_id": null,
            "name": "reader"
        }
    ]
}

(12)解决401报错问题

        401错误是没有用户的身份鉴权,需要通过post请求获取用户的token信息,然后将token信息作为header传入到各种服务的访问请求中。


(13)获取所有的域信息

在这里插入图片描述

        传入参数如下所示:
在这里插入图片描述

        得到的响应如下所示,可以看到一个Default域:

{
    "domains": [
        {
            "description": "The default domain",
            "links": {
                "self": "http://192.168.112.146:5000/v3/domains/default"
            },
            "tags": [],
            "enabled": true,
            "options": {},
            "id": "default",
            "name": "Default"
        }
    ],
    "links": {
        "self": "http://192.168.112.146:5000/v3/domains",
        "previous": null,
        "next": null
    }
}

(14)查看一个域的详细信息

在这里插入图片描述

        传入参数:
在这里插入图片描述

        得到响应如下所示:

{
    "domain": {
        "description": "The default domain",
        "links": {
            "self": "http://192.168.112.146:5000/v3/domains/default"
        },
        "tags": [],
        "enabled": true,
        "options": {},
        "id": "default",
        "name": "Default"
    }
}

(15)获取所有的项目信息

在这里插入图片描述

        传入参数如下所示:
在这里插入图片描述

        得到的响应如下所示,列出了所有的项目信息:

{
    "links": {
        "self": "http://192.168.112.146:5000/v3/projects",
        "previous": null,
        "next": null
    },
    "projects": [
        {
            "is_domain": false,
            "description": "Service Project",
            "links": {
                "self": "http://192.168.112.146:5000/v3/projects/6f0e8f4df35d4d27941e31d9125ae94e"
            },
            "tags": [],
            "enabled": true,
            "id": "6f0e8f4df35d4d27941e31d9125ae94e",
            "parent_id": "default",
            "options": {},
            "domain_id": "default",
            "name": "service"
        },
        {
            "is_domain": false,
            "description": "Bootstrap project for initializing the cloud.",
            "links": {
                "self": "http://192.168.112.146:5000/v3/projects/a7d812868cb74f1a978035530f55f1d0"
            },
            "tags": [],
            "enabled": true,
            "id": "a7d812868cb74f1a978035530f55f1d0",
            "parent_id": "default",
            "options": {},
            "domain_id": "default",
            "name": "admin"
        },
        {
            "is_domain": false,
            "description": "Demo Project",
            "links": {
                "self": "http://192.168.112.146:5000/v3/projects/bfd496a2b814455bae8e77483d04f06c"
            },
            "tags": [],
            "enabled": true,
            "id": "bfd496a2b814455bae8e77483d04f06c",
            "parent_id": "default",
            "options": {},
            "domain_id": "default",
            "name": "demo"
        }
    ]
}

(16)创建一个项目

在这里插入图片描述

        传入参数:

在这里插入图片描述

        得到响应,查看dashboard看到有了新的项目:
在这里插入图片描述


(17)查看所有的region地区信息

在这里插入图片描述

        传入参数如下所示:
在这里插入图片描述

        得到的响应如下所示,就是一个默认的RegionOne:

{
    "regions": [
        {
            "parent_region_id": null,
            "id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/regions/RegionOne"
            },
            "description": ""
        }
    ],
    "links": {
        "self": "http://192.168.112.146:5000/v3/regions",
        "previous": null,
        "next": null
    }
}

(18)查看所有的role角色信息

在这里插入图片描述

        传入参数:
在这里插入图片描述

        得到的响应是所有的角色信息:

{
    "links": {
        "self": "http://192.168.112.146:5000/v3/roles",
        "previous": null,
        "next": null
    },
    "roles": [
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/303658bc49594790a63775e8bf992c07"
            },
            "options": {},
            "id": "303658bc49594790a63775e8bf992c07",
            "domain_id": null,
            "name": "member"
        },
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/cec37c653079484295efdf8b69d63bf9"
            },
            "options": {},
            "id": "cec37c653079484295efdf8b69d63bf9",
            "domain_id": null,
            "name": "admin"
        },
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/d469d83419024ea7b7a0c9f731fc96e5"
            },
            "options": {},
            "id": "d469d83419024ea7b7a0c9f731fc96e5",
            "domain_id": null,
            "name": "user"
        },
        {
            "description": null,
            "links": {
                "self": "http://192.168.112.146:5000/v3/roles/f959f0964ed04b94816e2ee111d13034"
            },
            "options": {},
            "id": "f959f0964ed04b94816e2ee111d13034",
            "domain_id": null,
            "name": "reader"
        }
    ]
}

(19)获取所有的服务信息

在这里插入图片描述

        传入参数如下所示:
在这里插入图片描述

        得到的响应,得到的所有的服务service信息:

{
    "services": [
        {
            "description": "OpenStack Networking",
            "links": {
                "self": "http://192.168.112.146:5000/v3/services/044427f3ea384a699b2f4f4892342a18"
            },
            "enabled": true,
            "type": "network",
            "id": "044427f3ea384a699b2f4f4892342a18",
            "name": "neutron"
        },
        {
            "description": "OpenStack Block Storage",
            "links": {
                "self": "http://192.168.112.146:5000/v3/services/45d68d1f8e564fe58d55582f7e30c2f0"
            },
            "enabled": true,
            "type": "volumev3",
            "id": "45d68d1f8e564fe58d55582f7e30c2f0",
            "name": "cinderv3"
        },
        {
            "enabled": true,
            "type": "identity",
            "name": "keystone",
            "links": {
                "self": "http://192.168.112.146:5000/v3/services/53850f0807f44b66b5618b7920137a81"
            },
            "id": "53850f0807f44b66b5618b7920137a81"
        },
        {
            "description": "OpenStack Image",
            "links": {
                "self": "http://192.168.112.146:5000/v3/services/7a4ae2c8db844e949bac9c70ad16fd4c"
            },
            "enabled": true,
            "type": "image",
            "id": "7a4ae2c8db844e949bac9c70ad16fd4c",
            "name": "glance"
        },
        {
            "description": "Placement API",
            "links": {
                "self": "http://192.168.112.146:5000/v3/services/824d32aaade740029a3b5cfabae7ce57"
            },
            "enabled": true,
            "type": "placement",
            "id": "824d32aaade740029a3b5cfabae7ce57",
            "name": "placement"
        },
        {
            "description": "OpenStack Compute",
            "links": {
                "self": "http://192.168.112.146:5000/v3/services/cb8c23da0f71475082693e6168909149"
            },
            "enabled": true,
            "type": "compute",
            "id": "cb8c23da0f71475082693e6168909149",
            "name": "nova"
        },
        {
            "description": "OpenStack Block Storage",
            "links": {
                "self": "http://192.168.112.146:5000/v3/services/ed7df5947cdf43ef9ca36bc823874b29"
            },
            "enabled": true,
            "type": "volumev2",
            "id": "ed7df5947cdf43ef9ca36bc823874b29",
            "name": "cinderv2"
        }
    ],
    "links": {
        "self": "http://192.168.112.146:5000/v3/services",
        "previous": null,
        "next": null
    }
}

(20)获取所有的服务端点endpoint

在这里插入图片描述

        传入参数:

在这里插入图片描述

        得到响应如下所示,得到了所有的端点endpoint:

{
    "endpoints": [
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/012892f45445463ba0b7b447d34b14aa"
            },
            "url": "http://192.168.112.146:5000/v3/",
            "region": "RegionOne",
            "enabled": true,
            "interface": "public",
            "service_id": "53850f0807f44b66b5618b7920137a81",
            "id": "012892f45445463ba0b7b447d34b14aa"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/1bb1e1841d63480894ce70492b7f205b"
            },
            "url": "http://192.168.112.146:8778",
            "region": "RegionOne",
            "enabled": true,
            "interface": "public",
            "service_id": "824d32aaade740029a3b5cfabae7ce57",
            "id": "1bb1e1841d63480894ce70492b7f205b"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/32a0993c72544d649f23514851638f85"
            },
            "url": "http://192.168.112.146:9696",
            "region": "RegionOne",
            "enabled": true,
            "interface": "internal",
            "service_id": "044427f3ea384a699b2f4f4892342a18",
            "id": "32a0993c72544d649f23514851638f85"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/3f0d1a72ea9f4a8b9a54dafc10bf5976"
            },
            "url": "http://192.168.112.146:5000/v3/",
            "region": "RegionOne",
            "enabled": true,
            "interface": "admin",
            "service_id": "53850f0807f44b66b5618b7920137a81",
            "id": "3f0d1a72ea9f4a8b9a54dafc10bf5976"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/55f08f96636547e0866fbfb998bc3d14"
            },
            "url": "http://192.168.112.146:5000/v3/",
            "region": "RegionOne",
            "enabled": true,
            "interface": "internal",
            "service_id": "53850f0807f44b66b5618b7920137a81",
            "id": "55f08f96636547e0866fbfb998bc3d14"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/76db67094f724787baec89a56b43ec03"
            },
            "url": "http://192.168.112.146:9696",
            "region": "RegionOne",
            "enabled": true,
            "interface": "public",
            "service_id": "044427f3ea384a699b2f4f4892342a18",
            "id": "76db67094f724787baec89a56b43ec03"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/7aff24982b0941b4b883f3ac926832cc"
            },
            "url": "http://192.168.112.146:8774/v2.1",
            "region": "RegionOne",
            "enabled": true,
            "interface": "public",
            "service_id": "cb8c23da0f71475082693e6168909149",
            "id": "7aff24982b0941b4b883f3ac926832cc"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/822b14c63ca841508dabb929b39af0e0"
            },
            "url": "http://192.168.112.146:8776/v2/%(project_id)s",
            "region": "RegionOne",
            "enabled": true,
            "interface": "admin",
            "service_id": "ed7df5947cdf43ef9ca36bc823874b29",
            "id": "822b14c63ca841508dabb929b39af0e0"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/85c51c4242e5438882c0853ee227c883"
            },
            "url": "http://192.168.112.146:8776/v3/%(project_id)s",
            "region": "RegionOne",
            "enabled": true,
            "interface": "admin",
            "service_id": "45d68d1f8e564fe58d55582f7e30c2f0",
            "id": "85c51c4242e5438882c0853ee227c883"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/8c58abf746e04b0aa6792d0274748482"
            },
            "url": "http://192.168.112.146:8776/v3/%(project_id)s",
            "region": "RegionOne",
            "enabled": true,
            "interface": "public",
            "service_id": "45d68d1f8e564fe58d55582f7e30c2f0",
            "id": "8c58abf746e04b0aa6792d0274748482"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/8df1f42a6aa04f648fe3f29907f8b52e"
            },
            "url": "http://192.168.112.146:8778",
            "region": "RegionOne",
            "enabled": true,
            "interface": "internal",
            "service_id": "824d32aaade740029a3b5cfabae7ce57",
            "id": "8df1f42a6aa04f648fe3f29907f8b52e"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/9c5b5ba66d844bd3989ce7044832417b"
            },
            "url": "http://192.168.112.146:9696",
            "region": "RegionOne",
            "enabled": true,
            "interface": "admin",
            "service_id": "044427f3ea384a699b2f4f4892342a18",
            "id": "9c5b5ba66d844bd3989ce7044832417b"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/ae1d0674a88d4928a8d0bc42d72a305e"
            },
            "url": "http://192.168.112.146:9292",
            "region": "RegionOne",
            "enabled": true,
            "interface": "internal",
            "service_id": "7a4ae2c8db844e949bac9c70ad16fd4c",
            "id": "ae1d0674a88d4928a8d0bc42d72a305e"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/b539410bc2514f789e3acbad97b7f0ed"
            },
            "url": "http://192.168.112.146:8778",
            "region": "RegionOne",
            "enabled": true,
            "interface": "admin",
            "service_id": "824d32aaade740029a3b5cfabae7ce57",
            "id": "b539410bc2514f789e3acbad97b7f0ed"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/bb0cea3567214ea897451938ff927049"
            },
            "url": "http://192.168.112.146:8776/v2/%(project_id)s",
            "region": "RegionOne",
            "enabled": true,
            "interface": "internal",
            "service_id": "ed7df5947cdf43ef9ca36bc823874b29",
            "id": "bb0cea3567214ea897451938ff927049"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/bc5de3a28e0e412d9f44ef40f2adc7eb"
            },
            "url": "http://192.168.112.146:8774/v2.1",
            "region": "RegionOne",
            "enabled": true,
            "interface": "admin",
            "service_id": "cb8c23da0f71475082693e6168909149",
            "id": "bc5de3a28e0e412d9f44ef40f2adc7eb"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/c8fbf3f819c8421c8fef829ca2c82ed0"
            },
            "url": "http://192.168.112.146:8776/v3/%(project_id)s",
            "region": "RegionOne",
            "enabled": true,
            "interface": "internal",
            "service_id": "45d68d1f8e564fe58d55582f7e30c2f0",
            "id": "c8fbf3f819c8421c8fef829ca2c82ed0"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/e150631f4c90421c8c56faf0ddfdd70b"
            },
            "url": "http://192.168.112.146:9292",
            "region": "RegionOne",
            "enabled": true,
            "interface": "public",
            "service_id": "7a4ae2c8db844e949bac9c70ad16fd4c",
            "id": "e150631f4c90421c8c56faf0ddfdd70b"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/e7b3eed9abd743379c45dbae7bbcef7e"
            },
            "url": "http://192.168.112.146:9292",
            "region": "RegionOne",
            "enabled": true,
            "interface": "admin",
            "service_id": "7a4ae2c8db844e949bac9c70ad16fd4c",
            "id": "e7b3eed9abd743379c45dbae7bbcef7e"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/f16c91f9f7594ba890c4db4a7416f0c0"
            },
            "url": "http://192.168.112.146:8774/v2.1",
            "region": "RegionOne",
            "enabled": true,
            "interface": "internal",
            "service_id": "cb8c23da0f71475082693e6168909149",
            "id": "f16c91f9f7594ba890c4db4a7416f0c0"
        },
        {
            "region_id": "RegionOne",
            "links": {
                "self": "http://192.168.112.146:5000/v3/endpoints/faff0be93505489c92dc4b2287eebabe"
            },
            "url": "http://192.168.112.146:8776/v2/%(project_id)s",
            "region": "RegionOne",
            "enabled": true,
            "interface": "public",
            "service_id": "ed7df5947cdf43ef9ca36bc823874b29",
            "id": "faff0be93505489c92dc4b2287eebabe"
        }
    ],
    "links": {
        "self": "http://192.168.112.146:5000/v3/endpoints",
        "previous": null,
        "next": null
    }
}

(21)获取所有的用户信息

        用户是域拥有的单个 API 使用者。角色明确地将用户与项目或域相关联。没有分配角色的用户无权访问 OpenStack 资源。
您可以列出、创建、显示详细信息、更新、删除和更改用户的密码。
在这里插入图片描述

        传入参数:
在这里插入图片描述

        得到响应,得到所有的用户user信息:

{
    "users": [
        {
            "name": "admin",
            "links": {
                "self": "http://192.168.112.146:5000/v3/users/9942eb4321644336a0c7383d9f1c2bed"
            },
            "domain_id": "default",
            "enabled": true,
            "options": {},
            "default_project_id": "a7d812868cb74f1a978035530f55f1d0",
            "id": "9942eb4321644336a0c7383d9f1c2bed",
            "password_expires_at": null
        },
        {
            "password_expires_at": null,
            "name": "demo",
            "links": {
                "self": "http://192.168.112.146:5000/v3/users/25ac7b3eb75147a89bdaa62485a4902d"
            },
            "domain_id": "default",
            "enabled": true,
            "id": "25ac7b3eb75147a89bdaa62485a4902d",
            "options": {}
        },
        {
            "password_expires_at": null,
            "name": "glance",
            "links": {
                "self": "http://192.168.112.146:5000/v3/users/384162e719d449ff82e5c2a472ec07c2"
            },
            "domain_id": "default",
            "enabled": true,
            "id": "384162e719d449ff82e5c2a472ec07c2",
            "options": {}
        },
        {
            "password_expires_at": null,
            "name": "placement",
            "links": {
                "self": "http://192.168.112.146:5000/v3/users/987ee801b27f42ff85ffff5a8d7859d6"
            },
            "domain_id": "default",
            "enabled": true,
            "id": "987ee801b27f42ff85ffff5a8d7859d6",
            "options": {}
        },
        {
            "password_expires_at": null,
            "name": "nova",
            "links": {
                "self": "http://192.168.112.146:5000/v3/users/038fb453b1f84b81a67da5889666b6d1"
            },
            "domain_id": "default",
            "enabled": true,
            "id": "038fb453b1f84b81a67da5889666b6d1",
            "options": {}
        },
        {
            "password_expires_at": null,
            "name": "neutron",
            "links": {
                "self": "http://192.168.112.146:5000/v3/users/984daa4030fe4b45831bde745c2679a2"
            },
            "domain_id": "default",
            "enabled": true,
            "id": "984daa4030fe4b45831bde745c2679a2",
            "options": {}
        },
        {
            "password_expires_at": null,
            "name": "cinder",
            "links": {
                "self": "http://192.168.112.146:5000/v3/users/f5fe8ae87a154615af34ca976bf24104"
            },
            "domain_id": "default",
            "enabled": true,
            "id": "f5fe8ae87a154615af34ca976bf24104",
            "options": {}
        }
    ],
    "links": {
        "self": "http://192.168.112.146:5000/v3/users",
        "previous": null,
        "next": null
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值