snapctl 0.46.3__tar.gz → 0.47.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 snapctl might be problematic. Click here for more details.

Files changed (28) hide show
  1. {snapctl-0.46.3 → snapctl-0.47.0}/PKG-INFO +10 -4
  2. {snapctl-0.46.3 → snapctl-0.47.0}/README.md +9 -3
  3. {snapctl-0.46.3 → snapctl-0.47.0}/pyproject.toml +1 -1
  4. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/commands/byogs.py +9 -2
  5. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/commands/byosnap.py +14 -2
  6. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/commands/snapend.py +65 -4
  7. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/config/constants.py +2 -2
  8. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/config/hashes.py +30 -2
  9. snapctl-0.47.0/snapctl/data/releases/beta-0.46.4.mdx +7 -0
  10. snapctl-0.47.0/snapctl/data/releases/beta-0.47.0.mdx +12 -0
  11. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/main.py +18 -7
  12. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/utils/helper.py +35 -0
  13. {snapctl-0.46.3 → snapctl-0.47.0}/LICENSE +0 -0
  14. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/__init__.py +0 -0
  15. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/__main__.py +0 -0
  16. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/commands/__init__.py +0 -0
  17. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/commands/game.py +0 -0
  18. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/commands/generate.py +0 -0
  19. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/commands/release_notes.py +0 -0
  20. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/config/__init__.py +0 -0
  21. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/config/endpoints.py +0 -0
  22. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/data/profiles/snapser-byosnap-profile.json +0 -0
  23. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/data/profiles/snapser-byosnap-profile.yaml +0 -0
  24. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/data/releases/beta-0.46.0.mdx +0 -0
  25. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/types/__init__.py +0 -0
  26. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/types/definitions.py +0 -0
  27. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/utils/__init__.py +0 -0
  28. {snapctl-0.46.3 → snapctl-0.47.0}/snapctl/utils/echo.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snapctl
3
- Version: 0.46.3
3
+ Version: 0.47.0
4
4
  Summary: Snapser CLI Tool
5
5
  Author: Ajinkya Apte
6
6
  Author-email: aj@snapser.com
@@ -637,15 +637,21 @@ snapctl snapend download --help
637
637
  # sdk(csharp, cpp, lua, ts, go, python, kotlin, java, c, node, js, perl, php, closure, ruby, rust),
638
638
  # protos(go, csharp, cpp, raw)
639
639
  # $type = One of the supported types:
640
- # For --category=sdk --type(user, server, internal, app)
641
- # For --category=protos --type(messages, services)
640
+ # For category=sdk type=(user, server, internal, app)
641
+ # For category=protos type=(messages, services)
642
+ # $http_lib (optional) = One of the supported libs
643
+ # For category=sdk format=unity http-lib=(httpclient, unitywebrequest, restsharp)
644
+ # For category=sdk format=csharp http-lib=(httpclient, restsharp)
645
+ # For category=sdk format=web-ts http-lib=(axios, fetch)
646
+ # For category=sdk format=ts http-lib=(axios, fetch)
642
647
  # Example:
643
648
  # snapctl snapend download --snapend-id gx5x6bc0 --category snapend-manifest --format yaml --out-path .
644
649
  # snapctl snapend download --snapend-id gx5x6bc0 --category sdk --format unity --type user --out-path .
645
650
  # snapctl snapend download --snapend-id gx5x6bc0 --category sdk --format cpp --type internal --out-path .
646
651
  # snapctl snapend download --snapend-id gx5x6bc0 --category protos --format raw --type messages --out-path .
652
+ # snapctl snapend download --snapend-id gx5x6bc0 --category sdk --format unity --type user --http-lib unitywebrequest --out-path .
647
653
  snapctl snapend download --snapend-id $snapend_id --category $category --format $format --type $type --out-path $out_path
