Skip to content

Commit 9f66c08

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 028cdc8 of spec repo
1 parent 9c0f90b commit 9f66c08

File tree

13 files changed

+368
-11
lines changed

13 files changed

+368
-11
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52263,14 +52263,31 @@ components:
5226352263
TeamSyncAttributes:
5226452264
description: Team sync attributes.
5226552265
properties:
52266+
frequency:
52267+
$ref: '#/components/schemas/TeamSyncAttributesFrequency'
5226652268
source:
5226752269
$ref: '#/components/schemas/TeamSyncAttributesSource'
52270+
sync_membership:
52271+
$ref: '#/components/schemas/TeamSyncAttributesSyncMembership'
5226852272
type:
5226952273
$ref: '#/components/schemas/TeamSyncAttributesType'
5227052274
required:
5227152275
- source
5227252276
- type
5227352277
type: object
52278+
TeamSyncAttributesFrequency:
52279+
description: How often the sync process should be run. Defaults to `once` when
52280+
not provided.
52281+
enum:
52282+
- once
52283+
- continuously
52284+
- paused
52285+
example: once
52286+
type: string
52287+
x-enum-varnames:
52288+
- ONCE
52289+
- CONTINUOUSLY
52290+
- PAUSED
5227452291
TeamSyncAttributesSource:
5227552292
description: The external source platform for team synchronization. Only "github"
5227652293
is supported.
@@ -52280,15 +52297,22 @@ components:
5228052297
type: string
5228152298
x-enum-varnames:
5228252299
- GITHUB
52300+
TeamSyncAttributesSyncMembership:
52301+
description: Whether to sync members from the external team to the Datadog team.
52302+
Defaults to `false` when not provided.
52303+
example: true
52304+
type: boolean
5228352305
TeamSyncAttributesType:
52284-
description: The type of synchronization operation. Only "link" is supported,
52285-
which links existing teams by matching names.
52306+
description: The type of synchronization operation. "link" connects teams by
52307+
matching names. "provision" will create new teams when no match is found.
5228652308
enum:
5228752309
- link
52310+
- provision
5228852311
example: link
5228952312
type: string
5229052313
x-enum-varnames:
5229152314
- LINK
52315+
- PROVISION
5229252316
TeamSyncBulkType:
5229352317
description: Team sync bulk type.
5229452318
enum:
@@ -52298,10 +52322,15 @@ components:
5229852322
x-enum-varnames:
5229952323
- TEAM_SYNC_BULK
5230052324
TeamSyncData:
52301-
description: Team sync data.
52325+
description: A configuration governing syncing between Datadog teams and teams
52326+
from an external system.
5230252327
properties:
5230352328
attributes:
5230452329
$ref: '#/components/schemas/TeamSyncAttributes'
52330+
id:
52331+
description: The sync's identifier
52332+
example: aeadc05e-98a8-11ec-ac2c-da7ad0900001
52333+
type: string
5230552334
type:
5230652335
$ref: '#/components/schemas/TeamSyncBulkType'
5230752336
required:
@@ -52322,6 +52351,15 @@ components:
5232252351
required:
5232352352
- data
5232452353
type: object
52354+
TeamSyncResponse:
52355+
description: Team sync configurations response.
52356+
properties:
52357+
data:
52358+
description: List of team sync configurations
52359+
items:
52360+
$ref: '#/components/schemas/TeamSyncData'
52361+
type: array
52362+
type: object
5232552363
TeamTarget:
5232652364
description: Represents a team target for an escalation policy step, including
5232752365
the team's ID and resource type.
@@ -81179,6 +81217,52 @@ paths:
8117981217

8118081218
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
8118181219
/api/v2/team/sync:
81220+
get:
81221+
description: 'Get all team synchronization configurations.
81222+
81223+
Returns a list of configurations used for linking or provisioning teams with
81224+
external sources like GitHub.'
81225+
operationId: GetTeamSync
81226+
parameters:
81227+
- description: Filter by the external source platform for team synchronization
81228+
in: query
81229+
name: filter[source]
81230+
required: true
81231+
schema:
81232+
$ref: '#/components/schemas/TeamSyncAttributesSource'
81233+
responses:
81234+
'200':
81235+
content:
81236+
application/json:
81237+
schema:
81238+
$ref: '#/components/schemas/TeamSyncResponse'
81239+
description: OK
81240+
'403':
81241+
$ref: '#/components/responses/ForbiddenResponse'
81242+
'404':
81243+
content:
81244+
application/json:
81245+
schema:
81246+
$ref: '#/components/schemas/APIErrorResponse'
81247+
description: Team sync configurations not found
81248+
'429':
81249+
$ref: '#/components/responses/TooManyRequestsResponse'
81250+
security:
81251+
- apiKeyAuth: []
81252+
appKeyAuth: []
81253+
- AuthZ:
81254+
- teams_read
81255+
summary: Get team sync configurations
81256+
tags:
81257+
- Teams
81258+
x-permission:
81259+
operator: OR
81260+
permissions:
81261+
- teams_read
81262+
x-unstable: '**Note**: This endpoint is in Preview. To request access, fill
81263+
out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/).
81264+
81265+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
8118281266
post:
8118381267
description: 'This endpoint attempts to link your existing Datadog teams with
8118481268
GitHub teams by matching their names.
@@ -81205,7 +81289,8 @@ paths:
8120581289
using a normalized exact match; case is ignored and spaces are removed. No
8120681290
modifications are made
8120781291

