1
0

hosting-asset-validation-for-cloud-server-to-webspace (#54)

Co-authored-by: Michael Hoennig <michael@hoennig.de>
Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/54
Reviewed-by: Marc Sandlus <marc.sandlus@hostsharing.net>
This commit is contained in:
Michael Hoennig
2024-05-06 10:50:59 +02:00
parent 6c25dddcda
commit 2e9e5d6ef0
14 changed files with 750 additions and 18 deletions

View File

@ -80,18 +80,85 @@ components:
# forces generating a java.lang.Object containing a Map, instead of class AssetConfiguration
anyOf:
- type: object
properties:
CPU:
type: integer
minimum: 1
maximum: 16
SSD:
type: integer
minimum: 16
maximum: 4096
HDD:
type: integer
minimum: 16
maximum: 4096
# single source of supported properties just via /api/hs/hosting/asset-types/{assetType}
# TODO.impl: later, we could generate the config types and their properties from the validation config
additionalProperties: true
PropertyDescriptor:
type: object
properties:
"type":
type: string
enum:
- integer
- boolean
- enumeration
"propertyName":
type: string
pattern: "^[ a-zA-Z0-9_-]$"
"required":
type: boolean
required:
- type
- propertyName
- required
IntegerPropertyDescriptor:
allOf:
- $ref: '#/components/schemas/PropertyDescriptor'
- type: object
properties:
"type":
type: string
enum:
- integer
"unit":
type: string
"min":
type: integer
minimum: 0
"max":
type: integer
minimum: 0
"step":
type: integer
minimum: 1
required:
- "type"
- "propertyName"
- "required"
BooleanPropertyDescriptor:
allOf:
- $ref: '#/components/schemas/PropertyDescriptor'
- type: object
properties:
"type":
type: string
enum:
- boolean
"falseIf":
type: object
anyOf:
- type: object
additionalProperties: true
EnumerationPropertyDescriptor:
allOf:
- $ref: '#/components/schemas/PropertyDescriptor'
- type: object
properties:
"type":
type: string
enum:
- enumeration
"values":
type: array
items:
type: string
HsHostingAssetProps:
anyOf:
- $ref: '#/components/schemas/IntegerPropertyDescriptor'
- $ref: '#/components/schemas/BooleanPropertyDescriptor'
- $ref: '#/components/schemas/EnumerationPropertyDescriptor'