648
-
654
+ snapctl snapend download --snapend-id $snapend_id --category $category --format $format --type $type --http-lib $http_lib --out-path $out_path
649
655
  ```
650
656
 
651
657
  #### 3. Clone Snapend
@@ -617,15 +617,21 @@ snapctl snapend download --help
617
617
  # sdk(csharp, cpp, lua, ts, go, python, kotlin, java, c, node, js, perl, php, closure, ruby, rust),
618
618
  # protos(go, csharp, cpp, raw)
619
619
  # $type = One of the supported types:
620
- # For --category=sdk --type(user, server, internal, app)
621
- # For --category=protos --type(messages, services)
620
+ # For category=sdk type=(user, server, internal, app)
621
+ # For category=protos type=(messages, services)
622
+ # $http_lib (optional) = One of the supported libs
623
+ # For category=sdk format=unity http-lib=(httpclient, unitywebrequest, restsharp)
624
+ # For category=sdk format=csharp http-lib=(httpclient, restsharp)
625
+ # For category=sdk format=web-ts http-lib=(axios, fetch)
626
+ # For category=sdk format=ts http-lib=(axios, fetch)
622
627
  # Example:
623
628
  # snapctl snapend download --snapend-id gx5x6bc0 --category snapend-manifest --format yaml --out-path .
624
629
  # snapctl snapend download --snapend-id gx5x6bc0 --category sdk --format unity --type user --out-path .
625
630
  # snapctl snapend download --snapend-id gx5x6bc0 --category sdk --format cpp --type internal --out-path .
626
631
  # snapctl snapend download --snapend-id gx5x6bc0 --category protos --format raw --type messages --out-path .
632
+ # snapctl snapend download --snapend-id gx5x6bc0 --category sdk --format unity --type user --http-lib unitywebrequest --out-path .
627
633
  snapctl snapend download --snapend-id $snapend_id --category $category --format $format --type $type --out-path $out_path
628
-
634
+ snapctl snapend download --snapend-id $snapend_id --category $category --format $format --type $type --http-lib $http_lib --out-path $out_path
629
635
  ```
630
636
 
631
637
  #### 3. Clone Snapend
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "snapctl"
3
- version = "0.46.3"
3
+ version = "0.47.0"
4
4
  description = "Snapser CLI Tool"
5
5
  authors = ["Ajinkya Apte <aj@snapser.com>"]
6
6
  readme = "README.md"
@@ -16,9 +16,10 @@ from snapctl.commands.snapend import Snapend
16
16
  from snapctl.config.constants import SNAPCTL_BYOGS_DEPENDENCY_MISSING, \
17
17
  SNAPCTL_BYOGS_ECR_LOGIN_ERROR, SNAPCTL_BYOGS_BUILD_ERROR, \
18
18
  SNAPCTL_BYOGS_TAG_ERROR, SNAPCTL_BYOGS_PUBLISH_ERROR, \
19
- SNAPCTL_BYOGS_PUBLISH_DUPLICATE_TAG_ERROR, SNAPCTL_INPUT_ERROR
19
+ SNAPCTL_BYOGS_PUBLISH_DUPLICATE_TAG_ERROR, SNAPCTL_INPUT_ERROR, \
20
+ SNAPCTL_CONFIGURATION_INCORRECT
20
21
  from snapctl.utils.helper import get_composite_token, snapctl_error, snapctl_success, \
21
- check_dockerfile_architecture
22
+ check_dockerfile_architecture, check_use_containerd_snapshotter
22
23
  from snapctl.utils.echo import info, warning
23
24
 
24
25
 
@@ -441,6 +442,12 @@ class ByoGs:
441
442
  5. Push the image
442
443
  6. Upload swagger.json
