File: types.py

package info (click to toggle)
python-keystoneauth1 5.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,280 kB
  • sloc: python: 23,506; xml: 285; makefile: 93; sh: 2
file content (233 lines) | stat: -rw-r--r-- 4,750 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import typing as ty

import typing_extensions as ty_ext

# Identity V2 auth fields


class TenantV2(ty.TypedDict):
    description: ty_ext.NotRequired[str | None]
    enabled: ty_ext.NotRequired[bool]
    id: str
    name: str


class TokenV2(ty.TypedDict):
    audit_ids: list[str]
    bind: ty_ext.NotRequired[dict[str, ty.Any]]
    expires: str
    id: str
    issued_at: ty_ext.NotRequired[str]
    tenant: ty_ext.NotRequired[TenantV2]


class EndpointV2(ty.TypedDict):
    adminURL: str
    region: str
    internalURL: str
    id: str
    publicURL: str


class CatalogServiceV2(ty.TypedDict):
    endpoints: list[EndpointV2]
    endpoints_links: list[ty.Any]
    type: str
    name: str


class RoleV2(ty.TypedDict):
    name: str


class UserV2(ty.TypedDict):
    id: str
    name: str
    role_links: list[ty.Any]
    roles: list[RoleV2]
    tenantId: ty_ext.NotRequired[str]
    tenantName: ty_ext.NotRequired[str]
    username: str


class MetadataV2(ty.TypedDict):
    is_admin: int
    roles: list[str]


class TrustV2(ty.TypedDict):
    id: str
    impersonation: bool
    trustee_user_id: str
    trustor_user_id: str


class AccessV2(ty.TypedDict):
    token: TokenV2
    serviceCatalog: ty_ext.NotRequired[list[CatalogServiceV2]]
    user: UserV2
    metadata: ty_ext.NotRequired[MetadataV2]
    trust: ty_ext.NotRequired[TrustV2]


class TokenResponseV2(ty.TypedDict):
    access: AccessV2


# Identity V3 auth fields


class EndpointV3(ty.TypedDict):
    id: str
    interface: str
    region: str
    region_id: str
    url: str


class ServiceV3(ty.TypedDict):
    endpoints: list[EndpointV3]
    id: str
    name: str
    type: str


class ProjectDomainV3(ty.TypedDict):
    id: str
    name: str


class ProjectV3(ty.TypedDict):
    domain: ProjectDomainV3
    id: str
    name: str


class DomainV3(ty.TypedDict):
    id: str
    name: str


class UserDomainV3(ty.TypedDict):
    id: str
    name: str


class FederationGroupV3(ty.TypedDict):
    id: str


class FederationProviderV3(ty.TypedDict):
    id: str


class FederationProtocolV3(ty.TypedDict):
    id: str


class FederationV3(ty.TypedDict):
    groups: list[FederationGroupV3]
    identity_provider: FederationProviderV3
    protocol: FederationProtocolV3


UserV3 = ty.TypedDict(
    'UserV3',
    {
        'domain': UserDomainV3,
        'id': str,
        'name': str,
        'password_expires_at': ty_ext.NotRequired[str],
        'OS-FEDERATION': ty_ext.NotRequired[FederationV3],
    },
)


class RoleV3(ty.TypedDict):
    id: str
    name: str


class ApplicationCredentialAccessRuleV3(ty.TypedDict):
    id: str


class ApplicationCredentialV3(ty.TypedDict):
    access_rules: ty_ext.NotRequired[list[ApplicationCredentialAccessRuleV3]]
    id: str
    name: str
    restricted: bool


class ServiceProviderV3(ty.TypedDict):
    auth_url: str
    id: str
    sp_url: str


class TrustorUser(ty.TypedDict):
    id: str


class TrusteeUser(ty.TypedDict):
    id: str


class TrustV3(ty.TypedDict):
    id: str
    impersonation: bool
    trustee_user: TrusteeUser
    trustor_user: TrustorUser


class OAuth1V3(ty.TypedDict):
    access_token_id: str
    consumer_id: str


OAuth2V3 = ty.TypedDict('OAuth2V3', {'x5t#S256': str})


class SystemV3(ty.TypedDict):
    all: bool


TokenV3 = ty.TypedDict(
    'TokenV3',
    {
        'application_credential': ty_ext.NotRequired[ApplicationCredentialV3],
        'audit_ids': list[str],
        'bind': ty_ext.NotRequired[dict[str, ty.Any]],
        'catalog': ty_ext.NotRequired[list[ServiceV3]],
        'domain': ty_ext.NotRequired[DomainV3],
        'expires_at': str,
        'is_admin_project': ty_ext.NotRequired[bool],
        'is_domain': ty_ext.NotRequired[bool],
        'issued_at': str,
        'methods': list[str],
        'oauth2_credential': ty_ext.NotRequired[OAuth2V3],
        'project': ProjectV3,
        'roles': list[RoleV3],
        'service_providers': ty_ext.NotRequired[list[ServiceProviderV3]],
        'system': ty_ext.NotRequired[SystemV3],
        'user': UserV3,
        'OS-OAUTH1': ty_ext.NotRequired[OAuth1V3],
        'OS-TRUST:trust': ty_ext.NotRequired[TrustV3],
    },
)


class TokenResponseV3(ty.TypedDict):
    token: TokenV3