Add profile support to /uploads/schedule/
Pass in the name of a profile in the `profile` field, or pass in one-time use settings in the `settings` object.
This commit is contained in:
parent
fd2330c4b7
commit
0eda252d61
@ -193,7 +193,7 @@ def v1_compose_start():
|
|||||||
should look like this. The "upload" object is optional.
|
should look like this. The "upload" object is optional.
|
||||||
|
|
||||||
The upload object can specify either a pre-existing profile to use (as returned by
|
The upload object can specify either a pre-existing profile to use (as returned by
|
||||||
`/uploads/providers` or one-time use settings for the provider.
|
`/uploads/providers`) or one-time use settings for the provider.
|
||||||
|
|
||||||
Example with upload profile::
|
Example with upload profile::
|
||||||
|
|
||||||
@ -575,7 +575,18 @@ def v1_compose_uploads_schedule(compose_uuid):
|
|||||||
|
|
||||||
**POST /api/v1/uploads/schedule/<compose_uuid>**
|
**POST /api/v1/uploads/schedule/<compose_uuid>**
|
||||||
|
|
||||||
Example request::
|
The body can specify either a pre-existing profile to use (as returned by
|
||||||
|
`/uploads/providers`) or one-time use settings for the provider.
|
||||||
|
|
||||||
|
Example with upload profile::
|
||||||
|
|
||||||
|
{
|
||||||
|
"image_name": "My Image",
|
||||||
|
"provider": "azure",
|
||||||
|
"profile": "production-azure-settings"
|
||||||
|
}
|
||||||
|
|
||||||
|
Example with upload settings::
|
||||||
|
|
||||||
{
|
{
|
||||||
"image_name": "My Image",
|
"image_name": "My Image",
|
||||||
@ -610,6 +621,11 @@ def v1_compose_uploads_schedule(compose_uuid):
|
|||||||
try:
|
try:
|
||||||
image_name = parsed["image_name"]
|
image_name = parsed["image_name"]
|
||||||
provider_name = parsed["provider"]
|
provider_name = parsed["provider"]
|
||||||
|
if "profile" in parsed:
|
||||||
|
# Load a specific profile for this provider
|
||||||
|
profile = parsed["profile"]
|
||||||
|
settings = load_settings(api.config["COMPOSER_CFG"]["upload"], provider_name, profile)
|
||||||
|
else:
|
||||||
settings = parsed["settings"]
|
settings = parsed["settings"]
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
error = {"id": UPLOAD_ERROR, "msg": f'Missing parameter {str(e)}!'}
|
error = {"id": UPLOAD_ERROR, "msg": f'Missing parameter {str(e)}!'}
|
||||||
|
Loading…
Reference in New Issue
Block a user