diff --git a/.github/config/en-custom.txt b/.github/config/en-custom.txt index 456f5447f..adf995edf 100644 --- a/.github/config/en-custom.txt +++ b/.github/config/en-custom.txt @@ -1296,4 +1296,7 @@ DaprConfigurationStoreProperties configurationStores configurationstores Oras -oras \ No newline at end of file +oras +apiVersions +openAPI +zA diff --git a/docs/content/reference/resource-schema/udt/index.md b/docs/content/reference/resource-schema/udt/index.md new file mode 100644 index 000000000..fb16928cf --- /dev/null +++ b/docs/content/reference/resource-schema/udt/index.md @@ -0,0 +1,100 @@ +--- +type: docs +title: "User Defined Resource Type Schema" +linkTitle: "User Defined Resource Type" +description: "Schema reference document for a User defined Resource Type" +categories: "Schema" +weight: 100 +--- + +## Overview + +Radius supports creation of user defined types, which have an user defined schema. +These types can be managed using [rad resource-type](docs/content/reference/cli/rad_resource-type.md) command. + +## Schema Format + +{{< tabs "Resource Manifest" >}} + +{{< codetab >}} + +{{< rad file="snippets/postgres.yaml" embed=true marker="//SAMPLE" >}} + +{{< /codetab >}} + +{{< /tabs >}} + +## Top-level + +Manifest file has below keys at the top level: + +| Key | Required | Description | Example | +|-----|----------|---------|---------| +| **name** | yes | The namespace in which the resource type is registered | `MyCompany.Resources` | +| [**types**](#types) | yes | type names in the specified namespace. The resource type manifest usually has one type that should be registered. | `postgresDatabases` | + +### types + +| Key | Required | Description | Example | +|-----|-------------|---------|-----------| +| [**resource type name**](#resource-type-name) | yes | The namespace in which the resource type is registered | `MyCompany.Resources` | + +## resource type name + +| Key | Required | Description | Example | +|-----|-------------|---------| +| **description** | yes | Description of the resource type | `A postgreSQL database` | +| [**apiVersions**](#apiVersions) | yes | api versions which support this resource type | `2025-01-01-preview` | + +## apiVersions + +| Key | Required |Description | Example | +|-----|-------------|---------| +| [**api version name**](#api-version-name) | yes | a specific api version which supports this resource type | `2025-01-01-preview` | + +## api version name + +| Key | Required | Description | +|-----|-------------|----------| +| [**schema**](#schema) | yes | openAPI v3 structural schema of the resource type in a specific api version. Radius supports a subset of open API capabilities. This is covered in subsequent sections | + +## schema + +`schema` holds the description of the structural schema for new resource type use using [Open API v3](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schema-object) + +| Key | Required | Description | +|-----|-------------|------------| +| **type**| yes | type of `schema`. This is always `object`, representing a open API v3 object | +| [**properties**](#properties)| yes | properties which are valid for a resource of the specified resource type| + +### properties + +| Key | Required | Description | Example | +|-----|-------------|---------|----------| +| [**property name**](#property-name)| yes | A property name. Property names MUST be strings and SHOULD conform to the regular expression: ^[a-zA-Z0-9\.\-_]+$.| logging-verbosity | + +### property name + +| Key | Required | Description | Example | +|-----|-------------|---------|----------| +| **type** | yes | type of the value of property. This can be `integer`, `number`, `string` or `boolean` | `true` | +| **description** | no | description of the property | "The size of database to provision" | + + +#### example + +``` + properties: + host: + type: string + description: hostname + port: + type: integer + description: server listening port + cost: + type: number + description: cost till date + shared: + type: boolean + description: is this resource shared between different applications +``` diff --git a/docs/content/reference/resource-schema/udt/snippets/postgres.yaml b/docs/content/reference/resource-schema/udt/snippets/postgres.yaml new file mode 100644 index 000000000..0247466e0 --- /dev/null +++ b/docs/content/reference/resource-schema/udt/snippets/postgres.yaml @@ -0,0 +1,37 @@ +name: MyCompany.Resources +types: + postgresDatabases: + description: A postgreSQL database + apiVersions: + '2023-10-01-preview': + schema: + type: object + properties: + environment: + type: string + application: + type: string + description: The resource ID of the application. + status: + type: object + properties: + binding: + type: object + properties: + database: + type: string + description: The name of the database. + host: + type: string + description: The host name of the database. + port: + type: string + description: The port number of the database. + username: + type: string + description: The username for the database. + password: + type: string + description: The password for the database. + capabilities: ["SupportsRecipes"] + \ No newline at end of file