snapctl 0.4.5__tar.gz → 0.22.1__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snapctl
3
- Version: 0.4.5
3
+ Version: 0.22.1
4
4
  Summary: Snapser CLI Tool
5
5
  Author: Ajinkya Apte
6
6
  Author-email: aj@snapser.com
@@ -8,6 +8,7 @@ Requires-Python: >=3.10,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
11
12
  Requires-Dist: configparser (>=6.0.0,<7.0.0)
12
13
  Requires-Dist: requests (>=2.28.2,<3.0.0)
13
14
  Requires-Dist: typer[all] (>=0.7.0,<0.8.0)
@@ -16,49 +17,92 @@ Description-Content-Type: text/markdown
16
17
  # Snapser CLI Tool
17
18
 
18
19
  ## Dependencies
19
- The Snapser CLI tool depends on Python 3.X and Pip. MacOS comes pre isntalled with Python. But
20
+
21
+ The Snapser CLI tool depends on Python 3.X and Pip. MacOS comes pre installed with Python. But
20
22
  please make sure you are running Python 3.X. On Windows, you can download Python 3.X from the
21
- Windows store. Some of the commands also need `docker`.
23
+ Windows store. Some of the commands also need docker.
22
24
 
23
25
  ## Installation
26
+
24
27
  Installing PIP on MacOS
25
- ```bash
28
+
29
+ ```
26
30
  curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
27
31
  python3 get-pip.py
28
32
  ```
29
33
 
30
34
  Installing PIP on Windows
31
- ```bash
35
+
36
+ ```
32
37
  curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
33
38
  python get-pip.py
34
39
  ```
35
40
 
36
41
  Once you have Python and Pip installed
37
- ```bash
42
+
43
+ ```
38
44
  pip install --user snapctl
39
45
  ```
40
- If you also have Python 2.X on your machine, you may have to run instead
41
- ```bash
46
+
47
+ If you also have Python 2.X on your machine, you may have to run the following command instead
48
+
49
+ ```
42
50
  pip3 install --user snapctl
43
51
  ```
44
52
 
45
- **Important** Please verify that your python path has been added to $PATH
53
+ <Note>
54
+ After you install snapctl you may have to add the python bin folder to your
55
+ path. For example, on MacOSX this is usually **~/Library/Python/3.9/bin**. On
56
+ Windows this is usually
57
+ **C:\Users\username\AppData\Roaming\Python\Python39\Scripts**.
58
+ </Note>
46
59
 
47
60
  ## Upgrade
61
+
48
62
  Upgrade your snapctl version
49
- ```bash
63
+
64
+ ```
50
65
  pip install --user snapctl --upgrade
51
66
  ```
52
67
 
53
68
  ## Setup
69
+
54
70
  ### Get your Snapser Access Key
55
- Log in to your Snapser account. Click on your user icon on the top right and select, User Settings.
56
- Under developer key tab you will be able to copy your Access Key.
71
+
72
+ Log in to your Snapser account. Click on your user icon on the top right and select, User Account.
73
+ In the left navigation click on **Developer** which will bring up your Personal API Key widget.
74
+ If you have not generated an API Key yet click on the **Generate** button to generate a new key.
75
+ You can generate up to 3 API Keys per user account.
76
+
77
+ <Note>
78
+ Please make sure you save your API key in a safe place. You will not be able
79
+ to see it again.
80
+ </Note>
57
81
 
58
82
  ### Setup a local config
59
- Create a file named `~/.snapser/config`. Open it using the editor of your choice and replace <key> with your
60
- personal Snapser Access key. Save the file.
61
- ```text
83
+
84
+ You have three ways to pass the API key to Snapctl
85
+ 1. Pass it via a command line argument with every command
86
+ 2. Pass it via an environment variable
87
+ 3. Pass it via a config file
88
+
89
+ #### Command line argument
90
+
91
+ Every Snapser command can take a command line argument `--api-key <your_key>`. This will take precedence over
92
+ other methods.
93
+
94
+ #### Environment Variable
95
+
96
+ You can set an Environment variable `SNAPSER_API_KEY=<your_key>` and then run your snapctl commands. This will
97
+ be evaluated after verifying if there is any command line argument.
98
+
99
+ #### Config file
100
+
101
+ Create a file named `~/.snapser/config`. Open it using the editor of your choice and replace with your
102
+ personal Snapser Access key. Save the file. Advantage of using this method is you can use the `--profile`
103
+ argument with your snapctl command to use different API keys.
104
+
105
+ ```
62
106
  [default]
63
107
  snapser_access_key = <key>
64
108
  ```
