nextmv 0.18.0__py3-none-any.whl → 1.0.0.dev2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. nextmv/__about__.py +1 -1
  2. nextmv/__entrypoint__.py +8 -13
  3. nextmv/__init__.py +53 -0
  4. nextmv/_serialization.py +96 -0
  5. nextmv/base_model.py +54 -9
  6. nextmv/cli/CONTRIBUTING.md +511 -0
  7. nextmv/cli/__init__.py +0 -0
  8. nextmv/cli/cloud/__init__.py +47 -0
  9. nextmv/cli/cloud/acceptance/__init__.py +27 -0
  10. nextmv/cli/cloud/acceptance/create.py +393 -0
  11. nextmv/cli/cloud/acceptance/delete.py +68 -0
  12. nextmv/cli/cloud/acceptance/get.py +104 -0
  13. nextmv/cli/cloud/acceptance/list.py +62 -0
  14. nextmv/cli/cloud/acceptance/update.py +95 -0
  15. nextmv/cli/cloud/account/__init__.py +28 -0
  16. nextmv/cli/cloud/account/create.py +83 -0
  17. nextmv/cli/cloud/account/delete.py +60 -0
  18. nextmv/cli/cloud/account/get.py +66 -0
  19. nextmv/cli/cloud/account/update.py +70 -0
  20. nextmv/cli/cloud/app/__init__.py +35 -0
  21. nextmv/cli/cloud/app/create.py +141 -0
  22. nextmv/cli/cloud/app/delete.py +58 -0
  23. nextmv/cli/cloud/app/exists.py +44 -0
  24. nextmv/cli/cloud/app/get.py +66 -0
  25. nextmv/cli/cloud/app/list.py +61 -0
  26. nextmv/cli/cloud/app/push.py +137 -0
  27. nextmv/cli/cloud/app/update.py +124 -0
  28. nextmv/cli/cloud/batch/__init__.py +29 -0
  29. nextmv/cli/cloud/batch/create.py +454 -0
  30. nextmv/cli/cloud/batch/delete.py +68 -0
  31. nextmv/cli/cloud/batch/get.py +104 -0
  32. nextmv/cli/cloud/batch/list.py +63 -0
  33. nextmv/cli/cloud/batch/metadata.py +66 -0
  34. nextmv/cli/cloud/batch/update.py +95 -0
  35. nextmv/cli/cloud/data/__init__.py +26 -0
  36. nextmv/cli/cloud/data/upload.py +162 -0
  37. nextmv/cli/cloud/ensemble/__init__.py +31 -0
  38. nextmv/cli/cloud/ensemble/create.py +414 -0
  39. nextmv/cli/cloud/ensemble/delete.py +67 -0
  40. nextmv/cli/cloud/ensemble/get.py +65 -0
  41. nextmv/cli/cloud/ensemble/update.py +103 -0
  42. nextmv/cli/cloud/input_set/__init__.py +30 -0
  43. nextmv/cli/cloud/input_set/create.py +170 -0
  44. nextmv/cli/cloud/input_set/get.py +63 -0
  45. nextmv/cli/cloud/input_set/list.py +63 -0
  46. nextmv/cli/cloud/input_set/update.py +123 -0
  47. nextmv/cli/cloud/instance/__init__.py +35 -0
  48. nextmv/cli/cloud/instance/create.py +290 -0
  49. nextmv/cli/cloud/instance/delete.py +62 -0
  50. nextmv/cli/cloud/instance/exists.py +39 -0
  51. nextmv/cli/cloud/instance/get.py +62 -0
  52. nextmv/cli/cloud/instance/list.py +60 -0
  53. nextmv/cli/cloud/instance/update.py +216 -0
  54. nextmv/cli/cloud/managed_input/__init__.py +31 -0
  55. nextmv/cli/cloud/managed_input/create.py +146 -0
  56. nextmv/cli/cloud/managed_input/delete.py +65 -0
  57. nextmv/cli/cloud/managed_input/get.py +63 -0
  58. nextmv/cli/cloud/managed_input/list.py +60 -0
  59. nextmv/cli/cloud/managed_input/update.py +97 -0
  60. nextmv/cli/cloud/run/__init__.py +37 -0
  61. nextmv/cli/cloud/run/cancel.py +37 -0
  62. nextmv/cli/cloud/run/create.py +530 -0
  63. nextmv/cli/cloud/run/get.py +199 -0
  64. nextmv/cli/cloud/run/input.py +86 -0
  65. nextmv/cli/cloud/run/list.py +80 -0
  66. nextmv/cli/cloud/run/logs.py +167 -0
  67. nextmv/cli/cloud/run/metadata.py +67 -0
  68. nextmv/cli/cloud/run/track.py +501 -0
  69. nextmv/cli/cloud/scenario/__init__.py +29 -0
  70. nextmv/cli/cloud/scenario/create.py +451 -0
  71. nextmv/cli/cloud/scenario/delete.py +65 -0
  72. nextmv/cli/cloud/scenario/get.py +102 -0
  73. nextmv/cli/cloud/scenario/list.py +63 -0
  74. nextmv/cli/cloud/scenario/metadata.py +67 -0
  75. nextmv/cli/cloud/scenario/update.py +93 -0
  76. nextmv/cli/cloud/secrets/__init__.py +33 -0
  77. nextmv/cli/cloud/secrets/create.py +206 -0
  78. nextmv/cli/cloud/secrets/delete.py +67 -0
  79. nextmv/cli/cloud/secrets/get.py +66 -0
  80. nextmv/cli/cloud/secrets/list.py +60 -0
  81. nextmv/cli/cloud/secrets/update.py +147 -0
  82. nextmv/cli/cloud/shadow/__init__.py +33 -0
  83. nextmv/cli/cloud/shadow/create.py +184 -0
  84. nextmv/cli/cloud/shadow/delete.py +68 -0
  85. nextmv/cli/cloud/shadow/get.py +61 -0
  86. nextmv/cli/cloud/shadow/list.py +63 -0
  87. nextmv/cli/cloud/shadow/metadata.py +66 -0
  88. nextmv/cli/cloud/shadow/start.py +43 -0
  89. nextmv/cli/cloud/shadow/stop.py +43 -0
  90. nextmv/cli/cloud/shadow/update.py +95 -0
  91. nextmv/cli/cloud/upload/__init__.py +22 -0
  92. nextmv/cli/cloud/upload/create.py +39 -0
  93. nextmv/cli/cloud/version/__init__.py +33 -0
  94. nextmv/cli/cloud/version/create.py +97 -0
  95. nextmv/cli/cloud/version/delete.py +62 -0
  96. nextmv/cli/cloud/version/exists.py +39 -0
  97. nextmv/cli/cloud/version/get.py +62 -0
  98. nextmv/cli/cloud/version/list.py +60 -0
  99. nextmv/cli/cloud/version/update.py +92 -0
  100. nextmv/cli/community/__init__.py +24 -0
  101. nextmv/cli/community/clone.py +270 -0
  102. nextmv/cli/community/list.py +265 -0
  103. nextmv/cli/configuration/__init__.py +23 -0
  104. nextmv/cli/configuration/config.py +195 -0
  105. nextmv/cli/configuration/create.py +94 -0
  106. nextmv/cli/configuration/delete.py +67 -0
  107. nextmv/cli/configuration/list.py +77 -0
  108. nextmv/cli/main.py +188 -0
  109. nextmv/cli/message.py +153 -0
  110. nextmv/cli/options.py +206 -0
  111. nextmv/cli/version.py +38 -0
  112. nextmv/cloud/__init__.py +71 -17
  113. nextmv/cloud/acceptance_test.py +757 -51
  114. nextmv/cloud/account.py +406 -17
  115. nextmv/cloud/application/__init__.py +957 -0
  116. nextmv/cloud/application/_acceptance.py +419 -0
  117. nextmv/cloud/application/_batch_scenario.py +860 -0
  118. nextmv/cloud/application/_ensemble.py +251 -0
  119. nextmv/cloud/application/_input_set.py +227 -0
  120. nextmv/cloud/application/_instance.py +289 -0
  121. nextmv/cloud/application/_managed_input.py +227 -0
  122. nextmv/cloud/application/_run.py +1393 -0
  123. nextmv/cloud/application/_secrets.py +294 -0
  124. nextmv/cloud/application/_shadow.py +314 -0
  125. nextmv/cloud/application/_utils.py +54 -0
  126. nextmv/cloud/application/_version.py +303 -0
  127. nextmv/cloud/assets.py +48 -0
  128. nextmv/cloud/batch_experiment.py +294 -33
  129. nextmv/cloud/client.py +307 -66
  130. nextmv/cloud/ensemble.py +247 -0
  131. nextmv/cloud/input_set.py +120 -2
  132. nextmv/cloud/instance.py +133 -8
  133. nextmv/cloud/integration.py +533 -0
  134. nextmv/cloud/package.py +168 -53
  135. nextmv/cloud/scenario.py +410 -0
  136. nextmv/cloud/secrets.py +234 -0
  137. nextmv/cloud/shadow.py +190 -0
  138. nextmv/cloud/url.py +73 -0
  139. nextmv/cloud/version.py +132 -4
  140. nextmv/default_app/.gitignore +1 -0
  141. nextmv/default_app/README.md +32 -0
  142. nextmv/default_app/app.yaml +12 -0
  143. nextmv/default_app/input.json +5 -0
  144. nextmv/default_app/main.py +37 -0
  145. nextmv/default_app/requirements.txt +2 -0
  146. nextmv/default_app/src/__init__.py +0 -0
  147. nextmv/default_app/src/visuals.py +36 -0
  148. nextmv/deprecated.py +47 -0
  149. nextmv/input.py +861 -90
  150. nextmv/local/__init__.py +5 -0
  151. nextmv/local/application.py +1251 -0
  152. nextmv/local/executor.py +1042 -0
  153. nextmv/local/geojson_handler.py +323 -0
  154. nextmv/local/local.py +97 -0
  155. nextmv/local/plotly_handler.py +61 -0
  156. nextmv/local/runner.py +274 -0
  157. nextmv/logger.py +80 -9
  158. nextmv/manifest.py +1466 -0
  159. nextmv/model.py +241 -66
  160. nextmv/options.py +708 -115
  161. nextmv/output.py +1301 -274
  162. nextmv/polling.py +325 -0
  163. nextmv/run.py +1702 -0
  164. nextmv/safe.py +145 -0
  165. nextmv/status.py +122 -0
  166. nextmv-1.0.0.dev2.dist-info/METADATA +311 -0
  167. nextmv-1.0.0.dev2.dist-info/RECORD +170 -0
  168. {nextmv-0.18.0.dist-info → nextmv-1.0.0.dev2.dist-info}/WHEEL +1 -1
  169. nextmv-1.0.0.dev2.dist-info/entry_points.txt +2 -0
  170. nextmv/cloud/application.py +0 -1405
  171. nextmv/cloud/manifest.py +0 -234
  172. nextmv/cloud/status.py +0 -29
  173. nextmv-0.18.0.dist-info/METADATA +0 -770
  174. nextmv-0.18.0.dist-info/RECORD +0 -25
  175. {nextmv-0.18.0.dist-info → nextmv-1.0.0.dev2.dist-info}/licenses/LICENSE +0 -0
