snapctl 0.48.0__py3-none-any.whl → 0.49.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 snapctl might be problematic. Click here for more details.

@@ -3,7 +3,7 @@ Constants used by snapctl
3
3
  """
4
4
  COMPANY_NAME = 'Snapser'
5
5
  VERSION_PREFIX = 'beta-'
6
- VERSION = '0.48.0'
6
+ VERSION = '0.49.0'
7
7
  CONFIG_FILE_MAC = '~/.snapser/config'
8
8
  CONFIG_FILE_WIN = '%homepath%\\.snapser\\config'
9
9
 
@@ -27,6 +27,7 @@ HTTP_ERROR_SERVICE_VERSION_EXISTS = 542
27
27
  HTTP_ERROR_SERVICE_IN_USE = 543
28
28
  HTTP_ERROR_TAG_NOT_AVAILABLE = 544
29
29
  HTTP_ERROR_ADD_ON_NOT_ENABLED = 547
30
+ HTTP_ERROR_SNAPEND_MANIFEST_MISMATCH = 594
30
31
 
31
32
  # CLI Return Codes
32
33
  SNAPCTL_SUCCESS = 0
@@ -49,7 +50,7 @@ SNAPCTL_BYOGS_PUBLISH_ERROR = 25
49
50
  SNAPCTL_BYOGS_PUBLISH_PERMISSION_ERROR = 26
50
51
  SNAPCTL_BYOGS_PUBLISH_DUPLICATE_TAG_ERROR = 27
51
52
 
52
- # BYOSNAP Errors - 30 - 49 then 86 - 99
53
+ # BYOSNAP Errors - 30 - 49 then 86 - 90
53
54
  SNAPCTL_BYOSNAP_NOT_FOUND = SNAPCTL_RESOURCE_NOT_FOUND
54
55
  SNAPCTL_BYOSNAP_GENERIC_ERROR = 30
55
56
  SNAPCTL_BYOSNAP_DEPENDENCY_MISSING = 31
@@ -102,7 +103,11 @@ SNAPCTL_SNAPEND_UPDATE_ERROR = 72
102
103
  SNAPCTL_SNAPEND_UPDATE_SERVER_ERROR = 73
103
104
  SNAPCTL_SNAPEND_UPDATE_TIMEOUT_ERROR = 74
104
105
  SNAPCTL_SNAPEND_STATE_ERROR = 75
106
+ SNAPCTL_SNAPEND_APPLY_MANIFEST_MISMATCH_ERROR = 76
105
107
 
106
108
  # Generate Errors - 80 - 85
107
109
  SNAPCTL_GENERATE_GENERIC_ERROR = 80
108
110
  SNAPCTL_GENERATE_CREDENTIALS_ERROR = 81
111
+
112
+ # BYOWs Errors - 95 - 99
113
+ SNAPCTL_BYOWS_GENERIC_ERROR = 95
@@ -9,3 +9,8 @@ END_POINTS: Dict[str, str] = {
9
9
  'PLAYTEST': 'https://gateway.dev.snapser.io/playtest',
10
10
  'PROD': 'https://gateway.snapser.com/snapser'
11
11
  }
12
+
13
+ GATEWAY_END_POINTS: Dict[str, str] = {
14
+ 'SANDBOX': 'https://gateway.dev.snapser.io',
15
+ 'LIVE': 'https://gateway-accel.snapser.com',
16
+ }
snapctl/config/hashes.py CHANGED
@@ -189,11 +189,15 @@ SERVICE_IDS: List[str] = [
189
189
  ]
190
190
 
191
191
  SDK_ACCESS_AUTH_TYPE_LOOKUP: Dict[str, Dict[str, str]] = {
192
+ # 'omni': {
193
+ # 'access_type': 'external',
194
+ # 'auth_type': 'omni'
195
+ # },
192
196
  'user': {
193
197
  'access_type': 'external',
194
198
  'auth_type': 'user'
195
199
  },
196
- 'server': {
200
+ 'api-key': {
197
201
  'access_type': 'external',
198
202
  'auth_type': 'api-key'
199
203
  },
File without changes
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ ## beta-0.49.0
2
+ ##### May 9, 2025
3
+
4
+ ### Breaking Change
5
+ 1. Renamed SDK type `server` to `api-key` to be consistent with the Snapser Web app.
6
+
7
+ ### Features
8
+ 1. You can now download the new Omni SDK via Snapctl.
9
+
10
+ ### Bug Fixes
11
+ 1. The `snapctl byosnap generate-profile` command was not working when outside the root snapctl folder. This is now fixed.
12
+ 2. The `snapctl release-notes` commands were not working when outside the root snapctl folder. This is now fixed.
snapctl/main.py CHANGED
@@ -14,11 +14,12 @@ from snapctl.commands.byogs import ByoGs
14
14
  from snapctl.commands.game import Game
15
15
  from snapctl.commands.generate import Generate
16
16
  from snapctl.commands.snapend import Snapend
17
+ from snapctl.commands.byows import Byows
17
18
  from snapctl.commands.release_notes import ReleaseNotes
18
19
  from snapctl.config.constants import COMPANY_NAME, API_KEY, URL_KEY, CONFIG_FILE_MAC, \
19
20
  CONFIG_FILE_WIN, DEFAULT_PROFILE, VERSION, SNAPCTL_SUCCESS, CONFIG_PATH_KEY, \
20
21
  SNAPCTL_CONFIGURATION_INCORRECT, VERSION_PREFIX
21
- from snapctl.config.endpoints import END_POINTS
22
+ from snapctl.config.endpoints import END_POINTS, GATEWAY_END_POINTS
22
23
  from snapctl.config.hashes import PROTOS_TYPES, SERVICE_IDS, \
23
24
  SNAPEND_MANIFEST_TYPES, SDK_TYPES
24
25
  from snapctl.utils.echo import error, success, info
@@ -109,6 +110,19 @@ def get_base_url(api_key: Union[str, None]) -> str:
109
110
  return END_POINTS['PLAYTEST']
110
111
  return END_POINTS['PROD']
111
112
 
113
+ def get_base_snapend_url(api_key: Union[str, None]) -> str:
114
+ """
115
+ Returns the base url for snapend based on the api_key
116
+ """
117
+ if api_key is None:
118
+ return ''
119
+ if api_key.startswith('dev_'):
120
+ return GATEWAY_END_POINTS['SANDBOX']
121
+ if api_key.startswith('devtwo_'):
122
+ return GATEWAY_END_POINTS['SANDBOX']
123
+ if api_key.startswith('playtest_'):
124
+ return GATEWAY_END_POINTS['SANDBOX']
125
+ return GATEWAY_END_POINTS['LIVE']
112
126
 
113
127
  def validate_command_context(
114
128
  ctx: typer.Context,
@@ -139,6 +153,7 @@ def default_context_callback(ctx: typer.Context):
139
153
  ctx.obj['api_key_location'] = api_key_obj['location']
140
154
  ctx.obj['profile'] = DEFAULT_PROFILE
141
155
  ctx.obj['base_url'] = get_base_url(api_key_obj['value'])
156
+ ctx.obj['base_snapend_url'] = get_base_snapend_url(api_key_obj['value'])
142
157
 
143
158
 
144
159
  def api_key_context_callback(
@@ -546,6 +561,10 @@ def snapend(
546
561
  None, "--manifest-path-filename",
547
562
  help="(req: apply|clone) Full Path to the manifest file including the filename."
548
563
  ),
564
+ force: bool = typer.Option(
565
+ False, "--force",
566
+ help="(optional: apply) If true, Snapser will ignore the configuration diff validation and allow to force apply the manifest."
567
+ ),
549
568
  # download
550
569
  category: str = typer.Option(
551
570
  None, "--category",
@@ -646,6 +665,7 @@ def snapend(
646
665
  name=name, env=env,
647
666
  # Apply, Clone
648
667
  manifest_path_filename=manifest_path_filename,
668
+ force=force,
649
669
  # Download
650
670
  category=category,
651
671
  category_format=category_format,
@@ -660,3 +680,54 @@ def snapend(
660
680
  getattr(snapend_obj, subcommand.replace('-', '_'))()
661
681
  success(f"Snapend {subcommand} complete")
662
682
  raise typer.Exit(code=SNAPCTL_SUCCESS)
683
+
684
+
685
+ @app.command()
686
+ def byows(
687
+ ctx: typer.Context,
688
+ # Required fields
689
+ subcommand: str = typer.Argument(
690
+ ..., help="Byows Subcommands: " + ", ".join(Byows.SUBCOMMANDS) + "."
691
+ ),
692
+ # attach
693
+ snapend_id: str = typer.Option(
694
+ None, "--snapend-id",
695
+ help=("(req: attach) Your Snapend Id")
696
+ ),
697
+ byosnap_id: str = typer.Option(
698
+ None, "--byosnap-id",
699
+ help=("(req: attach) Your BYOSnap Id")
700
+ ),
701
+ http_port: str = typer.Option(
702
+ None, "--http-port",
703
+ help=("(oneof: attach) HTTP port of your local server. One of --http-port or --grpc-port is required.")
704
+ ),
705
+ grpc_port: str = typer.Option(
706
+ None, "--grpc-port",
707
+ help=("(oneof: attach) gRPC port of your local server. One of --http-port or --grpc-port is required.")
708
+ ),
709
+ # overrides
710
+ api_key: Union[str, None] = typer.Option(
711
+ None, "--api-key", help="API Key override.", callback=api_key_context_callback
712
+ ),
713
+ profile: Union[str, None] = typer.Option(
714
+ None, "--profile", help="Profile from the Snapser config to use.", callback=profile_context_callback
715
+ ),
716
+ ) -> None:
717
+ """
718
+ Bring your own workstation commands
719
+ """
720
+ validate_command_context(ctx)
721
+ byows_obj: Byows = Byows(
722
+ subcommand=subcommand,
723
+ base_url=ctx.obj['base_url'],
724
+ base_snapend_url=ctx.obj['base_snapend_url'],
725
+ api_key=ctx.obj['api_key'],
726
+ snapend_id=snapend_id,
727
+ byosnap_id=byosnap_id,
728
+ http_port=http_port,
729
+ grpc_port=grpc_port,
730
+ )
731
+ getattr(byows_obj, subcommand.replace('-', '_'))()
732
+ success(f"BYOWs {subcommand} complete")
733
+ raise typer.Exit(code=SNAPCTL_SUCCESS)
snapctl/utils/helper.py CHANGED
@@ -14,6 +14,7 @@ from snapctl.config.constants import HTTP_NOT_FOUND, HTTP_FORBIDDEN, HTTP_UNAUTH
14
14
  SERVER_CALL_TIMEOUT, SNAPCTL_CONFIGURATION_ERROR, SNAPCTL_SUCCESS
15
15
  from snapctl.config.hashes import ARCHITECTURE_MAPPING
16
16
  from snapctl.utils.echo import error, success
17
+ from pathlib import Path
17
18
 
18
19
 
19
20
  def validate_api_key(base_url: str, api_key: Union[str, None]) -> bool:
@@ -183,3 +184,11 @@ def check_use_containerd_snapshotter() -> bool:
183
184
  return False
184
185
  except Exception:
185
186
  return False
187
+
188
+ def get_dot_snapser_dir() -> Path:
189
+ """
190
+ Returns the .snapser configuration directory, creating it if necessary.
191
+ """
192
+ config_dir = Path.home() / ".snapser"
193
+ config_dir.mkdir(parents=True, exist_ok=True)
194
+ return config_dir