Skip to content
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
383 changes: 383 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions examples/v2/team-connections/CreateTeamConnections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Create team connections returns "Created" response
*/

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

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

// there is a valid "dd_team" in the system
const DD_TEAM_DATA_ID = process.env.DD_TEAM_DATA_ID as string;

const params: v2.TeamConnectionsApiCreateTeamConnectionsRequest = {
body: {
data: [
{
type: "team_connection",
attributes: {
source: "github",
managedBy: "datadog",
},
relationships: {
team: {
data: {
id: DD_TEAM_DATA_ID,
type: "team",
},
},
connectedTeam: {
data: {
id: "@MyGitHubAccount/my-team-name",
type: "github_team",
},
},
},
},
],
},
};

apiInstance
.createTeamConnections(params)
.then((data: v2.TeamConnectionsResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
29 changes: 29 additions & 0 deletions examples/v2/team-connections/DeleteTeamConnections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Delete team connections returns "No Content" response
*/

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

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

const params: v2.TeamConnectionsApiDeleteTeamConnectionsRequest = {
body: {
data: [
{
id: "12345678-1234-5678-9abc-123456789012",
type: "team_connection",
},
],
},
};

apiInstance
.deleteTeamConnections(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
18 changes: 18 additions & 0 deletions examples/v2/team-connections/ListTeamConnections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* List team connections returns "OK" response
*/

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

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

apiInstance
.listTeamConnections()
.then((data: v2.TeamConnectionsResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
23 changes: 23 additions & 0 deletions examples/v2/team-connections/ListTeamConnections_1473516764.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* List team connections with filters returns "OK" response
*/

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

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

const params: v2.TeamConnectionsApiListTeamConnectionsRequest = {
pageSize: 10,
filterSources: ["github"],
};

apiInstance
.listTeamConnections(params)
.then((data: v2.TeamConnectionsResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
19 changes: 19 additions & 0 deletions examples/v2/team-connections/ListTeamConnections_2418873869.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* List team connections returns "OK" response with pagination
*/

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

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

(async () => {
try {
for await (const item of apiInstance.listTeamConnectionsWithPagination()) {
console.log(item);
}
} catch (error) {
console.error(error);
}
})();
49 changes: 49 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8900,6 +8900,55 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "UserTeamsResponse",
},
"v2.ListTeamConnections": {
"pageSize": {
"type": "number",
"format": "int64",
},
"pageNumber": {
"type": "number",
"format": "int64",
},
"pageOffset": {
"type": "number",
"format": "int64",
},
"pageLimit": {
"type": "number",
"format": "int64",
},
"filterSources": {
"type": "Array<string>",
"format": "",
},
"filterTeamIds": {
"type": "Array<string>",
"format": "",
},
"filterConnectedTeamIds": {
"type": "Array<string>",
"format": "",
},
"filterConnectionIds": {
"type": "Array<string>",
"format": "",
},
"operationResponseType": "TeamConnectionsResponse",
},
"v2.CreateTeamConnections": {
"body": {
"type": "TeamConnectionCreateRequest",
"format": "",
},
"operationResponseType": "TeamConnectionsResponse",
},
"v2.DeleteTeamConnections": {
"body": {
"type": "TeamConnectionDeleteRequest",
"format": "",
},
"operationResponseType": "{}",
},
"v2.ListIncidentTeams": {
"include": {
"type": "IncidentRelatedObject",
Expand Down
7 changes: 7 additions & 0 deletions features/v2/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,13 @@
"tag": "Teams",
"operationId": "CreateTeam"
},
{
"source": "data.data[0]",
"step": "there is a valid \"team_connection\" in the system",
"key": "team_connection",
"tag": "Team Connections",
"operationId": "CreateTeamConnections"
},
{
"parameters": [
{
Expand Down
93 changes: 93 additions & 0 deletions features/v2/team_connections.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
@endpoint(team-connections) @endpoint(team-connections-v2)
Feature: Team Connections
View and manage relationships between Datadog teams and teams from
external sources, such as GitHub.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "TeamConnections" API

@skip @team:DataDog/aaa-omg
Scenario: Create team connections returns "Bad Request" response
Given operation "CreateTeamConnections" enabled
And new "CreateTeamConnections" request
And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/aaa-omg
Scenario: Create team connections returns "Conflict" response
Given operation "CreateTeamConnections" enabled
And new "CreateTeamConnections" request
And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]}
When the request is sent
Then the response status is 409 Conflict

@skip @team:DataDog/aaa-omg
Scenario: Create team connections returns "Created" response
Given operation "CreateTeamConnections" enabled
And new "CreateTeamConnections" request
And there is a valid "dd_team" in the system
And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]}
When the request is sent
Then the response status is 201 Created
And the response "data.data[0].attributes.source" is equal to "github"
And the response "data.data[0].attributes.managed_by" is equal to "datadog"
And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}"
And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name"
And the response "data.data[0].type" is equal to "team_connection"

@skip @team:DataDog/aaa-omg
Scenario: Delete team connections returns "Bad Request" response
Given operation "DeleteTeamConnections" enabled
And new "DeleteTeamConnections" request
And body with value {"data": [{"type": "team_connection"}]}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/aaa-omg
Scenario: Delete team connections returns "No Content" response
Given operation "DeleteTeamConnections" enabled
And new "DeleteTeamConnections" request
And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]}
When the request is sent
Then the response status is 204 No Content

@generated @skip @team:DataDog/aaa-omg
Scenario: Delete team connections returns "Not Found" response
Given operation "DeleteTeamConnections" enabled
And new "DeleteTeamConnections" request
And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/aaa-omg
Scenario: List team connections returns "Bad Request" response
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
When the request is sent
Then the response status is 400 Bad Request

@skip @team:DataDog/aaa-omg
Scenario: List team connections returns "OK" response
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/aaa-omg @with-pagination
Scenario: List team connections returns "OK" response with pagination
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
When the request with pagination is sent
Then the response status is 200 OK

@skip @team:DataDog/aaa-omg
Scenario: List team connections with filters returns "OK" response
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
And request contains "filter[sources]" parameter with value ["github"]
And request contains "page[size]" parameter with value 10
When the request is sent
Then the response status is 200 OK
19 changes: 19 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4268,6 +4268,25 @@
"type": "unsafe"
}
},
"DeleteTeamConnections": {
"tag": "Team Connections",
"undo": {
"type": "idempotent"
}
},
"ListTeamConnections": {
"tag": "Team Connections",
"undo": {
"type": "safe"
}
},
"CreateTeamConnections": {
"tag": "Team Connections",
"undo": {
"operationId": "DeleteTeamConnections",
"type": "unsafe"
}
},
"SyncTeams": {
"tag": "Teams",
"undo": {
Expand Down
3 changes: 3 additions & 0 deletions packages/datadog-api-client-common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ export function createConfiguration(
"v2.listMemberTeams": false,
"v2.removeMemberTeam": false,
"v2.syncTeams": false,
"v2.createTeamConnections": false,
"v2.deleteTeamConnections": false,
"v2.listTeamConnections": false,
"v2.createIncidentTeam": false,
"v2.deleteIncidentTeam": false,
"v2.getIncidentTeam": false,
Expand Down
Loading