|
47 | 47 | User, |
48 | 48 | CreateSSHKeyRequest, |
49 | 49 | UpdateSSHKeyRequest, |
| 50 | + CreateUserRequest, |
50 | 51 | CreateApplicationRequest, |
51 | 52 | UpdateApplicationRequest, |
52 | 53 | CreateGroupRequest, |
|
69 | 70 | marshal_CreateGroupRequest, |
70 | 71 | marshal_CreatePolicyRequest, |
71 | 72 | marshal_CreateSSHKeyRequest, |
| 73 | + marshal_CreateUserRequest, |
72 | 74 | marshal_RemoveGroupMemberRequest, |
73 | 75 | marshal_SetGroupMembersRequest, |
74 | 76 | marshal_SetRulesRequest, |
@@ -464,6 +466,40 @@ async def delete_user( |
464 | 466 | self._throw_on_error(res) |
465 | 467 | return None |
466 | 468 |
|
| 469 | + async def create_user( |
| 470 | + self, |
| 471 | + *, |
| 472 | + email: str, |
| 473 | + organization_id: Optional[str] = None, |
| 474 | + ) -> User: |
| 475 | + """ |
| 476 | + Create a new user. |
| 477 | + Create a new user. You must define the `organization_id` and the `email` in your request. |
| 478 | + :param organization_id: ID of the Organization. |
| 479 | + :param email: Email of the user. |
| 480 | + :return: :class:`User <User>` |
| 481 | +
|
| 482 | + Usage: |
| 483 | + :: |
| 484 | +
|
| 485 | + result = await api.create_user(email="example") |
| 486 | + """ |
| 487 | + |
| 488 | + res = self._request( |
| 489 | + "POST", |
| 490 | + f"/iam/v1alpha1/users", |
| 491 | + body=marshal_CreateUserRequest( |
| 492 | + CreateUserRequest( |
| 493 | + email=email, |
| 494 | + organization_id=organization_id, |
| 495 | + ), |
| 496 | + self.client, |
| 497 | + ), |
| 498 | + ) |
| 499 | + |
| 500 | + self._throw_on_error(res) |
| 501 | + return unmarshal_User(res.json()) |
| 502 | + |
467 | 503 | async def list_applications( |
468 | 504 | self, |
469 | 505 | *, |
|
0 commit comments