81208-
to teams in GitHub. This will not create new Teams in Datadog.'
81292+
to teams in GitHub. This will only create new teams in Datadog when type is
81293+
set to `provision`.'
8120981294
operationId: SyncTeams
8121081295
requestBody:
8121181296
content:

features/v2/teams.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,22 @@ Feature: Teams
235235
Then the response status is 200 OK
236236
And the response has 3 items
237237

238+
@generated @skip @team:DataDog/aaa-omg
239+
Scenario: Get team sync configurations returns "OK" response
240+
Given operation "GetTeamSync" enabled
241+
And new "GetTeamSync" request
242+
And request contains "filter[source]" parameter from "REPLACE.ME"
243+
When the request is sent
244+
Then the response status is 200 OK
245+
246+
@generated @skip @team:DataDog/aaa-omg
247+
Scenario: Get team sync configurations returns "Team sync configurations not found" response
248+
Given operation "GetTeamSync" enabled
249+
And new "GetTeamSync" request
250+
And request contains "filter[source]" parameter from "REPLACE.ME"
251+
When the request is sent
252+
Then the response status is 404 Team sync configurations not found
253+
238254
@generated @skip @team:DataDog/aaa-omg
239255
Scenario: Get user memberships returns "API error response." response
240256
Given new "GetUserMemberships" request

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4287,6 +4287,12 @@
42874287
"type": "unsafe"
42884288
}
42894289
},
4290+
"GetTeamSync": {
4291+
"tag": "Teams",
4292+
"undo": {
4293+
"type": "safe"
4294+
}
4295+
},
42904296
"SyncTeams": {
42914297
"tag": "Teams",
42924298
"undo": {

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8693,6 +8693,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
86938693
},
86948694
operationResponseType: "TeamResponse",
86958695
},
8696+
"TeamsApi.V2.GetTeamSync": {
8697+
filterSource: {
8698+
type: "TeamSyncAttributesSource",
8699+
format: "",
8700+
},
8701+
operationResponseType: "TeamSyncResponse",
8702+
},
86968703
"TeamsApi.V2.SyncTeams": {
86978704
body: {
86988705
type: "TeamSyncRequest",

services/teams/src/v2/TeamsApi.ts

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ import { TeamPermissionSettingUpdateRequest } from "./models/TeamPermissionSetti
3838
import { TeamResponse } from "./models/TeamResponse";
3939
import { TeamsField } from "./models/TeamsField";
4040
import { TeamsResponse } from "./models/TeamsResponse";
41+
import { TeamSyncAttributesSource } from "./models/TeamSyncAttributesSource";
4142
import { TeamSyncRequest } from "./models/TeamSyncRequest";
43+
import { TeamSyncResponse } from "./models/TeamSyncResponse";
4244
import { TeamUpdateRequest } from "./models/TeamUpdateRequest";
4345
import { UserTeam } from "./models/UserTeam";
4446
import { UserTeamRequest } from "./models/UserTeamRequest";
@@ -702,6 +704,63 @@ export class TeamsApiRequestFactory extends BaseAPIRequestFactory {
702704
return requestContext;
703705
}
704706

707+
public async getTeamSync(
708+
filterSource: TeamSyncAttributesSource,
709+
_options?: Configuration,
710+
): Promise<RequestContext> {
711+
const _config = _options || this.configuration;
712+
713+
if (!_config.unstableOperations["TeamsApi.v2.getTeamSync"]) {
714+
throw new Error(
715+
"Unstable operation 'getTeamSync' is disabled. Enable it by setting `configuration.unstableOperations['TeamsApi.v2.getTeamSync'] = true`",
716+
);
717+
}
718+
719+
// verify required parameter 'filterSource' is not null or undefined
720+
if (filterSource === null || filterSource === undefined) {
721+
throw new RequiredError("filterSource", "getTeamSync");
722+
}
723+
724+
// Path Params
725+
const localVarPath = "/api/v2/team/sync";
726+
727+
// Make Request Context
728+
const { server, overrides } = _config.getServerAndOverrides(
729+
"TeamsApi.v2.getTeamSync",
730+
TeamsApi.operationServers,
731+
);
732+
const requestContext = server.makeRequestContext(
733+
localVarPath,
734+
HttpMethod.GET,
735+
overrides,
736+
);
737+
requestContext.setHeaderParam("Accept", "application/json");
738+
requestContext.setHttpConfig(_config.httpConfig);
739+
740+
// Set User-Agent
741+
if (this.userAgent) {
742+
requestContext.setHeaderParam("User-Agent", this.userAgent);
743+
}
744+
745+
// Query Params
746+
if (filterSource !== undefined) {
747+
requestContext.setQueryParam(
748+
"filter[source]",
749+
serialize(filterSource, TypingInfo, "TeamSyncAttributesSource", ""),
750+
"",
751+
);
752+
}
753+
754+
// Apply auth methods
755+
applySecurityAuthentication(_config, requestContext, [
756+
"apiKeyAuth",
757+
"appKeyAuth",
758+
"AuthZ",
759+
]);
760+
761+
return requestContext;
762+
}
763+
705764
public async getUserMemberships(
706765
userUuid: string,
707766
_options?: Configuration,
@@ -1955,6 +2014,66 @@ export class TeamsApiResponseProcessor {
19552014
);
19562015
}
19572016

2017+
/**
2018+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
2019+
* to the expected objects
2020+
*
2021+
* @params response Response returned by the server for a request to getTeamSync
2022+
* @throws ApiException if the response code was not in [200, 299]
2023+
*/
2024+
public async getTeamSync(
2025+
response: ResponseContext,
2026+
): Promise<TeamSyncResponse> {
2027+
const contentType = normalizeMediaType(response.headers["content-type"]);
2028+
if (response.httpStatusCode === 200) {
2029+
const body: TeamSyncResponse = deserialize(
2030+
parse(await response.body.text(), contentType),
2031+
TypingInfo,
2032+
"TeamSyncResponse",
2033+
) as TeamSyncResponse;
2034+
return body;
2035+
}
2036+
if (
2037+
response.httpStatusCode === 403 ||
2038+
response.httpStatusCode === 404 ||
2039+
response.httpStatusCode === 429
2040+
) {
2041+
const bodyText = parse(await response.body.text(), contentType);
2042+
let body: APIErrorResponse;
2043+
try {
2044+
body = deserialize(
2045+
bodyText,
2046+
TypingInfo,
2047+
"APIErrorResponse",
2048+
) as APIErrorResponse;
2049+
} catch (error) {
2050+
logger.debug(`Got error deserializing error: ${error}`);
2051+
throw new ApiException<APIErrorResponse>(
2052+
response.httpStatusCode,
2053+
bodyText,
2054+
);
2055+
}
2056+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
2057+
}
2058+
2059+
// Work around for missing responses in specification, e.g. for petstore.yaml
2060+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
2061+
const body: TeamSyncResponse = deserialize(
2062+
parse(await response.body.text(), contentType),
2063+
TypingInfo,
2064+
"TeamSyncResponse",
2065+
"",
2066+
) as TeamSyncResponse;
2067+
return body;
2068+
}
2069+
2070+
const body = (await response.body.text()) || "";
2071+
throw new ApiException<string>(
2072+
response.httpStatusCode,
2073+
'Unknown API Status Code!\nBody: "' + body + '"',
2074+
);
2075+
}
2076+
19582077
/**
19592078
* Unwraps the actual response sent by the server from the response context and deserializes the response content
19602079
* to the expected objects
@@ -2602,6 +2721,14 @@ export interface TeamsApiGetTeamPermissionSettingsRequest {
26022721
teamId: string;
26032722
}
26042723

2724+
export interface TeamsApiGetTeamSyncRequest {
2725+
/**
2726+
* Filter by the external source platform for team synchronization
2727+
* @type TeamSyncAttributesSource
2728+
*/
2729+
filterSource: TeamSyncAttributesSource;
2730+
}
2731+
26052732
export interface TeamsApiGetUserMembershipsRequest {
26062733
/**
26072734
* None
@@ -3081,6 +3208,28 @@ export class TeamsApi {
30813208
});
30823209
}
30833210

3211+
/**
3212+
* Get all team synchronization configurations.
3213+
* Returns a list of configurations used for linking or provisioning teams with external sources like GitHub.
3214+
* @param param The request object
3215+
*/
3216+
public getTeamSync(
3217+
param: TeamsApiGetTeamSyncRequest,
3218+
options?: Configuration,
3219+
): Promise<TeamSyncResponse> {
3220+
const requestContextPromise = this.requestFactory.getTeamSync(
3221+
param.filterSource,
3222+
options,
3223+
);
3224+
return requestContextPromise.then((requestContext) => {
3225+
return this.configuration.httpApi
3226+
.send(requestContext)
3227+
.then((responseContext) => {
3228+
return this.responseProcessor.getTeamSync(responseContext);
3229+
});
3230+
});
3231+
}
3232+
30843233
/**
30853234
* Get a list of memberships for a user
30863235
* @param param The request object
@@ -3271,7 +3420,7 @@ export class TeamsApi {
32713420
* [A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/),
32723421
* and the GitHub App integrated with Datadog must have the `Members Read` permission. Matching is performed by comparing the Datadog team handle to the GitHub team slug
32733422
* using a normalized exact match; case is ignored and spaces are removed. No modifications are made
3274-
* to teams in GitHub. This will not create new Teams in Datadog.
3423+
* to teams in GitHub. This will only create new teams in Datadog when type is set to `provision`.
32753424
* @param param The request object
32763425
*/
32773426
public syncTeams(

0 commit comments

Comments
 (0)