443
444
  """
445
+ if check_use_containerd_snapshotter():
446
+ msg = 'Containerd is active. Please disable it from your Docker Desktop settings.'
447
+ snapctl_error(
448
+ message=msg,
449
+ code=SNAPCTL_CONFIGURATION_INCORRECT
450
+ )
444
451
  self._check_dependencies()
445
452
  if not self.skip_build:
446
453
  self._docker_build()
@@ -29,10 +29,10 @@ from snapctl.config.constants import HTTP_ERROR_SERVICE_VERSION_EXISTS, \
29
29
  SNAPCTL_BYOSNAP_UPDATE_VERSION_ERROR, SNAPCTL_BYOSNAP_UPDATE_VERSION_SERVICE_IN_USE_ERROR, \
30
30
  SNAPCTL_BYOSNAP_UPDATE_VERSION_TAG_ERROR, SNAPCTL_BYOSNAP_NOT_FOUND, \
31
31
  HTTP_ERROR_RESOURCE_NOT_FOUND, SNAPCTL_BYOSNAP_PUBLISH_ERROR, \
32
- SNAPCTL_BYOSNAP_GENERATE_PROFILE_ERROR
32
+ SNAPCTL_BYOSNAP_GENERATE_PROFILE_ERROR, SNAPCTL_CONFIGURATION_INCORRECT
33
33
  from snapctl.utils.echo import info, warning, success
34
34
  from snapctl.utils.helper import get_composite_token, snapctl_error, snapctl_success, \
35
- check_dockerfile_architecture
35
+ check_dockerfile_architecture, check_use_containerd_snapshotter
36
36
 
37
37
 
38
38
  class ByoSnap:
@@ -65,6 +65,7 @@ class ByoSnap:
65
65
  VALID_MEMORY_MARKS = [0.125, 0.25, 0.5, 1, 2, 3, 4]
66
66
  MAX_READINESS_TIMEOUT = 30
67
67
  MAX_MIN_REPLICAS = 4
68
+ INTERNAL_PORT_NAME_CHAR_LIMIT = 15
68
69
 
69
70
  def __init__(
70
71
  self, *, subcommand: str, base_url: str, api_key: Union[str, None], byosnap_id: str,
@@ -274,6 +275,11 @@ class ByoSnap:
274
275
  f"Check the internal port number #{index}.",
275
276
  code=SNAPCTL_INPUT_ERROR
276
277
  )
278
+ if len(internal_port_obj['name']) > ByoSnap.INTERNAL_PORT_NAME_CHAR_LIMIT:
279
+ snapctl_error("Internal port name should be less than " +
280
+ f"{ByoSnap.INTERNAL_PORT_NAME_CHAR_LIMIT} characters. " +
281
+ f"Check internal port number {index}.",
282
+ SNAPCTL_INPUT_ERROR)
277
283
  if internal_port_obj['name'] is None or internal_port_obj['name'].strip() == '':
278
284
  snapctl_error(
279
285
  message='Invalid Ingress internal_port value in BYOSnap profile. ' +
@@ -1284,6 +1290,12 @@ class ByoSnap:
1284
1290
  5. Push the image
1285
1291
  6. Upload swagger.json
1286
1292
  """
1293
+ if check_use_containerd_snapshotter():
1294
+ msg = 'Containerd is active. Please disable it from your Docker Desktop settings.'
1295
+ snapctl_error(
1296
+ message=msg,
1297
+ code=SNAPCTL_CONFIGURATION_INCORRECT
1298
+ )
1287
1299
  self._check_dependencies()
1288
1300
  if not self.skip_build:
1289
1301
  self._docker_build()
@@ -19,7 +19,7 @@ from snapctl.config.constants import SERVER_CALL_TIMEOUT, SNAPCTL_INPUT_ERROR, \
19
19
  SNAPCTL_SNAPEND_PROMOTE_TIMEOUT_ERROR, SNAPCTL_SNAPEND_PROMOTE_ERROR, \
20
20
  SNAPCTL_SNAPEND_DOWNLOAD_ERROR, SNAPCTL_SNAPEND_UPDATE_TIMEOUT_ERROR, \
21
21
  SNAPCTL_SNAPEND_UPDATE_ERROR, SNAPCTL_SNAPEND_STATE_ERROR
22
- from snapctl.config.hashes import PROTOS_TYPES, CLIENT_SDK_TYPES, \
22
+ from snapctl.config.hashes import PROTOS_TYPES, CLIENT_SDK_TYPES, SERVER_SDK_TYPES, \
23
23
  SNAPEND_MANIFEST_TYPES, SDK_TYPES, SDK_ACCESS_AUTH_TYPE_LOOKUP
24
24
  from snapctl.utils.echo import error, success, info
25
25
  from snapctl.utils.helper import snapctl_error, snapctl_success
@@ -38,6 +38,7 @@ class Snapend:
38
38
  ]
39
39
  CATEGORY_TYPE_SDK = ['user', 'server', 'internal', 'app']
40
40
  CATEGORY_TYPE_PROTOS = ['messages', 'services']
41
+ # CATEGORY_TYPE_HTTP_LIB_FORMATS = ['unity', 'web-ts', 'ts']
41
42
 
42
43
  DOWNLOAD_TYPE_NOT_REQUIRED = ['admin-settings']
43
44
  # ACCESS_TYPES = ['external', 'internal']
@@ -60,6 +61,7 @@ class Snapend:
60
61
  category: Union[str, None] = None,
61
62
  category_format: Union[str, None] = None,
62
63
  category_type: Union[str, None] = None,
64
+ category_http_lib: Union[str, None] = None,
63
65
  snaps: Union[str, None] = None,