@@ -66,35 +110,34 @@ snapser_access_key = <key>
66
110
  Or you can run the following command
67
111
 
68
112
  on MacOSX
69
- ```bash {{title: 'MacOSX'}}
113
+
114
+ ```
70
115
  # $your_api_key = Your Snapser developer key
71
116
  echo -e "[default]\nSNAPSER_API_KEY=$your_api_key" > ~/.snapser/config
72
117
  ```
118
+
73
119
  on Windows Powershell
74
- ```bash {{title: 'Windows Powershell'}}
120
+
121
+ ```
75
122
  # $your_api_key = Your Snapser developer key
76
123
  echo "[default]
77
124
  SNAPSER_API_KEY=$your_api_key" | Out-File -encoding utf8 ~\.snapser\config
78
125
  ```
79
126
 
80
-
81
127
  ## Verify Snapctl installation
82
- ```bash
128
+
129
+ ```
83
130
  snapctl --version
84
131
  ```
85
- You should see the latest snapctl version in the output
86
-
87
132
 
88
- ## Supported commands
89
- Run the following to see the list of commands Snapser supports
90
- ```bash
91
- snapctl --help
92
- ```
133
+ You should see the latest snapctl version in the output
93
134
 
94
135
  ## Advanced Setup
136
+
95
137
  Snapser by default supports access to multiple accounts. You can create multiple profiles in your Snapser config
96
- `~/.snapser/config`.
97
- ```text
138
+ **~/.snapser/config**.
139
+
140
+ ```
98
141
  [profile personal]
99
142
  snapser_access_key = <key>
100
143
 
@@ -102,33 +145,48 @@ snapser_access_key = <key>
102
145
  snapser_access_key = <key>
103
146
 
104
147
  ```
148
+
105
149
  You can then set an environment variable telling Snapser which profile you want to use.
106
- ```bash
150
+
151
+ ```
107
152
  # Mac
108
153
  export SNAPSER_PROFILE="my_profile_name";
109
154
 
110
155
  ```
111
- ```bash
156
+
157
+ ```
112
158
  # Windows
113
159
  setx SNAPSER_PROFILE="my_profile_name";
114
160
 
115
161
  ```
116
- Or you can pass `--profile my_profile_name` with every command to tell Snapser to use a particular profile.
117
162
 
163
+ Or you can pass **--profile my_profile_name** with every command to tell Snapser to use a particular profile.
118
164
 
119
165
  ## Commands
120
166
 
167
+ Run the following to see the list of commands Snapser supports
168
+
169
+ ```
170
+ snapctl --help
171
+ ```
172
+
121
173
  ### BYO Snap - Bring your own Snap
174
+
122
175
  #### 1. byosnap help
176
+
123
177
  See all the supported commands
124
- ```bash {{ title: 'Bring your own Snap - Help' }}
178
+
179
+ ```
125
180
  # Help for the byosnap command
126
181
  snapctl byosnap --help
