snapctl 0.26.1__tar.gz → 0.31.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.
- {snapctl-0.26.1 → snapctl-0.31.0}/PKG-INFO +34 -12
- {snapctl-0.26.1 → snapctl-0.31.0}/README.md +33 -11
- {snapctl-0.26.1 → snapctl-0.31.0}/pyproject.toml +1 -1
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/commands/byogs.py +25 -7
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/commands/snapend.py +29 -12
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/config/constants.py +1 -1
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/config/hashes.py +12 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/main.py +14 -7
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/__init__.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/__main__.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/commands/__init__.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/commands/byosnap.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/commands/game.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/config/__init__.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/config/endpoints.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/types/__init__.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/types/definitions.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/utils/__init__.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/utils/echo.py +0 -0
- {snapctl-0.26.1 → snapctl-0.31.0}/snapctl/utils/helper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: snapctl
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.31.0
|
|
4
4
|
Summary: Snapser CLI Tool
|
|
5
5
|
Author: Ajinkya Apte
|
|
6
6
|
Author-email: aj@snapser.com
|
|
@@ -302,7 +302,7 @@ See all the supported commands
|
|
|
302
302
|
snapctl byogs --help
|
|
303
303
|
```
|
|
304
304
|
|
|
305
|
-
#### 2. byogs create
|
|
305
|
+
#### 2. [Deprecated soon] byogs create
|
|
306
306
|
|
|
307
307
|
Create a custom game server. Note that you will have to build, push and publish your game server image, for it to be useable
|
|
308
308
|
in a Snapend fleet.
|
|
@@ -336,7 +336,7 @@ snapctl byogs build --help
|
|
|
336
336
|
# $image_tag = An image tag for your snap
|
|
337
337
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
338
338
|
# Example:
|
|
339
|
-
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
339
|
+
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
340
340
|
snapctl byogs build $byogs_sid --tag $image_tag --path $code_root_path
|
|
341
341
|
```
|
|
342
342
|
|
|
@@ -356,7 +356,7 @@ snapctl byogs push --help
|
|
|
356
356
|
snapctl byogs push $byogs_sid --tag $image_tag
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
#### 5. byogs publish-image
|
|
359
|
+
#### 5. [Deprecated soon] byogs publish-image
|
|
360
360
|
|
|
361
361
|
Publish your custom game server image. This command executes, `build` and `push` one after the other.
|
|
362
362
|
|
|
@@ -369,11 +369,11 @@ snapctl byogs publish-image --help
|
|
|
369
369
|
# $image_tag = An image tag for your snap
|
|
370
370
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
371
371
|
# Example:
|
|
372
|
-
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
372
|
+
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
373
373
|
snapctl byogs publish-image $byogs_sid --tag $image_tag --path $code_root_path
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
-
#### 6. byogs publish-version
|
|
376
|
+
#### 6. [Deprecated soon] byogs publish-version
|
|
377
377
|
|
|
378
378
|
Publish a new version for your game server. Only after your game server version is published, you will be able
|
|
379
379
|
to use it in your Snapend fleet. This command should be run after you `push` or `publish-image` commands.
|
|
@@ -393,6 +393,24 @@ snapctl byogs publish-version --help
|
|
|
393
393
|
snapctl byogs publish-version $byogs_sid --tag $image_tag --prefix $prefix --version $version --http-port $ingress_port
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
+
#### 7. [New] byogs publish
|
|
397
|
+
|
|
398
|
+
Publish your custom game server image. This commend replaces the old way of creating, publishing image and
|
|
399
|
+
then publishing the byogs. Now all you have to do is publish your image and create a fleet using the web portal.
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
# Help for the byogs command
|
|
403
|
+
snapctl byogs publish --help
|
|
404
|
+
|
|
405
|
+
# Publish a new image
|
|
406
|
+
# $image_tag = An image tag for your snap
|
|
407
|
+
# $code_root_path = Local code path where your Dockerfile is present
|
|
408
|
+
# Example:
|
|
409
|
+
# snapctl byogs publish --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
410
|
+
snapctl byogs publish --tag $image_tag --path $code_root_path
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
|
|
396
414
|
### Game
|
|
397
415
|
|
|
398
416
|
#### 1. snapend help
|
|
@@ -443,10 +461,14 @@ snapctl snapend download --help
|
|
|
443
461
|
# snapend-manifest(yaml, json)
|
|
444
462
|
# client-sdk(unity, unreal, roblox, godot, cocos, ios-objc, ios-swift, android-java, android-kotlin, web-ts, web-js),
|
|
445
463
|
# server-sdk(csharp, cpp, lua, ts, go, python, kotlin, java, c, node, js, perl, php, closure, ruby, rust),
|
|
446
|
-
# protos(go, csharp, cpp,
|
|
464
|
+
# protos(go, csharp, cpp, raw)
|
|
465
|
+
# $protos-category = messages or services (only with --type protos)
|
|
466
|
+
# $auth-type = user or app (only with --type server-sdk)
|
|
447
467
|
# Example:
|
|
448
468
|
# snapctl snapend download gx5x6bc0 --category snapend-manifest --type yaml
|
|
449
469
|
# snapctl snapend download gx5x6bc0 --category client-sdk --type unity
|
|
470
|
+
# snapctl snapend download gx5x6bc0 --category server-sdk --type unity --auth-type app
|
|
471
|
+
# snapctl snapend download gx5x6bc0 --category protos --type raw --protos-category messages
|
|
450
472
|
snapctl snapend download $snapend_id --category $category --type $type
|
|
451
473
|
```
|
|
452
474
|
|
|
@@ -455,10 +477,10 @@ snapctl snapend download $snapend_id --category $category --type $type
|
|
|
455
477
|
Clone a Snapend from an existing manifest. Passing the blocking flag ensures your CLI command waits till the new Snapend is up.
|
|
456
478
|
|
|
457
479
|
```
|
|
458
|
-
# Help for the
|
|
480
|
+
# Help for the clone command
|
|
459
481
|
snapctl snapend clone --help
|
|
460
482
|
|
|
461
|
-
#
|
|
483
|
+
# Clone your Snapend
|
|
462
484
|
# $gameId = Game Id
|
|
463
485
|
# $snapendName = Name of your new Snapend
|
|
464
486
|
# $env = One of development, staging
|
|
@@ -475,10 +497,10 @@ Apply changes to your Snapend from a manifest. You should have the latest manife
|
|
|
475
497
|
a user stomping over someone elses changes. Passing the blocking flag ensures your CLI command waits till the update is complete.
|
|
476
498
|
|
|
477
499
|
```
|
|
478
|
-
# Help for the
|
|
500
|
+
# Help for the apply command
|
|
479
501
|
snapctl snapend apply --help
|
|
480
502
|
|
|
481
|
-
#
|
|
503
|
+
# Apply changes to a snapend via manifest
|
|
482
504
|
# $pathToManifest = Path to the manifest file; should include the file name
|
|
483
505
|
# Example:
|
|
484
506
|
# snapctl snapend apply --manifest-path "C:\Users\name\Downloads\snapser-ox1bcyim-manifest.json" --blocking
|
|
@@ -502,7 +524,7 @@ snapctl snapend update --help
|
|
|
502
524
|
# Note at least one of the two needs to be present
|
|
503
525
|
# Example:
|
|
504
526
|
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs byogs-fleet-one:gs-1:v0.0.1,my-fleet-two:gs-2:v0.0.4
|
|
505
|
-
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs
|
|
527
|
+
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs fleet-one:v0.0.1,fleet-two:v0.0.4 --blocking
|
|
506
528
|
snapctl snapend update $snapend_id --byosnaps $byosnaps --byogs $byogs --blocking
|
|
507
529
|
```
|
|
508
530
|
|
|
@@ -285,7 +285,7 @@ See all the supported commands
|
|
|
285
285
|
snapctl byogs --help
|
|
286
286
|
```
|
|
287
287
|
|
|
288
|
-
#### 2. byogs create
|
|
288
|
+
#### 2. [Deprecated soon] byogs create
|
|
289
289
|
|
|
290
290
|
Create a custom game server. Note that you will have to build, push and publish your game server image, for it to be useable
|
|
291
291
|
in a Snapend fleet.
|
|
@@ -319,7 +319,7 @@ snapctl byogs build --help
|
|
|
319
319
|
# $image_tag = An image tag for your snap
|
|
320
320
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
321
321
|
# Example:
|
|
322
|
-
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
322
|
+
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
323
323
|
snapctl byogs build $byogs_sid --tag $image_tag --path $code_root_path
|
|
324
324
|
```
|
|
325
325
|
|
|
@@ -339,7 +339,7 @@ snapctl byogs push --help
|
|
|
339
339
|
snapctl byogs push $byogs_sid --tag $image_tag
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
#### 5. byogs publish-image
|
|
342
|
+
#### 5. [Deprecated soon] byogs publish-image
|
|
343
343
|
|
|
344
344
|
Publish your custom game server image. This command executes, `build` and `push` one after the other.
|
|
345
345
|
|
|
@@ -352,11 +352,11 @@ snapctl byogs publish-image --help
|
|
|
352
352
|
# $image_tag = An image tag for your snap
|
|
353
353
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
354
354
|
# Example:
|
|
355
|
-
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
355
|
+
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
356
356
|
snapctl byogs publish-image $byogs_sid --tag $image_tag --path $code_root_path
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
#### 6. byogs publish-version
|
|
359
|
+
#### 6. [Deprecated soon] byogs publish-version
|
|
360
360
|
|
|
361
361
|
Publish a new version for your game server. Only after your game server version is published, you will be able
|
|
362
362
|
to use it in your Snapend fleet. This command should be run after you `push` or `publish-image` commands.
|
|
@@ -376,6 +376,24 @@ snapctl byogs publish-version --help
|
|
|
376
376
|
snapctl byogs publish-version $byogs_sid --tag $image_tag --prefix $prefix --version $version --http-port $ingress_port
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
+
#### 7. [New] byogs publish
|
|
380
|
+
|
|
381
|
+
Publish your custom game server image. This commend replaces the old way of creating, publishing image and
|
|
382
|
+
then publishing the byogs. Now all you have to do is publish your image and create a fleet using the web portal.
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
# Help for the byogs command
|
|
386
|
+
snapctl byogs publish --help
|
|
387
|
+
|
|
388
|
+
# Publish a new image
|
|
389
|
+
# $image_tag = An image tag for your snap
|
|
390
|
+
# $code_root_path = Local code path where your Dockerfile is present
|
|
391
|
+
# Example:
|
|
392
|
+
# snapctl byogs publish --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
393
|
+
snapctl byogs publish --tag $image_tag --path $code_root_path
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
|
|
379
397
|
### Game
|
|
380
398
|
|
|
381
399
|
#### 1. snapend help
|
|
@@ -426,10 +444,14 @@ snapctl snapend download --help
|
|
|
426
444
|
# snapend-manifest(yaml, json)
|
|
427
445
|
# client-sdk(unity, unreal, roblox, godot, cocos, ios-objc, ios-swift, android-java, android-kotlin, web-ts, web-js),
|
|
428
446
|
# server-sdk(csharp, cpp, lua, ts, go, python, kotlin, java, c, node, js, perl, php, closure, ruby, rust),
|
|
429
|
-
# protos(go, csharp, cpp,
|
|
447
|
+
# protos(go, csharp, cpp, raw)
|
|
448
|
+
# $protos-category = messages or services (only with --type protos)
|
|
449
|
+
# $auth-type = user or app (only with --type server-sdk)
|
|
430
450
|
# Example:
|
|
431
451
|
# snapctl snapend download gx5x6bc0 --category snapend-manifest --type yaml
|
|
432
452
|
# snapctl snapend download gx5x6bc0 --category client-sdk --type unity
|
|
453
|
+
# snapctl snapend download gx5x6bc0 --category server-sdk --type unity --auth-type app
|
|
454
|
+
# snapctl snapend download gx5x6bc0 --category protos --type raw --protos-category messages
|
|
433
455
|
snapctl snapend download $snapend_id --category $category --type $type
|
|
434
456
|
```
|
|
435
457
|
|
|
@@ -438,10 +460,10 @@ snapctl snapend download $snapend_id --category $category --type $type
|
|
|
438
460
|
Clone a Snapend from an existing manifest. Passing the blocking flag ensures your CLI command waits till the new Snapend is up.
|
|
439
461
|
|
|
440
462
|
```
|
|
441
|
-
# Help for the
|
|
463
|
+
# Help for the clone command
|
|
442
464
|
snapctl snapend clone --help
|
|
443
465
|
|
|
444
|
-
#
|
|
466
|
+
# Clone your Snapend
|
|
445
467
|
# $gameId = Game Id
|
|
446
468
|
# $snapendName = Name of your new Snapend
|
|
447
469
|
# $env = One of development, staging
|
|
@@ -458,10 +480,10 @@ Apply changes to your Snapend from a manifest. You should have the latest manife
|
|
|
458
480
|
a user stomping over someone elses changes. Passing the blocking flag ensures your CLI command waits till the update is complete.
|
|
459
481
|
|
|
460
482
|
```
|
|
461
|
-
# Help for the
|
|
483
|
+
# Help for the apply command
|
|
462
484
|
snapctl snapend apply --help
|
|
463
485
|
|
|
464
|
-
#
|
|
486
|
+
# Apply changes to a snapend via manifest
|
|
465
487
|
# $pathToManifest = Path to the manifest file; should include the file name
|
|
466
488
|
# Example:
|
|
467
489
|
# snapctl snapend apply --manifest-path "C:\Users\name\Downloads\snapser-ox1bcyim-manifest.json" --blocking
|
|
@@ -485,7 +507,7 @@ snapctl snapend update --help
|
|
|
485
507
|
# Note at least one of the two needs to be present
|
|
486
508
|
# Example:
|
|
487
509
|
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs byogs-fleet-one:gs-1:v0.0.1,my-fleet-two:gs-2:v0.0.4
|
|
488
|
-
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs
|
|
510
|
+
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs fleet-one:v0.0.1,fleet-two:v0.0.4 --blocking
|
|
489
511
|
snapctl snapend update $snapend_id --byosnaps $byosnaps --byogs $byogs --blocking
|
|
490
512
|
```
|
|
491
513
|
|
|
@@ -24,10 +24,11 @@ class ByoGs:
|
|
|
24
24
|
"""
|
|
25
25
|
BYOGS CLI commands
|
|
26
26
|
"""
|
|
27
|
-
|
|
27
|
+
SID = 'byogs'
|
|
28
28
|
SUBCOMMANDS = [
|
|
29
29
|
'build', 'push',
|
|
30
30
|
'create', 'publish-image', 'publish-version',
|
|
31
|
+
'publish'
|
|
31
32
|
]
|
|
32
33
|
PLATFORMS = ['linux/amd64']
|
|
33
34
|
LANGUAGES = ['go', 'python', 'ruby', 'c#', 'c++', 'rust', 'java', 'node']
|
|
@@ -45,15 +46,17 @@ class ByoGs:
|
|
|
45
46
|
self.base_url: str = base_url
|
|
46
47
|
self.api_key: str = api_key
|
|
47
48
|
self.sid: str = sid
|
|
49
|
+
if subcommand == 'publish':
|
|
50
|
+
self.sid = ByoGs.SID
|
|
48
51
|
self.name: str = name
|
|
49
52
|
self.desc: str = desc
|
|
50
53
|
self.platform_type: str = platform_type
|
|
51
54
|
self.language: str = language
|
|
55
|
+
self.token: Union[str, None] = None
|
|
52
56
|
if subcommand != 'create':
|
|
53
57
|
self.token: Union[str, None] = get_composite_token(
|
|
54
|
-
base_url, api_key, 'byogs', {'service_id': sid}
|
|
55
|
-
|
|
56
|
-
self.token: Union[str, None] = None
|
|
58
|
+
base_url, api_key, 'byogs', {'service_id': self.sid}
|
|
59
|
+
)
|
|
57
60
|
self.token_parts: Union[list, None] = ByoGs._get_token_values(
|
|
58
61
|
self.token) if self.token is not None else None
|
|
59
62
|
self.input_tag: Union[str, None] = input_tag
|
|
@@ -269,10 +272,10 @@ class ByoGs:
|
|
|
269
272
|
response['msg'] = f"Invalid command. Valid commands are {', '.join(ByoGs.SUBCOMMANDS)}."
|
|
270
273
|
return response
|
|
271
274
|
# Validate the SID
|
|
272
|
-
if not self.sid.startswith(ByoGs.
|
|
275
|
+
if not self.sid.startswith(ByoGs.SID):
|
|
273
276
|
response['msg'] = (
|
|
274
277
|
"Invalid Game Server ID. Valid Game Server IDs start "
|
|
275
|
-
f"with {ByoGs.
|
|
278
|
+
f"with {ByoGs.SID}."
|
|
276
279
|
)
|
|
277
280
|
return response
|
|
278
281
|
if len(self.sid) > ByoGs.SID_CHARACTER_LIMIT:
|
|
@@ -310,7 +313,7 @@ class ByoGs:
|
|
|
310
313
|
f"{ByoGs.TAG_CHARACTER_LIMIT} characters"
|
|
311
314
|
)
|
|
312
315
|
return response
|
|
313
|
-
if self.subcommand
|
|
316
|
+
if self.subcommand in ['build', 'publish-image', 'publish']:
|
|
314
317
|
if not self.input_tag:
|
|
315
318
|
response['msg'] = "Missing required parameter: tag"
|
|
316
319
|
return response
|
|
@@ -430,6 +433,21 @@ class ByoGs:
|
|
|
430
433
|
return False
|
|
431
434
|
return True
|
|
432
435
|
|
|
436
|
+
def publish(self) -> bool:
|
|
437
|
+
"""
|
|
438
|
+
Publish the image
|
|
439
|
+
1. Check Dependencies
|
|
440
|
+
2. Login to Snapser Registry
|
|
441
|
+
3. Build your snap
|
|
442
|
+
4. Tag the repo
|
|
443
|
+
5. Push the image
|
|
444
|
+
6. Upload swagger.json
|
|
445
|
+
"""
|
|
446
|
+
if not self._check_dependencies() or not self._docker_login() or \
|
|
447
|
+
not self._docker_build() or not self._docker_tag() or not self._docker_push():
|
|
448
|
+
return False
|
|
449
|
+
return True
|
|
450
|
+
|
|
433
451
|
def publish_version(self) -> bool:
|
|
434
452
|
"""
|
|
435
453
|
Publish your game server version
|
|
@@ -30,6 +30,7 @@ class Snapend:
|
|
|
30
30
|
'client-sdk', 'server-sdk', 'protos', 'admin-settings', 'snapend-manifest'
|
|
31
31
|
]
|
|
32
32
|
DOWNLOAD_TYPE_NOT_REQUIRED = ['admin-settings']
|
|
33
|
+
PROTOS_CATEGORY = ['messages', 'services']
|
|
33
34
|
AUTH_TYPES = ['user', 'app']
|
|
34
35
|
ENV_TYPES = ['DEVELOPMENT', 'STAGING']
|
|
35
36
|
BLOCKING_CALL_SLEEP = 5
|
|
@@ -45,7 +46,7 @@ class Snapend:
|
|
|
45
46
|
# Clone, Apply, Promote
|
|
46
47
|
manifest_path: str | None,
|
|
47
48
|
# Download
|
|
48
|
-
category: str, platform_type: str, auth_type: str, snaps: str | None,
|
|
49
|
+
category: str, platform_type: str, protos_category: str, auth_type: str, snaps: str | None,
|
|
49
50
|
# Clone, Apply, Promote, Download
|
|
50
51
|
out_path: str | None,
|
|
51
52
|
# Update
|
|
@@ -66,6 +67,7 @@ class Snapend:
|
|
|
66
67
|
self.download_types: Union[
|
|
67
68
|
dict[str, dict[str, str]], None
|
|
68
69
|
] = Snapend._make_download_type(category)
|
|
70
|
+
self.protos_category: str = protos_category
|
|
69
71
|
self.auth_type: str = auth_type
|
|
70
72
|
self.platform_type: str = platform_type
|
|
71
73
|
self.out_path: str | None = out_path
|
|
@@ -115,12 +117,11 @@ class Snapend:
|
|
|
115
117
|
byogs_list = []
|
|
116
118
|
for byog in byogs.split(','):
|
|
117
119
|
byog = byog.strip()
|
|
118
|
-
if len(byog.split(':')) !=
|
|
120
|
+
if len(byog.split(':')) != 2:
|
|
119
121
|
return []
|
|
120
122
|
byogs_list.append({
|
|
121
123
|
'fleet_name': byog.split(':')[0],
|
|
122
|
-
'
|
|
123
|
-
'service_version': byog.split(':')[2]
|
|
124
|
+
'image_tag': byog.split(':')[1],
|
|
124
125
|
})
|
|
125
126
|
return byogs_list
|
|
126
127
|
|
|
@@ -179,14 +180,18 @@ class Snapend:
|
|
|
179
180
|
f"download?category={self.category}"
|
|
180
181
|
)
|
|
181
182
|
if self.category not in Snapend.DOWNLOAD_TYPE_NOT_REQUIRED:
|
|
182
|
-
url +=
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if self.category
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
url += f"&type={self.download_types[self.platform_type]['type']}"
|
|
184
|
+
# If Protos, add protos category
|
|
185
|
+
if self.category == 'protos':
|
|
186
|
+
url += f"&subtype={self.protos_category}"
|
|
187
|
+
# If client or server SDK, add sub type and auth type
|
|
188
|
+
if self.category in ['client-sdk', 'server-sdk']:
|
|
189
|
+
url += f"&subtype={self.download_types[self.platform_type]['subtype']}"
|
|
190
|
+
url_auth_type: str = 'user'
|
|
191
|
+
if self.category == 'server-sdk' and self.auth_type == 'app':
|
|
192
|
+
url_auth_type = 'app'
|
|
193
|
+
url += f"&auth_type={url_auth_type}"
|
|
194
|
+
# Customize snaps
|
|
190
195
|
if self.snaps:
|
|
191
196
|
url += f"&snaps={self.snaps}"
|
|
192
197
|
res = requests.get(
|
|
@@ -200,6 +205,11 @@ class Snapend:
|
|
|
200
205
|
f"snapser-{self.snapend_id}-"
|
|
201
206
|
f"manifest.{self.download_types[self.platform_type]['type']}"
|
|
202
207
|
)
|
|
208
|
+
elif self.category == 'protos':
|
|
209
|
+
fn = (
|
|
210
|
+
f"snapser-{self.snapend_id}-{self.category}"
|
|
211
|
+
f"-{self.platform_type}-{self.protos_category}.zip"
|
|
212
|
+
)
|
|
203
213
|
else:
|
|
204
214
|
fn = (
|
|
205
215
|
f"snapser-{self.snapend_id}-{self.category}"
|
|
@@ -292,6 +302,13 @@ class Snapend:
|
|
|
292
302
|
"Please enter a valid path to save your output file"
|
|
293
303
|
)
|
|
294
304
|
return response
|
|
305
|
+
# Check the Protos category
|
|
306
|
+
if self.category == 'protos' and self.protos_category not in Snapend.PROTOS_CATEGORY:
|
|
307
|
+
response['msg'] = (
|
|
308
|
+
"Invalid Protos category. Valid categories are "
|
|
309
|
+
f"{', '.join(Snapend.PROTOS_CATEGORY)}."
|
|
310
|
+
)
|
|
311
|
+
return response
|
|
295
312
|
# Check the auth type
|
|
296
313
|
if self.category == 'server-sdk' and self.auth_type not in Snapend.AUTH_TYPES:
|
|
297
314
|
response['msg'] = (
|
|
@@ -120,10 +120,22 @@ SERVER_SDK_TYPES: dict[str, dict[str, str]] = {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
PROTOS_TYPES: dict[str, dict[str, str]] = {
|
|
123
|
+
'cpp': {
|
|
124
|
+
'type': 'cpp',
|
|
125
|
+
'subtype': '',
|
|
126
|
+
},
|
|
127
|
+
'csharp': {
|
|
128
|
+
'type': 'csharp',
|
|
129
|
+
'subtype': '',
|
|
130
|
+
},
|
|
123
131
|
'go': {
|
|
124
132
|
'type': 'go',
|
|
125
133
|
'subtype': '',
|
|
126
134
|
},
|
|
135
|
+
'raw': {
|
|
136
|
+
'type': 'raw',
|
|
137
|
+
'subtype': '',
|
|
138
|
+
},
|
|
127
139
|
}
|
|
128
140
|
|
|
129
141
|
SNAPEND_MANIFEST_TYPES: dict[str, dict[str, str]] = {
|
|
@@ -319,7 +319,7 @@ def byogs(
|
|
|
319
319
|
..., help="BYOGs Subcommands: " + ", ".join(ByoGs.SUBCOMMANDS) + "."
|
|
320
320
|
),
|
|
321
321
|
sid: str = typer.Argument(
|
|
322
|
-
|
|
322
|
+
ByoGs.SID, help="Game Server Id. Should start with byogs"
|
|
323
323
|
),
|
|
324
324
|
# create
|
|
325
325
|
name: str = typer.Option(
|
|
@@ -338,14 +338,14 @@ def byogs(
|
|
|
338
338
|
help="(req: create) Language of your snap - " + \
|
|
339
339
|
", ".join(ByoGs.LANGUAGES) + "."
|
|
340
340
|
),
|
|
341
|
-
# publish-image and publish-version
|
|
341
|
+
# publish, publish-image and publish-version
|
|
342
342
|
tag: str = typer.Option(
|
|
343
343
|
None, "--tag",
|
|
344
|
-
help="(req: build, push, publish-image and publish-version) Tag for your snap"
|
|
344
|
+
help="(req: build, push, publish, publish-image and publish-version) Tag for your snap"
|
|
345
345
|
),
|
|
346
|
-
# publish-image
|
|
346
|
+
# publish and publish-image
|
|
347
347
|
path: Union[str, None] = typer.Option(
|
|
348
|
-
None, "--path", help="(req: build, publish-image, upload-docs) Path to your snap code"
|
|
348
|
+
None, "--path", help="(req: build, publish, publish-image, upload-docs) Path to your snap code"
|
|
349
349
|
),
|
|
350
350
|
docker_file: str = typer.Option(
|
|
351
351
|
"Dockerfile", help="Dockerfile name to use"
|
|
@@ -468,6 +468,13 @@ def snapend(
|
|
|
468
468
|
", ".join(SNAPEND_MANIFEST_TYPES.keys()) + ")"
|
|
469
469
|
)
|
|
470
470
|
),
|
|
471
|
+
protos_category: str = typer.Option(
|
|
472
|
+
'messages', "--protos-category",
|
|
473
|
+
help=(
|
|
474
|
+
"(optional: download) Only applicable for --category protos --protos-category"
|
|
475
|
+
"Protos-Category: (" + ", ".join(Snapend.PROTOS_CATEGORY) + ")"
|
|
476
|
+
)
|
|
477
|
+
),
|
|
471
478
|
auth_type: str = typer.Option(
|
|
472
479
|
'user', "--auth-type",
|
|
473
480
|
help=(
|
|
@@ -505,7 +512,7 @@ def snapend(
|
|
|
505
512
|
byogs: str = typer.Option(
|
|
506
513
|
None, "--byogs",
|
|
507
514
|
help=(
|
|
508
|
-
"(optional: update) Comma separated list of BYOGs fleet name
|
|
515
|
+
"(optional: update) Comma separated list of BYOGs fleet name:tags. "
|
|
509
516
|
"Eg: fleet-1:service-1:v1.0.0,fleet-2:service-2:v1.0.0"
|
|
510
517
|
)
|
|
511
518
|
),
|
|
@@ -538,7 +545,7 @@ def snapend(
|
|
|
538
545
|
# Apply, Clone
|
|
539
546
|
manifest_path,
|
|
540
547
|
# Download
|
|
541
|
-
category, platform_type, auth_type, snaps,
|
|
548
|
+
category, platform_type, protos_category, auth_type, snaps,
|
|
542
549
|
# Download, Apply and Clone
|
|
543
550
|
out_path,
|
|
544
551
|
# Update
|
|
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
|