64
66
  # Clone, Apply, Promote, Download
65
67
  out_path: Union[str, None] = None,
@@ -77,8 +79,11 @@ class Snapend:
77
79
  self.env: str = env
78
80
  self.manifest_path_filename: Union[str, None] = manifest_path_filename
79
81
  self.category: str = category
82
+ self.portal_category: Union[str, None] = Snapend._make_portal_category(
83
+ category_format)
80
84
  self.category_format: str = category_format
81
85
  self.category_type: Union[str, None] = category_type
86
+ self.category_http_lib: Union[str, None] = category_http_lib
82
87
  self.download_types: Union[
83
88
  Dict[str, Dict[str, str]], None
84
89
  ] = Snapend._make_download_type(category)
@@ -97,7 +102,6 @@ class Snapend:
97
102
  self.validate_input()
98
103
 
99
104
  # Helpers
100
-
101
105
  @staticmethod
102
106
  def _get_manifest_file_name(manifest_path: str) -> Union[str, None]:
103
107
  if manifest_path and manifest_path != '' and os.path.isfile(manifest_path):
@@ -107,6 +111,19 @@ class Snapend:
107
111
  return file_name
108
112
  return None
109
113
 
114
+ @staticmethod
115
+ def _make_portal_category(category_format: str):
116
+ '''
117
+ We have simplified the input for the user to only take the category as sdk
118
+ The portal server however expects us to pass client-sdk or server-sdk
119
+ Hence we need to do this
120
+ '''
121
+ if category_format in CLIENT_SDK_TYPES:
122
+ return 'client-sdk'
123
+ if category_format in SERVER_SDK_TYPES:
124
+ return 'server-sdk'
125
+ return None
126
+
110
127
  @staticmethod
111
128
  def _make_download_type(category: str):
112
129
  if category == 'sdk':
@@ -195,7 +212,7 @@ class Snapend:
195
212
  try:
196
213
  url = (
197
214
  f"{self.base_url}/v1/snapser-api/snapends/{self.snapend_id}/"
198
- f"download?category={self.category}"
215
+ f"download?category={self.portal_category}"
199
216
  )
200
217
  if self.category not in Snapend.DOWNLOAD_TYPE_NOT_REQUIRED:
201
218
  url += "&type=" + \
@@ -211,6 +228,10 @@ class Snapend:
211
228
  if 'auth_type' in SDK_ACCESS_AUTH_TYPE_LOOKUP[self.category_type] and \
212
229
  SDK_ACCESS_AUTH_TYPE_LOOKUP[self.category_type]['auth_type'] != '':
213
230
  url += f"&auth_type={SDK_ACCESS_AUTH_TYPE_LOOKUP[self.category_type]['auth_type']}"
231
+ if self.category_http_lib:
232
+ # First check if the format supports http-lib
233
+ if self.category_format in Snapend.get_formats_supporting_http_lib():
234
+ url += f"&http_lib={self.category_http_lib}"
214
235
  # Customize snaps
215
236
  if self.snaps:
216
237
  url += f"&snaps={self.snaps}"
@@ -233,6 +254,10 @@ class Snapend:
233
254
  if 'auth_type' in SDK_ACCESS_AUTH_TYPE_LOOKUP[self.category_type] and \
234
255
  SDK_ACCESS_AUTH_TYPE_LOOKUP[self.category_type]['auth_type'] != '':
235
256
  fn += f"-{SDK_ACCESS_AUTH_TYPE_LOOKUP[self.category_type]['auth_type']}"
257
+ if self.category_http_lib:
258
+ # First check if the format supports http-lib
259
+ if self.category_format in Snapend.get_formats_supporting_http_lib():
260
+ fn += f"-{self.category_http_lib}"
236
261
  fn += ".zip"
237
262
  if self.out_path is not None:
238
263
  file_save_path = os.path.join(self.out_path, fn)
@@ -253,6 +278,30 @@ class Snapend:
253
278
  )
254
279
  return False
255
280
 
