From db0927019cd1e5f04de1cc08c864ba4fcbb17034 Mon Sep 17 00:00:00 2001 From: Wei Lim Date: Tue, 12 Nov 2024 13:12:20 -0800 Subject: [PATCH] compose: update schema for alpha (#4539) Update schema.alpha.json for composability. Contributes to #4397, https://github.com/Azure/azure-dev-pr/issues/1682 --- schemas/alpha/azure.yaml.json | 139 ++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/schemas/alpha/azure.yaml.json b/schemas/alpha/azure.yaml.json index f846f3f1f..f1d3016c7 100644 --- a/schemas/alpha/azure.yaml.json +++ b/schemas/alpha/azure.yaml.json @@ -352,6 +352,44 @@ ] } }, + "resources": { + "type": "object", + "additionalProperties": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "title": "Type of resource", + "description": "The type of resource to be created. (Example: db.postgres)", + "enum": [ + "db.postgres", + "db.redis", + "db.mongo", + "ai.openai.model", + "host.containerapp" + ] + }, + "uses": { + "type": "array", + "title": "Other resources that this resource uses", + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "allOf": [ + { "if": { "properties": { "type": { "const": "host.containerapp" }}}, "then": { "$ref": "#/definitions/containerAppResource" } }, + { "if": { "properties": { "type": { "const": "ai.openai.model" }}}, "then": { "$ref": "#/definitions/aiModelResource" } }, + { "if": { "properties": { "type": { "const": "db.postgres" }}}, "then": { "$ref": "#/definitions/resource"} }, + { "if": { "properties": { "type": { "const": "db.redis" }}}, "then": { "$ref": "#/definitions/resource"} }, + { "if": { "properties": { "type": { "const": "db.mongo" }}}, "then": { "$ref": "#/definitions/resource"} } + ] + } + }, "pipeline": { "type": "object", "title": "Definition of continuous integration pipeline", @@ -1159,6 +1197,107 @@ } } } + }, + "resource": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "title": "Type of resource", + "description": "The type of resource to be created. (Example: db.postgres)", + "enum": [ + "db.postgres", + "db.redis", + "db.mongo", + "host.containerapp", + "ai.openai.model" + ] + }, + "uses": { + "type": "array", + "title": "Other resources that this resource uses", + "items": { + "type": "string" + }, + "uniqueItems": true + } + } + }, + "containerAppResource": { + "type": "object", + "description": "A Docker-based container app.", + "additionalProperties": false, + "required": [ + "port" + ], + "properties": { + "type": true, + "uses": true, + "port": { + "type": "integer", + "title": "Port that the container app listens on", + "description": "Optional. The port that the container app listens on. (Default: 80)" + }, + "env": { + "type": "array", + "title": "Environment variables to set for the container app", + "items": { + "type": "object", + "required": [ + "name" + ], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "title": "Name of the environment variable" + }, + "value": { + "type": "string", + "title": "Value of the environment variable. Supports environment variable substitution." + }, + "secret": { + "type": "string", + "title": "Secret value of the environment variable. Supports environment variable substitution." + } + } + } + } + } + }, + "aiModelResource": { + "type": "object", + "description": "A deployed, ready-to-use AI model.", + "additionalProperties": false, + "required": [ + "model" + ], + "properties": { + "type": true, + "uses": true, + "model": { + "type": "object", + "description": "The underlying AI model.", + "additionalProperties": false, + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "type": "string", + "title": "The name of the AI model.", + "description": "Required. The name of the AI model." + }, + "version": { + "type": "string", + "title": "The version of the AI model.", + "description": "Required. The version of the AI model." + } + } + } + } } } } \ No newline at end of file