diff --git a/.apigentools-info b/.apigentools-info index 4b45c275bb08..bf8917818d5b 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-09-26 14:16:48.035277", - "spec_repo_commit": "0270a00c" + "regenerated": "2023-09-27 19:56:39.496254", + "spec_repo_commit": "a0d45efc" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-09-26 14:16:48.056865", - "spec_repo_commit": "0270a00c" + "regenerated": "2023-09-27 19:56:39.513537", + "spec_repo_commit": "a0d45efc" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 848cd2d8dada..439887f10e31 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -4,6 +4,13 @@ components: headers: {} links: {} parameters: + APIKeyCategoryParameter: + description: Filter API keys by category. + in: query + name: filter[category] + required: false + schema: + type: string APIKeyFilterCreatedAtEndParameter: description: Only include API keys created on or before the specified date. in: query @@ -59,6 +66,13 @@ components: schema: example: created_by,modified_by type: string + APIKeyReadConfigReadEnabledParameter: + description: Filter API keys by remote config read enabled status. + in: query + name: filter[remote_config_read_enabled] + required: false + schema: + type: boolean APIKeysSortParameter: description: 'API key attribute used to sort results. Sort order is ascending @@ -16731,6 +16745,41 @@ components: required: - data type: object + TeamsField: + description: Supported teams field. + enum: + - id + - name + - handle + - summary + - description + - avatar + - banner + - visible_modules + - hidden_modules + - created_at + - modified_at + - user_count + - link_count + - team_links + - user_team_permissions + type: string + x-enum-varnames: + - ID + - NAME + - HANDLE + - SUMMARY + - DESCRIPTION + - AVATAR + - BANNER + - VISIBLE_MODULES + - HIDDEN_MODULES + - CREATED_AT + - MODIFIED_AT + - USER_COUNT + - LINK_COUNT + - TEAM_LINKS + - USER_TEAM_PERMISSIONS TeamsResponse: description: Response with multiple teams properties: @@ -17365,8 +17414,8 @@ components: description: User team permission attributes properties: permissions: - description: Object of team permission actions and boolean values indicating - of the currently logged in user can perform them on this team + description: Object of team permission actions and boolean values that a + logged in user can perform on this team. readOnly: true type: object type: object @@ -17621,6 +17670,8 @@ paths: - $ref: '#/components/parameters/APIKeyFilterModifiedAtStartParameter' - $ref: '#/components/parameters/APIKeyFilterModifiedAtEndParameter' - $ref: '#/components/parameters/APIKeyIncludeParameter' + - $ref: '#/components/parameters/APIKeyReadConfigReadEnabledParameter' + - $ref: '#/components/parameters/APIKeyCategoryParameter' responses: '200': content: @@ -18053,6 +18104,7 @@ paths: - $ref: '#/components/parameters/ApplicationKeyFilterParameter' - $ref: '#/components/parameters/ApplicationKeyFilterCreatedAtStartParameter' - $ref: '#/components/parameters/ApplicationKeyFilterCreatedAtEndParameter' + - $ref: '#/components/parameters/ApplicationKeyIncludeParameter' responses: '200': content: @@ -18934,6 +18986,7 @@ paths: - $ref: '#/components/parameters/ApplicationKeyFilterParameter' - $ref: '#/components/parameters/ApplicationKeyFilterCreatedAtStartParameter' - $ref: '#/components/parameters/ApplicationKeyFilterCreatedAtEndParameter' + - $ref: '#/components/parameters/ApplicationKeyIncludeParameter' responses: '200': content: @@ -23702,6 +23755,12 @@ paths: required: false schema: type: string + - description: Filter all roles by the given list of role IDs. + in: query + name: filter[id] + required: false + schema: + type: string responses: '200': content: @@ -26422,12 +26481,14 @@ paths: - description: Specifies the order of the returned teams in: query name: sort + required: false schema: $ref: '#/components/schemas/ListTeamsSort' - description: 'Included related resources optionally requested. Allowed enum values: `team_links, user_team_permissions`' in: query name: include + required: false schema: items: $ref: '#/components/schemas/ListTeamsInclude' @@ -26436,13 +26497,23 @@ paths: member in: query name: filter[keyword] + required: false schema: type: string - description: When true, only returns teams the current user belongs to in: query name: filter[me] + required: false schema: type: boolean + - description: List of fields that need to be fetched. + in: query + name: fields[team] + required: false + schema: + items: + $ref: '#/components/schemas/TeamsField' + type: array responses: '200': content: @@ -26837,11 +26908,13 @@ paths: - description: Specifies the order of returned team memberships in: query name: sort + required: false schema: $ref: '#/components/schemas/GetTeamMembershipsSort' - description: Search query, can be user email or name in: query name: filter[keyword] + required: false schema: type: string responses: diff --git a/cassettes/v2/Teams_3116892301/Get-all-teams-with-fields_team-parameter-returns-OK-response_3146995176/frozen.json b/cassettes/v2/Teams_3116892301/Get-all-teams-with-fields_team-parameter-returns-OK-response_3146995176/frozen.json new file mode 100644 index 000000000000..aa61e8602f6d --- /dev/null +++ b/cassettes/v2/Teams_3116892301/Get-all-teams-with-fields_team-parameter-returns-OK-response_3146995176/frozen.json @@ -0,0 +1 @@ +"2023-09-27T19:53:13.057Z" diff --git a/cassettes/v2/Teams_3116892301/Get-all-teams-with-fields_team-parameter-returns-OK-response_3146995176/recording.har b/cassettes/v2/Teams_3116892301/Get-all-teams-with-fields_team-parameter-returns-OK-response_3146995176/recording.har new file mode 100644 index 000000000000..69fc46103f3e --- /dev/null +++ b/cassettes/v2/Teams_3116892301/Get-all-teams-with-fields_team-parameter-returns-OK-response_3146995176/recording.har @@ -0,0 +1,64 @@ +{ + "log": { + "_recordingName": "Teams/Get all teams with fields_team parameter returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "4aeec0c800b2d080a618312ef1af24a6", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 514, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [ + { + "name": "fields", + "value": { + "team": "id" + } + } + ], + "url": "https://api.datadoghq.com/api/v2/team?fields%5Bteam%5D=id" + }, + "response": { + "bodySize": 637, + "content": { + "mimeType": "application/json", + "size": 637, + "text": "{\"data\":[{\"type\":\"team\",\"id\":\"ac73040e-c8d4-11ed-b2ea-da7ad0900002\"},{\"type\":\"team\",\"id\":\"cc338b02-405b-11ee-835e-da7ad0900002\"},{\"type\":\"team\",\"id\":\"ecc8affc-27d6-11ee-b33c-da7ad0900002\"}],\"meta\":{\"pagination\":{\"offset\":0,\"first_offset\":0,\"prev_offset\":0,\"next_offset\":100,\"last_offset\":0,\"limit\":100,\"type\":\"offset_limit\",\"total\":3}},\"links\":{\"self\":\"https://api.datadoghq.com/api/v2/team?fields%5Bteam%5D=id\",\"last\":null,\"next\":\"https://api.datadoghq.com/api/v2/team?fields%5Bteam%5D=id&page[offset]=100&page[limit]=100\",\"prev\":null,\"first\":\"https://api.datadoghq.com/api/v2/team?fields%5Bteam%5D=id&page[offset]=0&page[limit]=100\"}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 653, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2023-09-27T19:53:13.067Z", + "time": 188 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v2/teams/ListTeams_3429963470.ts b/examples/v2/teams/ListTeams_3429963470.ts new file mode 100644 index 000000000000..22aadae0b1a5 --- /dev/null +++ b/examples/v2/teams/ListTeams_3429963470.ts @@ -0,0 +1,21 @@ +/** + * Get all teams with fields_team parameter returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.TeamsApi(configuration); + +const params: v2.TeamsApiListTeamsRequest = { + fieldsTeam: ["id"], +}; + +apiInstance + .listTeams(params) + .then((data: v2.TeamsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 0a26f38473f4..6d19517fc2e8 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -2310,6 +2310,14 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { "type": "string", "format": "", }, + "filterRemoteConfigReadEnabled": { + "type": "boolean", + "format": "", + }, + "filterCategory": { + "type": "string", + "format": "", + }, "operationResponseType": "APIKeysResponse", }, "v2.CreateAPIKey": { @@ -2373,6 +2381,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { "type": "string", "format": "", }, + "include": { + "type": "string", + "format": "", + }, "operationResponseType": "ListApplicationKeysResponse", }, "v2.DeleteApplicationKey": { @@ -2429,6 +2441,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { "type": "string", "format": "", }, + "include": { + "type": "string", + "format": "", + }, "operationResponseType": "ListApplicationKeysResponse", }, "v2.CreateCurrentUserApplicationKey": { @@ -3745,6 +3761,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { "type": "string", "format": "", }, + "filterId": { + "type": "string", + "format": "", + }, "operationResponseType": "RolesResponse", }, "v2.CreateRole": { @@ -4590,6 +4610,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { "type": "boolean", "format": "", }, + "fieldsTeam": { + "type": "Array", + "format": "", + }, "operationResponseType": "TeamsResponse", }, "v2.CreateTeam": { diff --git a/features/v2/teams.feature b/features/v2/teams.feature index 0bc53da0f0dd..9d87ce535917 100644 --- a/features/v2/teams.feature +++ b/features/v2/teams.feature @@ -126,6 +126,14 @@ Feature: Teams Then the response status is 200 OK And the response has 3 items + @team:DataDog/core-app + Scenario: Get all teams with fields_team parameter returns "OK" response + Given new "ListTeams" request + And request contains "fields[team]" parameter with value ["id"] + When the request is sent + Then the response status is 200 OK + And the response "data[0]" has field "id" + @team:DataDog/core-app Scenario: Get links for a team returns "API error response." response Given new "GetTeamLinks" request diff --git a/packages/datadog-api-client-v2/apis/KeyManagementApi.ts b/packages/datadog-api-client-v2/apis/KeyManagementApi.ts index 8d2f50de2e4a..52889725ec4b 100644 --- a/packages/datadog-api-client-v2/apis/KeyManagementApi.ts +++ b/packages/datadog-api-client-v2/apis/KeyManagementApi.ts @@ -339,6 +339,8 @@ export class KeyManagementApiRequestFactory extends BaseAPIRequestFactory { filterModifiedAtStart?: string, filterModifiedAtEnd?: string, include?: string, + filterRemoteConfigReadEnabled?: boolean, + filterCategory?: string, _options?: Configuration ): Promise { const _config = _options || this.configuration; @@ -408,6 +410,18 @@ export class KeyManagementApiRequestFactory extends BaseAPIRequestFactory { ObjectSerializer.serialize(include, "string", "") ); } + if (filterRemoteConfigReadEnabled !== undefined) { + requestContext.setQueryParam( + "filter[remote_config_read_enabled]", + ObjectSerializer.serialize(filterRemoteConfigReadEnabled, "boolean", "") + ); + } + if (filterCategory !== undefined) { + requestContext.setQueryParam( + "filter[category]", + ObjectSerializer.serialize(filterCategory, "string", "") + ); + } // Apply auth methods applySecurityAuthentication(_config, requestContext, [ @@ -425,6 +439,7 @@ export class KeyManagementApiRequestFactory extends BaseAPIRequestFactory { filter?: string, filterCreatedAtStart?: string, filterCreatedAtEnd?: string, + include?: string, _options?: Configuration ): Promise { const _config = _options || this.configuration; @@ -476,6 +491,12 @@ export class KeyManagementApiRequestFactory extends BaseAPIRequestFactory { ObjectSerializer.serialize(filterCreatedAtEnd, "string", "") ); } + if (include !== undefined) { + requestContext.setQueryParam( + "include", + ObjectSerializer.serialize(include, "string", "") + ); + } // Apply auth methods applySecurityAuthentication(_config, requestContext, [ @@ -493,6 +514,7 @@ export class KeyManagementApiRequestFactory extends BaseAPIRequestFactory { filter?: string, filterCreatedAtStart?: string, filterCreatedAtEnd?: string, + include?: string, _options?: Configuration ): Promise { const _config = _options || this.configuration; @@ -544,6 +566,12 @@ export class KeyManagementApiRequestFactory extends BaseAPIRequestFactory { ObjectSerializer.serialize(filterCreatedAtEnd, "string", "") ); } + if (include !== undefined) { + requestContext.setQueryParam( + "include", + ObjectSerializer.serialize(include, "string", "") + ); + } // Apply auth methods applySecurityAuthentication(_config, requestContext, [ @@ -1684,6 +1712,16 @@ export interface KeyManagementApiListAPIKeysRequest { * @type string */ include?: string; + /** + * Filter API keys by remote config read enabled status. + * @type boolean + */ + filterRemoteConfigReadEnabled?: boolean; + /** + * Filter API keys by category. + * @type string + */ + filterCategory?: string; } export interface KeyManagementApiListApplicationKeysRequest { @@ -1719,6 +1757,11 @@ export interface KeyManagementApiListApplicationKeysRequest { * @type string */ filterCreatedAtEnd?: string; + /** + * Resource path for related resources to include in the response. Only `owned_by` is supported. + * @type string + */ + include?: string; } export interface KeyManagementApiListCurrentUserApplicationKeysRequest { @@ -1754,6 +1797,11 @@ export interface KeyManagementApiListCurrentUserApplicationKeysRequest { * @type string */ filterCreatedAtEnd?: string; + /** + * Resource path for related resources to include in the response. Only `owned_by` is supported. + * @type string + */ + include?: string; } export interface KeyManagementApiUpdateAPIKeyRequest { @@ -2000,6 +2048,8 @@ export class KeyManagementApi { param.filterModifiedAtStart, param.filterModifiedAtEnd, param.include, + param.filterRemoteConfigReadEnabled, + param.filterCategory, options ); return requestContextPromise.then((requestContext) => { @@ -2026,6 +2076,7 @@ export class KeyManagementApi { param.filter, param.filterCreatedAtStart, param.filterCreatedAtEnd, + param.include, options ); return requestContextPromise.then((requestContext) => { @@ -2053,6 +2104,7 @@ export class KeyManagementApi { param.filter, param.filterCreatedAtStart, param.filterCreatedAtEnd, + param.include, options ); return requestContextPromise.then((requestContext) => { diff --git a/packages/datadog-api-client-v2/apis/RolesApi.ts b/packages/datadog-api-client-v2/apis/RolesApi.ts index bdb0f6037213..82cd00e9c58b 100644 --- a/packages/datadog-api-client-v2/apis/RolesApi.ts +++ b/packages/datadog-api-client-v2/apis/RolesApi.ts @@ -358,6 +358,7 @@ export class RolesApiRequestFactory extends BaseAPIRequestFactory { pageNumber?: number, sort?: RolesSort, filter?: string, + filterId?: string, _options?: Configuration ): Promise { const _config = _options || this.configuration; @@ -397,6 +398,12 @@ export class RolesApiRequestFactory extends BaseAPIRequestFactory { ObjectSerializer.serialize(filter, "string", "") ); } + if (filterId !== undefined) { + requestContext.setQueryParam( + "filter[id]", + ObjectSerializer.serialize(filterId, "string", "") + ); + } // Apply auth methods applySecurityAuthentication(_config, requestContext, [ @@ -1516,6 +1523,11 @@ export interface RolesApiListRolesRequest { * @type string */ filter?: string; + /** + * Filter all roles by the given list of role IDs. + * @type string + */ + filterId?: string; } export interface RolesApiListRoleUsersRequest { @@ -1781,6 +1793,7 @@ export class RolesApi { param.pageNumber, param.sort, param.filter, + param.filterId, options ); return requestContextPromise.then((requestContext) => { diff --git a/packages/datadog-api-client-v2/apis/TeamsApi.ts b/packages/datadog-api-client-v2/apis/TeamsApi.ts index fa9759fef5da..97ce3e7d5de2 100644 --- a/packages/datadog-api-client-v2/apis/TeamsApi.ts +++ b/packages/datadog-api-client-v2/apis/TeamsApi.ts @@ -29,6 +29,7 @@ import { TeamPermissionSettingResponse } from "../models/TeamPermissionSettingRe import { TeamPermissionSettingsResponse } from "../models/TeamPermissionSettingsResponse"; import { TeamPermissionSettingUpdateRequest } from "../models/TeamPermissionSettingUpdateRequest"; import { TeamResponse } from "../models/TeamResponse"; +import { TeamsField } from "../models/TeamsField"; import { TeamsResponse } from "../models/TeamsResponse"; import { TeamUpdateRequest } from "../models/TeamUpdateRequest"; import { UserTeamRequest } from "../models/UserTeamRequest"; @@ -539,6 +540,7 @@ export class TeamsApiRequestFactory extends BaseAPIRequestFactory { include?: Array, filterKeyword?: string, filterMe?: boolean, + fieldsTeam?: Array, _options?: Configuration ): Promise { const _config = _options || this.configuration; @@ -590,6 +592,12 @@ export class TeamsApiRequestFactory extends BaseAPIRequestFactory { ObjectSerializer.serialize(filterMe, "boolean", "") ); } + if (fieldsTeam !== undefined) { + requestContext.setQueryParam( + "fields[team]", + ObjectSerializer.serialize(fieldsTeam, "Array", "") + ); + } // Apply auth methods applySecurityAuthentication(_config, requestContext, [ @@ -1969,6 +1977,11 @@ export interface TeamsApiListTeamsRequest { * @type boolean */ filterMe?: boolean; + /** + * List of fields that need to be fetched. + * @type Array + */ + fieldsTeam?: Array; } export interface TeamsApiUpdateTeamRequest { @@ -2331,6 +2344,7 @@ export class TeamsApi { param.include, param.filterKeyword, param.filterMe, + param.fieldsTeam, options ); return requestContextPromise.then((requestContext) => { @@ -2363,6 +2377,7 @@ export class TeamsApi { param.include, param.filterKeyword, param.filterMe, + param.fieldsTeam, options ); const responseContext = await this.configuration.httpApi.send( diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index cb45555a2aa2..a6c9fb03e9b5 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -1450,6 +1450,7 @@ export { TeamPermissionSettingValue } from "./models/TeamPermissionSettingValue" export { TeamRelationships } from "./models/TeamRelationships"; export { TeamRelationshipsLinks } from "./models/TeamRelationshipsLinks"; export { TeamResponse } from "./models/TeamResponse"; +export { TeamsField } from "./models/TeamsField"; export { TeamsResponse } from "./models/TeamsResponse"; export { TeamsResponseLinks } from "./models/TeamsResponseLinks"; export { TeamsResponseMeta } from "./models/TeamsResponseMeta"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index aad8c7eee9b7..23cb376ea279 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -1328,6 +1328,23 @@ const enumsMap: { [key: string]: any[] } = { "teams_manage", ], TeamType: ["team"], + TeamsField: [ + "id", + "name", + "handle", + "summary", + "description", + "avatar", + "banner", + "visible_modules", + "hidden_modules", + "created_at", + "modified_at", + "user_count", + "link_count", + "team_links", + "user_team_permissions", + ], TimeseriesFormulaRequestType: ["timeseries_request"], TimeseriesFormulaResponseType: ["timeseries_response"], UsageTimeSeriesType: ["usage_timeseries"], diff --git a/packages/datadog-api-client-v2/models/TeamsField.ts b/packages/datadog-api-client-v2/models/TeamsField.ts new file mode 100644 index 000000000000..9a4ecbe046bb --- /dev/null +++ b/packages/datadog-api-client-v2/models/TeamsField.ts @@ -0,0 +1,44 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Supported teams field. + */ + +export type TeamsField = + | typeof ID + | typeof NAME + | typeof HANDLE + | typeof SUMMARY + | typeof DESCRIPTION + | typeof AVATAR + | typeof BANNER + | typeof VISIBLE_MODULES + | typeof HIDDEN_MODULES + | typeof CREATED_AT + | typeof MODIFIED_AT + | typeof USER_COUNT + | typeof LINK_COUNT + | typeof TEAM_LINKS + | typeof USER_TEAM_PERMISSIONS + | UnparsedObject; +export const ID = "id"; +export const NAME = "name"; +export const HANDLE = "handle"; +export const SUMMARY = "summary"; +export const DESCRIPTION = "description"; +export const AVATAR = "avatar"; +export const BANNER = "banner"; +export const VISIBLE_MODULES = "visible_modules"; +export const HIDDEN_MODULES = "hidden_modules"; +export const CREATED_AT = "created_at"; +export const MODIFIED_AT = "modified_at"; +export const USER_COUNT = "user_count"; +export const LINK_COUNT = "link_count"; +export const TEAM_LINKS = "team_links"; +export const USER_TEAM_PERMISSIONS = "user_team_permissions"; diff --git a/packages/datadog-api-client-v2/models/UserTeamPermissionAttributes.ts b/packages/datadog-api-client-v2/models/UserTeamPermissionAttributes.ts index 7452b110d301..2e1736087b56 100644 --- a/packages/datadog-api-client-v2/models/UserTeamPermissionAttributes.ts +++ b/packages/datadog-api-client-v2/models/UserTeamPermissionAttributes.ts @@ -11,7 +11,7 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; */ export class UserTeamPermissionAttributes { /** - * Object of team permission actions and boolean values indicating of the currently logged in user can perform them on this team + * Object of team permission actions and boolean values that a logged in user can perform on this team. */ "permissions"?: any;