127
182
  ```
128
183
 
129
184
  #### 2. byosnap create
130
- Ability to create a custom snap.
131
- ```bash {{ title: 'Bring your own Snap - Create' }}
185
+
186
+ Create a custom snap. Note that you will have to build, push and publish your snap image, for it to be useable
187
+ in a Snapend.
188
+
189
+ ```
132
190
  # Help for the byosnap command
133
191
  snapctl byosnap create --help
134
192
 
@@ -144,41 +202,44 @@ snapctl byosnap create --help
144
202
  snapctl byosnap create $byosnap_sid --name "$name" --desc "$desc" --platform "$platform" --language "$language"
145
203
  ```
146
204
 
147
- #### 3. byosnap publish-image
148
- Ability to publish a custom snap code image.
149
- ```bash {{ title: 'Bring your own Snap - Publish a new image' }}
205
+ ### 3. byosnap build
206
+
207
+ Build your snap image
208
+
209
+ ```
150
210
  # Help for the byosnap command
151
- snapctl byosnap publish-image --help
211
+ snapctl byosnap build --help
152
212
 
153
213
  # Publish a new image
154
214
  # $byosnap_sid = Snap ID for your snap
155
215
  # $image_tag = An image tag for your snap
156
216
  # $code_root_path = Local code path where your Dockerfile is present
157
217
  # Example:
158
- # snapctl byosnap publish-image byosnap-jinks-flask --tag my-first-image --path /Users/DevName/Development/SnapserEngine/jinks_flask
159
- snapctl byosnap publish-image $byosnap_sid --tag $image_tag --path $code_root_path
218
+ # snapctl byosnap build byosnap-jinks-flask --tag my-first-image --path /Users/DevName/Development/SnapserEngine/jinks_flask
219
+ snapctl byosnap build $byosnap_sid --tag $image_tag --path $code_root_path
160
220
  ```
161
221
 
162
- #### 4. byosnap publish-version
163
- Ability to publish a new version for your Snap.
164
- ```bash {{ title: 'Bring your own Snap - Publish a new version' }}
222
+ ### 4. byosnap push
223
+
224
+ Push your snap image to Snapser
225
+
226
+ ```
165
227
  # Help for the byosnap command
166
- snapctl byosnap publish-version --help
228
+ snapctl byosnap push --help
167
229
 
168
230
  # Publish a new image
169
231
  # $byosnap_sid = Snap ID for your snap
170
232
  # $image_tag = An image tag for your snap
171
- # $prefix = Prefix for your snap Eg: /v1
172
- # $version = Semantic version for your snap Eg: v0.0.1
173
- # $ingress_port = Ingress port for your snap Eg: 5003
174
233
  # Example:
175
- # snapctl byosnap publish-image byosnap-jinks-flask --tag my-first-image --prefix /v1 --version v0.0.1 --http-port 5003
176
- snapctl byosnap publish-version $byosnap_sid --tag $image_tag --prefix $prefix --version $version --http-port $ingress_port
234
+ # snapctl byosnap push byosnap-jinks-flask --tag my-first-image
235
+ snapctl byosnap push $byosnap_sid --tag $image_tag
177
236
  ```
178
237
 
179
238
  #### 5. byosnap upload-docs
180
- Ability to upload swagger.json and README.md for you Snap
181
- ```bash {{ title: 'Bring your own Game Server - Publish a new image' }}
239
+
240
+ Upload swagger.json and README.md for you Snap
241
+
242
+ ```
182
243
  # Help for the byogs command
183
244
  snapctl byosnap upload-docs --help
184
245
 
@@ -191,17 +252,61 @@ snapctl byosnap upload-docs --help
191
252
  snapctl byosnap upload-docs $byogs_sid --tag $image_tag --path $code_root_path
