twc-cli 2.7.0__tar.gz → 2.8.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.

Potentially problematic release.


This version of twc-cli might be problematic. Click here for more details.

Files changed (34) hide show
  1. {twc_cli-2.7.0 → twc_cli-2.8.0}/PKG-INFO +2 -1
  2. {twc_cli-2.7.0 → twc_cli-2.8.0}/pyproject.toml +1 -1
  3. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/__version__.py +1 -1
  4. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/api/client.py +13 -3
  5. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/domain.py +56 -9
  6. {twc_cli-2.7.0 → twc_cli-2.8.0}/CHANGELOG.md +0 -0
  7. {twc_cli-2.7.0 → twc_cli-2.8.0}/COPYING +0 -0
  8. {twc_cli-2.7.0 → twc_cli-2.8.0}/README.md +0 -0
  9. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/__init__.py +0 -0
  10. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/__main__.py +0 -0
  11. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/api/__init__.py +0 -0
  12. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/api/base.py +0 -0
  13. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/api/exceptions.py +0 -0
  14. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/api/types.py +0 -0
  15. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/apiwrap.py +0 -0
  16. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/__init__.py +0 -0
  17. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/account.py +0 -0
  18. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/balancer.py +0 -0
  19. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/common.py +0 -0
  20. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/config.py +0 -0
  21. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/database.py +0 -0
  22. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/firewall.py +0 -0
  23. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/floating_ip.py +0 -0
  24. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/image.py +0 -0
  25. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/kubernetes.py +0 -0
  26. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/project.py +0 -0
  27. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/server.py +0 -0
  28. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/ssh_key.py +0 -0
  29. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/storage.py +0 -0
  30. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/commands/vpc.py +0 -0
  31. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/fmt.py +0 -0
  32. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/typerx.py +0 -0
  33. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/utils.py +0 -0
  34. {twc_cli-2.7.0 → twc_cli-2.8.0}/twc/vars.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: twc-cli
3
- Version: 2.7.0
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)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "twc-cli"
3
- version = "2.7.0"
3
+ version = "2.8.0"
4
4
  description = "Timeweb Cloud Command Line Interface."
5
5
  authors = ["ge <dev@timeweb.cloud>"]
6
6
  homepage = "https://github.com/timeweb-cloud/twc"
@@ -12,5 +12,5 @@
12
12
  import sys
13
13
 
14
14
 
15
- __version__ = "2.7.0"
15
+ __version__ = "2.8.0"
16
16
  __pyversion__ = sys.version.replace("\n", "")
@@ -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
@@ -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
- response = client.add_domain_dns_record(
376
- domain_name,
377
- record_type,
378
- value,
379
- subdomain,
380
- priority,
381
- null_subdomain=null_subdomain,
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,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes