Skip to content

Commit e5e5298

Browse files
authored
Merge pull request #596 from meshery/org-team-hard-delete-endpoint
OpenAPI: org team soft-delete via POST action payload
2 parents 5f32af7 + 888ac05 commit e5e5298

File tree

1 file changed

+150
-0
lines changed
  • schemas/constructs/v1beta1/organization

1 file changed

+150
-0
lines changed

schemas/constructs/v1beta1/organization/api.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,77 @@ paths:
2828
"500":
2929
description: Internal server error
3030

31+
/api/identity/orgs/{orgID}/teams/{teamId}:
32+
post:
33+
summary: Add team to organization or soft delete team
34+
description: Adds a team to an organization. If request body contains action=delete, tombstones a team by setting its deleted_at timestamp. The team's organization mapping remains intact.
35+
operationId: AddTeamToOrg
36+
parameters:
37+
- $ref: "#/components/parameters/orgID"
38+
- $ref: "#/components/parameters/teamId"
39+
requestBody:
40+
required: false
41+
content:
42+
application/json:
43+
schema:
44+
$ref: "#/components/schemas/OrgTeamActionPayload"
45+
responses:
46+
"200":
47+
description: Team added to organization or team tombstoned
48+
content:
49+
application/json:
50+
schema:
51+
oneOf:
52+
- $ref: "#/components/schemas/TeamsOrganizationsMappingPage"
53+
- $ref: "#/components/schemas/TeamsPage"
54+
"400":
55+
description: Bad request
56+
"401":
57+
description: Unauthorized
58+
"404":
59+
description: Not found
60+
"500":
61+
description: Internal server error
62+
63+
delete:
64+
summary: Remove team from organization
65+
description: Removes (unassigns) a team from an organization.
66+
operationId: RemoveTeamFromOrg
67+
parameters:
68+
- $ref: "#/components/parameters/orgID"
69+
- $ref: "#/components/parameters/teamId"
70+
responses:
71+
"200":
72+
description: Team removed from organization
73+
content:
74+
application/json:
75+
schema:
76+
$ref: "#/components/schemas/TeamsOrganizationsMappingPage"
77+
"400":
78+
description: Bad request
79+
"401":
80+
description: Unauthorized
81+
"404":
82+
description: Not found
83+
"500":
84+
description: Internal server error
85+
3186
components:
87+
parameters:
88+
orgID:
89+
name: orgID
90+
in: path
91+
required: true
92+
schema:
93+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/organization_id"
94+
95+
teamId:
96+
name: teamId
97+
in: path
98+
required: true
99+
schema:
100+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/team_id"
101+
32102
schemas:
33103
UUID:
34104
$ref: "../../v1alpha1/core/api.yml#/components/schemas/uuid"
@@ -39,6 +109,22 @@ components:
39109
Time:
40110
$ref: "../../v1alpha1/core/api.yml#/components/schemas/Time"
41111

112+
Text:
113+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/Text"
114+
115+
MapObject:
116+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/MapObject"
117+
118+
OrgTeamActionPayload:
119+
type: object
120+
description: Optional action payload for POST on /api/identity/orgs/{orgID}/teams/{teamId}.
121+
properties:
122+
action:
123+
type: string
124+
description: Internal action to perform on the team resource.
125+
enum:
126+
- delete
127+
42128
Location:
43129
type: object
44130
required:
@@ -172,3 +258,67 @@ components:
172258
nullable: true
173259
x-oapi-codegen-extra-tags:
174260
db: "domain"
261+
262+
AvailableTeam:
263+
type: object
264+
properties:
265+
ID:
266+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/general_id"
267+
name:
268+
$ref: "#/components/schemas/Text"
269+
description:
270+
$ref: "#/components/schemas/Text"
271+
owner:
272+
$ref: "#/components/schemas/Text"
273+
metadata:
274+
$ref: "#/components/schemas/MapObject"
275+
created_at:
276+
$ref: "#/components/schemas/Time"
277+
updated_at:
278+
$ref: "#/components/schemas/Time"
279+
deleted_at:
280+
$ref: "#/components/schemas/NullableTime"
281+
282+
TeamsPage:
283+
type: object
284+
properties:
285+
page:
286+
type: integer
287+
page_size:
288+
type: integer
289+
total_count:
290+
type: integer
291+
teams:
292+
type: array
293+
items:
294+
$ref: "#/components/schemas/AvailableTeam"
295+
296+
TeamsOrganizationsMapping:
297+
type: object
298+
properties:
299+
ID:
300+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/general_id"
301+
org_id:
302+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/organization_id"
303+
team_id:
304+
$ref: "../../v1alpha1/core/api.yml#/components/schemas/team_id"
305+
created_at:
306+
$ref: "#/components/schemas/Time"
307+
updated_at:
308+
$ref: "#/components/schemas/Time"
309+
deleted_at:
310+
$ref: "#/components/schemas/NullableTime"
311+
312+
TeamsOrganizationsMappingPage:
313+
type: object
314+
properties:
315+
page:
316+
type: integer
317+
page_size:
318+
type: integer
319+
total_count:
320+
type: integer
321+
teams_organizations_mapping:
322+
type: array
323+
items:
324+
$ref: "#/components/schemas/TeamsOrganizationsMapping"

0 commit comments

Comments
 (0)