192
253
  ```
193
254
 
255
+ #### 6. byosnap publish-image
256
+
257
+ Publish a custom snap code image. This command executes, `build`, `push` and `upload-docs` one
258
+ after the other.
259
+
260
+ ```
261
+ # Help for the byosnap command
262
+ snapctl byosnap publish-image --help
263
+
264
+ # Publish a new image
265
+ # $byosnap_sid = Snap ID for your snap
266
+ # $image_tag = An image tag for your snap
267
+ # $code_root_path = Local code path where your Dockerfile is present
268
+ # Example:
269
+ # snapctl byosnap publish-image byosnap-jinks-flask --tag my-first-image --path /Users/DevName/Development/SnapserEngine/jinks_flask
270
+ snapctl byosnap publish-image $byosnap_sid --tag $image_tag --path $code_root_path
271
+ ```
272
+
273
+ #### 7. byosnap publish-version
274
+
275
+ Publish a new version for your Snap. Only after your Snap version is published, you will be able
276
+ to use your snap in your Snapend. This command should be run after `push` or `publish-image` commands.
277
+
278
+ ```
279
+ # Help for the byosnap command
280
+ snapctl byosnap publish-version --help
281
+
282
+ # Publish a new image
283
+ # $byosnap_sid = Snap ID for your snap
284
+ # $image_tag = An image tag for your snap
285
+ # $prefix = Prefix for your snap Eg: /v1
286
+ # $version = Semantic version for your snap Eg: v0.0.1
287
+ # $ingress_port = Ingress port for your snap Eg: 5003
288
+ # Example:
289
+ # snapctl byosnap publish-image byosnap-jinks-flask --tag my-first-image --prefix /v1 --version v0.0.1 --http-port 5003
290
+ snapctl byosnap publish-version $byosnap_sid --tag $image_tag --prefix $prefix --version $version --http-port $ingress_port
291
+ ```
292
+
194
293
  ### BYO Game Server - Bring your own Game Server
294
+
195
295
  #### 1. byogs help
296
+
196
297
  See all the supported commands
197
- ```bash {{ title: 'Bring your own Game Server - Help' }}
298
+
299
+ ```
198
300
  # Help for the byogs command
199
301
  snapctl byogs --help
200
302
  ```
201
303
 
202
304
  #### 2. byogs create
203
- Ability to create a custom game server.
204
- ```bash {{ title: 'Bring your own Game Server - Create' }}
305
+
306
+ Create a custom game server. Note that you will have to build, push and publish your game server image, for it to be useable
307
+ in a Snapend fleet.
308
+
309
+ ```
205
310
  # Help for the byosnap command
206
311
  snapctl byogs create --help
207
312
 
@@ -217,9 +322,44 @@ snapctl byogs create --help
217
322
  snapctl byogs create $byogs_sid --name "$name" --desc "$desc" --platform "$platform" --language "$language"
218
323
  ```
219
324
 
220
- #### 3. byogs publish-image
221
- Ability to publish your custom game server image.
222
- ```bash {{ title: 'Bring your own Game Server - Publish a new image' }}
325
+ #### 3. byogs build
326
+
327
+ Build your custom game server image.
328
+
329
+ ```
330
+ # Help for the byogs command
331
+ snapctl byogs build --help
332
+
333
+ # Publish a new image
334
+ # $byogs_sid = Game server ID for your snap
335
+ # $image_tag = An image tag for your snap
336
+ # $code_root_path = Local code path where your Dockerfile is present
337
+ # Example:
338
+ # snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/jinks_flask
339
+ snapctl byogs build $byogs_sid --tag $image_tag --path $code_root_path
340
+ ```
341
+
342
+ #### 4. byogs push
343
+
344
+ Push your custom game server image.
345
+
346
+ ```
347
+ # Help for the byogs command
348
+ snapctl byogs push --help
349
+
350
+ # Publish a new image
351
+ # $byogs_sid = Game server ID for your snap
352
+ # $image_tag = An image tag for your snap
353
+ # Example:
354
+ # snapctl byogs push byosnap-jinks-gs --tag my-first-image
355
+ snapctl byogs push $byogs_sid --tag $image_tag
356
+ ```
357
+
358
+ #### 5. byogs publish-image
359
+
360
+ Publish your custom game server image. This command executes, `build` and `push` one after the other.
361
+
362
+ ```
223
363
  # Help for the byogs command
224
364
  snapctl byogs publish-image --help
225
365
 
@@ -232,9 +372,12 @@ snapctl byogs publish-image --help
232
372
  snapctl byogs publish-image $byogs_sid --tag $image_tag --path $code_root_path
233
373
  ```