281
+ @staticmethod
282
+ def get_formats_supporting_http_lib() -> list:
283
+ '''
284
+ Get the list of formats that support http-lib
285
+ '''
286
+ format_list = []
287
+ for key, value in SDK_TYPES.items():
288
+ if 'http-lib' in value and len(value['http-lib']) > 0:
289
+ format_list.append(key)
290
+ return format_list
291
+
292
+ @staticmethod
293
+ def get_http_formats_str() -> str:
294
+ '''
295
+ Get the list of formats that support http-lib as a string
296
+ '''
297
+ format_str = ""
298
+ for key, value in SDK_TYPES.items():
299
+ if 'http-lib' in value and len(value['http-lib']) > 0:
300
+ format_str += f"{key}({', '.join(value['http-lib'])}) | "
301
+ if format_str != "":
302
+ format_str = format_str[:-2]
303
+ return format_str
304
+
256
305
  # Validate input
257
306
  def validate_input(self) -> None:
258
307
  """
@@ -373,8 +422,20 @@ class Snapend:
373
422
  ", ".join(CLIENT_SDK_TYPES.keys()) + " SDKs.",
374
423
  code=SNAPCTL_INPUT_ERROR
375
424
  )
425
+ if self.category_http_lib:
426
+ # First check if the format supports http-lib
427
+ if self.category_format in Snapend.get_formats_supporting_http_lib():
428
+ # Check if the http-lib is supported for the format
429
+ valid_http_libs = SDK_TYPES[self.category_format]['http-lib']
430
+ if self.category_http_lib not in valid_http_libs:
431
+ print('Caught you')
432
+ snapctl_error(
433
+ message="Invalid HTTP Library. Valid libraries are " +
434
+ Snapend.get_http_formats_str(),
435
+ code=SNAPCTL_INPUT_ERROR
436
+ )
376
437
 
377
- # Check file path
438
+ # Check file path
378
439
  if not self.out_path:
379
440
  snapctl_error(
380
441
  message="Missing required parameter: out-path",
@@ -3,7 +3,7 @@ Constants used by snapctl
3
3
  """
4
4
  COMPANY_NAME = 'Snapser'
5
5
  VERSION_PREFIX = 'beta-'
6
- VERSION = '0.46.3'
6
+ VERSION = '0.47.0'
7
7
  CONFIG_FILE_MAC = '~/.snapser/config'
8
8
  CONFIG_FILE_WIN = '%homepath%\\.snapser\\config'
9
9
 
@@ -11,7 +11,7 @@ DEFAULT_PROFILE = 'default'
11
11
  API_KEY = 'SNAPSER_API_KEY'
12
12
  URL_KEY = 'SNAPSER_URL_KEY'
13
13
  CONFIG_PATH_KEY = 'SNAPSER_CONFIG_PATH'
14
- SERVER_CALL_TIMEOUT = 30
14
+ SERVER_CALL_TIMEOUT = 300
15
15
 
16
16
  # HTTP codes
17
17
  HTTP_UNAUTHORIZED = 401
@@ -7,50 +7,62 @@ CLIENT_SDK_TYPES: Dict[str, Dict[str, str]] = {
7
7
  'unity': {
8
8
  'type': 'csharp',
9
9
  'subtype': 'unity',
10
+ 'http-lib': ['httpclient', 'unitywebrequest', 'restsharp'],
10
11
  },
11
12
  'unreal': {
12
13
  'type': 'cpp-ue4',
13
14
  'subtype': 'unreal',
15
+ 'http-lib': [],
14
16
  },
15
17
  'roblox': {
16
18
  'type': 'lua',
17
19
  'subtype': 'roblox',
20
+ 'http-lib': [],
18
21
  },
19
22
  'godot-csharp': {
20
23
  'type': 'csharp',
21
24
  'subtype': 'godot',
25
+ 'http-lib': [],
22
26
  },
23
27
  'godot-cpp': {
24
28
  'type': 'cpp-restsdk',
25
29
  'subtype': 'godot',
30
+ 'http-lib': [],
26
31
  },
27
32
  'cocos': {
28
33
  'type': 'cpp-restsdk',
29
34
  'subtype': 'cocos',
35
+ 'http-lib': [],
30
36
  },
31
37
  'ios-objc': {
32
38
  'type': 'objc',
33
39
  'subtype': 'ios',
40
+ 'http-lib': [],
34
41
  },
35
42
  'ios-swift': {
36
43
  'type': 'swift5',
37
44
  'subtype': 'ios',
45
+ 'http-lib': [],
38
46
  },
39
47
  'android-java': {
40
48
  'type': 'android',
41
49
  'subtype': 'android',
50
+ 'http-lib': [],
42
51
  },
43
52
  'android-kotlin': {
44
53
  'type': 'android',
45
54
  'subtype': 'android',
55
+ 'http-lib': [],
46
56
  },
47
57
  'web-ts': {
48
- 'type': 'typescript-axios',
58
+ 'type': 'typescript',
49
59
  'subtype': 'web',
60
+ 'http-lib': ['axios', 'fetch'],
50
61
  },
51
62
  'web-js': {
52
63
  'type': 'javascript',
53
64
  'subtype': 'web',
65
+ 'http-lib': [],
54
66
  },
55
67
  }
