cacholong-cloud-cli 1.0.0__tar.gz → 1.2.0__tar.gz
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.
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/PKG-INFO +1 -1
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/cli.py +2 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/accounts.py +196 -5
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/addresses.py +46 -18
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/companies.py +23 -10
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/dns_records.py +30 -16
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/dns_templates.py +25 -9
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/dns_zones.py +45 -19
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/mail_address_aliases.py +19 -6
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/mail_addresses.py +39 -14
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/mail_domains.py +46 -20
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/mail_forwards.py +21 -6
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/products.py +25 -12
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/purchases.py +55 -30
- cacholong_cloud_cli-1.2.0/cacholong_cli/commands/users.py +204 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/common.py +11 -8
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/__init__.py +2 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/api_schema.py +23 -4
- cacholong_cloud_cli-1.2.0/cacholong_sdk/user_role_base.py +15 -0
- cacholong_cloud_cli-1.2.0/cacholong_sdk/user_role_show.py +15 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/pyproject.toml +1 -1
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/README.md +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/AsyncTyper.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/__init__.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/connection.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/account_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/account_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/address_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/address_create_with_company.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/address_create_with_user.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/address_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/address_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/common.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/company_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/company_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/company_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/connection.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_record_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_record_create_with_template.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_record_create_with_zone.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_record_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_record_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_template_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_template_create.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_template_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_template_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_zone_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_zone_create.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_zone_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/dns_zone_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/exception.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_alias_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_alias_create.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_alias_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_alias_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_create.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_address_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_domain_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_domain_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_forward_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_forward_create.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_forward_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/mail_forward_update.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/product_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/product_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/purchase_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/purchase_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/service_mail_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/service_mail_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/user_base.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_sdk/user_show.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/__init__.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/common.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/document.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/exceptions.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/filter.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/objects.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/relationships.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/resourceobject.py +0 -0
- {cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/jsonapi-client/src/jsonapi_client/session.py +0 -0
|
@@ -17,6 +17,7 @@ from cacholong_cli.commands import (
|
|
|
17
17
|
mail_forwards,
|
|
18
18
|
products,
|
|
19
19
|
purchases,
|
|
20
|
+
users,
|
|
20
21
|
)
|
|
21
22
|
from cacholong_cli.common import OutputFormat
|
|
22
23
|
from xdg import BaseDirectory
|
|
@@ -57,6 +58,7 @@ app.add_typer(mail_domains.app, name="mail-domains", help="Manage mail domains")
|
|
|
57
58
|
app.add_typer(mail_forwards.app, name="mail-forwards", help="Manage mail forwards")
|
|
58
59
|
app.add_typer(products.app, name="products", help="Manage products")
|
|
59
60
|
app.add_typer(purchases.app, name="purchases", help="Manage purchases")
|
|
61
|
+
app.add_typer(users.app, name="users", help="")
|
|
60
62
|
|
|
61
63
|
|
|
62
64
|
# Handle version
|
|
@@ -39,6 +39,9 @@ async def list(
|
|
|
39
39
|
account_account_relation: Annotated[
|
|
40
40
|
Optional[str], typer.Option(help="Parent account relationship type")
|
|
41
41
|
] = None,
|
|
42
|
+
company: Annotated[
|
|
43
|
+
Optional[UUID], typer.Option(help="The company associated with this account")
|
|
44
|
+
] = None,
|
|
42
45
|
created_at: Annotated[
|
|
43
46
|
Optional[datetime],
|
|
44
47
|
typer.Option(help="Timestamp when the account was created (exact match)"),
|
|
@@ -87,23 +90,25 @@ async def list(
|
|
|
87
90
|
Optional[datetime],
|
|
88
91
|
typer.Option(help="Timestamp when the account was last updated (less than)"),
|
|
89
92
|
] = None,
|
|
90
|
-
company: Annotated[
|
|
91
|
-
Optional[UUID], typer.Option(help="The company associated with this account")
|
|
92
|
-
] = None,
|
|
93
93
|
):
|
|
94
94
|
|
|
95
95
|
# Build modifier
|
|
96
96
|
modifier = []
|
|
97
|
+
|
|
97
98
|
if name is not None:
|
|
98
99
|
modifier.append(Filter(name=name))
|
|
100
|
+
|
|
99
101
|
if description is not None:
|
|
100
102
|
modifier.append(Filter(description=description))
|
|
103
|
+
|
|
101
104
|
if account_type is not None:
|
|
102
105
|
modifier.append(Filter(query_str="filter[account_type]=" + str(account_type)))
|
|
106
|
+
|
|
103
107
|
if account_account_id is not None:
|
|
104
108
|
modifier.append(
|
|
105
109
|
Filter(query_str="filter[account_account_id]=" + str(account_account_id))
|
|
106
110
|
)
|
|
111
|
+
|
|
107
112
|
if account_account_relation is not None:
|
|
108
113
|
modifier.append(
|
|
109
114
|
Filter(
|
|
@@ -111,6 +116,10 @@ async def list(
|
|
|
111
116
|
+ str(account_account_relation)
|
|
112
117
|
)
|
|
113
118
|
)
|
|
119
|
+
|
|
120
|
+
if company is not None:
|
|
121
|
+
modifier.append(Filter(company=str(company)))
|
|
122
|
+
|
|
114
123
|
if created_at is not None:
|
|
115
124
|
modifier.append(
|
|
116
125
|
Filter(
|
|
@@ -161,6 +170,7 @@ async def list(
|
|
|
161
170
|
+ "Z"
|
|
162
171
|
)
|
|
163
172
|
)
|
|
173
|
+
|
|
164
174
|
if updated_at is not None:
|
|
165
175
|
modifier.append(
|
|
166
176
|
Filter(
|
|
@@ -211,15 +221,15 @@ async def list(
|
|
|
211
221
|
+ "Z"
|
|
212
222
|
)
|
|
213
223
|
)
|
|
214
|
-
if company is not None:
|
|
215
|
-
modifier.append(Filter(company=str(company)))
|
|
216
224
|
|
|
217
225
|
# Table definition
|
|
218
226
|
tabledef: TableDef = [
|
|
219
227
|
{"header": Column("Id", no_wrap=True), "column": "id"},
|
|
228
|
+
{"header": "Name", "column": "name"},
|
|
220
229
|
{"header": "Created", "column": "created_at"},
|
|
221
230
|
{"header": "Updated", "column": "updated_at"},
|
|
222
231
|
]
|
|
232
|
+
|
|
223
233
|
async with Connection() as conn:
|
|
224
234
|
await list_resources(ctx, AccountBase(conn, api_schema), tabledef, modifier)
|
|
225
235
|
|
|
@@ -238,3 +248,184 @@ async def show(
|
|
|
238
248
|
show_resource(ctx, model)
|
|
239
249
|
except DocumentError as e:
|
|
240
250
|
await print_document_error(e)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@app.async_command(name="list-user-roles", help="List all user-roles for an account")
|
|
254
|
+
async def list_user_roles(
|
|
255
|
+
ctx: typer.Context,
|
|
256
|
+
account_id: Annotated[UUID, typer.Argument(help="Parent resource ID")],
|
|
257
|
+
account: Annotated[Optional[UUID], typer.Option(help="The account")] = None,
|
|
258
|
+
user: Annotated[Optional[UUID], typer.Option(help="The user")] = None,
|
|
259
|
+
role: Annotated[Optional[UUID], typer.Option(help="The role")] = None,
|
|
260
|
+
created_at: Annotated[
|
|
261
|
+
Optional[datetime], typer.Option(help="Timestamp when created (exact match)")
|
|
262
|
+
] = None,
|
|
263
|
+
created_at_gte: Annotated[
|
|
264
|
+
Optional[datetime],
|
|
265
|
+
typer.Option(help="Timestamp when created (greater than or equal)"),
|
|
266
|
+
] = None,
|
|
267
|
+
created_at_lte: Annotated[
|
|
268
|
+
Optional[datetime],
|
|
269
|
+
typer.Option(help="Timestamp when created (less than or equal)"),
|
|
270
|
+
] = None,
|
|
271
|
+
created_at_gt: Annotated[
|
|
272
|
+
Optional[datetime], typer.Option(help="Timestamp when created (greater than)")
|
|
273
|
+
] = None,
|
|
274
|
+
created_at_lt: Annotated[
|
|
275
|
+
Optional[datetime], typer.Option(help="Timestamp when created (less than)")
|
|
276
|
+
] = None,
|
|
277
|
+
updated_at: Annotated[
|
|
278
|
+
Optional[datetime],
|
|
279
|
+
typer.Option(help="Timestamp when last updated (exact match)"),
|
|
280
|
+
] = None,
|
|
281
|
+
updated_at_gte: Annotated[
|
|
282
|
+
Optional[datetime],
|
|
283
|
+
typer.Option(help="Timestamp when last updated (greater than or equal)"),
|
|
284
|
+
] = None,
|
|
285
|
+
updated_at_lte: Annotated[
|
|
286
|
+
Optional[datetime],
|
|
287
|
+
typer.Option(help="Timestamp when last updated (less than or equal)"),
|
|
288
|
+
] = None,
|
|
289
|
+
updated_at_gt: Annotated[
|
|
290
|
+
Optional[datetime],
|
|
291
|
+
typer.Option(help="Timestamp when last updated (greater than)"),
|
|
292
|
+
] = None,
|
|
293
|
+
updated_at_lt: Annotated[
|
|
294
|
+
Optional[datetime], typer.Option(help="Timestamp when last updated (less than)")
|
|
295
|
+
] = None,
|
|
296
|
+
):
|
|
297
|
+
"""List all user-roles for an account"""
|
|
298
|
+
try:
|
|
299
|
+
async with Connection() as conn:
|
|
300
|
+
# Fetch parent resource
|
|
301
|
+
parent_ctrl = AccountBase(conn, api_schema)
|
|
302
|
+
parent_model = await parent_ctrl.fetch(account_id)
|
|
303
|
+
|
|
304
|
+
# Build modifier for filtering and includes
|
|
305
|
+
modifier = []
|
|
306
|
+
|
|
307
|
+
if account is not None:
|
|
308
|
+
modifier.append(Filter(account=str(account)))
|
|
309
|
+
|
|
310
|
+
if user is not None:
|
|
311
|
+
modifier.append(Filter(user=str(user)))
|
|
312
|
+
|
|
313
|
+
if role is not None:
|
|
314
|
+
modifier.append(Filter(role=str(role)))
|
|
315
|
+
|
|
316
|
+
if created_at is not None:
|
|
317
|
+
modifier.append(
|
|
318
|
+
Filter(
|
|
319
|
+
query_str="filter[created_at]="
|
|
320
|
+
+ created_at.astimezone(timezone.utc)
|
|
321
|
+
.replace(tzinfo=None)
|
|
322
|
+
.isoformat(timespec="milliseconds")
|
|
323
|
+
+ "Z"
|
|
324
|
+
)
|
|
325
|
+
)
|
|
326
|
+
if created_at_gte is not None:
|
|
327
|
+
modifier.append(
|
|
328
|
+
Filter(
|
|
329
|
+
query_str="filter[created_at_gte]="
|
|
330
|
+
+ created_at_gte.astimezone(timezone.utc)
|
|
331
|
+
.replace(tzinfo=None)
|
|
332
|
+
.isoformat(timespec="milliseconds")
|
|
333
|
+
+ "Z"
|
|
334
|
+
)
|
|
335
|
+
)
|
|
336
|
+
if created_at_lte is not None:
|
|
337
|
+
modifier.append(
|
|
338
|
+
Filter(
|
|
339
|
+
query_str="filter[created_at_lte]="
|
|
340
|
+
+ created_at_lte.astimezone(timezone.utc)
|
|
341
|
+
.replace(tzinfo=None)
|
|
342
|
+
.isoformat(timespec="milliseconds")
|
|
343
|
+
+ "Z"
|
|
344
|
+
)
|
|
345
|
+
)
|
|
346
|
+
if created_at_gt is not None:
|
|
347
|
+
modifier.append(
|
|
348
|
+
Filter(
|
|
349
|
+
query_str="filter[created_at_gt]="
|
|
350
|
+
+ created_at_gt.astimezone(timezone.utc)
|
|
351
|
+
.replace(tzinfo=None)
|
|
352
|
+
.isoformat(timespec="milliseconds")
|
|
353
|
+
+ "Z"
|
|
354
|
+
)
|
|
355
|
+
)
|
|
356
|
+
if created_at_lt is not None:
|
|
357
|
+
modifier.append(
|
|
358
|
+
Filter(
|
|
359
|
+
query_str="filter[created_at_lt]="
|
|
360
|
+
+ created_at_lt.astimezone(timezone.utc)
|
|
361
|
+
.replace(tzinfo=None)
|
|
362
|
+
.isoformat(timespec="milliseconds")
|
|
363
|
+
+ "Z"
|
|
364
|
+
)
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
if updated_at is not None:
|
|
368
|
+
modifier.append(
|
|
369
|
+
Filter(
|
|
370
|
+
query_str="filter[updated_at]="
|
|
371
|
+
+ updated_at.astimezone(timezone.utc)
|
|
372
|
+
.replace(tzinfo=None)
|
|
373
|
+
.isoformat(timespec="milliseconds")
|
|
374
|
+
+ "Z"
|
|
375
|
+
)
|
|
376
|
+
)
|
|
377
|
+
if updated_at_gte is not None:
|
|
378
|
+
modifier.append(
|
|
379
|
+
Filter(
|
|
380
|
+
query_str="filter[updated_at_gte]="
|
|
381
|
+
+ updated_at_gte.astimezone(timezone.utc)
|
|
382
|
+
.replace(tzinfo=None)
|
|
383
|
+
.isoformat(timespec="milliseconds")
|
|
384
|
+
+ "Z"
|
|
385
|
+
)
|
|
386
|
+
)
|
|
387
|
+
if updated_at_lte is not None:
|
|
388
|
+
modifier.append(
|
|
389
|
+
Filter(
|
|
390
|
+
query_str="filter[updated_at_lte]="
|
|
391
|
+
+ updated_at_lte.astimezone(timezone.utc)
|
|
392
|
+
.replace(tzinfo=None)
|
|
393
|
+
.isoformat(timespec="milliseconds")
|
|
394
|
+
+ "Z"
|
|
395
|
+
)
|
|
396
|
+
)
|
|
397
|
+
if updated_at_gt is not None:
|
|
398
|
+
modifier.append(
|
|
399
|
+
Filter(
|
|
400
|
+
query_str="filter[updated_at_gt]="
|
|
401
|
+
+ updated_at_gt.astimezone(timezone.utc)
|
|
402
|
+
.replace(tzinfo=None)
|
|
403
|
+
.isoformat(timespec="milliseconds")
|
|
404
|
+
+ "Z"
|
|
405
|
+
)
|
|
406
|
+
)
|
|
407
|
+
if updated_at_lt is not None:
|
|
408
|
+
modifier.append(
|
|
409
|
+
Filter(
|
|
410
|
+
query_str="filter[updated_at_lt]="
|
|
411
|
+
+ updated_at_lt.astimezone(timezone.utc)
|
|
412
|
+
.replace(tzinfo=None)
|
|
413
|
+
.isoformat(timespec="milliseconds")
|
|
414
|
+
+ "Z"
|
|
415
|
+
)
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
# Table definition
|
|
419
|
+
tabledef: TableDef = [
|
|
420
|
+
{"header": Column("Id", no_wrap=True), "column": "id"},
|
|
421
|
+
{"header": "Id", "column": "id"},
|
|
422
|
+
{"header": "Created", "column": "created_at"},
|
|
423
|
+
{"header": "Updated", "column": "updated_at"},
|
|
424
|
+
]
|
|
425
|
+
|
|
426
|
+
# List related resources
|
|
427
|
+
await list_relation_resources(
|
|
428
|
+
ctx, parent_model, "user-roles", tabledef, modifier
|
|
429
|
+
)
|
|
430
|
+
except DocumentError as e:
|
|
431
|
+
await print_document_error(e)
|
|
@@ -60,6 +60,12 @@ async def list(
|
|
|
60
60
|
country: Annotated[
|
|
61
61
|
Optional[str], typer.Option(help="Must contain two uppercase letters (A-Z).")
|
|
62
62
|
] = None,
|
|
63
|
+
user: Annotated[
|
|
64
|
+
Optional[UUID], typer.Option(help="The user associated with this address.")
|
|
65
|
+
] = None,
|
|
66
|
+
company: Annotated[
|
|
67
|
+
Optional[UUID], typer.Option(help="The company associated with this address.")
|
|
68
|
+
] = None,
|
|
63
69
|
created_at: Annotated[
|
|
64
70
|
Optional[datetime],
|
|
65
71
|
typer.Option(help="Timestamp when the address was created. (exact match)"),
|
|
@@ -110,12 +116,6 @@ async def list(
|
|
|
110
116
|
Optional[datetime],
|
|
111
117
|
typer.Option(help="Timestamp when the address was last updated. (less than)"),
|
|
112
118
|
] = None,
|
|
113
|
-
user: Annotated[
|
|
114
|
-
Optional[UUID], typer.Option(help="The user associated with this address.")
|
|
115
|
-
] = None,
|
|
116
|
-
company: Annotated[
|
|
117
|
-
Optional[UUID], typer.Option(help="The company associated with this address.")
|
|
118
|
-
] = None,
|
|
119
119
|
):
|
|
120
120
|
# Validate mutually exclusive required parameters
|
|
121
121
|
_require_one_of_group = [user, company]
|
|
@@ -127,20 +127,34 @@ async def list(
|
|
|
127
127
|
|
|
128
128
|
# Build modifier
|
|
129
129
|
modifier = []
|
|
130
|
+
|
|
130
131
|
if street is not None:
|
|
131
132
|
modifier.append(Filter(street=street))
|
|
133
|
+
|
|
132
134
|
if number is not None:
|
|
133
135
|
modifier.append(Filter(number=number))
|
|
136
|
+
|
|
134
137
|
if suffix is not None:
|
|
135
138
|
modifier.append(Filter(suffix=suffix))
|
|
139
|
+
|
|
136
140
|
if zipcode is not None:
|
|
137
141
|
modifier.append(Filter(zipcode=zipcode))
|
|
142
|
+
|
|
138
143
|
if city is not None:
|
|
139
144
|
modifier.append(Filter(city=city))
|
|
145
|
+
|
|
140
146
|
if state is not None:
|
|
141
147
|
modifier.append(Filter(state=state))
|
|
148
|
+
|
|
142
149
|
if country is not None:
|
|
143
150
|
modifier.append(Filter(country=country))
|
|
151
|
+
|
|
152
|
+
if user is not None:
|
|
153
|
+
modifier.append(Filter(user=str(user)))
|
|
154
|
+
|
|
155
|
+
if company is not None:
|
|
156
|
+
modifier.append(Filter(company=str(company)))
|
|
157
|
+
|
|
144
158
|
if created_at is not None:
|
|
145
159
|
modifier.append(
|
|
146
160
|
Filter(
|
|
@@ -191,6 +205,7 @@ async def list(
|
|
|
191
205
|
+ "Z"
|
|
192
206
|
)
|
|
193
207
|
)
|
|
208
|
+
|
|
194
209
|
if updated_at is not None:
|
|
195
210
|
modifier.append(
|
|
196
211
|
Filter(
|
|
@@ -241,24 +256,32 @@ async def list(
|
|
|
241
256
|
+ "Z"
|
|
242
257
|
)
|
|
243
258
|
)
|
|
244
|
-
|
|
245
|
-
modifier.append(Filter(user=str(user)))
|
|
246
|
-
if company is not None:
|
|
247
|
-
modifier.append(Filter(company=str(company)))
|
|
259
|
+
|
|
248
260
|
modifier.append(Inclusion("company"))
|
|
249
261
|
modifier.append(Inclusion("user"))
|
|
250
262
|
|
|
251
263
|
# Table definition
|
|
252
264
|
tabledef: TableDef = [
|
|
253
265
|
{"header": Column("Id", no_wrap=True), "column": "id"},
|
|
254
|
-
{
|
|
255
|
-
|
|
266
|
+
{
|
|
267
|
+
"header": "Company",
|
|
268
|
+
"column": "company",
|
|
269
|
+
"column_kebab": "company",
|
|
270
|
+
"nested_column": "name",
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"header": "User",
|
|
274
|
+
"column": "user",
|
|
275
|
+
"column_kebab": "user",
|
|
276
|
+
"nested_column": "name",
|
|
277
|
+
},
|
|
256
278
|
{"header": "Street", "column": "street"},
|
|
257
279
|
{"header": "Number", "column": "number"},
|
|
258
280
|
{"header": "City", "column": "city"},
|
|
259
281
|
{"header": "Created", "column": "created_at"},
|
|
260
282
|
{"header": "Updated", "column": "updated_at"},
|
|
261
283
|
]
|
|
284
|
+
|
|
262
285
|
async with Connection() as conn:
|
|
263
286
|
await list_resources(ctx, AddressShow(conn, api_schema), tabledef, modifier)
|
|
264
287
|
|
|
@@ -300,6 +323,12 @@ async def create(
|
|
|
300
323
|
country: Annotated[
|
|
301
324
|
str, typer.Option(help="Must contain two uppercase letters (A-Z).")
|
|
302
325
|
],
|
|
326
|
+
user: Annotated[
|
|
327
|
+
UUID, typer.Option(help="The user to associate with this address.")
|
|
328
|
+
],
|
|
329
|
+
company: Annotated[
|
|
330
|
+
UUID, typer.Option(help="The company to associate with this address.")
|
|
331
|
+
],
|
|
303
332
|
suffix: Annotated[
|
|
304
333
|
Optional[str],
|
|
305
334
|
typer.Option(
|
|
@@ -312,12 +341,6 @@ async def create(
|
|
|
312
341
|
help="Can contain any letter (combined with accent) from any language, any kind of hyphen or dash, single or alternative quote or space."
|
|
313
342
|
),
|
|
314
343
|
] = None,
|
|
315
|
-
user: Annotated[
|
|
316
|
-
Optional[UUID], typer.Option(help="The user to associate with this address.")
|
|
317
|
-
] = None,
|
|
318
|
-
company: Annotated[
|
|
319
|
-
Optional[UUID], typer.Option(help="The company to associate with this address.")
|
|
320
|
-
] = None,
|
|
321
344
|
):
|
|
322
345
|
# Validate mutually exclusive required parameters
|
|
323
346
|
_require_one_of_group = [user, company]
|
|
@@ -338,6 +361,7 @@ async def create(
|
|
|
338
361
|
async with Connection() as conn:
|
|
339
362
|
ctrl = ctrl_class(conn, api_schema)
|
|
340
363
|
model = ctrl.create()
|
|
364
|
+
|
|
341
365
|
model["street"] = street
|
|
342
366
|
model["number"] = number
|
|
343
367
|
if suffix is not None:
|
|
@@ -347,10 +371,12 @@ async def create(
|
|
|
347
371
|
if state is not None:
|
|
348
372
|
model["state"] = state
|
|
349
373
|
model["country"] = country
|
|
374
|
+
|
|
350
375
|
if user is not None:
|
|
351
376
|
model["user"] = ResourceTuple(user, "users")
|
|
352
377
|
if company is not None:
|
|
353
378
|
model["company"] = ResourceTuple(company, "companies")
|
|
379
|
+
|
|
354
380
|
await ctrl.store(model, ctx.obj["create_issue"]) # type: ignore[arg-type]
|
|
355
381
|
|
|
356
382
|
show_resource(ctx, model)
|
|
@@ -399,6 +425,7 @@ async def update(
|
|
|
399
425
|
async with Connection() as conn:
|
|
400
426
|
ctrl = AddressShow(conn, api_schema)
|
|
401
427
|
model = await ctrl.fetch(address_id)
|
|
428
|
+
|
|
402
429
|
if street is not None:
|
|
403
430
|
model["street"] = street
|
|
404
431
|
if number is not None:
|
|
@@ -413,6 +440,7 @@ async def update(
|
|
|
413
440
|
model["state"] = state
|
|
414
441
|
if country is not None:
|
|
415
442
|
model["country"] = country
|
|
443
|
+
|
|
416
444
|
await ctrl.update(model)
|
|
417
445
|
|
|
418
446
|
show_resource(ctx, model)
|
|
@@ -68,6 +68,7 @@ async def update(
|
|
|
68
68
|
async with Connection() as conn:
|
|
69
69
|
ctrl = CompanyBase(conn, api_schema)
|
|
70
70
|
model = await ctrl.fetch(company_id)
|
|
71
|
+
|
|
71
72
|
if name is not None:
|
|
72
73
|
model["name"] = name
|
|
73
74
|
if kvknr is not None:
|
|
@@ -80,6 +81,7 @@ async def update(
|
|
|
80
81
|
model["email_invoice"] = email_invoice
|
|
81
82
|
if vat_number is not None:
|
|
82
83
|
model["vat_number"] = vat_number
|
|
84
|
+
|
|
83
85
|
await ctrl.update(model)
|
|
84
86
|
|
|
85
87
|
show_resource(ctx, model)
|
|
@@ -123,6 +125,12 @@ async def list_addresses(
|
|
|
123
125
|
country: Annotated[
|
|
124
126
|
Optional[str], typer.Option(help="Must contain two uppercase letters (A-Z).")
|
|
125
127
|
] = None,
|
|
128
|
+
user: Annotated[
|
|
129
|
+
Optional[UUID], typer.Option(help="The user associated with this address.")
|
|
130
|
+
] = None,
|
|
131
|
+
company: Annotated[
|
|
132
|
+
Optional[UUID], typer.Option(help="The company associated with this address.")
|
|
133
|
+
] = None,
|
|
126
134
|
created_at: Annotated[
|
|
127
135
|
Optional[datetime],
|
|
128
136
|
typer.Option(help="Timestamp when the address was created. (exact match)"),
|
|
@@ -173,12 +181,6 @@ async def list_addresses(
|
|
|
173
181
|
Optional[datetime],
|
|
174
182
|
typer.Option(help="Timestamp when the address was last updated. (less than)"),
|
|
175
183
|
] = None,
|
|
176
|
-
user: Annotated[
|
|
177
|
-
Optional[UUID], typer.Option(help="The user associated with this address.")
|
|
178
|
-
] = None,
|
|
179
|
-
company: Annotated[
|
|
180
|
-
Optional[UUID], typer.Option(help="The company associated with this address.")
|
|
181
|
-
] = None,
|
|
182
184
|
):
|
|
183
185
|
"""List all addresses for a company"""
|
|
184
186
|
try:
|
|
@@ -189,20 +191,34 @@ async def list_addresses(
|
|
|
189
191
|
|
|
190
192
|
# Build modifier for filtering and includes
|
|
191
193
|
modifier = []
|
|
194
|
+
|
|
192
195
|
if street is not None:
|
|
193
196
|
modifier.append(Filter(street=street))
|
|
197
|
+
|
|
194
198
|
if number is not None:
|
|
195
199
|
modifier.append(Filter(number=number))
|
|
200
|
+
|
|
196
201
|
if suffix is not None:
|
|
197
202
|
modifier.append(Filter(suffix=suffix))
|
|
203
|
+
|
|
198
204
|
if zipcode is not None:
|
|
199
205
|
modifier.append(Filter(zipcode=zipcode))
|
|
206
|
+
|
|
200
207
|
if city is not None:
|
|
201
208
|
modifier.append(Filter(city=city))
|
|
209
|
+
|
|
202
210
|
if state is not None:
|
|
203
211
|
modifier.append(Filter(state=state))
|
|
212
|
+
|
|
204
213
|
if country is not None:
|
|
205
214
|
modifier.append(Filter(country=country))
|
|
215
|
+
|
|
216
|
+
if user is not None:
|
|
217
|
+
modifier.append(Filter(user=str(user)))
|
|
218
|
+
|
|
219
|
+
if company is not None:
|
|
220
|
+
modifier.append(Filter(company=str(company)))
|
|
221
|
+
|
|
206
222
|
if created_at is not None:
|
|
207
223
|
modifier.append(
|
|
208
224
|
Filter(
|
|
@@ -253,6 +269,7 @@ async def list_addresses(
|
|
|
253
269
|
+ "Z"
|
|
254
270
|
)
|
|
255
271
|
)
|
|
272
|
+
|
|
256
273
|
if updated_at is not None:
|
|
257
274
|
modifier.append(
|
|
258
275
|
Filter(
|
|
@@ -303,10 +320,6 @@ async def list_addresses(
|
|
|
303
320
|
+ "Z"
|
|
304
321
|
)
|
|
305
322
|
)
|
|
306
|
-
if user is not None:
|
|
307
|
-
modifier.append(Filter(user=str(user)))
|
|
308
|
-
if company is not None:
|
|
309
|
-
modifier.append(Filter(company=str(company)))
|
|
310
323
|
|
|
311
324
|
# Table definition
|
|
312
325
|
tabledef: TableDef = [
|
{cacholong_cloud_cli-1.0.0 → cacholong_cloud_cli-1.2.0}/cacholong_cli/commands/dns_records.py
RENAMED
|
@@ -57,6 +57,12 @@ async def list(
|
|
|
57
57
|
Optional[str],
|
|
58
58
|
typer.Option(help="Priority (required for MX and SRV records only)"),
|
|
59
59
|
] = None,
|
|
60
|
+
dns_zone: Annotated[
|
|
61
|
+
Optional[UUID], typer.Option(help="DNS zone that owns this record")
|
|
62
|
+
] = None,
|
|
63
|
+
dns_template: Annotated[
|
|
64
|
+
Optional[UUID], typer.Option(help="DNS template that owns this record")
|
|
65
|
+
] = None,
|
|
60
66
|
created_at: Annotated[
|
|
61
67
|
Optional[datetime],
|
|
62
68
|
typer.Option(help="When this record was created (exact match)"),
|
|
@@ -97,12 +103,6 @@ async def list(
|
|
|
97
103
|
Optional[datetime],
|
|
98
104
|
typer.Option(help="When this record was last updated (less than)"),
|
|
99
105
|
] = None,
|
|
100
|
-
dns_zone: Annotated[
|
|
101
|
-
Optional[UUID], typer.Option(help="DNS zone that owns this record")
|
|
102
|
-
] = None,
|
|
103
|
-
dns_template: Annotated[
|
|
104
|
-
Optional[UUID], typer.Option(help="DNS template that owns this record")
|
|
105
|
-
] = None,
|
|
106
106
|
):
|
|
107
107
|
# Validate mutually exclusive required parameters
|
|
108
108
|
_require_one_of_group = [dns_zone, dns_template]
|
|
@@ -116,20 +116,33 @@ async def list(
|
|
|
116
116
|
|
|
117
117
|
# Build modifier
|
|
118
118
|
modifier = []
|
|
119
|
+
|
|
119
120
|
if status is not None:
|
|
120
121
|
modifier.append(Filter(status=status))
|
|
122
|
+
|
|
121
123
|
if dns_record_type is not None:
|
|
122
124
|
modifier.append(
|
|
123
125
|
Filter(query_str="filter[dns_record_type]=" + str(dns_record_type))
|
|
124
126
|
)
|
|
127
|
+
|
|
125
128
|
if name is not None:
|
|
126
129
|
modifier.append(Filter(name=name))
|
|
130
|
+
|
|
127
131
|
if content is not None:
|
|
128
132
|
modifier.append(Filter(content=content))
|
|
133
|
+
|
|
129
134
|
if ttl is not None:
|
|
130
135
|
modifier.append(Filter(ttl=ttl))
|
|
136
|
+
|
|
131
137
|
if priority is not None:
|
|
132
138
|
modifier.append(Filter(priority=priority))
|
|
139
|
+
|
|
140
|
+
if dns_zone is not None:
|
|
141
|
+
modifier.append(Filter(query_str="filter[dns-zone]=" + str(dns_zone)))
|
|
142
|
+
|
|
143
|
+
if dns_template is not None:
|
|
144
|
+
modifier.append(Filter(query_str="filter[dns-template]=" + str(dns_template)))
|
|
145
|
+
|
|
133
146
|
if created_at is not None:
|
|
134
147
|
modifier.append(
|
|
135
148
|
Filter(
|
|
@@ -180,6 +193,7 @@ async def list(
|
|
|
180
193
|
+ "Z"
|
|
181
194
|
)
|
|
182
195
|
)
|
|
196
|
+
|
|
183
197
|
if updated_at is not None:
|
|
184
198
|
modifier.append(
|
|
185
199
|
Filter(
|
|
@@ -230,10 +244,6 @@ async def list(
|
|
|
230
244
|
+ "Z"
|
|
231
245
|
)
|
|
232
246
|
)
|
|
233
|
-
if dns_zone is not None:
|
|
234
|
-
modifier.append(Filter(query_str="filter[dns-zone]=" + str(dns_zone)))
|
|
235
|
-
if dns_template is not None:
|
|
236
|
-
modifier.append(Filter(query_str="filter[dns-template]=" + str(dns_template)))
|
|
237
247
|
|
|
238
248
|
# Table definition
|
|
239
249
|
tabledef: TableDef = [
|
|
@@ -246,6 +256,7 @@ async def list(
|
|
|
246
256
|
{"header": "Created", "column": "created_at"},
|
|
247
257
|
{"header": "Updated", "column": "updated_at"},
|
|
248
258
|
]
|
|
259
|
+
|
|
249
260
|
async with Connection() as conn:
|
|
250
261
|
await list_resources(ctx, DnsRecordBase(conn, api_schema), tabledef, modifier)
|
|
251
262
|
|
|
@@ -280,6 +291,10 @@ async def create(
|
|
|
280
291
|
str,
|
|
281
292
|
typer.Option(help="Record content (IP address, hostname, text value, etc.)"),
|
|
282
293
|
],
|
|
294
|
+
dns_zone: Annotated[UUID, typer.Option(help="DNS zone that will own this record")],
|
|
295
|
+
dns_template: Annotated[
|
|
296
|
+
UUID, typer.Option(help="DNS template that will own this record")
|
|
297
|
+
],
|
|
283
298
|
ttl: Annotated[
|
|
284
299
|
Optional[int],
|
|
285
300
|
typer.Option(
|
|
@@ -290,12 +305,6 @@ async def create(
|
|
|
290
305
|
Optional[int],
|
|
291
306
|
typer.Option(help="Priority (required for MX and SRV records only)"),
|
|
292
307
|
] = None,
|
|
293
|
-
dns_zone: Annotated[
|
|
294
|
-
Optional[UUID], typer.Option(help="DNS zone that will own this record")
|
|
295
|
-
] = None,
|
|
296
|
-
dns_template: Annotated[
|
|
297
|
-
Optional[UUID], typer.Option(help="DNS template that will own this record")
|
|
298
|
-
] = None,
|
|
299
308
|
):
|
|
300
309
|
# Validate mutually exclusive required parameters
|
|
301
310
|
_require_one_of_group = [dns_zone, dns_template]
|
|
@@ -318,6 +327,7 @@ async def create(
|
|
|
318
327
|
async with Connection() as conn:
|
|
319
328
|
ctrl = ctrl_class(conn, api_schema)
|
|
320
329
|
model = ctrl.create()
|
|
330
|
+
|
|
321
331
|
model["dns_record_type"] = dns_record_type
|
|
322
332
|
model["name"] = name
|
|
323
333
|
model["content"] = content
|
|
@@ -325,10 +335,12 @@ async def create(
|
|
|
325
335
|
model["ttl"] = ttl
|
|
326
336
|
if priority is not None:
|
|
327
337
|
model["priority"] = priority
|
|
338
|
+
|
|
328
339
|
if dns_zone is not None:
|
|
329
340
|
model["dns-zone"] = ResourceTuple(dns_zone, "dns-zones")
|
|
330
341
|
if dns_template is not None:
|
|
331
342
|
model["dns-template"] = ResourceTuple(dns_template, "dns-templates")
|
|
343
|
+
|
|
332
344
|
await ctrl.store(model, ctx.obj["create_issue"]) # type: ignore[arg-type]
|
|
333
345
|
|
|
334
346
|
show_resource(ctx, model)
|
|
@@ -370,6 +382,7 @@ async def update(
|
|
|
370
382
|
async with Connection() as conn:
|
|
371
383
|
ctrl = DnsRecordBase(conn, api_schema)
|
|
372
384
|
model = await ctrl.fetch(dns_record_id)
|
|
385
|
+
|
|
373
386
|
if dns_record_type is not None:
|
|
374
387
|
model["dns_record_type"] = dns_record_type
|
|
375
388
|
if name is not None:
|
|
@@ -380,6 +393,7 @@ async def update(
|
|
|
380
393
|
model["ttl"] = ttl
|
|
381
394
|
if priority is not None:
|
|
382
395
|
model["priority"] = priority
|
|
396
|
+
|
|
383
397
|
await ctrl.update(model)
|
|
384
398
|
|
|
385
399
|
show_resource(ctx, model)
|