fix(api): create service endpoint validation and docs (#7916)
This commit is contained in:
commit
a83e1899be
3 changed files with 22 additions and 192 deletions
|
|
@ -105,98 +105,7 @@ public function services(Request $request)
|
|||
type: 'object',
|
||||
required: ['server_uuid', 'project_uuid', 'environment_name', 'environment_uuid'],
|
||||
properties: [
|
||||
'type' => [
|
||||
'description' => 'The one-click service type',
|
||||
'type' => 'string',
|
||||
'enum' => [
|
||||
'activepieces',
|
||||
'appsmith',
|
||||
'appwrite',
|
||||
'authentik',
|
||||
'babybuddy',
|
||||
'budge',
|
||||
'changedetection',
|
||||
'chatwoot',
|
||||
'classicpress-with-mariadb',
|
||||
'classicpress-with-mysql',
|
||||
'classicpress-without-database',
|
||||
'cloudflared',
|
||||
'code-server',
|
||||
'dashboard',
|
||||
'directus',
|
||||
'directus-with-postgresql',
|
||||
'docker-registry',
|
||||
'docuseal',
|
||||
'docuseal-with-postgres',
|
||||
'dokuwiki',
|
||||
'duplicati',
|
||||
'emby',
|
||||
'embystat',
|
||||
'fider',
|
||||
'filebrowser',
|
||||
'firefly',
|
||||
'formbricks',
|
||||
'ghost',
|
||||
'gitea',
|
||||
'gitea-with-mariadb',
|
||||
'gitea-with-mysql',
|
||||
'gitea-with-postgresql',
|
||||
'glance',
|
||||
'glances',
|
||||
'glitchtip',
|
||||
'grafana',
|
||||
'grafana-with-postgresql',
|
||||
'grocy',
|
||||
'heimdall',
|
||||
'homepage',
|
||||
'jellyfin',
|
||||
'kuzzle',
|
||||
'listmonk',
|
||||
'logto',
|
||||
'mediawiki',
|
||||
'meilisearch',
|
||||
'metabase',
|
||||
'metube',
|
||||
'minio',
|
||||
'moodle',
|
||||
'n8n',
|
||||
'n8n-with-postgresql',
|
||||
'next-image-transformation',
|
||||
'nextcloud',
|
||||
'nocodb',
|
||||
'odoo',
|
||||
'openblocks',
|
||||
'pairdrop',
|
||||
'penpot',
|
||||
'phpmyadmin',
|
||||
'pocketbase',
|
||||
'posthog',
|
||||
'reactive-resume',
|
||||
'rocketchat',
|
||||
'shlink',
|
||||
'slash',
|
||||
'snapdrop',
|
||||
'statusnook',
|
||||
'stirling-pdf',
|
||||
'supabase',
|
||||
'syncthing',
|
||||
'tolgee',
|
||||
'trigger',
|
||||
'trigger-with-external-database',
|
||||
'twenty',
|
||||
'umami',
|
||||
'unleash-with-postgresql',
|
||||
'unleash-without-database',
|
||||
'uptime-kuma',
|
||||
'vaultwarden',
|
||||
'vikunja',
|
||||
'weblate',
|
||||
'whoogle',
|
||||
'wordpress-with-mariadb',
|
||||
'wordpress-with-mysql',
|
||||
'wordpress-without-database',
|
||||
],
|
||||
],
|
||||
'type' => ['description' => 'The one-click service type (e.g. "actualbudget", "calibre-web", "gitea-with-mysql" ...)', 'type' => 'string'],
|
||||
'name' => ['type' => 'string', 'maxLength' => 255, 'description' => 'Name of the service.'],
|
||||
'description' => ['type' => 'string', 'nullable' => true, 'description' => 'Description of the service.'],
|
||||
'project_uuid' => ['type' => 'string', 'description' => 'Project UUID.'],
|
||||
|
|
@ -205,7 +114,7 @@ public function services(Request $request)
|
|||
'server_uuid' => ['type' => 'string', 'description' => 'Server UUID.'],
|
||||
'destination_uuid' => ['type' => 'string', 'description' => 'Destination UUID. Required if server has multiple destinations.'],
|
||||
'instant_deploy' => ['type' => 'boolean', 'default' => false, 'description' => 'Start the service immediately after creation.'],
|
||||
'docker_compose_raw' => ['type' => 'string', 'description' => 'The Docker Compose raw content.'],
|
||||
'docker_compose_raw' => ['type' => 'string', 'description' => 'The base64 encoded Docker Compose content.'],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -283,6 +192,13 @@ public function create_service(Request $request)
|
|||
'errors' => $errors,
|
||||
], 422);
|
||||
}
|
||||
|
||||
if (filled($request->type) && filled($request->docker_compose_raw)) {
|
||||
return response()->json([
|
||||
'message' => 'You cannot provide both service type and docker_compose_raw. Use one or the other.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$environmentUuid = $request->environment_uuid;
|
||||
$environmentName = $request->environment_name;
|
||||
if (blank($environmentUuid) && blank($environmentName)) {
|
||||
|
|
@ -524,8 +440,11 @@ public function create_service(Request $request)
|
|||
'uuid' => $service->uuid,
|
||||
'domains' => $domains,
|
||||
])->setStatusCode(201);
|
||||
} else {
|
||||
return response()->json(['message' => 'No service type or docker_compose_raw provided.'], 400);
|
||||
} elseif (filled($request->type)) {
|
||||
return response()->json([
|
||||
'message' => 'Invalid service type.',
|
||||
'valid_service_types' => $serviceKeys,
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -702,7 +621,7 @@ public function delete_by_uuid(Request $request)
|
|||
'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID.'],
|
||||
'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the service should be deployed instantly.'],
|
||||
'connect_to_docker_network' => ['type' => 'boolean', 'default' => false, 'description' => 'Connect the service to the predefined docker network.'],
|
||||
'docker_compose_raw' => ['type' => 'string', 'description' => 'The Docker Compose raw content.'],
|
||||
'docker_compose_raw' => ['type' => 'string', 'description' => 'The base64 encoded Docker Compose content.'],
|
||||
],
|
||||
)
|
||||
),
|
||||
|
|
|
|||
96
openapi.json
96
openapi.json
|
|
@ -8809,96 +8809,8 @@
|
|||
],
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "The one-click service type",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"activepieces",
|
||||
"appsmith",
|
||||
"appwrite",
|
||||
"authentik",
|
||||
"babybuddy",
|
||||
"budge",
|
||||
"changedetection",
|
||||
"chatwoot",
|
||||
"classicpress-with-mariadb",
|
||||
"classicpress-with-mysql",
|
||||
"classicpress-without-database",
|
||||
"cloudflared",
|
||||
"code-server",
|
||||
"dashboard",
|
||||
"directus",
|
||||
"directus-with-postgresql",
|
||||
"docker-registry",
|
||||
"docuseal",
|
||||
"docuseal-with-postgres",
|
||||
"dokuwiki",
|
||||
"duplicati",
|
||||
"emby",
|
||||
"embystat",
|
||||
"fider",
|
||||
"filebrowser",
|
||||
"firefly",
|
||||
"formbricks",
|
||||
"ghost",
|
||||
"gitea",
|
||||
"gitea-with-mariadb",
|
||||
"gitea-with-mysql",
|
||||
"gitea-with-postgresql",
|
||||
"glance",
|
||||
"glances",
|
||||
"glitchtip",
|
||||
"grafana",
|
||||
"grafana-with-postgresql",
|
||||
"grocy",
|
||||
"heimdall",
|
||||
"homepage",
|
||||
"jellyfin",
|
||||
"kuzzle",
|
||||
"listmonk",
|
||||
"logto",
|
||||
"mediawiki",
|
||||
"meilisearch",
|
||||
"metabase",
|
||||
"metube",
|
||||
"minio",
|
||||
"moodle",
|
||||
"n8n",
|
||||
"n8n-with-postgresql",
|
||||
"next-image-transformation",
|
||||
"nextcloud",
|
||||
"nocodb",
|
||||
"odoo",
|
||||
"openblocks",
|
||||
"pairdrop",
|
||||
"penpot",
|
||||
"phpmyadmin",
|
||||
"pocketbase",
|
||||
"posthog",
|
||||
"reactive-resume",
|
||||
"rocketchat",
|
||||
"shlink",
|
||||
"slash",
|
||||
"snapdrop",
|
||||
"statusnook",
|
||||
"stirling-pdf",
|
||||
"supabase",
|
||||
"syncthing",
|
||||
"tolgee",
|
||||
"trigger",
|
||||
"trigger-with-external-database",
|
||||
"twenty",
|
||||
"umami",
|
||||
"unleash-with-postgresql",
|
||||
"unleash-without-database",
|
||||
"uptime-kuma",
|
||||
"vaultwarden",
|
||||
"vikunja",
|
||||
"weblate",
|
||||
"whoogle",
|
||||
"wordpress-with-mariadb",
|
||||
"wordpress-with-mysql",
|
||||
"wordpress-without-database"
|
||||
]
|
||||
"description": "The one-click service type (e.g. \"actualbudget\", \"calibre-web\", \"gitea-with-mysql\" ...)",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
|
|
@ -8937,7 +8849,7 @@
|
|||
},
|
||||
"docker_compose_raw": {
|
||||
"type": "string",
|
||||
"description": "The Docker Compose raw content."
|
||||
"description": "The base64 encoded Docker Compose content."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
|
|
@ -9187,7 +9099,7 @@
|
|||
},
|
||||
"docker_compose_raw": {
|
||||
"type": "string",
|
||||
"description": "The Docker Compose raw content."
|
||||
"description": "The base64 encoded Docker Compose content."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
|
|
|
|||
|
|
@ -5581,9 +5581,8 @@ paths:
|
|||
- environment_uuid
|
||||
properties:
|
||||
type:
|
||||
description: 'The one-click service type'
|
||||
description: 'The one-click service type (e.g. "actualbudget", "calibre-web", "gitea-with-mysql" ...)'
|
||||
type: string
|
||||
enum: [activepieces, appsmith, appwrite, authentik, babybuddy, budge, changedetection, chatwoot, classicpress-with-mariadb, classicpress-with-mysql, classicpress-without-database, cloudflared, code-server, dashboard, directus, directus-with-postgresql, docker-registry, docuseal, docuseal-with-postgres, dokuwiki, duplicati, emby, embystat, fider, filebrowser, firefly, formbricks, ghost, gitea, gitea-with-mariadb, gitea-with-mysql, gitea-with-postgresql, glance, glances, glitchtip, grafana, grafana-with-postgresql, grocy, heimdall, homepage, jellyfin, kuzzle, listmonk, logto, mediawiki, meilisearch, metabase, metube, minio, moodle, n8n, n8n-with-postgresql, next-image-transformation, nextcloud, nocodb, odoo, openblocks, pairdrop, penpot, phpmyadmin, pocketbase, posthog, reactive-resume, rocketchat, shlink, slash, snapdrop, statusnook, stirling-pdf, supabase, syncthing, tolgee, trigger, trigger-with-external-database, twenty, umami, unleash-with-postgresql, unleash-without-database, uptime-kuma, vaultwarden, vikunja, weblate, whoogle, wordpress-with-mariadb, wordpress-with-mysql, wordpress-without-database]
|
||||
name:
|
||||
type: string
|
||||
maxLength: 255
|
||||
|
|
@ -5613,7 +5612,7 @@ paths:
|
|||
description: 'Start the service immediately after creation.'
|
||||
docker_compose_raw:
|
||||
type: string
|
||||
description: 'The Docker Compose raw content.'
|
||||
description: 'The base64 encoded Docker Compose content.'
|
||||
type: object
|
||||
responses:
|
||||
'201':
|
||||
|
|
@ -5780,7 +5779,7 @@ paths:
|
|||
description: 'Connect the service to the predefined docker network.'
|
||||
docker_compose_raw:
|
||||
type: string
|
||||
description: 'The Docker Compose raw content.'
|
||||
description: 'The base64 encoded Docker Compose content.'
|
||||
type: object
|
||||
responses:
|
||||
'200':
|
||||
|
|
|
|||
Loading…
Reference in a new issue