56
68
 
@@ -58,66 +70,82 @@ SERVER_SDK_TYPES: Dict[str, Dict[str, str]] = {
58
70
  'csharp': {
59
71
  'type': 'csharp',
60
72
  'subtype': '',
73
+ 'http-lib': ['httpclient', 'restsharp'],
61
74
  },
62
75
  'cpp': {
63
76
  'type': 'cpp-restsdk',
64
77
  'subtype': '',
78
+ 'http-lib': [],
65
79
  },
66
80
  'lua': {
67
81
  'type': 'lua',
68
82
  'subtype': '',
83
+ 'http-lib': [],
69
84
  },
70
85
  'ts': {
71
- 'type': 'typescript-axios',
86
+ 'type': 'typescript',
72
87
  'subtype': '',
88
+ 'http-lib': ['axios', 'fetch'],
73
89
  },
74
90
  'go': {
75
91
  'type': 'go',
76
92
  'subtype': '',
93
+ 'http-lib': [],
77
94
  },
78
95
  'python': {
79
96
  'type': 'python',
80
97
  'subtype': '',
98
+ 'http-lib': [],
81
99
  },
82
100
  'kotlin': {
83
101
  'type': 'kotlin',
84
102
  'subtype': '',
103
+ 'http-lib': [],
85
104
  },
86
105
  'java': {
87
106
  'type': 'java',
88
107
  'subtype': '',
108
+ 'http-lib': [],
89
109
  },
90
110
  'c': {
91
111
  'type': 'c',
92
112
  'subtype': '',
113
+ 'http-lib': [],
93
114
  },
94
115
  'node': {
95
116
  'type': 'typescript-node',
96
117
  'subtype': '',
118
+ 'http-lib': [],
97
119
  },
98
120
  'js': {
99
121
  'type': 'javascript',
100
122
  'subtype': '',
123
+ 'http-lib': [],
101
124
  },
102
125
  'perl': {
103
126
  'type': 'perl',
104
127
  'subtype': '',
128
+ 'http-lib': [],
105
129
  },
106
130
  'php': {
107
131
  'type': 'php',
108
132
  'subtype': '',
133
+ 'http-lib': [],
109
134
  },
110
135
  'clojure': {
111
136
  'type': 'clojure',
112
137
  'subtype': '',
138
+ 'http-lib': [],
113
139
  },
114
140
  'ruby': {
115
141
  'type': 'ruby',
116
142
  'subtype': '',
143
+ 'http-lib': [],
117
144
  },
118
145
  'rust': {
119
146
  'type': 'rust',
120
147
  'subtype': '',
148
+ 'http-lib': [],
121
149
  },
122
150
  }
123
151
 
