Skip to content

Add API spec for team hierarchy APIs #2266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-27 17:12:13.510503",
"spec_repo_commit": "ed439f7c"
"regenerated": "2025-05-27 19:53:23.338372",
"spec_repo_commit": "7131a437"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-27 17:12:13.526776",
"spec_repo_commit": "ed439f7c"
"regenerated": "2025-05-27 19:53:23.356165",
"spec_repo_commit": "7131a437"
}
}
}
180 changes: 180 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,14 @@ components:
type: string
x-enum-varnames:
- BILLING_DIMENSIONS
AddMemberTeamRequest:
description: Request to add a member team to super team's hierarchy
properties:
data:
$ref: '#/components/schemas/MemberTeam'
required:
- data
type: object
Advisory:
description: Advisory.
properties:
Expand Down Expand Up @@ -21003,6 +21011,28 @@ components:
- ms_channel_name
- redirect_url
type: object
MemberTeam:
description: A member team
properties:
id:
description: The member team's identifier
example: aeadc05e-98a8-11ec-ac2c-da7ad0900001
type: string
type:
$ref: '#/components/schemas/MemberTeamType'
required:
- id
- type
type: object
MemberTeamType:
default: member_teams
description: Member team type
enum:
- member_teams
example: member_teams
type: string
x-enum-varnames:
- MEMBER_TEAMS
Metadata:
description: The metadata related to this request.
properties:
Expand Down Expand Up @@ -59781,6 +59811,156 @@ paths:
permissions:
- teams_read
- teams_manage
/api/v2/team/{super_team_id}/member_teams:
get:
description: Get all member teams.
operationId: ListMemberTeams
parameters:
- description: None
in: path
name: super_team_id
required: true
schema:
type: string
- $ref: '#/components/parameters/PageSize'
- $ref: '#/components/parameters/PageNumber'
- description: List of fields that need to be fetched.
explode: false
in: query
name: fields[team]
required: false
schema:
items:
$ref: '#/components/schemas/TeamsField'
type: array
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/TeamsResponse'
description: OK
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: API error response.
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- teams_read
summary: Get all member teams
tags:
- Teams
x-pagination:
limitParam: page[size]
pageParam: page[number]
resultsPath: data
x-permission:
operator: OR
permissions:
- teams_read
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
post:
description: 'Add a member team.

Adds the team given by the `id` in the body as a member team of the super
team.'
operationId: AddMemberTeam
parameters:
- description: None
in: path
name: super_team_id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddMemberTeamRequest'
required: true
responses:
'204':
description: Added
'403':
$ref: '#/components/responses/ForbiddenResponse'
'409':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: API error response.
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- teams_read
summary: Add a member team
tags:
- Teams
x-permission:
operator: OR
permissions:
- teams_read
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/team/{super_team_id}/member_teams/{member_team_id}:
delete:
description: Remove a super team's member team identified by `member_team_id`.
operationId: RemoveMemberTeam
parameters:
- description: None
in: path
name: super_team_id
required: true
schema:
type: string
- description: None
in: path
name: member_team_id
required: true
schema:
type: string
responses:
'204':
description: No Content
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: API error response.
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- teams_read
summary: Remove a member team
tags:
- Teams
x-permission:
operator: OR
permissions:
- teams_read
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/team/{team_id}:
delete:
description: Remove a team using the team's `id`.
Expand Down
28 changes: 28 additions & 0 deletions examples/v2/teams/AddMemberTeam.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Add a member team returns "Added" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.addMemberTeam"] = true;
const apiInstance = new v2.TeamsApi(configuration);

const params: v2.TeamsApiAddMemberTeamRequest = {
body: {
data: {
id: "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
type: "member_teams",
},
},
superTeamId: "super_team_id",
};

apiInstance
.addMemberTeam(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
22 changes: 22 additions & 0 deletions examples/v2/teams/ListMemberTeams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Get all member teams returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listMemberTeams"] = true;
const apiInstance = new v2.TeamsApi(configuration);

const params: v2.TeamsApiListMemberTeamsRequest = {
superTeamId: "super_team_id",
};

apiInstance
.listMemberTeams(params)
.then((data: v2.TeamsResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
25 changes: 25 additions & 0 deletions examples/v2/teams/ListMemberTeams_1662850354.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Get all member teams returns "OK" response with pagination
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listMemberTeams"] = true;
const apiInstance = new v2.TeamsApi(configuration);

const params: v2.TeamsApiListMemberTeamsRequest = {
superTeamId: "super_team_id",
};

(async () => {
try {
for await (const item of apiInstance.listMemberTeamsWithPagination(
params
)) {
console.log(item);
}
} catch (error) {
console.error(error);
}
})();
23 changes: 23 additions & 0 deletions examples/v2/teams/RemoveMemberTeam.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Remove a member team returns "No Content" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.removeMemberTeam"] = true;
const apiInstance = new v2.TeamsApi(configuration);

const params: v2.TeamsApiRemoveMemberTeamRequest = {
superTeamId: "super_team_id",
memberTeamId: "member_team_id",
};

apiInstance
.removeMemberTeam(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
41 changes: 41 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7199,6 +7199,47 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "TeamResponse",
},
"v2.ListMemberTeams": {
"superTeamId": {
"type": "string",
"format": "",
},
"pageSize": {
"type": "number",
"format": "int64",
},
"pageNumber": {
"type": "number",
"format": "int64",
},
"fieldsTeam": {
"type": "Array<TeamsField>",
"format": "",
},
"operationResponseType": "TeamsResponse",
},
"v2.AddMemberTeam": {
"superTeamId": {
"type": "string",
"format": "",
},
"body": {
"type": "AddMemberTeamRequest",
"format": "",
},
"operationResponseType": "void",
},
"v2.RemoveMemberTeam": {
"superTeamId": {
"type": "string",
"format": "",
},
"memberTeamId": {
"type": "string",
"format": "",
},
"operationResponseType": "void",
},
"v2.DeleteTeam": {
"teamId": {
"type": "string",
Expand Down
Loading