nextmv/cloud/account.py CHANGED
@@ -1,13 +1,85 @@
1
- from dataclasses import dataclass
1
+ """
2
+ Account management functionality for the Nextmv Cloud API.
3
+
4
+ This module provides classes for interacting with account-level resources
5
+ in the Nextmv Platform, particularly for accessing and managing the queue
6
+ of runs.
7
+
8
+ Classes
9
+ -------
10
+ QueuedRun
11
+ A run that is pending to be executed in the account.
12
+ Queue
13
+ A list of runs that are pending or currently being executed.
14
+ Account
15
+ The Nextmv Platform account with API access methods.
16
+ """
17
+
2
18
  from datetime import datetime
3
19
 
20
+ from pydantic import AliasChoices, Field
21
+
4
22
  from nextmv.base_model import BaseModel
5
23
  from nextmv.cloud.client import Client
6
- from nextmv.cloud.status import Status, StatusV2
24
+ from nextmv.status import Status, StatusV2
7
25
 
8
26
 
9
27
  class QueuedRun(BaseModel):
10
- """A run that is pending to be executed in the account."""
28
+ """
29
+ A run that is pending to be executed in the account.
30
+
31
+ You can import the `QueuedRun` class directly from `cloud`:
32
+
33
+ ```python
34
+ from nextmv.cloud import QueuedRun
35
+ ```
36
+
37
+ Represents details of a run in the queue, including its status and metadata.
38
+ QueuedRun objects are typically obtained through the Account.queue() method.
39
+
40
+ Attributes
41
+ ----------
42
+ id : str
43
+ ID of the run.
44
+ user_email : str
45
+ Email of the user who created the run.
46
+ name : str
47
+ Name of the run.
48
+ description : str
49
+ Description of the run.
50
+ created_at : datetime
51
+ Creation date of the run.
52
+ application_id : str
53
+ ID of the application used for the run.
54
+ application_instance_id : str
55
+ ID of the application instance used for the run.
56
+ application_version_id : str
57
+ ID of the application version used for the run.
58
+ execution_class : str
59
+ Execution class used for the run.
60
+ status : Status
61
+ Deprecated: use status_v2.
62
+ status_v2 : StatusV2
63
+ Status of the run.
64
+
65
+ Examples
66
+ --------
67
+ >>> queued_run = QueuedRun.from_dict({
68
+ ... "id": "run-123456",
69
+ ... "user_email": "user@example.com",
70
+ ... "name": "My Run",
71
+ ... "description": "Test run",
72
+ ... "created_at": "2023-01-01T12:00:00Z",
73
+ ... "application_id": "app-123456",
74
+ ... "application_instance_id": "appins-123456",
75
+ ... "application_version_id": "appver-123456",
76
+ ... "execution_class": "standard",
77
+ ... "status": "RUNNING",
78
+ ... "status_v2": "RUNNING"
79
+ ... })
80
+ >>> print(queued_run.name)
81
+ My Run
82
+ """
11
83
 
