snapctl 0.22.0__py3-none-any.whl → 0.22.1__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.
- snapctl/commands/byogs.py +239 -195
- snapctl/commands/byosnap.py +251 -160
- snapctl/commands/snapend.py +5 -1
- snapctl/config/constants.py +1 -1
- snapctl/main.py +134 -72
- snapctl/utils/helper.py +6 -3
- {snapctl-0.22.0.dist-info → snapctl-0.22.1.dist-info}/METADATA +111 -22
- {snapctl-0.22.0.dist-info → snapctl-0.22.1.dist-info}/RECORD +10 -10
- {snapctl-0.22.0.dist-info → snapctl-0.22.1.dist-info}/WHEEL +0 -0
- {snapctl-0.22.0.dist-info → snapctl-0.22.1.dist-info}/entry_points.txt +0 -0
snapctl/main.py
CHANGED
|
@@ -22,83 +22,137 @@ app = typer.Typer()
|
|
|
22
22
|
######### HELPER METHODS #########
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def extract_api_key(profile: str | None = None) ->
|
|
25
|
+
def extract_api_key(profile: str | None = None) -> object:
|
|
26
26
|
"""
|
|
27
|
-
Extracts the API Key from the
|
|
27
|
+
Extracts the API Key from the environment variable and if not present from the config file
|
|
28
28
|
"""
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
result = {
|
|
30
|
+
'location': '',
|
|
31
|
+
'value': None
|
|
32
|
+
}
|
|
33
|
+
# Option 1
|
|
34
|
+
env_api_key = os.getenv(API_KEY)
|
|
35
|
+
if env_api_key is not None:
|
|
36
|
+
result['location'] = 'environment-variable'
|
|
37
|
+
result['value'] = env_api_key
|
|
38
|
+
return result
|
|
39
|
+
# Option 2
|
|
40
|
+
config_file_path: str = ''
|
|
41
|
+
encoding: str | None = None
|
|
31
42
|
if platform == 'win32':
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
config.read(os.path.expanduser(CONFIG_FILE_MAC))
|
|
35
|
-
config_profile: str = DEFAULT_PROFILE
|
|
36
|
-
if profile is not None and profile != '' and profile != DEFAULT_PROFILE:
|
|
37
|
-
config_profile = f'profile {profile}'
|
|
38
|
-
info(f"Using Profile from input {profile}")
|
|
43
|
+
config_file_path = os.path.expandvars(CONFIG_FILE_WIN)
|
|
44
|
+
encoding = "utf-8-sig"
|
|
39
45
|
else:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
config_file_path = os.path.expanduser(CONFIG_FILE_MAC)
|
|
47
|
+
if os.path.isfile(config_file_path):
|
|
48
|
+
result['location'] = 'config-file'
|
|
49
|
+
config = configparser.ConfigParser()
|
|
50
|
+
config.read(config_file_path, encoding=encoding)
|
|
51
|
+
config_profile: str = DEFAULT_PROFILE
|
|
52
|
+
if profile is not None and profile != '' and profile != DEFAULT_PROFILE:
|
|
53
|
+
result['location'] = f'config-file:profile:{profile}'
|
|
54
|
+
config_profile = f'profile {profile}'
|
|
55
|
+
info(f"Trying to extract API KEY from from profile {profile}")
|
|
56
|
+
result['value'] = config.get(
|
|
57
|
+
config_profile, API_KEY, fallback=None, raw=True
|
|
58
|
+
)
|
|
59
|
+
return result
|
|
45
60
|
|
|
46
61
|
|
|
47
|
-
def get_base_url(api_key: str) -> str:
|
|
62
|
+
def get_base_url(api_key: str | None) -> str:
|
|
48
63
|
"""
|
|
49
64
|
Returns the base url based on the api_key
|
|
50
65
|
"""
|
|
66
|
+
if api_key is None:
|
|
67
|
+
return ''
|
|
51
68
|
if api_key.startswith('dev_'):
|
|
52
69
|
return END_POINTS['DEV']
|
|
53
70
|
if api_key.startswith('playtest_'):
|
|
54
71
|
return END_POINTS['PLAYTEST']
|
|
55
72
|
return END_POINTS['PROD']
|
|
56
73
|
|
|
74
|
+
|
|
75
|
+
def validate_command_context(
|
|
76
|
+
ctx: typer.Context,
|
|
77
|
+
):
|
|
78
|
+
"""
|
|
79
|
+
Validator to confirm if the context has been set properly
|
|
80
|
+
"""
|
|
81
|
+
if ctx.obj['api_key'] is None or ctx.obj['base_url'] == '':
|
|
82
|
+
error('API Key not found.')
|
|
83
|
+
raise typer.Exit(SNAPCTL_ERROR)
|
|
84
|
+
info(f"Using API Key from {ctx.obj['api_key_location']}")
|
|
85
|
+
|
|
57
86
|
######### CALLBACKS #########
|
|
58
87
|
|
|
59
88
|
|
|
60
|
-
def
|
|
89
|
+
def default_context_callback(ctx: typer.Context):
|
|
61
90
|
"""
|
|
62
|
-
|
|
63
|
-
This
|
|
64
|
-
Then if the command has a --profile override it will apply it
|
|
91
|
+
Common Callback to set the main app context
|
|
92
|
+
This gets called on every command right at the start
|
|
65
93
|
"""
|
|
94
|
+
# info("In default callback")
|
|
66
95
|
# Ensure ctx object is instantiated
|
|
67
96
|
ctx.ensure_object(dict)
|
|
97
|
+
# Extract the api_key
|
|
98
|
+
api_key_obj = extract_api_key()
|
|
99
|
+
ctx.obj['version'] = VERSION
|
|
100
|
+
ctx.obj['api_key'] = api_key_obj['value']
|
|
101
|
+
ctx.obj['api_key_location'] = api_key_obj['location']
|
|
102
|
+
ctx.obj['profile'] = DEFAULT_PROFILE
|
|
103
|
+
ctx.obj['base_url'] = get_base_url(api_key_obj['value'])
|
|
68
104
|
|
|
69
|
-
# If the user has not overridden the profile you can early exit
|
|
70
|
-
# this is because when you come here from `def common` the context
|
|
71
|
-
# setup happens considering the default profile
|
|
72
|
-
# So only if the user has overridden the profile is when we want to run this
|
|
73
|
-
# method again
|
|
74
|
-
if 'profile' in ctx.obj and ctx.obj['profile'] == profile:
|
|
75
|
-
return
|
|
76
105
|
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
def api_key_context_callback(
|
|
107
|
+
ctx: typer.Context,
|
|
108
|
+
api_key: str | None = None
|
|
109
|
+
):
|
|
110
|
+
"""
|
|
111
|
+
Callback to set the context for the api_key
|
|
112
|
+
This gets called only if the user has added a --api-key override
|
|
113
|
+
"""
|
|
79
114
|
if api_key is None:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
else:
|
|
85
|
-
conf_file = os.path.expanduser(CONFIG_FILE_MAC)
|
|
86
|
-
error(
|
|
87
|
-
'Invalid profile. Please check your snap config file '
|
|
88
|
-
f'at {conf_file} and try again.'
|
|
89
|
-
)
|
|
90
|
-
else:
|
|
91
|
-
error(
|
|
92
|
-
'API Key not found. Please generate a new one from the Snapser dashboard.'
|
|
93
|
-
)
|
|
94
|
-
raise typer.Exit(SNAPCTL_ERROR)
|
|
95
|
-
# Set the context
|
|
115
|
+
return None
|
|
116
|
+
# info("In API Key callback")
|
|
117
|
+
# Ensure ctx object is instantiated
|
|
118
|
+
ctx.ensure_object(dict)
|
|
96
119
|
ctx.obj['version'] = VERSION
|
|
97
120
|
ctx.obj['api_key'] = api_key
|
|
98
|
-
ctx.obj['
|
|
121
|
+
ctx.obj['api_key_location'] = 'command-line-argument'
|
|
99
122
|
ctx.obj['base_url'] = get_base_url(api_key)
|
|
100
123
|
|
|
101
124
|
|
|
125
|
+
def profile_context_callback(
|
|
126
|
+
ctx: typer.Context,
|
|
127
|
+
profile: str | None = None
|
|
128
|
+
):
|
|
129
|
+
"""
|
|
130
|
+
Callback to set the context for the profile
|
|
131
|
+
This gets called only if the user has added a --profile override
|
|
132
|
+
"""
|
|
133
|
+
# Its important to early return if user has already entered API Key via command line
|
|
134
|
+
if profile is None or ctx.obj['api_key_location'] == 'command-line-argument':
|
|
135
|
+
return None
|
|
136
|
+
# info("In Profile Callback")
|
|
137
|
+
# Ensure ctx object is instantiated
|
|
138
|
+
ctx.ensure_object(dict)
|
|
139
|
+
api_key_obj = extract_api_key(profile)
|
|
140
|
+
if api_key_obj['value'] is None and profile is not None and profile != '':
|
|
141
|
+
conf_file = ''
|
|
142
|
+
if platform == 'win32':
|
|
143
|
+
conf_file = os.path.expandvars(CONFIG_FILE_WIN)
|
|
144
|
+
else:
|
|
145
|
+
conf_file = os.path.expanduser(CONFIG_FILE_MAC)
|
|
146
|
+
error(
|
|
147
|
+
f'Invalid profile. Please check your snap config file at {conf_file}'
|
|
148
|
+
)
|
|
149
|
+
ctx.obj['version'] = VERSION
|
|
150
|
+
ctx.obj['api_key'] = api_key_obj['value']
|
|
151
|
+
ctx.obj['api_key_location'] = api_key_obj['location']
|
|
152
|
+
ctx.obj['profile'] = profile if profile else DEFAULT_PROFILE
|
|
153
|
+
ctx.obj['base_url'] = get_base_url(api_key_obj['value'])
|
|
154
|
+
|
|
155
|
+
|
|
102
156
|
# Presently in typer this is the only way we can expose the `--version`
|
|
103
157
|
def version_callback(value: bool = True):
|
|
104
158
|
"""
|
|
@@ -116,34 +170,30 @@ def common(
|
|
|
116
170
|
None, "--version",
|
|
117
171
|
help="Get the Snapctl version.",
|
|
118
172
|
callback=version_callback
|
|
119
|
-
)
|
|
173
|
+
),
|
|
120
174
|
):
|
|
121
175
|
"""
|
|
122
176
|
Snapser CLI Tool
|
|
123
177
|
"""
|
|
124
|
-
|
|
125
|
-
# Note this executes only when the user runs a command and not for --help or --version
|
|
126
|
-
if platform == 'win32':
|
|
127
|
-
config_file_path = os.path.expandvars(CONFIG_FILE_WIN)
|
|
128
|
-
else:
|
|
129
|
-
config_file_path = os.path.expanduser(CONFIG_FILE_MAC)
|
|
130
|
-
if not os.path.isfile(config_file_path):
|
|
131
|
-
error(f'Snapser configuration file not found at {config_file_path} ')
|
|
132
|
-
raise typer.Exit(SNAPCTL_ERROR)
|
|
133
|
-
# Set the main context this always sets the default context
|
|
134
|
-
set_context_callback(ctx)
|
|
178
|
+
default_context_callback(ctx)
|
|
135
179
|
|
|
136
180
|
######### TYPER COMMANDS #########
|
|
137
181
|
|
|
138
182
|
|
|
139
183
|
@app.command()
|
|
140
184
|
def validate(
|
|
141
|
-
|
|
142
|
-
|
|
185
|
+
ctx: typer.Context,
|
|
186
|
+
api_key: Union[str, None] = typer.Option(
|
|
187
|
+
None, "--api-key", help="API Key override.", callback=api_key_context_callback
|
|
188
|
+
),
|
|
189
|
+
profile: Union[str, None] = typer.Option(
|
|
190
|
+
None, "--profile", help="Profile to use.", callback=profile_context_callback
|
|
191
|
+
),
|
|
143
192
|
):
|
|
144
193
|
"""
|
|
145
194
|
Validate your Snapctl setup
|
|
146
195
|
"""
|
|
196
|
+
validate_command_context(ctx)
|
|
147
197
|
success("Setup is valid")
|
|
148
198
|
|
|
149
199
|
|
|
@@ -174,11 +224,11 @@ def byosnap(
|
|
|
174
224
|
),
|
|
175
225
|
# publish-image and publish-version
|
|
176
226
|
tag: str = typer.Option(
|
|
177
|
-
None, "--tag", help="(req: publish-image and publish-version) Tag for your snap"
|
|
227
|
+
None, "--tag", help="(req: build, push publish-image and publish-version) Tag for your snap"
|
|
178
228
|
),
|
|
179
229
|
# publish-image
|
|
180
230
|
path: Union[str, None] = typer.Option(
|
|
181
|
-
None, "--path", help="(req: publish-image) Path to your snap code"
|
|
231
|
+
None, "--path", help="(req: build, publish-image) Path to your snap code"
|
|
182
232
|
),
|
|
183
233
|
docker_file: str = typer.Option(
|
|
184
234
|
"Dockerfile", help="Dockerfile name to use"
|
|
@@ -194,16 +244,18 @@ def byosnap(
|
|
|
194
244
|
http_port: Union[str, None] = typer.Option(
|
|
195
245
|
None, "--http-port", help="(req: publish-version) Ingress HTTP port version"
|
|
196
246
|
),
|
|
197
|
-
#
|
|
247
|
+
# overrides
|
|
248
|
+
api_key: Union[str, None] = typer.Option(
|
|
249
|
+
None, "--api-key", help="API Key override.", callback=api_key_context_callback
|
|
250
|
+
),
|
|
198
251
|
profile: Union[str, None] = typer.Option(
|
|
199
|
-
None, "--profile", help="Profile to use.", callback=
|
|
252
|
+
None, "--profile", help="Profile to use.", callback=profile_context_callback
|
|
200
253
|
),
|
|
201
254
|
) -> None:
|
|
202
255
|
"""
|
|
203
256
|
Bring your own snap commands
|
|
204
257
|
"""
|
|
205
|
-
|
|
206
|
-
# ctx.command.name, {'service_id': sid})
|
|
258
|
+
validate_command_context(ctx)
|
|
207
259
|
byosnap_obj: ByoSnap = ByoSnap(
|
|
208
260
|
subcommand, ctx.obj['base_url'], ctx.obj['api_key'], sid,
|
|
209
261
|
name, desc, platform_type, language, tag, path, docker_file,
|
|
@@ -250,11 +302,12 @@ def byogs(
|
|
|
250
302
|
),
|
|
251
303
|
# publish-image and publish-version
|
|
252
304
|
tag: str = typer.Option(
|
|
253
|
-
None, "--tag",
|
|
305
|
+
None, "--tag",
|
|
306
|
+
help="(req: build, push, publish-image and publish-version) Tag for your snap"
|
|
254
307
|
),
|
|
255
308
|
# publish-image
|
|
256
309
|
path: Union[str, None] = typer.Option(
|
|
257
|
-
None, "--path", help="(req: publish-image, upload-docs) Path to your snap code"
|
|
310
|
+
None, "--path", help="(req: build, publish-image, upload-docs) Path to your snap code"
|
|
258
311
|
),
|
|
259
312
|
docker_file: str = typer.Option(
|
|
260
313
|
"Dockerfile", help="Dockerfile name to use"
|
|
@@ -269,14 +322,18 @@ def byogs(
|
|
|
269
322
|
debug_port: Union[str, None] = typer.Option(
|
|
270
323
|
None, "--debug-port", help="(optional: publish-version) Debug HTTP port version"
|
|
271
324
|
),
|
|
272
|
-
#
|
|
325
|
+
# overrides
|
|
326
|
+
api_key: Union[str, None] = typer.Option(
|
|
327
|
+
None, "--api-key", help="API Key override.", callback=api_key_context_callback
|
|
328
|
+
),
|
|
273
329
|
profile: Union[str, None] = typer.Option(
|
|
274
|
-
None, "--profile", help="Profile to use.", callback=
|
|
330
|
+
None, "--profile", help="Profile to use.", callback=profile_context_callback
|
|
275
331
|
),
|
|
276
332
|
) -> None:
|
|
277
333
|
"""
|
|
278
334
|
Bring your own game server commands
|
|
279
335
|
"""
|
|
336
|
+
validate_command_context(ctx)
|
|
280
337
|
byogs_obj: ByoGs = ByoGs(
|
|
281
338
|
subcommand, ctx.obj['base_url'], ctx.obj['api_key'], sid,
|
|
282
339
|
name, desc, platform_type, language, tag, path, docker_file,
|
|
@@ -358,13 +415,18 @@ def snapend(
|
|
|
358
415
|
"before returning."
|
|
359
416
|
)
|
|
360
417
|
),
|
|
418
|
+
# overrides
|
|
419
|
+
api_key: Union[str, None] = typer.Option(
|
|
420
|
+
None, "--api-key", help="API Key override.", callback=api_key_context_callback
|
|
421
|
+
),
|
|
361
422
|
profile: Union[str, None] = typer.Option(
|
|
362
|
-
None, "--profile", help="Profile to use.", callback=
|
|
423
|
+
None, "--profile", help="Profile to use.", callback=profile_context_callback
|
|
363
424
|
),
|
|
364
425
|
) -> None:
|
|
365
426
|
"""
|
|
366
427
|
Snapend commands
|
|
367
428
|
"""
|
|
429
|
+
validate_command_context(ctx)
|
|
368
430
|
snapend_obj: Snapend = Snapend(
|
|
369
431
|
subcommand, ctx.obj['base_url'], ctx.obj['api_key'],
|
|
370
432
|
snapend_id, category, platform_type, auth_type,
|
snapctl/utils/helper.py
CHANGED
|
@@ -8,10 +8,12 @@ from snapctl.config.constants import HTTP_NOT_FOUND, HTTP_FORBIDDEN, HTTP_UNAUTH
|
|
|
8
8
|
from snapctl.utils.echo import error, success
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def get_composite_token(base_url: str, api_key: str, action: str, params: object) -> str:
|
|
11
|
+
def get_composite_token(base_url: str, api_key: str | None, action: str, params: object) -> str:
|
|
12
12
|
"""
|
|
13
13
|
This function exchanges the api_key for a composite token.
|
|
14
14
|
"""
|
|
15
|
+
if not api_key or base_url == '':
|
|
16
|
+
return ''
|
|
15
17
|
# Exchange the api_key for a token
|
|
16
18
|
payload: object = {
|
|
17
19
|
'action': action,
|
|
@@ -23,8 +25,9 @@ def get_composite_token(base_url: str, api_key: str, action: str, params: object
|
|
|
23
25
|
if res.status_code == HTTP_NOT_FOUND:
|
|
24
26
|
error('Service ID is invalid.')
|
|
25
27
|
elif res.status_code == HTTP_UNAUTHORIZED:
|
|
26
|
-
error(
|
|
27
|
-
|
|
28
|
+
error(
|
|
29
|
+
'API Key verification failed. Your API Key is either invalid or may have expired. '
|
|
30
|
+
)
|
|
28
31
|
elif res.status_code == HTTP_FORBIDDEN:
|
|
29
32
|
error(
|
|
30
33
|
'Permission denied. Your role has been revoked. Please contact your administrator.')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: snapctl
|
|
3
|
-
Version: 0.22.
|
|
3
|
+
Version: 0.22.1
|
|
4
4
|
Summary: Snapser CLI Tool
|
|
5
5
|
Author: Ajinkya Apte
|
|
6
6
|
Author-email: aj@snapser.com
|
|
@@ -81,8 +81,26 @@ You can generate up to 3 API Keys per user account.
|
|
|
81
81
|
|
|
82
82
|
### Setup a local config
|
|
83
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
|
+
|
|
84
101
|
Create a file named `~/.snapser/config`. Open it using the editor of your choice and replace with your
|
|
85
|
-
personal Snapser Access key. Save the file.
|
|
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.
|
|
86
104
|
|
|
87
105
|
```
|
|
88
106
|
[default]
|
|
@@ -165,7 +183,8 @@ snapctl byosnap --help
|
|
|
165
183
|
|
|
166
184
|
#### 2. byosnap create
|
|
167
185
|
|
|
168
|
-
|
|
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.
|
|
169
188
|
|
|
170
189
|
```
|
|
171
190
|
# Help for the byosnap command
|
|
@@ -183,45 +202,42 @@ snapctl byosnap create --help
|
|
|
183
202
|
snapctl byosnap create $byosnap_sid --name "$name" --desc "$desc" --platform "$platform" --language "$language"
|
|
184
203
|
```
|
|
185
204
|
|
|
186
|
-
|
|
205
|
+
### 3. byosnap build
|
|
187
206
|
|
|
188
|
-
|
|
207
|
+
Build your snap image
|
|
189
208
|
|
|
190
209
|
```
|
|
191
210
|
# Help for the byosnap command
|
|
192
|
-
snapctl byosnap
|
|
211
|
+
snapctl byosnap build --help
|
|
193
212
|
|
|
194
213
|
# Publish a new image
|
|
195
214
|
# $byosnap_sid = Snap ID for your snap
|
|
196
215
|
# $image_tag = An image tag for your snap
|
|
197
216
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
198
217
|
# Example:
|
|
199
|
-
# snapctl byosnap
|
|
200
|
-
snapctl byosnap
|
|
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
|
|
201
220
|
```
|
|
202
221
|
|
|
203
|
-
|
|
222
|
+
### 4. byosnap push
|
|
204
223
|
|
|
205
|
-
|
|
224
|
+
Push your snap image to Snapser
|
|
206
225
|
|
|
207
226
|
```
|
|
208
227
|
# Help for the byosnap command
|
|
209
|
-
snapctl byosnap
|
|
228
|
+
snapctl byosnap push --help
|
|
210
229
|
|
|
211
230
|
# Publish a new image
|
|
212
231
|
# $byosnap_sid = Snap ID for your snap
|
|
213
232
|
# $image_tag = An image tag for your snap
|
|
214
|
-
# $prefix = Prefix for your snap Eg: /v1
|
|
215
|
-
# $version = Semantic version for your snap Eg: v0.0.1
|
|
216
|
-
# $ingress_port = Ingress port for your snap Eg: 5003
|
|
217
233
|
# Example:
|
|
218
|
-
# snapctl byosnap
|
|
219
|
-
snapctl byosnap
|
|
234
|
+
# snapctl byosnap push byosnap-jinks-flask --tag my-first-image
|
|
235
|
+
snapctl byosnap push $byosnap_sid --tag $image_tag
|
|
220
236
|
```
|
|
221
237
|
|
|
222
238
|
#### 5. byosnap upload-docs
|
|
223
239
|
|
|
224
|
-
|
|
240
|
+
Upload swagger.json and README.md for you Snap
|
|
225
241
|
|
|
226
242
|
```
|
|
227
243
|
# Help for the byogs command
|
|
@@ -236,6 +252,44 @@ snapctl byosnap upload-docs --help
|
|
|
236
252
|
snapctl byosnap upload-docs $byogs_sid --tag $image_tag --path $code_root_path
|
|
237
253
|
```
|
|
238
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
|
+
|
|
239
293
|
### BYO Game Server - Bring your own Game Server
|
|
240
294
|
|
|
241
295
|
#### 1. byogs help
|
|
@@ -249,7 +303,8 @@ snapctl byogs --help
|
|
|
249
303
|
|
|
250
304
|
#### 2. byogs create
|
|
251
305
|
|
|
252
|
-
|
|
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.
|
|
253
308
|
|
|
254
309
|
```
|
|
255
310
|
# Help for the byosnap command
|
|
@@ -267,9 +322,42 @@ snapctl byogs create --help
|
|
|
267
322
|
snapctl byogs create $byogs_sid --name "$name" --desc "$desc" --platform "$platform" --language "$language"
|
|
268
323
|
```
|
|
269
324
|
|
|
270
|
-
#### 3. byogs
|
|
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
|
|
271
359
|
|
|
272
|
-
|
|
360
|
+
Publish your custom game server image. This command executes, `build` and `push` one after the other.
|
|
273
361
|
|
|
274
362
|
```
|
|
275
363
|
# Help for the byogs command
|
|
@@ -284,9 +372,10 @@ snapctl byogs publish-image --help
|
|
|
284
372
|
snapctl byogs publish-image $byogs_sid --tag $image_tag --path $code_root_path
|
|
285
373
|
```
|
|
286
374
|
|
|
287
|
-
####
|
|
375
|
+
#### 6. byogs publish-version
|
|
288
376
|
|
|
289
|
-
|
|
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.
|
|
290
379
|
|
|
291
380
|
```
|
|
292
381
|
# Help for the byogs command
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
snapctl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
snapctl/__main__.py,sha256=43jKoTk8b85hk_MT6499N3ruHdEfM8WBImd_-3VzjI8,116
|
|
3
3
|
snapctl/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
snapctl/commands/byogs.py,sha256=
|
|
5
|
-
snapctl/commands/byosnap.py,sha256=
|
|
6
|
-
snapctl/commands/snapend.py,sha256=
|
|
4
|
+
snapctl/commands/byogs.py,sha256=hXRyqEYb_k3gdqmbXn1TqHYa0dDp6yOGQIgvxY03OC8,19077
|
|
5
|
+
snapctl/commands/byosnap.py,sha256=Yf9f5Os6vdfHBRVKx_E4IqAGctAtf32QobqUG0fBukw,23033
|
|
6
|
+
snapctl/commands/snapend.py,sha256=fX35lRZwqs2VSyu8XZL4FGrWmWSN6uFIF7L4qraV5K4,11420
|
|
7
7
|
snapctl/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
snapctl/config/constants.py,sha256=
|
|
8
|
+
snapctl/config/constants.py,sha256=t39Rnos-WA2W8MuavMN9AqjJUF2oDL5_18zERAjpavY,469
|
|
9
9
|
snapctl/config/endpoints.py,sha256=7aSu-tWwF4NcSh1eEpNlAa-Cjg2mitBLudSf41Wb47M,241
|
|
10
10
|
snapctl/config/hashes.py,sha256=yf2800SRpq1pr0BrEuj4CndoyZA1i2jrhg7dLRWNp7Y,2696
|
|
11
|
-
snapctl/main.py,sha256=
|
|
11
|
+
snapctl/main.py,sha256=X892XAVwD17kxekPcOLbfV67G-I52fF2AMnxKHyyEw8,15026
|
|
12
12
|
snapctl/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
snapctl/types/definitions.py,sha256=rkRyTBHzeQtCt_uYObgYvL5txnVq8r_n5g4IUAq2FWc,233
|
|
14
14
|
snapctl/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
snapctl/utils/echo.py,sha256=0nhWYDBQTfZGtl8EK21hJhj0now2rQmCT-yYMCKupy4,584
|
|
16
|
-
snapctl/utils/helper.py,sha256=
|
|
17
|
-
snapctl-0.22.
|
|
18
|
-
snapctl-0.22.
|
|
19
|
-
snapctl-0.22.
|
|
20
|
-
snapctl-0.22.
|
|
16
|
+
snapctl/utils/helper.py,sha256=xasSsg-0DgHT-TWejh2IXW-s9AYntO1D2O6Uy6BQLcE,1381
|
|
17
|
+
snapctl-0.22.1.dist-info/METADATA,sha256=EuiYMZTcKw9qw9Jc7mGlW1fsWSHs-ZUGbzIMMa8wNg8,13204
|
|
18
|
+
snapctl-0.22.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
19
|
+
snapctl-0.22.1.dist-info/entry_points.txt,sha256=tkKW9MzmFdRs6Bgkv29G78i9WEBK4WIOWunPfe3t2Wg,44
|
|
20
|
+
snapctl-0.22.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|