twc-cli 2.7.0__py3-none-any.whl → 2.8.0__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.
Potentially problematic release.
This version of twc-cli might be problematic. Click here for more details.
- twc/__version__.py +1 -1
- twc/api/client.py +13 -3
- twc/commands/domain.py +56 -9
- {twc_cli-2.7.0.dist-info → twc_cli-2.8.0.dist-info}/METADATA +2 -1
- {twc_cli-2.7.0.dist-info → twc_cli-2.8.0.dist-info}/RECORD +8 -8
- {twc_cli-2.7.0.dist-info → twc_cli-2.8.0.dist-info}/WHEEL +1 -1
- {twc_cli-2.7.0.dist-info → twc_cli-2.8.0.dist-info}/COPYING +0 -0
- {twc_cli-2.7.0.dist-info → twc_cli-2.8.0.dist-info}/entry_points.txt +0 -0
twc/__version__.py
CHANGED
twc/api/client.py
CHANGED
|
@@ -1410,18 +1410,28 @@ class TimewebCloud(TimewebCloudBase):
|
|
|
1410
1410
|
self,
|
|
1411
1411
|
fqdn: str,
|
|
1412
1412
|
dns_record_type: DNSRecordType,
|
|
1413
|
-
value: str,
|
|
1413
|
+
value: Optional[str] = None,
|
|
1414
1414
|
subdomain: Optional[str] = None,
|
|
1415
1415
|
priority: Optional[int] = None,
|
|
1416
|
+
ttl: Optional[int] = None,
|
|
1417
|
+
protocol: Optional[str] = None,
|
|
1418
|
+
service: Optional[str] = None,
|
|
1419
|
+
host: Optional[str] = None,
|
|
1420
|
+
port: Optional[int] = None,
|
|
1416
1421
|
*,
|
|
1417
1422
|
null_subdomain: bool = False,
|
|
1418
1423
|
):
|
|
1419
1424
|
"""Add DNS record to domain."""
|
|
1420
1425
|
payload = {
|
|
1421
1426
|
"type": dns_record_type,
|
|
1422
|
-
"value": value,
|
|
1427
|
+
**({"value": value} if value else {}),
|
|
1423
1428
|
**({"subdomain": subdomain} if subdomain else {}),
|
|
1424
|
-
**({"priority": priority} if priority else {}),
|
|
1429
|
+
**({"priority": priority} if priority is not None else {}),
|
|
1430
|
+
**({"ttl": ttl} if ttl else {}),
|
|
1431
|
+
**({"protocol": protocol} if protocol else {}),
|
|
1432
|
+
**({"service": service} if service else {}),
|
|
1433
|
+
**({"host": host} if host else {}),
|
|
1434
|
+
**({"port": port} if port else {}),
|
|
1425
1435
|
}
|
|
1426
1436
|
if null_subdomain:
|
|
1427
1437
|
payload["subdomain"] = None
|
twc/commands/domain.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
import sys
|
|
5
|
+
from enum import Enum
|
|
5
6
|
from typing import Optional, List
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
|
|
@@ -316,6 +317,14 @@ def domain_remove_dns_record(
|
|
|
316
317
|
# ------------------------------------------------------------- #
|
|
317
318
|
|
|
318
319
|
|
|
320
|
+
class SRVProtocol(str, Enum):
|
|
321
|
+
"""Supported protocols for SRV records."""
|
|
322
|
+
|
|
323
|
+
TCP = "TCP"
|
|
324
|
+
UPD = "UDP"
|
|
325
|
+
TLS = "TLS"
|
|
326
|
+
|
|
327
|
+
|
|
319
328
|
@domain_record.command("add", "create")
|
|
320
329
|
def domain_add_dns_record(
|
|
321
330
|
domain_name: str,
|
|
@@ -331,12 +340,40 @@ def domain_add_dns_record(
|
|
|
331
340
|
metavar="TYPE",
|
|
332
341
|
help=f"[{'|'.join([k.value for k in DNSRecordType])}]",
|
|
333
342
|
),
|
|
334
|
-
value: Optional[str] = typer.Option(
|
|
343
|
+
value: Optional[str] = typer.Option(
|
|
344
|
+
None,
|
|
345
|
+
help="Record value. Skip it for SRV records.",
|
|
346
|
+
),
|
|
335
347
|
priority: Optional[int] = typer.Option(
|
|
336
348
|
None,
|
|
337
349
|
"--prio",
|
|
338
350
|
help="Record priority. Supported for MX, SRV records.",
|
|
339
351
|
),
|
|
352
|
+
service: Optional[str] = typer.Option(
|
|
353
|
+
None,
|
|
354
|
+
"--service",
|
|
355
|
+
help="Service for SRV record e.g '_matrix'.",
|
|
356
|
+
),
|
|
357
|
+
proto: Optional[SRVProtocol] = typer.Option(
|
|
358
|
+
None,
|
|
359
|
+
"--proto",
|
|
360
|
+
help="Protocol for SRV record.",
|
|
361
|
+
),
|
|
362
|
+
host: Optional[str] = typer.Option(
|
|
363
|
+
None,
|
|
364
|
+
"--host",
|
|
365
|
+
help="Host for SRV record.",
|
|
366
|
+
),
|
|
367
|
+
port: Optional[int] = typer.Option(
|
|
368
|
+
None,
|
|
369
|
+
"--port",
|
|
370
|
+
help="Port for SRV record.",
|
|
371
|
+
min=1,
|
|
372
|
+
max=65535,
|
|
373
|
+
),
|
|
374
|
+
ttl: Optional[int] = typer.Option(
|
|
375
|
+
None, "--ttl", help="Time-To-Live for DNS record."
|
|
376
|
+
),
|
|
340
377
|
second_ld: Optional[bool] = typer.Option(
|
|
341
378
|
False,
|
|
342
379
|
"--2ld",
|
|
@@ -346,6 +383,9 @@ def domain_add_dns_record(
|
|
|
346
383
|
"""Add dns record for domain or subdomain."""
|
|
347
384
|
client = create_client(config, profile)
|
|
348
385
|
|
|
386
|
+
if record_type != "SRV" and not value:
|
|
387
|
+
sys.exit("Error: --value is expected for non-SRV DNS records")
|
|
388
|
+
|
|
349
389
|
null_subdomain = False
|
|
350
390
|
|
|
351
391
|
if second_ld:
|
|
@@ -372,14 +412,21 @@ def domain_add_dns_record(
|
|
|
372
412
|
domain_name = original_domain_name
|
|
373
413
|
subdomain = None
|
|
374
414
|
|
|
375
|
-
|
|
376
|
-
domain_name,
|
|
377
|
-
record_type,
|
|
378
|
-
value,
|
|
379
|
-
subdomain,
|
|
380
|
-
priority,
|
|
381
|
-
|
|
382
|
-
|
|
415
|
+
payload = {
|
|
416
|
+
"fqdn": domain_name,
|
|
417
|
+
"dns_record_type": record_type,
|
|
418
|
+
"value": value,
|
|
419
|
+
"subdomain": subdomain,
|
|
420
|
+
"priority": priority,
|
|
421
|
+
"ttl": ttl,
|
|
422
|
+
"protocol": "_" + proto if proto else None,
|
|
423
|
+
"service": service,
|
|
424
|
+
"host": host,
|
|
425
|
+
"port": port,
|
|
426
|
+
"null_subdomain": null_subdomain,
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
response = client.add_domain_dns_record(**payload)
|
|
383
430
|
fmt.printer(
|
|
384
431
|
response,
|
|
385
432
|
output_format=output_format,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: twc-cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Summary: Timeweb Cloud Command Line Interface.
|
|
5
5
|
Home-page: https://github.com/timeweb-cloud/twc
|
|
6
6
|
License: MIT
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
17
|
Requires-Dist: colorama (>=0.4.6,<0.5.0)
|
|
17
18
|
Requires-Dist: pygments (>=2.18.0,<3.0.0)
|
|
18
19
|
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
@@ -2,10 +2,10 @@ CHANGELOG.md,sha256=AnIkFEP7S8yrjLrgp1Vbsp47c79n6RQxz6-6OEwwEmk,26436
|
|
|
2
2
|
COPYING,sha256=fpJLxZS_kHr_659xkpmqEtqHeZp6lQR9CmKCwnYbsmE,1089
|
|
3
3
|
twc/__init__.py,sha256=NwPAMNw3NuHdWGQvWS9_lromVF6VM194oVOipojfJns,113
|
|
4
4
|
twc/__main__.py,sha256=ADHceaQUzgLmvhYHvb5O8urdJWj5IcEHLpTQkSExiD8,2468
|
|
5
|
-
twc/__version__.py,sha256=
|
|
5
|
+
twc/__version__.py,sha256=OHC5aleI7fbFRKonYAojGfgjUXrryXI8Eh5UyrmuNM4,442
|
|
6
6
|
twc/api/__init__.py,sha256=SXew0Fe51M7nRBNQaaLRH4NjnRHkQUn7J26OCkQsftA,128
|
|
7
7
|
twc/api/base.py,sha256=QRefnIgmlbz8n37GLBKeAK1AtzkcNo1IFjZgHDDECJ4,7912
|
|
8
|
-
twc/api/client.py,sha256=
|
|
8
|
+
twc/api/client.py,sha256=ROuj2ZklQOtgrcXYjoiN2mimwxfNFpy4MZvm0qTfomY,59010
|
|
9
9
|
twc/api/exceptions.py,sha256=UzK3pKRffcXlhnkPy6MDjP_DygVoV17DuZ_mdNbOzts,2369
|
|
10
10
|
twc/api/types.py,sha256=HCxdTi-o8nVq4ShPthd2fUvlYufEoXafx_6qrNHFH04,5406
|
|
11
11
|
twc/apiwrap.py,sha256=hKrg_o6rLfY32SEnWMc1BSXHnSAh7TGar1JQ90YnG5M,2970
|
|
@@ -15,7 +15,7 @@ twc/commands/balancer.py,sha256=QAouc74ZT5go11gB1vjjfYtd1luTmWrfpACPwokZ5sU,2027
|
|
|
15
15
|
twc/commands/common.py,sha256=Wph8cVogUNNvc456SQrASb7mv7G88I8ETwHgISVjLQQ,8282
|
|
16
16
|
twc/commands/config.py,sha256=hoRtxn2VRxIsuy9vgO6yd0Cu15Rbl-uYMZeU0Ix7dG0,8797
|
|
17
17
|
twc/commands/database.py,sha256=2NZ-TyRBkFgfYJyUdZUcfdqSaX7QVdWDU4k_yQNtUvo,16052
|
|
18
|
-
twc/commands/domain.py,sha256=
|
|
18
|
+
twc/commands/domain.py,sha256=BIg5k0TDQ-iWnhjuAHaWlZBB0bfaZgqZ2EWZGk3BICA,17154
|
|
19
19
|
twc/commands/firewall.py,sha256=KNolqbi2rsppOZwbs_j3yoZQt-0wKbj1JPGiZdfGxDE,27439
|
|
20
20
|
twc/commands/floating_ip.py,sha256=G9nD5BbHCZcuytbzeneDJWQDhd8c8WRtq9pAfwI9m7E,8747
|
|
21
21
|
twc/commands/image.py,sha256=OviQwegXK55H3TBlroCASVcgj2QUVCTo0ZhF5ug9eT8,8165
|
|
@@ -29,8 +29,8 @@ twc/fmt.py,sha256=nbuYZ8nVabYDwCmZqnL3-c6Tmri4B-R_sTCkG6sdfeI,7171
|
|
|
29
29
|
twc/typerx.py,sha256=AZ6BgTQvlrZYfKVYd9YqRNQnAR2XuyqImz4rf6di6f4,6737
|
|
30
30
|
twc/utils.py,sha256=uWizyUC4dHLwtk50q4Sub3zOvnVESfHKBbXYwk5t71w,651
|
|
31
31
|
twc/vars.py,sha256=fva3O2leMGtExb1aWiAk6sOV0O8et9_kEyRpYYIZ7CM,543
|
|
32
|
-
twc_cli-2.
|
|
33
|
-
twc_cli-2.
|
|
34
|
-
twc_cli-2.
|
|
35
|
-
twc_cli-2.
|
|
36
|
-
twc_cli-2.
|
|
32
|
+
twc_cli-2.8.0.dist-info/COPYING,sha256=fpJLxZS_kHr_659xkpmqEtqHeZp6lQR9CmKCwnYbsmE,1089
|
|
33
|
+
twc_cli-2.8.0.dist-info/METADATA,sha256=LEAHMaB0puxa1JSU4C1ok6O1S1p99CObd5VpDuB1jEY,2652
|
|
34
|
+
twc_cli-2.8.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
35
|
+
twc_cli-2.8.0.dist-info/entry_points.txt,sha256=tmTaVRhm8BkNrXC_9XJMum7O9wFVOvkXcBetxmahWvE,40
|
|
36
|
+
twc_cli-2.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|