|
| 1 | +from __future__ import annotations |
| 2 | + |
1 | 3 | from datetime import datetime
|
2 | 4 |
|
3 | 5 | import requests
|
|
16 | 18 | )
|
17 | 19 | from linode_api4.objects.longview import LongviewClient, LongviewSubscription
|
18 | 20 | from linode_api4.objects.nodebalancer import NodeBalancer
|
| 21 | +from linode_api4.objects.profile import PersonalAccessToken |
19 | 22 | from linode_api4.objects.support import SupportTicket
|
20 | 23 |
|
21 | 24 |
|
@@ -53,6 +56,37 @@ class Account(Base):
|
53 | 56 | }
|
54 | 57 |
|
55 | 58 |
|
| 59 | +class ChildAccount(Account): |
| 60 | + """ |
| 61 | + A child account under a parent account. |
| 62 | +
|
| 63 | + API Documentation: TBD |
| 64 | + """ |
| 65 | + |
| 66 | + api_endpoint = "/account/child-accounts/{euuid}" |
| 67 | + id_attribute = "euuid" |
| 68 | + |
| 69 | + def create_token(self, **kwargs): |
| 70 | + """ |
| 71 | + Create a ephemeral token for accessing the child account. |
| 72 | +
|
| 73 | + API Documentation: TBD |
| 74 | + """ |
| 75 | + resp = self._client.post( |
| 76 | + "{}/token".format(self.api_endpoint), |
| 77 | + model=self, |
| 78 | + data=kwargs, |
| 79 | + ) |
| 80 | + |
| 81 | + if "errors" in resp: |
| 82 | + raise UnexpectedResponseError( |
| 83 | + "Unexpected response when creating a token for the child account!", |
| 84 | + json=resp, |
| 85 | + ) |
| 86 | + |
| 87 | + return PersonalAccessToken(self._client, resp["id"], resp) |
| 88 | + |
| 89 | + |
56 | 90 | class ServiceTransfer(Base):
|
57 | 91 | """
|
58 | 92 | A transfer request for transferring a service between Linode accounts.
|
@@ -476,6 +510,7 @@ class User(Base):
|
476 | 510 | properties = {
|
477 | 511 | "email": Property(),
|
478 | 512 | "username": Property(identifier=True, mutable=True),
|
| 513 | + "user_type": Property(), |
479 | 514 | "restricted": Property(mutable=True),
|
480 | 515 | "ssh_keys": Property(),
|
481 | 516 | "tfa_enabled": Property(),
|
|
0 commit comments