@@ -15,6 +15,7 @@ def create(
15
15
expire_time : int = 0 ,
16
16
role_names : Optional [List [str ]] = None ,
17
17
key_tenants : Optional [List [AssociatedTenant ]] = None ,
18
+ user_id : Optional [str ] = None ,
18
19
) -> dict :
19
20
"""
20
21
Create a new access key.
@@ -26,6 +27,8 @@ def create(
26
27
mutually exclusive with the `key_tenant` roles, which take precedence over them.
27
28
key_tenants (List[AssociatedTenant]): An optional list of the access key's tenants, and optionally, their roles per tenant. These roles are
28
29
mutually exclusive with the general `role_names`, and take precedence over them.
30
+ user_id (str): Bind access key to this user id
31
+ If user_id is supplied, then authorization would be ignored, and access key would be bound to the users authorization
29
32
30
33
Return value (dict):
31
34
Return dict in the format
@@ -44,7 +47,9 @@ def create(
44
47
45
48
response = self ._auth .do_post (
46
49
MgmtV1 .access_key_create_path ,
47
- AccessKey ._compose_create_body (name , expire_time , role_names , key_tenants ),
50
+ AccessKey ._compose_create_body (
51
+ name , expire_time , role_names , key_tenants , user_id
52
+ ),
48
53
pswd = self ._auth .management_key ,
49
54
)
50
55
return response .json ()
@@ -188,10 +193,12 @@ def _compose_create_body(
188
193
expire_time : int ,
189
194
role_names : List [str ],
190
195
key_tenants : List [AssociatedTenant ],
196
+ user_id : Optional [str ] = None ,
191
197
) -> dict :
192
198
return {
193
199
"name" : name ,
194
200
"expireTime" : expire_time ,
195
201
"roleNames" : role_names ,
196
202
"keyTenants" : associated_tenants_to_dict (key_tenants ),
203
+ "userId" : user_id ,
197
204
}
0 commit comments