diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 90e1196820ee..53a4ea6a1a50 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -75076,6 +75076,18 @@ components: required: - data type: object + OwnershipConfidenceLevel: + description: The ownership confidence level. + enum: + - high + - medium + - low + example: high + type: string + x-enum-varnames: + - HIGH + - MEDIUM + - LOW OwnershipEvidenceAttributes: description: The attributes of an ownership evidence response. properties: @@ -75639,6 +75651,152 @@ components: - TEAM - SERVICE - UNKNOWN + OwnershipSettingsAttributes: + description: The attributes of the ownership settings response. + properties: + auto_tag: + description: Whether automatic ownership tagging is enabled. + example: true + type: boolean + confidence_level: + $ref: "#/components/schemas/OwnershipConfidenceLevel" + version: + description: The current version of the ownership settings. + example: 1 + format: int64 + type: integer + required: + - version + - auto_tag + - confidence_level + type: object + OwnershipSettingsData: + description: The data wrapper for an ownership settings response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipSettingsAttributes" + id: + description: The identifier of the ownership settings resource. + example: settings + type: string + type: + $ref: "#/components/schemas/OwnershipSettingsType" + required: + - id + - type + - attributes + type: object + OwnershipSettingsRequest: + description: The request body for updating ownership settings. + properties: + data: + $ref: "#/components/schemas/OwnershipSettingsRequestData" + required: + - data + type: object + OwnershipSettingsRequestAttributes: + description: The attributes of an ownership settings request. + properties: + auto_tag: + description: Whether automatic ownership tagging is enabled. + example: true + type: boolean + confidence_level: + $ref: "#/components/schemas/OwnershipConfidenceLevel" + required: + - auto_tag + - confidence_level + type: object + OwnershipSettingsRequestData: + description: The data wrapper for an ownership settings request. + properties: + attributes: + $ref: "#/components/schemas/OwnershipSettingsRequestAttributes" + type: + $ref: "#/components/schemas/OwnershipSettingsType" + required: + - type + - attributes + type: object + OwnershipSettingsResponse: + description: The response returned when retrieving or updating ownership settings. + properties: + data: + $ref: "#/components/schemas/OwnershipSettingsData" + required: + - data + type: object + OwnershipSettingsType: + default: ownership_settings + description: The type of the ownership settings resource. The value should always be `ownership_settings`. + enum: + - ownership_settings + example: ownership_settings + type: string + x-enum-varnames: + - OWNERSHIP_SETTINGS + OwnershipUntaggedFindingsAttributes: + description: The counts of findings without a team tag by ownership confidence. + properties: + high_confidence: + description: The number of high confidence findings without a team tag. + example: 30 + format: int64 + type: integer + low_confidence: + description: The number of low confidence findings without a team tag. + example: 42 + format: int64 + type: integer + medium_confidence: + description: The number of medium confidence findings without a team tag. + example: 70 + format: int64 + type: integer + total: + description: The total number of findings without a team tag. + example: 142 + format: int64 + type: integer + required: + - total + - high_confidence + - medium_confidence + - low_confidence + type: object + OwnershipUntaggedFindingsData: + description: The data wrapper for an ownership untagged findings response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipUntaggedFindingsAttributes" + id: + description: The identifier of the ownership untagged findings resource. + example: untagged + type: string + type: + $ref: "#/components/schemas/OwnershipUntaggedFindingsType" + required: + - id + - type + - attributes + type: object + OwnershipUntaggedFindingsResponse: + description: The response returned when counting findings without a team tag by ownership confidence. + properties: + data: + $ref: "#/components/schemas/OwnershipUntaggedFindingsData" + required: + - data + type: object + OwnershipUntaggedFindingsType: + default: ownership_untagged_findings + description: The type of the ownership untagged findings resource. The value should always be `ownership_untagged_findings`. + enum: + - ownership_untagged_findings + example: ownership_untagged_findings + type: string + x-enum-varnames: + - OWNERSHIP_UNTAGGED_FINDINGS PageAnnotationsAttributes: description: Attributes of the annotations on a page. properties: @@ -132295,6 +132453,128 @@ paths: $ref: "#/components/responses/TooManyRequestsResponse" summary: Get all CSM Serverless Agents tags: ["CSM Agents"] + /api/v2/csm/ownership/settings: + get: + description: Get ownership settings for the org. When settings are unset, the API returns the default opt-out configuration with `auto_tag` set to `true` and `confidence_level` set to `high`. + operationId: GetOwnershipSettings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + version: 1 + id: settings + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get ownership settings for the org + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Update ownership settings for the org. + operationId: PostOwnershipSettings + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + version: 1 + id: settings + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update ownership settings for the org + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/csm/ownership/settings/untagged: + get: + description: Count findings with no team tag, grouped by ownership confidence level. + operationId: GetOwnershipUntaggedFindings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + high_confidence: 30 + low_confidence: 42 + medium_confidence: 70 + total: 142 + id: untagged + type: ownership_untagged_findings + schema: + $ref: "#/components/schemas/OwnershipUntaggedFindingsResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Count untagged findings by ownership confidence + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/csm/ownership/{resource_id}: get: description: Get all current ownership inferences for a resource, one per owner type (`user`, `team`, `service`, `unknown`). diff --git a/examples/v2/csm-ownership/GetOwnershipSettings.ts b/examples/v2/csm-ownership/GetOwnershipSettings.ts new file mode 100644 index 000000000000..332a308bb955 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipSettings.ts @@ -0,0 +1,18 @@ +/** + * Get ownership settings for the org returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.getOwnershipSettings"] = true; +const apiInstance = new v2.CSMOwnershipApi(configuration); + +apiInstance + .getOwnershipSettings() + .then((data: v2.OwnershipSettingsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.ts b/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.ts new file mode 100644 index 000000000000..a15aa30f898c --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.ts @@ -0,0 +1,18 @@ +/** + * Count untagged findings by ownership confidence returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.getOwnershipUntaggedFindings"] = true; +const apiInstance = new v2.CSMOwnershipApi(configuration); + +apiInstance + .getOwnershipUntaggedFindings() + .then((data: v2.OwnershipUntaggedFindingsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/csm-ownership/PostOwnershipSettings.ts b/examples/v2/csm-ownership/PostOwnershipSettings.ts new file mode 100644 index 000000000000..b3dda867bb57 --- /dev/null +++ b/examples/v2/csm-ownership/PostOwnershipSettings.ts @@ -0,0 +1,30 @@ +/** + * Update ownership settings for the org returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.postOwnershipSettings"] = true; +const apiInstance = new v2.CSMOwnershipApi(configuration); + +const params: v2.CSMOwnershipApiPostOwnershipSettingsRequest = { + body: { + data: { + attributes: { + autoTag: true, + confidenceLevel: "high", + }, + type: "ownership_settings", + }, + }, +}; + +apiInstance + .postOwnershipSettings(params) + .then((data: v2.OwnershipSettingsResponse) => { + 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 cb95788f3b78..08f8b5c7c42e 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -8619,6 +8619,19 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { "v2.GetCSMServerlessCoverageAnalysis": { "operationResponseType": "CsmServerlessCoverageAnalysisResponse", }, + "v2.GetOwnershipSettings": { + "operationResponseType": "OwnershipSettingsResponse", + }, + "v2.PostOwnershipSettings": { + "body": { + "type": "OwnershipSettingsRequest", + "format": "", + }, + "operationResponseType": "OwnershipSettingsResponse", + }, + "v2.GetOwnershipUntaggedFindings": { + "operationResponseType": "OwnershipUntaggedFindingsResponse", + }, "v2.ListOwnershipInferences": { "resourceId": { "type": "string", diff --git a/features/v2/csm_ownership.feature b/features/v2/csm_ownership.feature index 58498ca15502..661e420b5c2f 100644 --- a/features/v2/csm_ownership.feature +++ b/features/v2/csm_ownership.feature @@ -12,6 +12,13 @@ Feature: CSM Ownership And a valid "appKeyAuth" key in the system And an instance of "CSMOwnership" API + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Count untagged findings by ownership confidence returns "OK" response + Given operation "GetOwnershipUntaggedFindings" enabled + And new "GetOwnershipUntaggedFindings" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs Scenario: Get an ownership inference by owner type returns "Bad Request" response Given operation "GetOwnershipInference" enabled @@ -39,6 +46,13 @@ Feature: CSM Ownership When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get ownership settings for the org returns "OK" response + Given operation "GetOwnershipSettings" enabled + And new "GetOwnershipSettings" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs Scenario: Get the evidence for an ownership inference returns "Bad Request" response Given operation "GetOwnershipEvidence" enabled @@ -163,3 +177,19 @@ Feature: CSM Ownership And body with value {"data": {"attributes": {"action": "confirm", "actor_handle": "user@example.com", "actor_type": "user", "corrected_owner_handle": "team-b", "corrected_owner_type": "team", "inference_checksum": "abc123", "reason": "Confirmed by team lead."}, "type": "ownership_feedback"}} When the request is sent Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Update ownership settings for the org returns "Bad Request" response + Given operation "PostOwnershipSettings" enabled + And new "PostOwnershipSettings" request + And body with value {"data": {"attributes": {"auto_tag": true, "confidence_level": "high"}, "type": "ownership_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Update ownership settings for the org returns "OK" response + Given operation "PostOwnershipSettings" enabled + And new "PostOwnershipSettings" request + And body with value {"data": {"attributes": {"auto_tag": true, "confidence_level": "high"}, "type": "ownership_settings"}} + 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 e72767d8e0d5..10ae8ac71d43 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2049,6 +2049,24 @@ "type": "safe" } }, + "GetOwnershipSettings": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, + "PostOwnershipSettings": { + "tag": "CSM Ownership", + "undo": { + "type": "idempotent" + } + }, + "GetOwnershipUntaggedFindings": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, "ListOwnershipInferences": { "tag": "CSM Ownership", "undo": { diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index 5630c3756207..edf9c527b23b 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -440,9 +440,12 @@ export function createConfiguration( "v2.createOwnershipFeedback": false, "v2.getOwnershipEvidence": false, "v2.getOwnershipInference": false, + "v2.getOwnershipSettings": false, + "v2.getOwnershipUntaggedFindings": false, "v2.listOwnershipHistory": false, "v2.listOwnershipHistoryByOwnerType": false, "v2.listOwnershipInferences": false, + "v2.postOwnershipSettings": false, "v2.getCSMAgentlessHostFacetInfo": false, "v2.getCSMUnifiedHostFacetInfo": false, "v2.listCSMAgentlessHostFacets": false, diff --git a/packages/datadog-api-client-v2/apis/CSMOwnershipApi.ts b/packages/datadog-api-client-v2/apis/CSMOwnershipApi.ts index a656f3bf1b6c..452d06d696c7 100644 --- a/packages/datadog-api-client-v2/apis/CSMOwnershipApi.ts +++ b/packages/datadog-api-client-v2/apis/CSMOwnershipApi.ts @@ -25,6 +25,9 @@ import { OwnershipHistoryResponse } from "../models/OwnershipHistoryResponse"; import { OwnershipInferenceListResponse } from "../models/OwnershipInferenceListResponse"; import { OwnershipInferenceResponse } from "../models/OwnershipInferenceResponse"; import { OwnershipOwnerType } from "../models/OwnershipOwnerType"; +import { OwnershipSettingsRequest } from "../models/OwnershipSettingsRequest"; +import { OwnershipSettingsResponse } from "../models/OwnershipSettingsResponse"; +import { OwnershipUntaggedFindingsResponse } from "../models/OwnershipUntaggedFindingsResponse"; export class CSMOwnershipApiRequestFactory extends BaseAPIRequestFactory { public async createOwnershipFeedback( @@ -195,6 +198,66 @@ export class CSMOwnershipApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async getOwnershipSettings( + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'getOwnershipSettings'"); + if (!_config.unstableOperations["v2.getOwnershipSettings"]) { + throw new Error("Unstable operation 'getOwnershipSettings' is disabled"); + } + + // Path Params + const localVarPath = "/api/v2/csm/ownership/settings"; + + // Make Request Context + const requestContext = _config + .getServer("v2.CSMOwnershipApi.getOwnershipSettings") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getOwnershipUntaggedFindings( + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'getOwnershipUntaggedFindings'"); + if (!_config.unstableOperations["v2.getOwnershipUntaggedFindings"]) { + throw new Error( + "Unstable operation 'getOwnershipUntaggedFindings' is disabled" + ); + } + + // Path Params + const localVarPath = "/api/v2/csm/ownership/settings/untagged"; + + // Make Request Context + const requestContext = _config + .getServer("v2.CSMOwnershipApi.getOwnershipUntaggedFindings") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async listOwnershipHistory( resourceId: string, cursor?: string, @@ -354,6 +417,52 @@ export class CSMOwnershipApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + + public async postOwnershipSettings( + body: OwnershipSettingsRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'postOwnershipSettings'"); + if (!_config.unstableOperations["v2.postOwnershipSettings"]) { + throw new Error("Unstable operation 'postOwnershipSettings' is disabled"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "postOwnershipSettings"); + } + + // Path Params + const localVarPath = "/api/v2/csm/ownership/settings"; + + // Make Request Context + const requestContext = _config + .getServer("v2.CSMOwnershipApi.postOwnershipSettings") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "OwnershipSettingsRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } } export class CSMOwnershipApiResponseProcessor { @@ -635,6 +744,170 @@ export class CSMOwnershipApiResponseProcessor { ); } + /** + * 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 getOwnershipSettings + * @throws ApiException if the response code was not in [200, 299] + */ + public async getOwnershipSettings( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: OwnershipSettingsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OwnershipSettingsResponse" + ) as OwnershipSettingsResponse; + return body; + } + if (response.httpStatusCode === 401) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "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: OwnershipSettingsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OwnershipSettingsResponse", + "" + ) as OwnershipSettingsResponse; + 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 getOwnershipUntaggedFindings + * @throws ApiException if the response code was not in [200, 299] + */ + public async getOwnershipUntaggedFindings( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: OwnershipUntaggedFindingsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OwnershipUntaggedFindingsResponse" + ) as OwnershipUntaggedFindingsResponse; + return body; + } + if (response.httpStatusCode === 401) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "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: OwnershipUntaggedFindingsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OwnershipUntaggedFindingsResponse", + "" + ) as OwnershipUntaggedFindingsResponse; + 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 @@ -881,6 +1154,87 @@ export class CSMOwnershipApiResponseProcessor { '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 postOwnershipSettings + * @throws ApiException if the response code was not in [200, 299] + */ + public async postOwnershipSettings( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: OwnershipSettingsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OwnershipSettingsResponse" + ) as OwnershipSettingsResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 401) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "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: OwnershipSettingsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OwnershipSettingsResponse", + "" + ) as OwnershipSettingsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } } export interface CSMOwnershipApiCreateOwnershipFeedbackRequest { @@ -985,6 +1339,13 @@ export interface CSMOwnershipApiListOwnershipInferencesRequest { resourceId: string; } +export interface CSMOwnershipApiPostOwnershipSettingsRequest { + /** + * @type OwnershipSettingsRequest + */ + body: OwnershipSettingsRequest; +} + export class CSMOwnershipApi { private requestFactory: CSMOwnershipApiRequestFactory; private responseProcessor: CSMOwnershipApiResponseProcessor; @@ -1081,6 +1442,44 @@ export class CSMOwnershipApi { }); } + /** + * Get ownership settings for the org. When settings are unset, the API returns the default opt-out configuration with `auto_tag` set to `true` and `confidence_level` set to `high`. + * @param param The request object + */ + public getOwnershipSettings( + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.getOwnershipSettings(options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getOwnershipSettings(responseContext); + }); + }); + } + + /** + * Count findings with no team tag, grouped by ownership confidence level. + * @param param The request object + */ + public getOwnershipUntaggedFindings( + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.getOwnershipUntaggedFindings(options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getOwnershipUntaggedFindings( + responseContext + ); + }); + }); + } + /** * List inference history entries for a resource across all owner types, ordered from most recent to oldest. Uses cursor-based pagination. * @param param The request object @@ -1153,4 +1552,25 @@ export class CSMOwnershipApi { }); }); } + + /** + * Update ownership settings for the org. + * @param param The request object + */ + public postOwnershipSettings( + param: CSMOwnershipApiPostOwnershipSettingsRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.postOwnershipSettings( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.postOwnershipSettings(responseContext); + }); + }); + } } diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 841260110477..3204aa2fbd12 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -189,6 +189,7 @@ export { CSMOwnershipApiListOwnershipHistoryRequest, CSMOwnershipApiListOwnershipHistoryByOwnerTypeRequest, CSMOwnershipApiListOwnershipInferencesRequest, + CSMOwnershipApiPostOwnershipSettingsRequest, CSMOwnershipApi, } from "./apis/CSMOwnershipApi"; @@ -6324,6 +6325,7 @@ export { OutputSchema } from "./models/OutputSchema"; export { OutputSchemaParameters } from "./models/OutputSchemaParameters"; export { OutputSchemaParametersType } from "./models/OutputSchemaParametersType"; export { OverwriteAllocationsRequest } from "./models/OverwriteAllocationsRequest"; +export { OwnershipConfidenceLevel } from "./models/OwnershipConfidenceLevel"; export { OwnershipEvidenceAttributes } from "./models/OwnershipEvidenceAttributes"; export { OwnershipEvidenceData } from "./models/OwnershipEvidenceData"; export { OwnershipEvidenceResponse } from "./models/OwnershipEvidenceResponse"; @@ -6354,6 +6356,17 @@ export { OwnershipInferenceStatus } from "./models/OwnershipInferenceStatus"; export { OwnershipInferencesType } from "./models/OwnershipInferencesType"; export { OwnershipInferenceType } from "./models/OwnershipInferenceType"; export { OwnershipOwnerType } from "./models/OwnershipOwnerType"; +export { OwnershipSettingsAttributes } from "./models/OwnershipSettingsAttributes"; +export { OwnershipSettingsData } from "./models/OwnershipSettingsData"; +export { OwnershipSettingsRequest } from "./models/OwnershipSettingsRequest"; +export { OwnershipSettingsRequestAttributes } from "./models/OwnershipSettingsRequestAttributes"; +export { OwnershipSettingsRequestData } from "./models/OwnershipSettingsRequestData"; +export { OwnershipSettingsResponse } from "./models/OwnershipSettingsResponse"; +export { OwnershipSettingsType } from "./models/OwnershipSettingsType"; +export { OwnershipUntaggedFindingsAttributes } from "./models/OwnershipUntaggedFindingsAttributes"; +export { OwnershipUntaggedFindingsData } from "./models/OwnershipUntaggedFindingsData"; +export { OwnershipUntaggedFindingsResponse } from "./models/OwnershipUntaggedFindingsResponse"; +export { OwnershipUntaggedFindingsType } from "./models/OwnershipUntaggedFindingsType"; export { PageAnnotationsAttributes } from "./models/PageAnnotationsAttributes"; export { PageAnnotationsData } from "./models/PageAnnotationsData"; export { PageAnnotationsResponse } from "./models/PageAnnotationsResponse"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index efce8a9bdc87..8c8e1e58560c 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -3443,6 +3443,15 @@ import { OwnershipInferenceListAttributes } from "./OwnershipInferenceListAttrib import { OwnershipInferenceListData } from "./OwnershipInferenceListData"; import { OwnershipInferenceListResponse } from "./OwnershipInferenceListResponse"; import { OwnershipInferenceResponse } from "./OwnershipInferenceResponse"; +import { OwnershipSettingsAttributes } from "./OwnershipSettingsAttributes"; +import { OwnershipSettingsData } from "./OwnershipSettingsData"; +import { OwnershipSettingsRequest } from "./OwnershipSettingsRequest"; +import { OwnershipSettingsRequestAttributes } from "./OwnershipSettingsRequestAttributes"; +import { OwnershipSettingsRequestData } from "./OwnershipSettingsRequestData"; +import { OwnershipSettingsResponse } from "./OwnershipSettingsResponse"; +import { OwnershipUntaggedFindingsAttributes } from "./OwnershipUntaggedFindingsAttributes"; +import { OwnershipUntaggedFindingsData } from "./OwnershipUntaggedFindingsData"; +import { OwnershipUntaggedFindingsResponse } from "./OwnershipUntaggedFindingsResponse"; import { PageAnnotationsAttributes } from "./PageAnnotationsAttributes"; import { PageAnnotationsData } from "./PageAnnotationsData"; import { PageAnnotationsResponse } from "./PageAnnotationsResponse"; @@ -7203,6 +7212,7 @@ const enumsMap: { [key: string]: any[] } = { "ARRAY_BOOLEAN", "ARRAY_OBJECT", ], + OwnershipConfidenceLevel: ["high", "medium", "low"], OwnershipEvidenceType: ["ownership_evidence"], OwnershipFeedbackAction: ["confirm", "reject", "correct", "persist"], OwnershipFeedbackResultType: ["ownership_feedback_result"], @@ -7218,6 +7228,8 @@ const enumsMap: { [key: string]: any[] } = { OwnershipInferenceType: ["ownership_inference"], OwnershipInferencesType: ["ownership_inferences"], OwnershipOwnerType: ["user", "team", "service", "unknown"], + OwnershipSettingsType: ["ownership_settings"], + OwnershipUntaggedFindingsType: ["ownership_untagged_findings"], PageAnnotationsType: ["page_annotations"], PageUrgency: ["low", "high"], PaginationMetaPageType: ["offset_limit"], @@ -12470,6 +12482,15 @@ const typeMap: { [index: string]: any } = { OwnershipInferenceListData: OwnershipInferenceListData, OwnershipInferenceListResponse: OwnershipInferenceListResponse, OwnershipInferenceResponse: OwnershipInferenceResponse, + OwnershipSettingsAttributes: OwnershipSettingsAttributes, + OwnershipSettingsData: OwnershipSettingsData, + OwnershipSettingsRequest: OwnershipSettingsRequest, + OwnershipSettingsRequestAttributes: OwnershipSettingsRequestAttributes, + OwnershipSettingsRequestData: OwnershipSettingsRequestData, + OwnershipSettingsResponse: OwnershipSettingsResponse, + OwnershipUntaggedFindingsAttributes: OwnershipUntaggedFindingsAttributes, + OwnershipUntaggedFindingsData: OwnershipUntaggedFindingsData, + OwnershipUntaggedFindingsResponse: OwnershipUntaggedFindingsResponse, PageAnnotationsAttributes: PageAnnotationsAttributes, PageAnnotationsData: PageAnnotationsData, PageAnnotationsResponse: PageAnnotationsResponse, diff --git a/packages/datadog-api-client-v2/models/OwnershipConfidenceLevel.ts b/packages/datadog-api-client-v2/models/OwnershipConfidenceLevel.ts new file mode 100644 index 000000000000..a3fa6bc47b12 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipConfidenceLevel.ts @@ -0,0 +1,20 @@ +/** + * 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"; + +/** + * The ownership confidence level. + */ + +export type OwnershipConfidenceLevel = + | typeof HIGH + | typeof MEDIUM + | typeof LOW + | UnparsedObject; +export const HIGH = "high"; +export const MEDIUM = "medium"; +export const LOW = "low"; diff --git a/packages/datadog-api-client-v2/models/OwnershipSettingsAttributes.ts b/packages/datadog-api-client-v2/models/OwnershipSettingsAttributes.ts new file mode 100644 index 000000000000..c2ef0a71e49f --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipSettingsAttributes.ts @@ -0,0 +1,73 @@ +/** + * 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 { OwnershipConfidenceLevel } from "./OwnershipConfidenceLevel"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The attributes of the ownership settings response. + */ +export class OwnershipSettingsAttributes { + /** + * Whether automatic ownership tagging is enabled. + */ + "autoTag": boolean; + /** + * The ownership confidence level. + */ + "confidenceLevel": OwnershipConfidenceLevel; + /** + * The current version of the ownership settings. + */ + "version": number; + + /** + * 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 = { + autoTag: { + baseName: "auto_tag", + type: "boolean", + required: true, + }, + confidenceLevel: { + baseName: "confidence_level", + type: "OwnershipConfidenceLevel", + required: true, + }, + version: { + baseName: "version", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipSettingsAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipSettingsData.ts b/packages/datadog-api-client-v2/models/OwnershipSettingsData.ts new file mode 100644 index 000000000000..fc29f6eb5656 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipSettingsData.ts @@ -0,0 +1,73 @@ +/** + * 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 { OwnershipSettingsAttributes } from "./OwnershipSettingsAttributes"; +import { OwnershipSettingsType } from "./OwnershipSettingsType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The data wrapper for an ownership settings response. + */ +export class OwnershipSettingsData { + /** + * The attributes of the ownership settings response. + */ + "attributes": OwnershipSettingsAttributes; + /** + * The identifier of the ownership settings resource. + */ + "id": string; + /** + * The type of the ownership settings resource. The value should always be `ownership_settings`. + */ + "type": OwnershipSettingsType; + + /** + * 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: "OwnershipSettingsAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "OwnershipSettingsType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipSettingsData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipSettingsRequest.ts b/packages/datadog-api-client-v2/models/OwnershipSettingsRequest.ts new file mode 100644 index 000000000000..b47b9aec7cb8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipSettingsRequest.ts @@ -0,0 +1,54 @@ +/** + * 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 { OwnershipSettingsRequestData } from "./OwnershipSettingsRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The request body for updating ownership settings. + */ +export class OwnershipSettingsRequest { + /** + * The data wrapper for an ownership settings request. + */ + "data": OwnershipSettingsRequestData; + + /** + * 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: "OwnershipSettingsRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipSettingsRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipSettingsRequestAttributes.ts b/packages/datadog-api-client-v2/models/OwnershipSettingsRequestAttributes.ts new file mode 100644 index 000000000000..dd85cd660aab --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipSettingsRequestAttributes.ts @@ -0,0 +1,63 @@ +/** + * 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 { OwnershipConfidenceLevel } from "./OwnershipConfidenceLevel"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The attributes of an ownership settings request. + */ +export class OwnershipSettingsRequestAttributes { + /** + * Whether automatic ownership tagging is enabled. + */ + "autoTag": boolean; + /** + * The ownership confidence level. + */ + "confidenceLevel": OwnershipConfidenceLevel; + + /** + * 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 = { + autoTag: { + baseName: "auto_tag", + type: "boolean", + required: true, + }, + confidenceLevel: { + baseName: "confidence_level", + type: "OwnershipConfidenceLevel", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipSettingsRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipSettingsRequestData.ts b/packages/datadog-api-client-v2/models/OwnershipSettingsRequestData.ts new file mode 100644 index 000000000000..63f7ecead86a --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipSettingsRequestData.ts @@ -0,0 +1,64 @@ +/** + * 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 { OwnershipSettingsRequestAttributes } from "./OwnershipSettingsRequestAttributes"; +import { OwnershipSettingsType } from "./OwnershipSettingsType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The data wrapper for an ownership settings request. + */ +export class OwnershipSettingsRequestData { + /** + * The attributes of an ownership settings request. + */ + "attributes": OwnershipSettingsRequestAttributes; + /** + * The type of the ownership settings resource. The value should always be `ownership_settings`. + */ + "type": OwnershipSettingsType; + + /** + * 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: "OwnershipSettingsRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "OwnershipSettingsType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipSettingsRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipSettingsResponse.ts b/packages/datadog-api-client-v2/models/OwnershipSettingsResponse.ts new file mode 100644 index 000000000000..97f16b5f7786 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipSettingsResponse.ts @@ -0,0 +1,54 @@ +/** + * 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 { OwnershipSettingsData } from "./OwnershipSettingsData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The response returned when retrieving or updating ownership settings. + */ +export class OwnershipSettingsResponse { + /** + * The data wrapper for an ownership settings response. + */ + "data": OwnershipSettingsData; + + /** + * 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: "OwnershipSettingsData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipSettingsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipSettingsType.ts b/packages/datadog-api-client-v2/models/OwnershipSettingsType.ts new file mode 100644 index 000000000000..2e1de2cdd0bf --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipSettingsType.ts @@ -0,0 +1,14 @@ +/** + * 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"; + +/** + * The type of the ownership settings resource. The value should always be `ownership_settings`. + */ + +export type OwnershipSettingsType = typeof OWNERSHIP_SETTINGS | UnparsedObject; +export const OWNERSHIP_SETTINGS = "ownership_settings"; diff --git a/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsAttributes.ts b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsAttributes.ts new file mode 100644 index 000000000000..4e9394749748 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsAttributes.ts @@ -0,0 +1,84 @@ +/** + * 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 { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The counts of findings without a team tag by ownership confidence. + */ +export class OwnershipUntaggedFindingsAttributes { + /** + * The number of high confidence findings without a team tag. + */ + "highConfidence": number; + /** + * The number of low confidence findings without a team tag. + */ + "lowConfidence": number; + /** + * The number of medium confidence findings without a team tag. + */ + "mediumConfidence": number; + /** + * The total number of findings without a team tag. + */ + "total": number; + + /** + * 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 = { + highConfidence: { + baseName: "high_confidence", + type: "number", + required: true, + format: "int64", + }, + lowConfidence: { + baseName: "low_confidence", + type: "number", + required: true, + format: "int64", + }, + mediumConfidence: { + baseName: "medium_confidence", + type: "number", + required: true, + format: "int64", + }, + total: { + baseName: "total", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipUntaggedFindingsAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsData.ts b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsData.ts new file mode 100644 index 000000000000..69546f8e83f6 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsData.ts @@ -0,0 +1,73 @@ +/** + * 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 { OwnershipUntaggedFindingsAttributes } from "./OwnershipUntaggedFindingsAttributes"; +import { OwnershipUntaggedFindingsType } from "./OwnershipUntaggedFindingsType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The data wrapper for an ownership untagged findings response. + */ +export class OwnershipUntaggedFindingsData { + /** + * The counts of findings without a team tag by ownership confidence. + */ + "attributes": OwnershipUntaggedFindingsAttributes; + /** + * The identifier of the ownership untagged findings resource. + */ + "id": string; + /** + * The type of the ownership untagged findings resource. The value should always be `ownership_untagged_findings`. + */ + "type": OwnershipUntaggedFindingsType; + + /** + * 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: "OwnershipUntaggedFindingsAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "OwnershipUntaggedFindingsType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipUntaggedFindingsData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsResponse.ts b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsResponse.ts new file mode 100644 index 000000000000..f0260cc36ca8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsResponse.ts @@ -0,0 +1,54 @@ +/** + * 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 { OwnershipUntaggedFindingsData } from "./OwnershipUntaggedFindingsData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The response returned when counting findings without a team tag by ownership confidence. + */ +export class OwnershipUntaggedFindingsResponse { + /** + * The data wrapper for an ownership untagged findings response. + */ + "data": OwnershipUntaggedFindingsData; + + /** + * 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: "OwnershipUntaggedFindingsData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OwnershipUntaggedFindingsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsType.ts b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsType.ts new file mode 100644 index 000000000000..e69bd7cf3351 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OwnershipUntaggedFindingsType.ts @@ -0,0 +1,16 @@ +/** + * 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"; + +/** + * The type of the ownership untagged findings resource. The value should always be `ownership_untagged_findings`. + */ + +export type OwnershipUntaggedFindingsType = + | typeof OWNERSHIP_UNTAGGED_FINDINGS + | UnparsedObject; +export const OWNERSHIP_UNTAGGED_FINDINGS = "ownership_untagged_findings";