12
84
  id: str
13
85
  """ID of the run."""
@@ -34,35 +106,352 @@ class QueuedRun(BaseModel):
34
106
 
35
107
 
36
108
  class Queue(BaseModel):
37
- """A queue is a list of runs that are pending to be executed, or currently
38
- being executed, in the account."""
109
+ """
110
+ A queue is a list of runs that are pending to be executed, or currently
111
+ being executed, in the account.
112
+
113
+ You can import the `Queue` class directly from `cloud`:
114
+
115
+ ```python
116
+ from nextmv.cloud import Queue
117
+ ```
118
+
119
+ The Queue object provides access to a list of queued runs in a Nextmv account.
120
+ It is typically obtained through the Account.queue() method.
121
+
122
+ Attributes
123
+ ----------
124
+ runs : list[QueuedRun]
125
+ List of runs in the queue.
126
+
127
+ Examples
128
+ --------
129
+ >>> from nextmv.cloud import Client, Account
130
+ >>> client = Client(api_key="your-api-key")
131
+ >>> account = Account.get(client=client, account_id="your-account-id")
132
+ >>> queue = account.queue()
133
+ >>> print(f"Number of runs in queue: {len(queue.runs)}")
134
+ Number of runs in queue: 5
135
+ >>> # Accessing the first run in the queue
136
+ >>> if queue.runs:
137
+ ... print(f"First run: {queue.runs[0].name}")
138
+ First run: My Priority Run
139
+ """
39
140
 
