Skip to content

Commit

Permalink
Merge branch 'fix/openapi-sph' into 'develop'
Browse files Browse the repository at this point in the history
fix v2 api

See merge request music-cloud-native/horizon/horizon!670
  • Loading branch information
bysph committed Jan 13, 2023
2 parents a1d3217 + 94c2a8c commit a102229
Show file tree
Hide file tree
Showing 11 changed files with 579 additions and 264 deletions.
169 changes: 96 additions & 73 deletions openapi/v1/restful/accesstoken.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ paths:
content:
application/json:
schema:
$ref: "#/definitions/CreateResourceScopedAccessTokenReq"
$ref: "#/components/schemas/CreateResourceScopedAccessTokenReq"
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/definitions/CreateResourceScopedAccessTokenResp"
type: object
properties:
data:
$ref: "#/components/schemas/CreateResourceScopedAccessTokenResp"
default:
description: Unexpected error
content:
Expand All @@ -55,9 +58,16 @@ paths:
content:
application/json:
schema:
type: array
items:
$ref: "#/definitions/AccessTokenDetailWithRole"
type: object
properties:
data:
type: object
properties:
items:
type: array
$ref: "#/components/schemas/AccessTokenDetailWithRole"
total:
type: integer
default:
description: Unexpected error
content:
Expand All @@ -75,14 +85,17 @@ paths:
content:
application/json:
schema:
$ref: "#/definitions/CreatePersonalAccessTokenReq"
$ref: "#/components/schemas/CreatePersonalAccessTokenReq"
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/definitions/CreatePersonalAccessTokenResp"
type: object
properties:
data:
$ref: "#/components/schemas/CreatePersonalAccessTokenResp"
default:
description: Unexpected error
content:
Expand All @@ -100,9 +113,16 @@ paths:
content:
application/json:
schema:
type: array
items:
$ref: "#/definitions/AccessTokenDetail"
type: object
properties:
data:
type: object
properties:
items:
type: array
$ref: "#/components/schemas/AccessTokenDetail"
total:
type: integer
default:
description: Unexpected error
content:
Expand All @@ -124,68 +144,71 @@ paths:
application/json:
schema:
$ref: "common.yaml#/components/schemas/Error"
definitions:
Role:
type: object
properties:
role:
type: string
enum: ["pe", "owner", "developer", "guest"]
TokenCode:
type: object
properties:
code:
type: string
description: "You could use it to pass authentication when calling the api. When using it, you need to put it in the request header Authorization: Bearer $token for use"
AccessTokenBasicInfo:
type: object
required: [name, expiresAt, role, scopes]
properties:
name:
type: string
description: "name of token"
expiresAt:
type: string
description: "expiration date of token, need to follow the format of 'YYYY-MM-DD' or 'never'"
scopes:
type: array
items:
components:
schemas:
Role:
type: object
properties:
role:
type: string
enum:
[
"applications:read-only",
"applications:read-write",
"clusters:read-only",
"clusters:read-write",
]
description: "permisson scopes"
CreateResourceScopedAccessTokenReq:
allOf:
- $ref: "#/definitions/AccessTokenBasicInfo"
- $ref: "#/definitions/Role"
CreatePersonalAccessTokenReq:
allOf:
- $ref: "#/definitions/AccessTokenBasicInfo"
AccessTokenDetail:
allOf:
- $ref: "#/definitions/AccessTokenBasicInfo"
- type: object
properties:
createdAt:
enum: ["pe", "owner", "developer", "guest"]
TokenCode:
type: object
properties:
code:
type: string
description: "You could use it to pass authentication when calling the api. When using it, you need to put it in the request header Authorization: Bearer $token for use"
AccessTokenBasicInfo:
type: object
required: [name, expiresAt, role, scopes]
properties:
name:
type: string
description: "name of token"
expiresAt:
type: string
description: "expiration date of token, need to follow the format of 'YYYY-MM-DD' or 'never'"
scopes:
type: array
items:
type: string
createdBy:
$ref: "common.yaml#/components/components/User"
id:
type: integer
AccessTokenDetailWithRole:
allOf:
- $ref: "#/definitions/AccessTokenDetail"
- $ref: "#/definitions/Role"
CreatePersonalAccessTokenResp:
allOf:
- $ref: "#/definitions/AccessTokenDetail"
- $ref: "#/definitions/TokenCode"
CreateResourceScopedAccessTokenResp:
allOf:
- $ref: "#/definitions/AccessTokenDetailWithRole"
- $ref: "#/definitions/TokenCode"
enum:
[
"groups:read-only",
"groups:read-write",
"applications:read-only",
"applications:read-write",
"clusters:read-only",
"clusters:read-write",
]
description: "permisson scopes"
CreateResourceScopedAccessTokenReq:
allOf:
- $ref: "#/components/schemas/AccessTokenBasicInfo"
- $ref: "#/components/schemas/Role"
CreatePersonalAccessTokenReq:
allOf:
- $ref: "#/components/schemas/AccessTokenBasicInfo"
AccessTokenDetail:
allOf:
- $ref: "#/components/schemas/AccessTokenBasicInfo"
- type: object
properties:
createdAt:
type: string
createdBy:
$ref: "common.yaml#/components/schemas/User"
id:
type: integer
AccessTokenDetailWithRole:
allOf:
- $ref: "#/components/schemas/AccessTokenDetail"
- $ref: "#/components/schemas/Role"
CreatePersonalAccessTokenResp:
allOf:
- $ref: "#/components/schemas/AccessTokenDetail"
- $ref: "#/components/schemas/TokenCode"
CreateResourceScopedAccessTokenResp:
allOf:
- $ref: "#/components/schemas/AccessTokenDetailWithRole"
- $ref: "#/components/schemas/TokenCode"
38 changes: 21 additions & 17 deletions openapi/v1/restful/event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,24 @@ paths:
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/SupportEvents"
type: object
properties:
data:
$ref: "#/components/schemas/SupportEvents"
example: |
{
"data": {
"applications_created": "New application is created",
"applications_deleted": "Application is deleted",
"applications_transferred": "Application is transferred to another group",
"clusters_builddeployed": "Cluster has completed a build task and triggered a deploy task",
"clusters_created": "New cluster is created",
"clusters_deleted": "Cluster is deleted",
"clusters_deployed": "Cluster has triggered a ",
"clusters_freed": "Cluster has been freed",
"clusters_rollbacked": "Cluster has triggered a rollback task"
}
}
default:
description: Unexpected error
content:
Expand All @@ -31,17 +46,6 @@ components:
schemas:
SupportEvents:
type: object
properties:
applications:
$ref: "#/components/schemas/Actions"
clusters:
$ref: "#/components/schemas/Actions"
Actions:
type: array
items:
type: object
properties:
name:
type: string
description:
type: string
additionalProperties:
type: string
description: "description of scope"
Loading

0 comments on commit a102229

Please sign in to comment.