gravi-cli 0.2.2__tar.gz → 0.2.3__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.
@@ -1,5 +1,5 @@
1
1
  [tool.bumpversion]
2
- current_version = "0.2.2"
2
+ current_version = "0.2.3"
3
3
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
4
4
  serialize = ["{major}.{minor}.{patch}"]
5
5
  search = "{current_version}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gravi-cli
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: CLI tool for Gravitate infrastructure management
5
5
  Project-URL: Homepage, https://github.com/gravitate/mom
6
6
  Project-URL: Documentation, https://github.com/gravitate/mom/tree/main/cli
@@ -6,4 +6,4 @@ allowing developers to authenticate, manage tokens, and access instance
6
6
  configurations and credentials.
7
7
  """
8
8
 
9
- __version__ = "0.2.2"
9
+ __version__ = "0.2.3"
@@ -32,6 +32,7 @@ from .exceptions import (
32
32
  APIError,
33
33
  RateLimitError,
34
34
  ConfigError,
35
+ PermissionDeniedError,
35
36
  )
36
37
 
37
38
 
@@ -393,6 +394,39 @@ def config(instance_key, format):
393
394
  sys.exit(1)
394
395
 
395
396
 
397
+ @main.command()
398
+ @click.argument("instance_key")
399
+ @click.option(
400
+ "--json",
401
+ "output_json",
402
+ is_flag=True,
403
+ help="Output as JSON for scripting",
404
+ )
405
+ def token(instance_key, output_json):
406
+ """Get access and refresh tokens for an instance."""
407
+ try:
408
+ token_data = get_instance_token(instance_key)
409
+
410
+ if output_json:
411
+ click.echo(json.dumps({
412
+ "access_token": token_data.get("access_token", ""),
413
+ "refresh_token": token_data.get("refresh_token", ""),
414
+ }))
415
+ else:
416
+ click.echo(f"AccessToken: {token_data.get('access_token', 'N/A')}")
417
+ click.echo(f"RefreshToken: {token_data.get('refresh_token', 'N/A')}")
418
+
419
+ except NotAuthenticatedError as e:
420
+ click.echo(f"Error: {e}", err=True)
421
+ sys.exit(1)
422
+ except PermissionDeniedError as e:
423
+ click.echo(f"Error: {e}", err=True)
424
+ sys.exit(1)
425
+ except Exception as e:
426
+ click.echo(f"Error: {e}", err=True)
427
+ sys.exit(1)
428
+
429
+
396
430
  # Add missing import for timedelta
397
431
  from datetime import timedelta
398
432
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "gravi-cli"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "CLI tool for Gravitate infrastructure management"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
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