40
141
  runs: list[QueuedRun]
41
142
  """List of runs in the queue."""
42
143
 
43
144
 
44
- @dataclass
45
- class Account:
46
- """The Nextmv Platform account."""
145
+ class AccountMember(BaseModel):
146
+ """
147
+ A member of a Nextmv Cloud account (organization).
148
+
149
+ You can import the `AccountMember` class directly from `cloud`:
150
+
151
+ ```python
152
+ from nextmv.cloud import AccountMember
153
+ ```
154
+
155
+ Represents an individual member of an organization in Nextmv Cloud,
156
+ including their role and invitation status.
157
+
158
+ Attributes
159
+ ----------
160
+ email : str | None
161
+ Email of the account member.
162
+ role : str | None
163
+ Role of the account member.
164
+ pending_invite : bool | None
165
+ Whether the member has a pending invite.
166
+
167
+ Examples
168
+ --------
169
+ >>> member = AccountMember.from_dict({
170
+ ... "email": "peter.rabbit@carrotexpress.com",
171
+ ... "role": "admin",
172
+ ... "pending_invite": False
173
+ ... })
174
+ >>> print(f"{member.email} - {member.role}")
175
+ peter.rabbit@carrotexpress.com - admin
176
+ """
177
+
178
+ email: str | None = None
179
+ """Email of the account member."""
180
+ role: str | None = None
181
+ """Role of the account member."""
182
+ pending_invite: bool | None = None
183
+ """Whether the member has a pending invite."""
47
184
 
48
- client: Client
49
- """Client to use for interacting with the Nextmv Cloud API."""
50
185
 
51
- endpoint: str = "v1/account"
186
+ class Account(BaseModel):
187
+ """
188
+ The Nextmv Cloud account (organization).
189
+
190
+ To handle managed accounts, SSO must be configured for your organization.
191
+ Please contact [Nextmv support](https://www.nextmv.io/contact) for
192
+ assistance.
193
+
194
+ You can import the `Account` class directly from `cloud`:
195
+
196
+ ```python
197
+ from nextmv.cloud import Account
198
+ ```
199
+
200
+ This class provides access to account-level operations in the Nextmv Cloud,
201
+ such as retrieving the queue of runs.
202
+
203
+ Note: It is recommended to use `Account.get()` or `Account.new()`
204
+ instead of direct initialization to ensure proper setup.
205
+
206
+ Parameters
207
+ ----------
208
+ client : Client
209
+ Client to use for interacting with the Nextmv Cloud API.
210
+ account_id : str, optional
211
+ ID of the account (organization).
212
+ name : str, optional
213
+ Name of the account (organization).
214
+ members : list[AccountMember], optional
215
+ List of members in the account (organization).
216
+ account_endpoint : str, default="v1/account"
217
+ Base endpoint for the account (SDK-specific).
218
+ organization_endpoint : str, default="v1/organization/{organization_id}"
219
+ Base endpoint for organization operations (SDK-specific).
220
+
221
+ Examples
222
+ --------
223
+ >>> from nextmv.cloud import Client, Account
224
+ >>> client = Client(api_key="your-api-key")
225
+ >>> # Retrieve an existing account
226
+ >>> account = Account.get(client=client, account_id="your-account-id")
227
+ >>> print(f"Account name: {account.name}")
228
+ Account name: Bunny Logistics
229
+ >>> # Create a new account
230
+ >>> new_account = Account.new(client=client, name="Hare Delivery Co", admins=["admin@example.com"])
231
+ >>> # Get the queue of runs
232
+ >>> queue = account.queue()
233
+ >>> print(f"Number of runs in queue: {len(queue.runs)}")
234
+ Number of runs in queue: 3
235
+ """
236
+
237
+ # Actual API attributes of an account.
238
+ account_id: str | None = Field(
239
+ serialization_alias="id",
240
+ validation_alias=AliasChoices("id", "account_id"),
241
+ default=None,
242
+ )
243
+ """ID of the account (organization)."""
244
+ name: str | None = None
245
+ """Name of the account (organization)."""
246
+ members: list[AccountMember] | None = None
247
+ """List of members in the account (organization)."""
248
+
249
+ # SDK-specific attributes for convenience when using methods.
250
+ client: Client = Field(exclude=True)
251
+ """Client to use for interacting with the Nextmv Cloud API."""
252
+ account_endpoint: str = Field(exclude=True, default="v1/account")
52
253
  """Base endpoint for the account."""