@@ -0,0 +1,7 @@
1
+ ## beta-0.46.4
2
+ ##### Feb 20, 2025
3
+
4
+ ### Bug fix
5
+ - **Byosnap**:
6
+ - Fixed a bug where the BYOSnap profile's internal port name was not being validated for
7
+ character length.
@@ -0,0 +1,12 @@
1
+ ## beta-0.47.0
2
+ ##### March 7, 2025
3
+
4
+ ### Features
5
+ 1. You can now pass the http-lib parameter to the `snapctl snapend download` command.
6
+ This parameter allows you to specify the HTTP library to use for downloading Snapend resources. The supported values are `requests` and `httpx`. If not specified, the default library is `requests`.
7
+ ```bash
8
+ snapctl snapend download --snapend-id gx5x6bc0 --category sdk --format unity --type user --http-lib unitywebrequest --out-path .
9
+ ```
10
+ 2. Snapctl now detects if the Docker desktop **Containerd** setting is enabled on your system and
11
+ throws an error. This is to prevent users from uploading empty BYOSnap or BYOGs images,
12
+ a side effect of the Containerd setting.
@@ -3,6 +3,7 @@
3
3
  """
4
4
  import configparser
5
5
  import os
6
+ import json
6
7
  from sys import platform
7
8
  from typing import Union
8
9
  import typer
@@ -556,19 +557,28 @@ def snapend(
556
557
  category_format: str = typer.Option(
557
558
  None, "--format",
558
559
  help=(
559
- "(req: --category sdk|protos|snapend-manifest --format ) "
560
- "SDK Formats: sdk(" + ", ".join(SDK_TYPES.keys()) +
561
- ") protos(" + ", ".join(PROTOS_TYPES.keys()) + ")" +
562
- ") snapend-manifest(" +
560
+ "(req: --category sdk|protos|snapend-manifest --format "
561
+ "sdk(" + ", ".join(SDK_TYPES.keys()) +
562
+ ") | protos(" + ", ".join(PROTOS_TYPES.keys()) + ")" +
563
+ ") | snapend-manifest(" +
563
564
  ", ".join(SNAPEND_MANIFEST_TYPES.keys()) + ")"
564
565
  )
565
566
  ),
566
567
  category_type: str = typer.Option(
567
568
  None, "--type",
568
569
  help=(
569
- "(optional: download) Only applicable for --category sdk|protos --type"
570
- "Sdk-types: (" + ", ".join(Snapend.CATEGORY_TYPE_SDK) + ")"
571
- "Protos-types: (" + ", ".join(Snapend.CATEGORY_TYPE_PROTOS) + ")"
570
+ "(optional: download) Only applicable for --category sdk|protos --type "
571
+ "sdk(" + ", ".join(Snapend.CATEGORY_TYPE_SDK) + ")"
572
+ " | protos(" + ", ".join(Snapend.CATEGORY_TYPE_PROTOS) + ")"
573
+ )
574
+ ),
575
+ category_http_lib: str = typer.Option(
576
+ None, "--http-lib",
577
+ help=(
578
+ "(optional: download) Only applicable for --category sdk "
579
+ "--format " + '|'.join(Snapend.get_formats_supporting_http_lib()) + ' ' +
580
+ "--type user|server|internal|app "
581
+ "--http-lib " + Snapend.get_http_formats_str()
572
582
  )
573
583
  ),
574
584
  snaps: Union[str, None] = typer.Option(
@@ -640,6 +650,7 @@ def snapend(
640
650
  category=category,
641
651
  category_format=category_format,
642
652
  category_type=category_type,
653
+ category_http_lib=category_http_lib,
643
654
  snaps=snaps,
644
655
  # Download, Apply and Clone
645
656
  out_path=out_path,
@@ -3,6 +3,9 @@ Helper functions for snapctl
3
3
  """
4
4
  from typing import Union, Dict
5
5
  import re
6
+ import platform
7
+ import os
8
+ import json
6
9
  import requests
7
10
  import typer
8
11
  from requests.exceptions import RequestException
@@ -148,3 +151,35 @@ def snapctl_error(message: str, code: int, progress: Union[Progress, None] = Non
148
151
  progress.stop()
149
152
  error(message, code)
150
153
  raise typer.Exit(code=code)
154
+
155
+
156
+ def check_use_containerd_snapshotter() -> bool:
157
+ '''
158
+ This function checks the value of the UseContainerdSnapshotter in the Docker Desktop
159
+ settings-store.json
160
+ '''
161
+ # Determine the OS
162
+ os_name = platform.system()
163
+
164
+ # Determine the correct path based on the OS
165
+ if os_name == 'Darwin':
166
+ path = os.path.expanduser(
167
+ '~/Library/Group Containers/group.com.docker/settings-store.json')
168
+ elif os_name == 'Windows':
169
+ username = os.getlogin() # Get the current logged-in username
170
+ path = f"C:\\Users\\{username}\\AppData\\Roaming\\Docker\\settings-store.json"
171
+ elif os_name == 'Linux':
172
+ path = os.path.expanduser('~/.docker/desktop/settings-store.json')
173
+ else:
174
+ return False
175
+
176
+ # Try to read the file and extract the UseContainerdSnapshotter value
177
+ try:
178
+ with open(path, 'r') as file:
179
+ settings = json.load(file)
180
+ # Access the specific key in the JSON data
181
+ return settings.get('UseContainerdSnapshotter', False)
182
+ except FileNotFoundError:
183
+ return False
184
+ except Exception:
185
+ return False
File without changes
File without changes
File without changes
File without changes