horizoncd/horizon

View on GitHub
openapi/v2/restful/member.yaml

Summary

Maintainability
Test Coverage
# Copyright © 2023 Horizoncd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
 
openapi: 3.0.1
info:
title: Horizon-Member-Restful
description: Restful API About Member
version: 2.0.0
servers:
- url: "http://localhost:8080/"
paths:
/apis/core/v2/{resourceType}/{resourceID}/members:
parameters:
- name: resourceType
in: path
description: type of target resource
required: true
schema:
type: string
enum: ["groups", "applications", "clusters", "templates"]
- name: resourceID
in: path
description: id of target resource
required: true
schema:
type: integer
post:
tags:
- member
operationId: createGroupMember
summary: create a group member
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PostMember"
responses:
"200":
description: Success
default:
description: Unexpected error
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/Member"
get:
tags:
- member
operationId: listGroupMember
summary: list a group member
responses:
"200":
description: Succuss
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
items:
$ref: "#/components/schemas/Member"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "common.yaml#/components/schemas/Error"
/apis/core/v2/members/{memberID}:
parameters:
- name: memberID
in: path
description: member id
required: true
schema:
type: integer
put:
tags:
- member
operationId: updateMember
summary: update a member
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PutMember"
responses:
"200":
description: Success
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/Member"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "common.yaml#/components/schemas/Error"
delete:
tags:
- member
operationId: deleteMember
summary: delete a member
responses:
"200":
description: Success
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "common.yaml#/components/schemas/Error"
components:
schemas:
PostMember:
type: object
required: [resourceType, resourceID, memberType, memberNameID, role]
properties:
resourceType:
$ref: "#/components/schemas/PostMember"
resourceID:
$ref: "#/components/schemas/ResourceID"
memberType:
$ref: "#/components/schemas/MemberType"
memberNameID:
$ref: "#/components/schemas/MemberNameID"
role:
$ref: "#/components/schemas/Role"
 
PutMember:
type: object
required: [role]
properties:
role:
$ref: "#/components/schemas/Role"
 
Member:
type: object
properties:
id:
$ref: "#/components/schemas/MemberEntryID"
memberName:
$ref: "#/components/schemas/MemberName"
memberNameID:
$ref: "#/components/schemas/MemberNameID"
memberType:
$ref: "#/components/schemas/MemberType"
resourceID:
$ref: "#/components/schemas/ResourceID"
resourceName:
$ref: "#/components/schemas/ResourceName"
resourcePath:
$ref: "#/components/schemas/ResourcePath"
resourceType:
$ref: "#/components/schemas/ResourceType"
grantTime:
$ref: "common.yaml#/components/schemas/Date"
grantedBy:
$ref: "#/components/schemas/GrantedBy"
grantorName:
$ref: "#/components/schemas/GrantorName"
role:
$ref: "#/components/schemas/Role"
 
MemberEntryID:
type: integer
format: uint64
description: the uniq id of a member entry
MemberName:
type: string
format: uint64
description: the groupname or username
MemberNameID:
type: integer
format: uint64
description: the groupID or userID
MemberType:
type: integer
format: uint8
enum: [0, 1]
description: 0 for user, 1 for group
ResourceID:
type: integer
format: uint64
description: groupID applicationID or clusterID
ResourceName:
type: string
description: groupName, applicationName or clusterName
ResourcePath:
type: string
description: full path of resource
ResourceType:
type: string
enum: ["group", "application", "cluster"]
description: add member to such resource
GrantedBy:
type: integer
format: uint64
description: id of user who grant this member
GrantorName:
type: string
description: name of user who grant this member
Role:
type: string
enum: ["owner", "maintainer", "developer", "reporter", "guest"]
description: the member role