254
+ organization_endpoint: str = Field(exclude=True, default="v1/organization/{organization_id}")
255
+
256
+ def model_post_init(self, __context) -> None:
257
+ """
258
+ Initialize the organization_endpoint attribute.
259
+
260
+ This method is automatically called after class initialization to
261
+ format the organization_endpoint URL with the account ID.
262
+ """
263
+
264
+ self.organization_endpoint = self.organization_endpoint.format(organization_id=self.account_id)
265
+
266
+ @classmethod
267
+ def get(cls, client: Client, account_id: str) -> "Account":
268
+ """
269
+ Retrieve an account directly from Nextmv Cloud.
270
+
271
+ This function is useful if you want to populate an `Account` class
272
+ by fetching the attributes directly from Nextmv Cloud.
273
+
274
+ Parameters
275
+ ----------
276
+ client : Client
277
+ Client to use for interacting with the Nextmv Cloud API.
278
+ account_id : str
279
+ ID of the account to retrieve.
280
+
281
+ Returns
282
+ -------
283
+ Account
284
+ The requested account.
285
+
286
+ Raises
287
+ ------
288
+ requests.HTTPError
289
+ If the response status code is not 2xx.
290
+
291
+ Examples
292
+ --------
293
+ >>> from nextmv.cloud import Client, Account
294
+ >>> client = Client(api_key="your-api-key")
295
+ >>> account = Account.get(client=client, account_id="bunny-logistics")
296
+ >>> print(f"Account: {account.name}")
297
+ Account: Bunny Logistics
298
+ >>> print(f"Members: {len(account.members)}")
299
+ Members: 3
300
+ """
301
+
302
+ response = client.request(
303
+ method="GET",
304
+ endpoint=f"v1/organization/{account_id}",
305
+ )
306
+
307
+ return cls.from_dict({"client": client} | response.json())
308
+
309
+ @classmethod
310
+ def new(
311
+ cls,
312
+ client: Client,
313
+ name: str,
314
+ admins: list[str],
315
+ ) -> "Account":
316
+ """
317
+ Create a new account (organization) directly in Nextmv Cloud.
318
+
319
+ To create managed accounts, SSO must be configured for your
320
+ organization. Please contact [Nextmv
321
+ support](https://www.nextmv.io/contact) for assistance.
322
+
323
+ Parameters
324
+ ----------
325
+ client : Client
326
+ Client to use for interacting with the Nextmv Cloud API.
327
+ name : str
328
+ Name of the new account.
329
+ admins : list[str]
330
+ List of admin user emails for the new account.
331
+
332
+ Returns
333
+ -------
334
+ Account
335
+ The newly created account.
336
+
337
+ Examples
338
+ --------
339
+ >>> from nextmv.cloud import Client
340
+ >>> client = Client(api_key="your-api-key")
341
+ >>> account = Account.new(client=client, name="My New Account", admins=["admin@example.com"])
342
+ """
343
+
344
+ if len(admins) == 0:
345
+ raise ValueError("at least one admin email must be provided to create an account")
346
+
347
+ payload = {
348
+ "name": name,
349
+ "admins": admins,
350
+ }
351
+
352
+ response = client.request(
353
+ method="POST",
354
+ endpoint="v1/organization",
355
+ payload=payload,
356
+ )
357
+
358
+ return cls.from_dict({"client": client} | response.json())
359
+
360
+ def delete(self) -> None:
361
+ """
362
+ Delete the account.
363
+
364
+ Permanently removes the account (organization) from Nextmv Cloud. You
365
+ must have the administrator role on that account in order to delete it.
366
+
367
+ Raises
368
+ ------
369
+ requests.HTTPError
370
+ If the response status code is not 2xx.
371
+
372
+ Examples
373
+ --------
374
+ >>> account.delete() # Permanently deletes the account
375
+ """
376
+
377
+ _ = self.client.request(
378
+ method="DELETE",
379
+ endpoint=self.organization_endpoint,
380
+ )
53
381
 
