From f4e933f6f0b79c3fef90a9b2be1b9b7a53ff6d9d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 7 Nov 2025 13:40:46 +0000 Subject: [PATCH] Regenerate client from commit fcc78bf of spec repo --- .generator/schemas/v2/openapi.yaml | 383 +++++++++++ features/v2/given.json | 7 + features/v2/team_connections.feature | 93 +++ features/v2/undo.json | 19 + packages/datadog-api-client/README.md | 1 + .../src/support/scenarios_model_mapping.ts | 49 ++ services/team_connections/.yarnrc.yml | 1 + services/team_connections/README.md | 44 ++ services/team_connections/package.json | 43 ++ services/team_connections/src/index.ts | 3 + .../src/v2/TeamConnectionsApi.ts | 632 ++++++++++++++++++ services/team_connections/src/v2/index.ts | 25 + .../src/v2/models/APIErrorResponse.ts | 45 ++ .../src/v2/models/ConnectedTeamRef.ts | 46 ++ .../src/v2/models/ConnectedTeamRefData.ts | 56 ++ .../src/v2/models/ConnectedTeamRefDataType.ts | 7 + .../v2/models/ConnectionsPagePagination.ts | 107 +++ .../src/v2/models/ConnectionsResponseMeta.ts | 46 ++ .../src/v2/models/TeamConnection.ts | 74 ++ .../src/v2/models/TeamConnectionAttributes.ts | 52 ++ .../src/v2/models/TeamConnectionCreateData.ts | 65 ++ .../v2/models/TeamConnectionCreateRequest.ts | 47 ++ .../v2/models/TeamConnectionDeleteRequest.ts | 47 ++ .../TeamConnectionDeleteRequestDataItem.ts | 56 ++ .../v2/models/TeamConnectionRelationships.ts | 55 ++ .../src/v2/models/TeamConnectionType.ts | 7 + .../src/v2/models/TeamConnectionsResponse.ts | 55 ++ .../team_connections/src/v2/models/TeamRef.ts | 46 ++ .../src/v2/models/TeamRefData.ts | 56 ++ .../src/v2/models/TeamRefDataType.ts | 7 + .../src/v2/models/TypingInfo.ts | 43 ++ services/team_connections/tsconfig.json | 28 + yarn.lock | 9 + 33 files changed, 2254 insertions(+) create mode 100644 features/v2/team_connections.feature create mode 100644 services/team_connections/.yarnrc.yml create mode 100644 services/team_connections/README.md create mode 100644 services/team_connections/package.json create mode 100644 services/team_connections/src/index.ts create mode 100644 services/team_connections/src/v2/TeamConnectionsApi.ts create mode 100644 services/team_connections/src/v2/index.ts create mode 100644 services/team_connections/src/v2/models/APIErrorResponse.ts create mode 100644 services/team_connections/src/v2/models/ConnectedTeamRef.ts create mode 100644 services/team_connections/src/v2/models/ConnectedTeamRefData.ts create mode 100644 services/team_connections/src/v2/models/ConnectedTeamRefDataType.ts create mode 100644 services/team_connections/src/v2/models/ConnectionsPagePagination.ts create mode 100644 services/team_connections/src/v2/models/ConnectionsResponseMeta.ts create mode 100644 services/team_connections/src/v2/models/TeamConnection.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionAttributes.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionCreateData.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionCreateRequest.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionDeleteRequest.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionDeleteRequestDataItem.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionRelationships.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionType.ts create mode 100644 services/team_connections/src/v2/models/TeamConnectionsResponse.ts create mode 100644 services/team_connections/src/v2/models/TeamRef.ts create mode 100644 services/team_connections/src/v2/models/TeamRefData.ts create mode 100644 services/team_connections/src/v2/models/TeamRefDataType.ts create mode 100644 services/team_connections/src/v2/models/TypingInfo.ts create mode 100644 services/team_connections/tsconfig.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6ed4b42368ed..ce755c7d4440 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -11515,6 +11515,35 @@ components: $ref: '#/components/schemas/ConfluentResourceResponseData' type: array type: object + ConnectedTeamRef: + description: Reference to a team from an external system. + properties: + data: + $ref: '#/components/schemas/ConnectedTeamRefData' + type: object + ConnectedTeamRefData: + description: Reference to connected external team. + properties: + id: + description: The connected team ID as it is referenced throughout the Datadog + ecosystem. + example: '@MyGitHubAccount/my-team-name' + type: string + type: + $ref: '#/components/schemas/ConnectedTeamRefDataType' + required: + - id + - type + type: object + ConnectedTeamRefDataType: + default: github_team + description: External team resource type. + enum: + - github_team + example: github_team + type: string + x-enum-varnames: + - GITHUB_TEAM Connection: description: The definition of `Connection` object. properties: @@ -11579,6 +11608,50 @@ components: - label - tags type: object + ConnectionsPagePagination: + description: Page-based pagination metadata. + properties: + first_number: + description: The first page number. + format: int64 + type: integer + last_number: + description: The last page number. + format: int64 + type: integer + next_number: + description: The next page number. + format: int64 + nullable: true + type: integer + number: + description: The current page number. + format: int64 + type: integer + prev_number: + description: The previous page number. + format: int64 + nullable: true + type: integer + size: + description: The page size. + format: int64 + type: integer + total: + description: Total connections matching request. + format: int64 + type: integer + type: + description: Pagination type. + example: number_size + type: string + type: object + ConnectionsResponseMeta: + description: Connections response metadata. + properties: + page: + $ref: '#/components/schemas/ConnectionsPagePagination' + type: object Container: description: Container object. properties: @@ -51314,6 +51387,111 @@ components: - handle - name type: object + TeamConnection: + description: A relationship between a Datadog team and a team from another external + system. + properties: + attributes: + $ref: '#/components/schemas/TeamConnectionAttributes' + id: + description: The unique identifier of the team connection. + example: 12345678-1234-5678-9abc-123456789012 + type: string + relationships: + $ref: '#/components/schemas/TeamConnectionRelationships' + type: + $ref: '#/components/schemas/TeamConnectionType' + required: + - id + - type + type: object + TeamConnectionAttributes: + description: Attributes of the team connection. + properties: + managed_by: + description: The entity that manages this team connection. + example: github_sync + type: string + source: + description: The name of the external source. + example: github + type: string + type: object + TeamConnectionCreateData: + description: Data for creating a team connection. + properties: + attributes: + $ref: '#/components/schemas/TeamConnectionAttributes' + relationships: + $ref: '#/components/schemas/TeamConnectionRelationships' + type: + $ref: '#/components/schemas/TeamConnectionType' + required: + - type + type: object + TeamConnectionCreateRequest: + description: Request for creating team connections. + properties: + data: + description: Array of team connections to create. + items: + $ref: '#/components/schemas/TeamConnectionCreateData' + type: array + required: + - data + type: object + TeamConnectionDeleteRequest: + description: Request for deleting team connections. + properties: + data: + description: Array of team connection IDs to delete. + items: + $ref: '#/components/schemas/TeamConnectionDeleteRequestDataItem' + type: array + required: + - data + type: object + TeamConnectionDeleteRequestDataItem: + description: A collection of connection ids to delete. + properties: + id: + description: The unique identifier of the team connection to delete. + example: 12345678-1234-5678-9abc-123456789012 + type: string + type: + $ref: '#/components/schemas/TeamConnectionType' + required: + - id + - type + type: object + TeamConnectionRelationships: + description: Relationships of the team connection. + properties: + connected_team: + $ref: '#/components/schemas/ConnectedTeamRef' + team: + $ref: '#/components/schemas/TeamRef' + type: object + TeamConnectionType: + default: team_connection + description: Team connection resource type. + enum: + - team_connection + example: team_connection + type: string + x-enum-varnames: + - TEAM_CONNECTION + TeamConnectionsResponse: + description: Response containing information about multiple team connections. + properties: + data: + description: Array of team connections. + items: + $ref: '#/components/schemas/TeamConnection' + type: array + meta: + $ref: '#/components/schemas/ConnectionsResponseMeta' + type: object TeamCreate: description: Team create properties: @@ -51731,6 +51909,34 @@ components: $ref: '#/components/schemas/TeamPermissionSetting' type: array type: object + TeamRef: + description: Reference to a Datadog team. + properties: + data: + $ref: '#/components/schemas/TeamRefData' + type: object + TeamRefData: + description: Reference to a Datadog team. + properties: + id: + description: The Datadog team ID. + example: 87654321-4321-8765-dcba-210987654321 + type: string + type: + $ref: '#/components/schemas/TeamRefDataType' + required: + - id + - type + type: object + TeamRefDataType: + default: team + description: Datadog team resource type. + enum: + - team + example: team + type: string + x-enum-varnames: + - TEAM TeamReference: description: Provides a reference to a team, including ID, type, and basic attributes/relationships. properties: @@ -80747,6 +80953,180 @@ paths: permissions: - teams_read - teams_manage + /api/v2/team/connections: + delete: + description: Delete multiple team connections. + operationId: DeleteTeamConnections + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionDeleteRequest' + required: true + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Delete team connections + tags: + - Team Connections + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Returns all team connections. + operationId: ListTeamConnections + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + - description: Specific offset to start retrieving results from. + in: query + name: page[offset] + required: false + schema: + format: int64 + type: integer + - description: Maximum number of results to return. + in: query + name: page[limit] + required: false + schema: + format: int64 + type: integer + - description: Filter team connections by external source systems. + explode: false + in: query + name: filter[sources] + required: false + schema: + items: + example: github + type: string + type: array + style: form + - description: Filter team connections by Datadog team IDs. + explode: false + in: query + name: filter[team_ids] + required: false + schema: + items: + example: 12345678-1234-5678-9abc-123456789012 + type: string + type: array + style: form + - description: Filter team connections by connected team IDs from external systems. + explode: false + in: query + name: filter[connected_team_ids] + required: false + schema: + items: + example: '@MyGitHubAccount/my-team-name' + type: string + type: array + style: form + - description: Filter team connections by connection IDs. + explode: false + in: query + name: filter[connection_ids] + required: false + schema: + items: + example: 12345678-1234-5678-9abc-123456789012 + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: List team connections + tags: + - Team Connections + 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. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create multiple team connections. + operationId: CreateTeamConnections + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamConnectionsResponse' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Create team connections + tags: + - Team Connections + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: '**Note**: This endpoint is in Preview. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/sync: post: description: 'This endpoint attempts to link your existing Datadog teams with @@ -83952,6 +84332,9 @@ tags: use Datadog\u2019s API to\nmanage both test types programmatically.\n\nFor more information about Synthetics, see the [Synthetics overview](https://docs.datadoghq.com/synthetics/)." name: Synthetics +- description: View and manage relationships between Datadog teams and teams from + external sources, such as GitHub. + name: Team Connections - description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information. name: Teams diff --git a/features/v2/given.json b/features/v2/given.json index 12852be0f21b..b67e2d5adcd8 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -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": [ { diff --git a/features/v2/team_connections.feature b/features/v2/team_connections.feature new file mode 100644 index 000000000000..49a0d92f5e6f --- /dev/null +++ b/features/v2/team_connections.feature @@ -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 diff --git a/features/v2/undo.json b/features/v2/undo.json index cd8c18bf0780..d25ca0a4dba2 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -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": { diff --git a/packages/datadog-api-client/README.md b/packages/datadog-api-client/README.md index 8fac2fe2cb16..afd9fea69672 100644 --- a/packages/datadog-api-client/README.md +++ b/packages/datadog-api-client/README.md @@ -437,6 +437,7 @@ apiInstance | Static Analysis | @datadog/datadog-api-client-static-analysis | [README.md](../../services/static-analysis/README.md) | | Synthetics | @datadog/datadog-api-client-synthetics | [README.md](../../services/synthetics/README.md) | | Tags | @datadog/datadog-api-client-tags | [README.md](../../services/tags/README.md) | +| Team Connections | @datadog/datadog-api-client-team-connections | [README.md](../../services/team-connections/README.md) | | Teams | @datadog/datadog-api-client-teams | [README.md](../../services/teams/README.md) | | Test Optimization | @datadog/datadog-api-client-test-optimization | [README.md](../../services/test-optimization/README.md) | | Usage Metering | @datadog/datadog-api-client-usage-metering | [README.md](../../services/usage-metering/README.md) | diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index c9aae4e5b427..4207af134652 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -8910,6 +8910,55 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "UserTeamsResponse", }, + "TeamConnectionsApi.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", + format: "", + }, + filterTeamIds: { + type: "Array", + format: "", + }, + filterConnectedTeamIds: { + type: "Array", + format: "", + }, + filterConnectionIds: { + type: "Array", + format: "", + }, + operationResponseType: "TeamConnectionsResponse", + }, + "TeamConnectionsApi.V2.CreateTeamConnections": { + body: { + type: "TeamConnectionCreateRequest", + format: "", + }, + operationResponseType: "TeamConnectionsResponse", + }, + "TeamConnectionsApi.V2.DeleteTeamConnections": { + body: { + type: "TeamConnectionDeleteRequest", + format: "", + }, + operationResponseType: "{}", + }, "IncidentTeamsApi.V2.ListIncidentTeams": { include: { type: "IncidentRelatedObject", diff --git a/services/team_connections/.yarnrc.yml b/services/team_connections/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/services/team_connections/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/services/team_connections/README.md b/services/team_connections/README.md new file mode 100644 index 000000000000..8eb9920c572a --- /dev/null +++ b/services/team_connections/README.md @@ -0,0 +1,44 @@ +# @datadog/datadog-api-client-team-connections + +## Description + +View and manage relationships between Datadog teams and teams from external sources, such as GitHub. + +## Navigation + +- [Installation](#installation) +- [Getting Started](#getting-started) + +## Installation + +```sh +# NPM +npm install @datadog/datadog-api-client-team-connections +# Yarn +yarn add @datadog/datadog-api-client-team-connections +``` + +## Getting Started +```ts +import { createConfiguration } from "@datadog/datadog-api-client"; +import { TeamConnectionsApiV2 } from "@datadog/datadog-api-client-team-connections"; +import { v2 } from "@datadog/datadog-api-client-team-connections"; + +const configuration = createConfiguration(); +// Enable unstable operations +const configurationOpts = { + unstableOperations: { + "TeamConnectionsApi.v2.listTeamConnections": true + } +} + +const configuration = createConfiguration(configurationOpts); +const apiInstance = new TeamConnectionsApiV2(configuration); +const params = {/* parameters */}; + +apiInstance.listTeamConnections(params).then((data) => { + console.log("API called successfully. Returned data: " + JSON.stringify(data)); +}).catch((error) => { + console.error("Error calling API: " + error); +}); +``` \ No newline at end of file diff --git a/services/team_connections/package.json b/services/team_connections/package.json new file mode 100644 index 000000000000..133b8c9dbac0 --- /dev/null +++ b/services/team_connections/package.json @@ -0,0 +1,43 @@ +{ + "name": "@datadog/datadog-api-client-team-connections", + "description": "", + "author": "", + "keywords": [ + "api", + "fetch", + "typescript" + ], + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/DataDog/datadog-api-client-typescript.git", + "directory": "services/team-connections" + }, + "files": [ + "dist/**/*" + ], + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "prepack": "yarn workspace @datadog/datadog-api-client build && yarn build", + "build": "yarn generate-version-files && tsc", + "generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts" + }, + "dependencies": { + "@datadog/datadog-api-client": "^2.0.0-beta.0" + }, + "devDependencies": { + "typescript": "5.8.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "version": "0.0.1", + "packageManager": "yarn@4.9.1" +} diff --git a/services/team_connections/src/index.ts b/services/team_connections/src/index.ts new file mode 100644 index 000000000000..5e4cf7179a5a --- /dev/null +++ b/services/team_connections/src/index.ts @@ -0,0 +1,3 @@ +export * as v2 from "./v2"; + +export { TeamConnectionsApi as TeamConnectionsApiV2 } from "./v2/TeamConnectionsApi"; diff --git a/services/team_connections/src/v2/TeamConnectionsApi.ts b/services/team_connections/src/v2/TeamConnectionsApi.ts new file mode 100644 index 000000000000..b8c0ec32d4a8 --- /dev/null +++ b/services/team_connections/src/v2/TeamConnectionsApi.ts @@ -0,0 +1,632 @@ +import { + ApiException, + BaseAPIRequestFactory, + BaseServerConfiguration, + buildUserAgent, + Configuration, + createConfiguration, + deserialize, + getPreferredMediaType, + HttpMethod, + isBrowser, + logger, + normalizeMediaType, + parse, + RequiredError, + RequestContext, + ResponseContext, + serialize, + ServerConfiguration, + stringify, + applySecurityAuthentication, +} from "@datadog/datadog-api-client"; + +import { TypingInfo } from "./models/TypingInfo"; +import { APIErrorResponse } from "./models/APIErrorResponse"; +import { TeamConnection } from "./models/TeamConnection"; +import { TeamConnectionCreateRequest } from "./models/TeamConnectionCreateRequest"; +import { TeamConnectionDeleteRequest } from "./models/TeamConnectionDeleteRequest"; +import { TeamConnectionsResponse } from "./models/TeamConnectionsResponse"; +import { version } from "../version"; + +export class TeamConnectionsApiRequestFactory extends BaseAPIRequestFactory { + public userAgent: string | undefined; + + public constructor(configuration: Configuration) { + super(configuration); + if (!isBrowser) { + this.userAgent = buildUserAgent("team-connections", version); + } + } + public async createTeamConnections( + body: TeamConnectionCreateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["TeamConnectionsApi.v2.createTeamConnections"] + ) { + throw new Error( + "Unstable operation 'createTeamConnections' is disabled. Enable it by setting `configuration.unstableOperations['TeamConnectionsApi.v2.createTeamConnections'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createTeamConnections"); + } + + // Path Params + const localVarPath = "/api/v2/team/connections"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "TeamConnectionsApi.v2.createTeamConnections", + TeamConnectionsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "TeamConnectionCreateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async deleteTeamConnections( + body: TeamConnectionDeleteRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["TeamConnectionsApi.v2.deleteTeamConnections"] + ) { + throw new Error( + "Unstable operation 'deleteTeamConnections' is disabled. Enable it by setting `configuration.unstableOperations['TeamConnectionsApi.v2.deleteTeamConnections'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "deleteTeamConnections"); + } + + // Path Params + const localVarPath = "/api/v2/team/connections"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "TeamConnectionsApi.v2.deleteTeamConnections", + TeamConnectionsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "TeamConnectionDeleteRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async listTeamConnections( + pageSize?: number, + pageNumber?: number, + pageOffset?: number, + pageLimit?: number, + filterSources?: Array, + filterTeamIds?: Array, + filterConnectedTeamIds?: Array, + filterConnectionIds?: Array, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["TeamConnectionsApi.v2.listTeamConnections"] + ) { + throw new Error( + "Unstable operation 'listTeamConnections' is disabled. Enable it by setting `configuration.unstableOperations['TeamConnectionsApi.v2.listTeamConnections'] = true`", + ); + } + + // Path Params + const localVarPath = "/api/v2/team/connections"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "TeamConnectionsApi.v2.listTeamConnections", + TeamConnectionsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + serialize(pageSize, TypingInfo, "number", "int64"), + "", + ); + } + if (pageNumber !== undefined) { + requestContext.setQueryParam( + "page[number]", + serialize(pageNumber, TypingInfo, "number", "int64"), + "", + ); + } + if (pageOffset !== undefined) { + requestContext.setQueryParam( + "page[offset]", + serialize(pageOffset, TypingInfo, "number", "int64"), + "", + ); + } + if (pageLimit !== undefined) { + requestContext.setQueryParam( + "page[limit]", + serialize(pageLimit, TypingInfo, "number", "int64"), + "", + ); + } + if (filterSources !== undefined) { + requestContext.setQueryParam( + "filter[sources]", + serialize(filterSources, TypingInfo, "Array", ""), + "csv", + ); + } + if (filterTeamIds !== undefined) { + requestContext.setQueryParam( + "filter[team_ids]", + serialize(filterTeamIds, TypingInfo, "Array", ""), + "csv", + ); + } + if (filterConnectedTeamIds !== undefined) { + requestContext.setQueryParam( + "filter[connected_team_ids]", + serialize(filterConnectedTeamIds, TypingInfo, "Array", ""), + "csv", + ); + } + if (filterConnectionIds !== undefined) { + requestContext.setQueryParam( + "filter[connection_ids]", + serialize(filterConnectionIds, TypingInfo, "Array", ""), + "csv", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } +} + +export class TeamConnectionsApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createTeamConnections + * @throws ApiException if the response code was not in [200, 299] + */ + public async createTeamConnections( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: TeamConnectionsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "TeamConnectionsResponse", + ) as TeamConnectionsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: TeamConnectionsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "TeamConnectionsResponse", + "", + ) as TeamConnectionsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteTeamConnections + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteTeamConnections(response: ResponseContext): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listTeamConnections + * @throws ApiException if the response code was not in [200, 299] + */ + public async listTeamConnections( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: TeamConnectionsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "TeamConnectionsResponse", + ) as TeamConnectionsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: TeamConnectionsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "TeamConnectionsResponse", + "", + ) as TeamConnectionsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } +} + +export interface TeamConnectionsApiCreateTeamConnectionsRequest { + /** + * @type TeamConnectionCreateRequest + */ + body: TeamConnectionCreateRequest; +} + +export interface TeamConnectionsApiDeleteTeamConnectionsRequest { + /** + * @type TeamConnectionDeleteRequest + */ + body: TeamConnectionDeleteRequest; +} + +export interface TeamConnectionsApiListTeamConnectionsRequest { + /** + * Size for a given page. The maximum allowed value is 100. + * @type number + */ + pageSize?: number; + /** + * Specific page number to return. + * @type number + */ + pageNumber?: number; + /** + * Specific offset to start retrieving results from. + * @type number + */ + pageOffset?: number; + /** + * Maximum number of results to return. + * @type number + */ + pageLimit?: number; + /** + * Filter team connections by external source systems. + * @type Array + */ + filterSources?: Array; + /** + * Filter team connections by Datadog team IDs. + * @type Array + */ + filterTeamIds?: Array; + /** + * Filter team connections by connected team IDs from external systems. + * @type Array + */ + filterConnectedTeamIds?: Array; + /** + * Filter team connections by connection IDs. + * @type Array + */ + filterConnectionIds?: Array; +} + +export class TeamConnectionsApi { + private requestFactory: TeamConnectionsApiRequestFactory; + private responseProcessor: TeamConnectionsApiResponseProcessor; + private configuration: Configuration; + + static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + + public constructor( + configuration?: Configuration, + requestFactory?: TeamConnectionsApiRequestFactory, + responseProcessor?: TeamConnectionsApiResponseProcessor, + ) { + this.configuration = configuration || createConfiguration(); + this.requestFactory = + requestFactory || + new TeamConnectionsApiRequestFactory(this.configuration); + this.responseProcessor = + responseProcessor || new TeamConnectionsApiResponseProcessor(); + } + + /** + * Create multiple team connections. + * @param param The request object + */ + public createTeamConnections( + param: TeamConnectionsApiCreateTeamConnectionsRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.createTeamConnections( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createTeamConnections(responseContext); + }); + }); + } + + /** + * Delete multiple team connections. + * @param param The request object + */ + public deleteTeamConnections( + param: TeamConnectionsApiDeleteTeamConnectionsRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.deleteTeamConnections( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteTeamConnections(responseContext); + }); + }); + } + + /** + * Returns all team connections. + * @param param The request object + */ + public listTeamConnections( + param: TeamConnectionsApiListTeamConnectionsRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listTeamConnections( + param.pageSize, + param.pageNumber, + param.pageOffset, + param.pageLimit, + param.filterSources, + param.filterTeamIds, + param.filterConnectedTeamIds, + param.filterConnectionIds, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listTeamConnections(responseContext); + }); + }); + } + + /** + * Provide a paginated version of listTeamConnections returning a generator with all the items. + */ + public async *listTeamConnectionsWithPagination( + param: TeamConnectionsApiListTeamConnectionsRequest = {}, + options?: Configuration, + ): AsyncGenerator { + let pageSize = 10; + if (param.pageSize !== undefined) { + pageSize = param.pageSize; + } + param.pageSize = pageSize; + param.pageNumber = 0; + while (true) { + const requestContext = await this.requestFactory.listTeamConnections( + param.pageSize, + param.pageNumber, + param.pageOffset, + param.pageLimit, + param.filterSources, + param.filterTeamIds, + param.filterConnectedTeamIds, + param.filterConnectionIds, + options, + ); + const responseContext = + await this.configuration.httpApi.send(requestContext); + + const response = + await this.responseProcessor.listTeamConnections(responseContext); + const responseData = response.data; + if (responseData === undefined) { + break; + } + const results = responseData; + for (const item of results) { + yield item; + } + if (results.length < pageSize) { + break; + } + param.pageNumber = param.pageNumber + 1; + } + } +} diff --git a/services/team_connections/src/v2/index.ts b/services/team_connections/src/v2/index.ts new file mode 100644 index 000000000000..3031bb22e4d0 --- /dev/null +++ b/services/team_connections/src/v2/index.ts @@ -0,0 +1,25 @@ +export { + TeamConnectionsApiCreateTeamConnectionsRequest, + TeamConnectionsApiDeleteTeamConnectionsRequest, + TeamConnectionsApiListTeamConnectionsRequest, + TeamConnectionsApi, +} from "./TeamConnectionsApi"; + +export { APIErrorResponse } from "./models/APIErrorResponse"; +export { ConnectedTeamRef } from "./models/ConnectedTeamRef"; +export { ConnectedTeamRefData } from "./models/ConnectedTeamRefData"; +export { ConnectedTeamRefDataType } from "./models/ConnectedTeamRefDataType"; +export { ConnectionsPagePagination } from "./models/ConnectionsPagePagination"; +export { ConnectionsResponseMeta } from "./models/ConnectionsResponseMeta"; +export { TeamConnection } from "./models/TeamConnection"; +export { TeamConnectionAttributes } from "./models/TeamConnectionAttributes"; +export { TeamConnectionCreateData } from "./models/TeamConnectionCreateData"; +export { TeamConnectionCreateRequest } from "./models/TeamConnectionCreateRequest"; +export { TeamConnectionDeleteRequest } from "./models/TeamConnectionDeleteRequest"; +export { TeamConnectionDeleteRequestDataItem } from "./models/TeamConnectionDeleteRequestDataItem"; +export { TeamConnectionRelationships } from "./models/TeamConnectionRelationships"; +export { TeamConnectionsResponse } from "./models/TeamConnectionsResponse"; +export { TeamConnectionType } from "./models/TeamConnectionType"; +export { TeamRef } from "./models/TeamRef"; +export { TeamRefData } from "./models/TeamRefData"; +export { TeamRefDataType } from "./models/TeamRefDataType"; diff --git a/services/team_connections/src/v2/models/APIErrorResponse.ts b/services/team_connections/src/v2/models/APIErrorResponse.ts new file mode 100644 index 000000000000..58d6c35b80f0 --- /dev/null +++ b/services/team_connections/src/v2/models/APIErrorResponse.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * API error response. + */ +export class APIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return APIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/ConnectedTeamRef.ts b/services/team_connections/src/v2/models/ConnectedTeamRef.ts new file mode 100644 index 000000000000..bf754a5b358c --- /dev/null +++ b/services/team_connections/src/v2/models/ConnectedTeamRef.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ConnectedTeamRefData } from "./ConnectedTeamRefData"; + +/** + * Reference to a team from an external system. + */ +export class ConnectedTeamRef { + /** + * Reference to connected external team. + */ + "data"?: ConnectedTeamRefData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "ConnectedTeamRefData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ConnectedTeamRef.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/ConnectedTeamRefData.ts b/services/team_connections/src/v2/models/ConnectedTeamRefData.ts new file mode 100644 index 000000000000..0b9ed8dcce54 --- /dev/null +++ b/services/team_connections/src/v2/models/ConnectedTeamRefData.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ConnectedTeamRefDataType } from "./ConnectedTeamRefDataType"; + +/** + * Reference to connected external team. + */ +export class ConnectedTeamRefData { + /** + * The connected team ID as it is referenced throughout the Datadog ecosystem. + */ + "id": string; + /** + * External team resource type. + */ + "type": ConnectedTeamRefDataType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "ConnectedTeamRefDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ConnectedTeamRefData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/ConnectedTeamRefDataType.ts b/services/team_connections/src/v2/models/ConnectedTeamRefDataType.ts new file mode 100644 index 000000000000..17901d14dbcf --- /dev/null +++ b/services/team_connections/src/v2/models/ConnectedTeamRefDataType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * External team resource type. + */ +export type ConnectedTeamRefDataType = typeof GITHUB_TEAM | UnparsedObject; +export const GITHUB_TEAM = "github_team"; diff --git a/services/team_connections/src/v2/models/ConnectionsPagePagination.ts b/services/team_connections/src/v2/models/ConnectionsPagePagination.ts new file mode 100644 index 000000000000..8adb050d46fd --- /dev/null +++ b/services/team_connections/src/v2/models/ConnectionsPagePagination.ts @@ -0,0 +1,107 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Page-based pagination metadata. + */ +export class ConnectionsPagePagination { + /** + * The first page number. + */ + "firstNumber"?: number; + /** + * The last page number. + */ + "lastNumber"?: number; + /** + * The next page number. + */ + "nextNumber"?: number; + /** + * The current page number. + */ + "number"?: number; + /** + * The previous page number. + */ + "prevNumber"?: number; + /** + * The page size. + */ + "size"?: number; + /** + * Total connections matching request. + */ + "total"?: number; + /** + * Pagination type. + */ + "type"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + firstNumber: { + baseName: "first_number", + type: "number", + format: "int64", + }, + lastNumber: { + baseName: "last_number", + type: "number", + format: "int64", + }, + nextNumber: { + baseName: "next_number", + type: "number", + format: "int64", + }, + number: { + baseName: "number", + type: "number", + format: "int64", + }, + prevNumber: { + baseName: "prev_number", + type: "number", + format: "int64", + }, + size: { + baseName: "size", + type: "number", + format: "int64", + }, + total: { + baseName: "total", + type: "number", + format: "int64", + }, + type: { + baseName: "type", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ConnectionsPagePagination.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/ConnectionsResponseMeta.ts b/services/team_connections/src/v2/models/ConnectionsResponseMeta.ts new file mode 100644 index 000000000000..8435360e0cfa --- /dev/null +++ b/services/team_connections/src/v2/models/ConnectionsResponseMeta.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ConnectionsPagePagination } from "./ConnectionsPagePagination"; + +/** + * Connections response metadata. + */ +export class ConnectionsResponseMeta { + /** + * Page-based pagination metadata. + */ + "page"?: ConnectionsPagePagination; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + page: { + baseName: "page", + type: "ConnectionsPagePagination", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ConnectionsResponseMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnection.ts b/services/team_connections/src/v2/models/TeamConnection.ts new file mode 100644 index 000000000000..3cfdcb6cd47a --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnection.ts @@ -0,0 +1,74 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { TeamConnectionAttributes } from "./TeamConnectionAttributes"; +import { TeamConnectionRelationships } from "./TeamConnectionRelationships"; +import { TeamConnectionType } from "./TeamConnectionType"; + +/** + * A relationship between a Datadog team and a team from another external system. + */ +export class TeamConnection { + /** + * Attributes of the team connection. + */ + "attributes"?: TeamConnectionAttributes; + /** + * The unique identifier of the team connection. + */ + "id": string; + /** + * Relationships of the team connection. + */ + "relationships"?: TeamConnectionRelationships; + /** + * Team connection resource type. + */ + "type": TeamConnectionType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "TeamConnectionAttributes", + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + relationships: { + baseName: "relationships", + type: "TeamConnectionRelationships", + }, + type: { + baseName: "type", + type: "TeamConnectionType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnection.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnectionAttributes.ts b/services/team_connections/src/v2/models/TeamConnectionAttributes.ts new file mode 100644 index 000000000000..04d1f4618f59 --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionAttributes.ts @@ -0,0 +1,52 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Attributes of the team connection. + */ +export class TeamConnectionAttributes { + /** + * The entity that manages this team connection. + */ + "managedBy"?: string; + /** + * The name of the external source. + */ + "source"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + managedBy: { + baseName: "managed_by", + type: "string", + }, + source: { + baseName: "source", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnectionAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnectionCreateData.ts b/services/team_connections/src/v2/models/TeamConnectionCreateData.ts new file mode 100644 index 000000000000..cfcf9733a185 --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionCreateData.ts @@ -0,0 +1,65 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { TeamConnectionAttributes } from "./TeamConnectionAttributes"; +import { TeamConnectionRelationships } from "./TeamConnectionRelationships"; +import { TeamConnectionType } from "./TeamConnectionType"; + +/** + * Data for creating a team connection. + */ +export class TeamConnectionCreateData { + /** + * Attributes of the team connection. + */ + "attributes"?: TeamConnectionAttributes; + /** + * Relationships of the team connection. + */ + "relationships"?: TeamConnectionRelationships; + /** + * Team connection resource type. + */ + "type": TeamConnectionType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "TeamConnectionAttributes", + }, + relationships: { + baseName: "relationships", + type: "TeamConnectionRelationships", + }, + type: { + baseName: "type", + type: "TeamConnectionType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnectionCreateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnectionCreateRequest.ts b/services/team_connections/src/v2/models/TeamConnectionCreateRequest.ts new file mode 100644 index 000000000000..2f8b58ab35f6 --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionCreateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { TeamConnectionCreateData } from "./TeamConnectionCreateData"; + +/** + * Request for creating team connections. + */ +export class TeamConnectionCreateRequest { + /** + * Array of team connections to create. + */ + "data": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnectionCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnectionDeleteRequest.ts b/services/team_connections/src/v2/models/TeamConnectionDeleteRequest.ts new file mode 100644 index 000000000000..35d850352acf --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionDeleteRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { TeamConnectionDeleteRequestDataItem } from "./TeamConnectionDeleteRequestDataItem"; + +/** + * Request for deleting team connections. + */ +export class TeamConnectionDeleteRequest { + /** + * Array of team connection IDs to delete. + */ + "data": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnectionDeleteRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnectionDeleteRequestDataItem.ts b/services/team_connections/src/v2/models/TeamConnectionDeleteRequestDataItem.ts new file mode 100644 index 000000000000..4b5f50e87a5c --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionDeleteRequestDataItem.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { TeamConnectionType } from "./TeamConnectionType"; + +/** + * A collection of connection ids to delete. + */ +export class TeamConnectionDeleteRequestDataItem { + /** + * The unique identifier of the team connection to delete. + */ + "id": string; + /** + * Team connection resource type. + */ + "type": TeamConnectionType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "TeamConnectionType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnectionDeleteRequestDataItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnectionRelationships.ts b/services/team_connections/src/v2/models/TeamConnectionRelationships.ts new file mode 100644 index 000000000000..8bc269b3306a --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionRelationships.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ConnectedTeamRef } from "./ConnectedTeamRef"; +import { TeamRef } from "./TeamRef"; + +/** + * Relationships of the team connection. + */ +export class TeamConnectionRelationships { + /** + * Reference to a team from an external system. + */ + "connectedTeam"?: ConnectedTeamRef; + /** + * Reference to a Datadog team. + */ + "team"?: TeamRef; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + connectedTeam: { + baseName: "connected_team", + type: "ConnectedTeamRef", + }, + team: { + baseName: "team", + type: "TeamRef", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnectionRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamConnectionType.ts b/services/team_connections/src/v2/models/TeamConnectionType.ts new file mode 100644 index 000000000000..3b69bf58f567 --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Team connection resource type. + */ +export type TeamConnectionType = typeof TEAM_CONNECTION | UnparsedObject; +export const TEAM_CONNECTION = "team_connection"; diff --git a/services/team_connections/src/v2/models/TeamConnectionsResponse.ts b/services/team_connections/src/v2/models/TeamConnectionsResponse.ts new file mode 100644 index 000000000000..ec133a0d62a6 --- /dev/null +++ b/services/team_connections/src/v2/models/TeamConnectionsResponse.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ConnectionsResponseMeta } from "./ConnectionsResponseMeta"; +import { TeamConnection } from "./TeamConnection"; + +/** + * Response containing information about multiple team connections. + */ +export class TeamConnectionsResponse { + /** + * Array of team connections. + */ + "data"?: Array; + /** + * Connections response metadata. + */ + "meta"?: ConnectionsResponseMeta; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + meta: { + baseName: "meta", + type: "ConnectionsResponseMeta", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamConnectionsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamRef.ts b/services/team_connections/src/v2/models/TeamRef.ts new file mode 100644 index 000000000000..0e5cf1a35059 --- /dev/null +++ b/services/team_connections/src/v2/models/TeamRef.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { TeamRefData } from "./TeamRefData"; + +/** + * Reference to a Datadog team. + */ +export class TeamRef { + /** + * Reference to a Datadog team. + */ + "data"?: TeamRefData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "TeamRefData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamRef.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamRefData.ts b/services/team_connections/src/v2/models/TeamRefData.ts new file mode 100644 index 000000000000..9d8dfd710b7d --- /dev/null +++ b/services/team_connections/src/v2/models/TeamRefData.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { TeamRefDataType } from "./TeamRefDataType"; + +/** + * Reference to a Datadog team. + */ +export class TeamRefData { + /** + * The Datadog team ID. + */ + "id": string; + /** + * Datadog team resource type. + */ + "type": TeamRefDataType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "TeamRefDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TeamRefData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/team_connections/src/v2/models/TeamRefDataType.ts b/services/team_connections/src/v2/models/TeamRefDataType.ts new file mode 100644 index 000000000000..9a1bd983bb1a --- /dev/null +++ b/services/team_connections/src/v2/models/TeamRefDataType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Datadog team resource type. + */ +export type TeamRefDataType = typeof TEAM | UnparsedObject; +export const TEAM = "team"; diff --git a/services/team_connections/src/v2/models/TypingInfo.ts b/services/team_connections/src/v2/models/TypingInfo.ts new file mode 100644 index 000000000000..81c84bcecf47 --- /dev/null +++ b/services/team_connections/src/v2/models/TypingInfo.ts @@ -0,0 +1,43 @@ +import { ModelTypingInfo } from "@datadog/datadog-api-client"; + +import { APIErrorResponse } from "./APIErrorResponse"; +import { ConnectedTeamRef } from "./ConnectedTeamRef"; +import { ConnectedTeamRefData } from "./ConnectedTeamRefData"; +import { ConnectionsPagePagination } from "./ConnectionsPagePagination"; +import { ConnectionsResponseMeta } from "./ConnectionsResponseMeta"; +import { TeamConnection } from "./TeamConnection"; +import { TeamConnectionAttributes } from "./TeamConnectionAttributes"; +import { TeamConnectionCreateData } from "./TeamConnectionCreateData"; +import { TeamConnectionCreateRequest } from "./TeamConnectionCreateRequest"; +import { TeamConnectionDeleteRequest } from "./TeamConnectionDeleteRequest"; +import { TeamConnectionDeleteRequestDataItem } from "./TeamConnectionDeleteRequestDataItem"; +import { TeamConnectionRelationships } from "./TeamConnectionRelationships"; +import { TeamConnectionsResponse } from "./TeamConnectionsResponse"; +import { TeamRef } from "./TeamRef"; +import { TeamRefData } from "./TeamRefData"; + +export const TypingInfo: ModelTypingInfo = { + enumsMap: { + ConnectedTeamRefDataType: ["github_team"], + TeamConnectionType: ["team_connection"], + TeamRefDataType: ["team"], + }, + oneOfMap: {}, + typeMap: { + APIErrorResponse: APIErrorResponse, + ConnectedTeamRef: ConnectedTeamRef, + ConnectedTeamRefData: ConnectedTeamRefData, + ConnectionsPagePagination: ConnectionsPagePagination, + ConnectionsResponseMeta: ConnectionsResponseMeta, + TeamConnection: TeamConnection, + TeamConnectionAttributes: TeamConnectionAttributes, + TeamConnectionCreateData: TeamConnectionCreateData, + TeamConnectionCreateRequest: TeamConnectionCreateRequest, + TeamConnectionDeleteRequest: TeamConnectionDeleteRequest, + TeamConnectionDeleteRequestDataItem: TeamConnectionDeleteRequestDataItem, + TeamConnectionRelationships: TeamConnectionRelationships, + TeamConnectionsResponse: TeamConnectionsResponse, + TeamRef: TeamRef, + TeamRefData: TeamRefData, + }, +}; diff --git a/services/team_connections/tsconfig.json b/services/team_connections/tsconfig.json new file mode 100644 index 000000000000..d6c32bfb893c --- /dev/null +++ b/services/team_connections/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + + "esModuleInterop": true, + "resolveJsonModule": true, + + "noImplicitAny": true, + "noImplicitThis": true, + + /* Additional Checks */ + "noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!) + "noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + + "sourceMap": true, + "outDir": "./dist", + "lib": ["es6", "es7"] + }, + "exclude": ["dist", "node_modules", "tests"], + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index 3f481cc6c412..4092bd31e9f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1072,6 +1072,15 @@ __metadata: languageName: unknown linkType: soft +"@datadog/datadog-api-client-team-connections@workspace:services/team_connections": + version: 0.0.0-use.local + resolution: "@datadog/datadog-api-client-team-connections@workspace:services/team_connections" + dependencies: + "@datadog/datadog-api-client": "npm:^2.0.0-beta.0" + typescript: "npm:5.8.3" + languageName: unknown + linkType: soft + "@datadog/datadog-api-client-teams@workspace:services/teams": version: 0.0.0-use.local resolution: "@datadog/datadog-api-client-teams@workspace:services/teams"