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:
@ -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'
|
||||
|
@ -0,0 +1,26 @@
|
||||
get:
|
||||
summary: Returns a list of available asset properties for the given type.
|
||||
description: Returns the list of available properties and their validations for a given asset type.
|
||||
tags:
|
||||
- hs-hosting-asset-props
|
||||
operationId: listAssetTypeProps
|
||||
parameters:
|
||||
- name: assetType
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
$ref: 'hs-hosting-asset-schemas.yaml#/components/schemas/HsHostingAssetType'
|
||||
description: The asset type whose properties are to be returned.
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'hs-hosting-asset-schemas.yaml#/components/schemas/HsHostingAssetProps'
|
||||
"401":
|
||||
$ref: 'error-responses.yaml#/components/responses/Unauthorized'
|
||||
"403":
|
||||
$ref: 'error-responses.yaml#/components/responses/Forbidden'
|
@ -0,0 +1,19 @@
|
||||
get:
|
||||
summary: Returns a list of available asset types.
|
||||
description: Returns the list of asset types to enable an adaptive UI.
|
||||
tags:
|
||||
- hs-hosting-asset-props
|
||||
operationId: listAssetTypes
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
"401":
|
||||
$ref: 'error-responses.yaml#/components/responses/Unauthorized'
|
||||
"403":
|
||||
$ref: 'error-responses.yaml#/components/responses/Forbidden'
|
@ -13,18 +13,20 @@ get:
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
description: The UUID of the debitor, whose hosting assets are to be listed.
|
||||
- name: parentAssetUuid
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
description: The UUID of the parentAsset, whose hosting assets are to be listed.
|
||||
- name: type
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
$ref: 'hs-hosting-asset-schemas.yaml#/components/schemas/HsHostingAssetType'
|
||||
description: The UUID of the debitor, whose hosting assets are to be listed.
|
||||
description: The type of hosting assets to be listed.
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
@ -8,10 +8,18 @@ servers:
|
||||
|
||||
paths:
|
||||
|
||||
# Items
|
||||
# Assets
|
||||
|
||||
/api/hs/hosting/assets:
|
||||
$ref: "hs-hosting-assets.yaml"
|
||||
|
||||
/api/hs/hosting/assets/{assetUuid}:
|
||||
$ref: "hs-hosting-assets-with-uuid.yaml"
|
||||
|
||||
# Asset-Types
|
||||
|
||||
/api/hs/hosting/asset-types:
|
||||
$ref: "hs-hosting-asset-types.yaml"
|
||||
|
||||
/api/hs/hosting/asset-types/{assetType}:
|
||||
$ref: "hs-hosting-asset-types-props.yaml"
|
||||
|
Reference in New Issue
Block a user