54
382
  def queue(self) -> Queue:
55
- """Get the queue of runs in the account.
383
+ """
384
+ Get the queue of runs in the account.
385
+
386
+ Retrieves the current list of runs that are pending or being executed
387
+ in the Nextmv account.
388
+
389
+ Returns
390
+ -------
391
+ Queue
392
+ Queue of runs in the account.
56
393
 
57
- Returns:
58
- Queue: Queue of runs in the account.
394
+ Raises
395
+ ------
396
+ requests.HTTPError
397
+ If the response status code is not 2xx.
59
398
 
60
- Raises:
61
- requests.HTTPError: If the response status code is not 2xx.
399
+ Examples
400
+ --------
401
+ >>> from nextmv.cloud import Client, Account
402
+ >>> client = Client(api_key="your-api-key")
403
+ >>> account = Account.get(client=client, account_id="your-account-id")
404
+ >>> queue = account.queue()
405
+ >>> for run in queue.runs:
406
+ ... print(f"Run {run.id}: {run.name} - Status: {run.status_v2}")
407
+ Run run-123: Daily Optimization - Status: RUNNING
408
+ Run run-456: Weekly Planning - Status: QUEUED
62
409
  """
63
410
  response = self.client.request(
64
411
  method="GET",
65
- endpoint=self.endpoint + "/queue",
412
+ endpoint=self.account_endpoint + "/queue",
66
413
  )
67
414
 
68
415
  return Queue.from_dict(response.json())
416
+
417
+ def update(self, name: str) -> "Account":
418
+ """
419
+ Update the account.
420
+
421
+ Parameters
422
+ ----------
423
+ name : str
424
+ Name of the account.
425
+
426
+ Returns
427
+ -------
428
+ Account
429
+ The updated account.
430
+
431
+ Raises
432
+ ------
433
+ requests.HTTPError
434
+ If the response status code is not 2xx.
435
+
436
+ Examples
437
+ --------
438
+ >>> from nextmv.cloud import Client, Account
439
+ >>> client = Client(api_key="your-api-key")
440
+ >>> account = Account.get(client=client, account_id="bunny-logistics")
441
+ >>> updated_account = account.update(name="Bunny Express Logistics")
442
+ >>> print(updated_account.name)
443
+ Bunny Express Logistics
444
+ """
445
+
446
+ account = self.get(client=self.client, account_id=self.account_id)
447
+ account_dict = account.to_dict()
448
+ payload = account_dict.copy()
449
+ payload["name"] = name
450
+
451
+ response = self.client.request(
452
+ method="PUT",
453
+ endpoint=self.organization_endpoint,
454
+ payload=payload,
455
+ )
456
+
457
+ return Account.from_dict({"client": self.client} | response.json())