cacholong-cloud-cli 0.3.4__tar.gz → 1.0.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-0.3.4 → cacholong_cloud_cli-1.0.0}/PKG-INFO +3 -2
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_cli/AsyncTyper.py +6 -3
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_cli/cli.py +12 -1
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/accounts.py +240 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/addresses.py +480 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/companies.py +350 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/dns_records.py +403 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/dns_templates.py +281 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/dns_zones.py +375 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/mail_address_aliases.py +351 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/mail_addresses.py +647 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/mail_domains.py +553 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/mail_forwards.py +328 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/products.py +372 -0
- cacholong_cloud_cli-1.0.0/cacholong_cli/commands/purchases.py +497 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_cli/common.py +20 -9
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_cli/connection.py +4 -1
- cacholong_cloud_cli-1.0.0/cacholong_sdk/__init__.py +70 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/account_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/account_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/address_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/address_create_with_company.py +17 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/address_create_with_user.py +17 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/address_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/address_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/api_schema.py +733 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_sdk/common.py +76 -5
- cacholong_cloud_cli-1.0.0/cacholong_sdk/company_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/company_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/company_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_record_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_record_create_with_template.py +17 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_record_create_with_zone.py +17 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_record_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_record_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_template_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_template_create.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_template_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_template_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_zone_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_zone_create.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_zone_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/dns_zone_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_alias_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_alias_create.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_alias_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_alias_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_create.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_address_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_domain_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_domain_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_forward_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_forward_create.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_forward_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/mail_forward_update.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/product_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/product_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/purchase_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/purchase_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/service_mail_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/service_mail_show.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/user_base.py +15 -0
- cacholong_cloud_cli-1.0.0/cacholong_sdk/user_show.py +15 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/pyproject.toml +2 -1
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/accounts.py +0 -105
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/addresses.py +0 -280
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/companies.py +0 -100
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/dns_records.py +0 -275
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/dns_templates.py +0 -141
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/dns_zones.py +0 -277
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/products.py +0 -121
- cacholong_cloud_cli-0.3.4/cacholong_cli/commands/purchases.py +0 -127
- cacholong_cloud_cli-0.3.4/cacholong_sdk/__init__.py +0 -18
- cacholong_cloud_cli-0.3.4/cacholong_sdk/account.py +0 -14
- cacholong_cloud_cli-0.3.4/cacholong_sdk/address.py +0 -14
- cacholong_cloud_cli-0.3.4/cacholong_sdk/api_schema.py +0 -124
- cacholong_cloud_cli-0.3.4/cacholong_sdk/company.py +0 -14
- cacholong_cloud_cli-0.3.4/cacholong_sdk/dns_record.py +0 -14
- cacholong_cloud_cli-0.3.4/cacholong_sdk/dns_template.py +0 -14
- cacholong_cloud_cli-0.3.4/cacholong_sdk/dns_zone.py +0 -14
- cacholong_cloud_cli-0.3.4/cacholong_sdk/product.py +0 -14
- cacholong_cloud_cli-0.3.4/cacholong_sdk/purchase.py +0 -14
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/README.md +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_cli/__init__.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_sdk/connection.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/cacholong_sdk/exception.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/__init__.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/common.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/document.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/exceptions.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/filter.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/objects.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/relationships.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/resourceobject.py +0 -0
- {cacholong_cloud_cli-0.3.4 → cacholong_cloud_cli-1.0.0}/jsonapi-client/src/jsonapi_client/session.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cacholong-cloud-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Cacholong CLI, manage cloud environments at Cacholong!
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Matthijs Möhlmann
|
|
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
15
|
Requires-Dist: aiodns (>=3.5.0,<4.0.0)
|
|
15
16
|
Requires-Dist: aiofiles (>=23.2.1,<24.0.0)
|
|
16
17
|
Requires-Dist: aiohttp (>=3.0)
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
from asyncio import run
|
|
2
2
|
from functools import wraps
|
|
3
|
+
from typing import Callable, Any
|
|
3
4
|
|
|
4
5
|
import typer
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class AsyncTyper(typer.Typer):
|
|
8
|
-
def async_command(
|
|
9
|
-
|
|
9
|
+
def async_command(
|
|
10
|
+
self, *args: Any, **kwargs: Any
|
|
11
|
+
) -> Callable[[Callable], Callable]:
|
|
12
|
+
def decorator(async_func: Callable) -> Callable:
|
|
10
13
|
@wraps(async_func)
|
|
11
|
-
def sync_func(*_args, **_kwargs):
|
|
14
|
+
def sync_func(*_args: Any, **_kwargs: Any) -> Any:
|
|
12
15
|
return run(async_func(*_args, **_kwargs))
|
|
13
16
|
|
|
14
17
|
self.command(*args, **kwargs)(sync_func)
|
|
@@ -11,13 +11,16 @@ from cacholong_cli.commands import (
|
|
|
11
11
|
dns_records,
|
|
12
12
|
dns_templates,
|
|
13
13
|
dns_zones,
|
|
14
|
+
mail_addresses,
|
|
15
|
+
mail_address_aliases,
|
|
16
|
+
mail_domains,
|
|
17
|
+
mail_forwards,
|
|
14
18
|
products,
|
|
15
19
|
purchases,
|
|
16
20
|
)
|
|
17
21
|
from cacholong_cli.common import OutputFormat
|
|
18
22
|
from xdg import BaseDirectory
|
|
19
23
|
|
|
20
|
-
|
|
21
24
|
# Version of our CLI
|
|
22
25
|
__version__ = importlib.metadata.version("cacholong-cloud-cli")
|
|
23
26
|
|
|
@@ -44,6 +47,14 @@ app.add_typer(companies.app, name="companies", help="Manage companies")
|
|
|
44
47
|
app.add_typer(dns_records.app, name="dns-records", help="Manage DNS records")
|
|
45
48
|
app.add_typer(dns_templates.app, name="dns-templates", help="Manage DNS templates")
|
|
46
49
|
app.add_typer(dns_zones.app, name="dns-zones", help="Manage DNS zones")
|
|
50
|
+
app.add_typer(mail_addresses.app, name="mail-addresses", help="Manage mail addresses")
|
|
51
|
+
app.add_typer(
|
|
52
|
+
mail_address_aliases.app,
|
|
53
|
+
name="mail-address-aliases",
|
|
54
|
+
help="Manage mail address aliases",
|
|
55
|
+
)
|
|
56
|
+
app.add_typer(mail_domains.app, name="mail-domains", help="Manage mail domains")
|
|
57
|
+
app.add_typer(mail_forwards.app, name="mail-forwards", help="Manage mail forwards")
|
|
47
58
|
app.add_typer(products.app, name="products", help="Manage products")
|
|
48
59
|
app.add_typer(purchases.app, name="purchases", help="Manage purchases")
|
|
49
60
|
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import typer
|
|
3
|
+
from typing import List, Optional, Dict, Any, Union, Type
|
|
4
|
+
from typing_extensions import Annotated
|
|
5
|
+
from rich.table import Column
|
|
6
|
+
from uuid import UUID
|
|
7
|
+
from datetime import datetime, date, timezone
|
|
8
|
+
from cacholong_cli.AsyncTyper import AsyncTyper
|
|
9
|
+
from cacholong_cli.common import (
|
|
10
|
+
list_resources,
|
|
11
|
+
list_relation_resources,
|
|
12
|
+
show_resource,
|
|
13
|
+
print_document_error,
|
|
14
|
+
TableDef,
|
|
15
|
+
)
|
|
16
|
+
from cacholong_cli.connection import Connection
|
|
17
|
+
from cacholong_sdk import Filter, Inclusion, DocumentError, ResourceTuple
|
|
18
|
+
from cacholong_sdk import AccountBase, AccountBaseModel
|
|
19
|
+
|
|
20
|
+
from cacholong_sdk.api_schema import api_schema
|
|
21
|
+
|
|
22
|
+
# Create typer object
|
|
23
|
+
app = AsyncTyper()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@app.async_command(help="Get accounts")
|
|
27
|
+
async def list(
|
|
28
|
+
ctx: typer.Context,
|
|
29
|
+
name: Annotated[Optional[str], typer.Option(help="The unique account name")] = None,
|
|
30
|
+
description: Annotated[
|
|
31
|
+
Optional[str], typer.Option(help="Optional description of the account")
|
|
32
|
+
] = None,
|
|
33
|
+
account_type: Annotated[
|
|
34
|
+
Optional[str], typer.Option(help="The account type")
|
|
35
|
+
] = None,
|
|
36
|
+
account_account_id: Annotated[
|
|
37
|
+
Optional[str], typer.Option(help="Parent account ID")
|
|
38
|
+
] = None,
|
|
39
|
+
account_account_relation: Annotated[
|
|
40
|
+
Optional[str], typer.Option(help="Parent account relationship type")
|
|
41
|
+
] = None,
|
|
42
|
+
created_at: Annotated[
|
|
43
|
+
Optional[datetime],
|
|
44
|
+
typer.Option(help="Timestamp when the account was created (exact match)"),
|
|
45
|
+
] = None,
|
|
46
|
+
created_at_gte: Annotated[
|
|
47
|
+
Optional[datetime],
|
|
48
|
+
typer.Option(
|
|
49
|
+
help="Timestamp when the account was created (greater than or equal)"
|
|
50
|
+
),
|
|
51
|
+
] = None,
|
|
52
|
+
created_at_lte: Annotated[
|
|
53
|
+
Optional[datetime],
|
|
54
|
+
typer.Option(
|
|
55
|
+
help="Timestamp when the account was created (less than or equal)"
|
|
56
|
+
),
|
|
57
|
+
] = None,
|
|
58
|
+
created_at_gt: Annotated[
|
|
59
|
+
Optional[datetime],
|
|
60
|
+
typer.Option(help="Timestamp when the account was created (greater than)"),
|
|
61
|
+
] = None,
|
|
62
|
+
created_at_lt: Annotated[
|
|
63
|
+
Optional[datetime],
|
|
64
|
+
typer.Option(help="Timestamp when the account was created (less than)"),
|
|
65
|
+
] = None,
|
|
66
|
+
updated_at: Annotated[
|
|
67
|
+
Optional[datetime],
|
|
68
|
+
typer.Option(help="Timestamp when the account was last updated (exact match)"),
|
|
69
|
+
] = None,
|
|
70
|
+
updated_at_gte: Annotated[
|
|
71
|
+
Optional[datetime],
|
|
72
|
+
typer.Option(
|
|
73
|
+
help="Timestamp when the account was last updated (greater than or equal)"
|
|
74
|
+
),
|
|
75
|
+
] = None,
|
|
76
|
+
updated_at_lte: Annotated[
|
|
77
|
+
Optional[datetime],
|
|
78
|
+
typer.Option(
|
|
79
|
+
help="Timestamp when the account was last updated (less than or equal)"
|
|
80
|
+
),
|
|
81
|
+
] = None,
|
|
82
|
+
updated_at_gt: Annotated[
|
|
83
|
+
Optional[datetime],
|
|
84
|
+
typer.Option(help="Timestamp when the account was last updated (greater than)"),
|
|
85
|
+
] = None,
|
|
86
|
+
updated_at_lt: Annotated[
|
|
87
|
+
Optional[datetime],
|
|
88
|
+
typer.Option(help="Timestamp when the account was last updated (less than)"),
|
|
89
|
+
] = None,
|
|
90
|
+
company: Annotated[
|
|
91
|
+
Optional[UUID], typer.Option(help="The company associated with this account")
|
|
92
|
+
] = None,
|
|
93
|
+
):
|
|
94
|
+
|
|
95
|
+
# Build modifier
|
|
96
|
+
modifier = []
|
|
97
|
+
if name is not None:
|
|
98
|
+
modifier.append(Filter(name=name))
|
|
99
|
+
if description is not None:
|
|
100
|
+
modifier.append(Filter(description=description))
|
|
101
|
+
if account_type is not None:
|
|
102
|
+
modifier.append(Filter(query_str="filter[account_type]=" + str(account_type)))
|
|
103
|
+
if account_account_id is not None:
|
|
104
|
+
modifier.append(
|
|
105
|
+
Filter(query_str="filter[account_account_id]=" + str(account_account_id))
|
|
106
|
+
)
|
|
107
|
+
if account_account_relation is not None:
|
|
108
|
+
modifier.append(
|
|
109
|
+
Filter(
|
|
110
|
+
query_str="filter[account_account_relation]="
|
|
111
|
+
+ str(account_account_relation)
|
|
112
|
+
)
|
|
113
|
+
)
|
|
114
|
+
if created_at is not None:
|
|
115
|
+
modifier.append(
|
|
116
|
+
Filter(
|
|
117
|
+
query_str="filter[created_at]="
|
|
118
|
+
+ created_at.astimezone(timezone.utc)
|
|
119
|
+
.replace(tzinfo=None)
|
|
120
|
+
.isoformat(timespec="milliseconds")
|
|
121
|
+
+ "Z"
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
if created_at_gte is not None:
|
|
125
|
+
modifier.append(
|
|
126
|
+
Filter(
|
|
127
|
+
query_str="filter[created_at_gte]="
|
|
128
|
+
+ created_at_gte.astimezone(timezone.utc)
|
|
129
|
+
.replace(tzinfo=None)
|
|
130
|
+
.isoformat(timespec="milliseconds")
|
|
131
|
+
+ "Z"
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
if created_at_lte is not None:
|
|
135
|
+
modifier.append(
|
|
136
|
+
Filter(
|
|
137
|
+
query_str="filter[created_at_lte]="
|
|
138
|
+
+ created_at_lte.astimezone(timezone.utc)
|
|
139
|
+
.replace(tzinfo=None)
|
|
140
|
+
.isoformat(timespec="milliseconds")
|
|
141
|
+
+ "Z"
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
if created_at_gt is not None:
|
|
145
|
+
modifier.append(
|
|
146
|
+
Filter(
|
|
147
|
+
query_str="filter[created_at_gt]="
|
|
148
|
+
+ created_at_gt.astimezone(timezone.utc)
|
|
149
|
+
.replace(tzinfo=None)
|
|
150
|
+
.isoformat(timespec="milliseconds")
|
|
151
|
+
+ "Z"
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
if created_at_lt is not None:
|
|
155
|
+
modifier.append(
|
|
156
|
+
Filter(
|
|
157
|
+
query_str="filter[created_at_lt]="
|
|
158
|
+
+ created_at_lt.astimezone(timezone.utc)
|
|
159
|
+
.replace(tzinfo=None)
|
|
160
|
+
.isoformat(timespec="milliseconds")
|
|
161
|
+
+ "Z"
|
|
162
|
+
)
|
|
163
|
+
)
|
|
164
|
+
if updated_at is not None:
|
|
165
|
+
modifier.append(
|
|
166
|
+
Filter(
|
|
167
|
+
query_str="filter[updated_at]="
|
|
168
|
+
+ updated_at.astimezone(timezone.utc)
|
|
169
|
+
.replace(tzinfo=None)
|
|
170
|
+
.isoformat(timespec="milliseconds")
|
|
171
|
+
+ "Z"
|
|
172
|
+
)
|
|
173
|
+
)
|
|
174
|
+
if updated_at_gte is not None:
|
|
175
|
+
modifier.append(
|
|
176
|
+
Filter(
|
|
177
|
+
query_str="filter[updated_at_gte]="
|
|
178
|
+
+ updated_at_gte.astimezone(timezone.utc)
|
|
179
|
+
.replace(tzinfo=None)
|
|
180
|
+
.isoformat(timespec="milliseconds")
|
|
181
|
+
+ "Z"
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
if updated_at_lte is not None:
|
|
185
|
+
modifier.append(
|
|
186
|
+
Filter(
|
|
187
|
+
query_str="filter[updated_at_lte]="
|
|
188
|
+
+ updated_at_lte.astimezone(timezone.utc)
|
|
189
|
+
.replace(tzinfo=None)
|
|
190
|
+
.isoformat(timespec="milliseconds")
|
|
191
|
+
+ "Z"
|
|
192
|
+
)
|
|
193
|
+
)
|
|
194
|
+
if updated_at_gt is not None:
|
|
195
|
+
modifier.append(
|
|
196
|
+
Filter(
|
|
197
|
+
query_str="filter[updated_at_gt]="
|
|
198
|
+
+ updated_at_gt.astimezone(timezone.utc)
|
|
199
|
+
.replace(tzinfo=None)
|
|
200
|
+
.isoformat(timespec="milliseconds")
|
|
201
|
+
+ "Z"
|
|
202
|
+
)
|
|
203
|
+
)
|
|
204
|
+
if updated_at_lt is not None:
|
|
205
|
+
modifier.append(
|
|
206
|
+
Filter(
|
|
207
|
+
query_str="filter[updated_at_lt]="
|
|
208
|
+
+ updated_at_lt.astimezone(timezone.utc)
|
|
209
|
+
.replace(tzinfo=None)
|
|
210
|
+
.isoformat(timespec="milliseconds")
|
|
211
|
+
+ "Z"
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
if company is not None:
|
|
215
|
+
modifier.append(Filter(company=str(company)))
|
|
216
|
+
|
|
217
|
+
# Table definition
|
|
218
|
+
tabledef: TableDef = [
|
|
219
|
+
{"header": Column("Id", no_wrap=True), "column": "id"},
|
|
220
|
+
{"header": "Created", "column": "created_at"},
|
|
221
|
+
{"header": "Updated", "column": "updated_at"},
|
|
222
|
+
]
|
|
223
|
+
async with Connection() as conn:
|
|
224
|
+
await list_resources(ctx, AccountBase(conn, api_schema), tabledef, modifier)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
@app.async_command(help="Get account with account id")
|
|
228
|
+
async def show(
|
|
229
|
+
ctx: typer.Context,
|
|
230
|
+
account_id: Annotated[UUID, typer.Argument(help="Resource ID to show")],
|
|
231
|
+
):
|
|
232
|
+
# Show resource
|
|
233
|
+
try:
|
|
234
|
+
async with Connection() as conn:
|
|
235
|
+
ctrl = AccountBase(conn, api_schema)
|
|
236
|
+
model = await ctrl.fetch(account_id)
|
|
237
|
+
|
|
238
|
+
show_resource(ctx, model)
|
|
239
|
+
except DocumentError as e:
|
|
240
|
+
await print_document_error(e)
|