234
374
 
235
- #### 4. byogs publish-version
236
- Ability to publish a new version for your Game server.
237
- ```bash {{ title: 'Bring your own Snap - Publish a new version' }}
375
+ #### 6. byogs publish-version
376
+
377
+ Publish a new version for your game server. Only after your game server version is published, you will be able
378
+ to use it in your Snapend fleet. This command should be run after you `push` or `publish-image` commands.
379
+
380
+ ```
238
381
  # Help for the byogs command
239
382
  snapctl byogs publish-version --help
240
383
 
@@ -250,22 +393,27 @@ snapctl byogs publish-version $byogs_sid --tag $image_tag --prefix $prefix --ver
250
393
  ```
251
394
 
252
395
  ### Snapend
396
+
253
397
  #### 1. snapend help
398
+
254
399
  See all the supported commands
255
- ```bash {{ title: 'Snapend - Help' }}
400
+
401
+ ```
256
402
  # Help for the byogs command
257
403
  snapctl snapend --help
258
404
  ```
259
405
 
260
406
  #### 2. Snapend Downloads
407
+
261
408
  Download SDKs and Protos for your Snapend
262
- ```bash {{ title: 'Snapend - Downloads' }}
409
+
410
+ ```
263
411
  # Help for the byogs command
264
412
  snapctl snapend download --help
265
413
 
266
414
  # Download your Snapend SDK and Protos
267
415
  # $snapend_id = Cluster Id
268
- # $category = client-sdk, server-sdk, protos
416
+ # $category = client-sdk, server-sdk, protos, admin-settings
269
417
  # $sdk_type = One of the supported SDK names:
270
418
  # client-sdk(unity, unreal, roblox, godot, cocos, ios-objc, ios-swift, android-java, android-kotlin, web-ts, web-js),
271
419
  # server-sdk(csharp, cpp, lua, ts, go, python, kotlin, java, c, node, js, perl, php, closure, ruby, rust),
@@ -276,8 +424,10 @@ snapctl snapend download $snapend_id --category $category --type $sdk_type
276
424
  ```
277
425
 
278
426
  #### 3. Update Snapend BYOSnap or BYOGs versions
427
+
279
428
  Update your BYOSnap or BYOGs versions for the Snapend
280
- ```bash {{ title: 'Snapend - Update BYOSnap or BYOGs' }}
429
+
430
+ ```
281
431
  # Help for the byogs command
282
432
  snapctl snapend update --help
283
433
 
@@ -286,7 +436,7 @@ snapctl snapend update --help
286
436
  # $byosnaps = Comma separated list of BYOSnap ids and version.
287
437
  # $byogs = Comma separated list of BYOGs fleet name, id and version.
288
438
  # --blocking = (Optional) This makes sure the CLI waits till your Snapend is live.
289
- # Note atleast one of the two needs to be present
439
+ # Note at least one of the two needs to be present
290
440
  # Example:
291
441
  # 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
292
442
  # 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 --blocking
@@ -294,8 +444,10 @@ snapctl snapend update $snapend_id --byosnaps $byosnaps --byogs $byogs --blockin
294
444
  ```
295
445
 
296
446
  #### 4. Get the Snapend state
447
+
297
448
  Get the Snapend state
298
- ```bash {{ title: 'Snapend - Get state' }}
449
+
450
+ ```
299
451
  # Help for the byogs command
300
452
  snapctl snapend state --help
301
453
 
@@ -306,4 +458,3 @@ snapctl snapend state --help
306
458
  snapctl snapend state $snapend_id
307
459
  ```
308
460
 
309
-