diff --git a/.generated-info b/.generated-info index bdcbb99f48..3e941c75ee 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "d02c8a3", - "generated": "2025-08-08 12:07:20.979" + "spec_repo_commit": "cf78334", + "generated": "2025-08-12 18:25:19.397" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4f155402b7..a37e26e678 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -14454,6 +14454,10 @@ components: description: Entity definition in raw JSON or YAML representation. example: "apiVersion: v3\nkind: service\nmetadata:\n name: myservice\n" type: string + EntityReference: + description: The unique reference for an IDP entity. + example: service:my-service + type: string EntityRelationships: description: Entity relationships. properties: @@ -43034,6 +43038,57 @@ components: id: $ref: '#/components/schemas/ApiID' type: object + UpdateOutcomesAsyncAttributes: + description: The JSON:API attributes for a batched set of scorecard outcomes. + properties: + results: + description: Set of scorecard outcomes to update asynchronously. + items: + $ref: '#/components/schemas/UpdateOutcomesAsyncRequestItem' + type: array + type: object + UpdateOutcomesAsyncRequest: + description: Scorecard outcomes batch request. + properties: + data: + $ref: '#/components/schemas/UpdateOutcomesAsyncRequestData' + type: object + UpdateOutcomesAsyncRequestData: + description: Scorecard outcomes batch request data. + properties: + attributes: + $ref: '#/components/schemas/UpdateOutcomesAsyncAttributes' + type: + $ref: '#/components/schemas/UpdateOutcomesAsyncType' + type: object + UpdateOutcomesAsyncRequestItem: + description: Scorecard outcome for a single entity and rule. + properties: + entity_reference: + $ref: '#/components/schemas/EntityReference' + remarks: + description: Any remarks regarding the scorecard rule's evaluation, and + supports HTML hyperlinks. + example: 'See: Services' + type: string + rule_id: + $ref: '#/components/schemas/RuleId' + state: + $ref: '#/components/schemas/State' + required: + - rule_id + - entity_reference + - state + type: object + UpdateOutcomesAsyncType: + default: batched-outcome + description: The JSON:API type for scorecard outcomes. + enum: + - batched-outcome + example: batched-outcome + type: string + x-enum-varnames: + - BATCHED_OUTCOME UpdateResourceEvaluationFiltersRequest: description: Request object to update a resource filter. properties: @@ -61018,6 +61073,37 @@ paths: resultsPath: data x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Updates multiple scorecard rule outcomes in a single batched request. + operationId: UpdateScorecardOutcomesAsync + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOutcomesAsyncRequest' + description: Set of scorecard outcomes. + required: true + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_write + summary: Update Scorecard outcomes asynchronously + tags: + - Service Scorecards + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/scorecard/outcomes/batch: post: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 3164dbe560..d763ba973d 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -19121,6 +19121,41 @@ datadog\_api\_client.v2.model.update\_open\_api\_response\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.update\_outcomes\_async\_attributes module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.update_outcomes_async_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_outcomes\_async\_request module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_outcomes_async_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_outcomes\_async\_request\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_outcomes_async_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_outcomes\_async\_request\_item module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_outcomes_async_request_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_outcomes\_async\_type module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.update_outcomes_async_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.update\_resource\_evaluation\_filters\_request module ----------------------------------------------------------------------------------- diff --git a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py b/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py new file mode 100644 index 0000000000..628b54228f --- /dev/null +++ b/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py @@ -0,0 +1,34 @@ +""" +Update Scorecard outcomes asynchronously returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.model.state import State +from datadog_api_client.v2.model.update_outcomes_async_attributes import UpdateOutcomesAsyncAttributes +from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest +from datadog_api_client.v2.model.update_outcomes_async_request_data import UpdateOutcomesAsyncRequestData +from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem +from datadog_api_client.v2.model.update_outcomes_async_type import UpdateOutcomesAsyncType + +body = UpdateOutcomesAsyncRequest( + data=UpdateOutcomesAsyncRequestData( + attributes=UpdateOutcomesAsyncAttributes( + results=[ + UpdateOutcomesAsyncRequestItem( + entity_reference="service:my-service", + remarks='See: Services', + rule_id="q8MQxk8TCqrHnWkx", + state=State.PASS, + ), + ], + ), + type=UpdateOutcomesAsyncType.BATCHED_OUTCOME, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_scorecard_outcomes_async"] = True +with ApiClient(configuration) as api_client: + api_instance = ServiceScorecardsApi(api_client) + api_instance.update_scorecard_outcomes_async(body=body) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index ae85238361..e4d39e0437 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -312,6 +312,7 @@ def __init__( "v2.delete_scorecard_rule": False, "v2.list_scorecard_outcomes": False, "v2.list_scorecard_rules": False, + "v2.update_scorecard_outcomes_async": False, "v2.update_scorecard_rule": False, "v2.create_incident_service": False, "v2.delete_incident_service": False, diff --git a/src/datadog_api_client/v2/api/service_scorecards_api.py b/src/datadog_api_client/v2/api/service_scorecards_api.py index 63cd7157ec..17f1b0de83 100644 --- a/src/datadog_api_client/v2/api/service_scorecards_api.py +++ b/src/datadog_api_client/v2/api/service_scorecards_api.py @@ -16,6 +16,7 @@ ) from datadog_api_client.v2.model.outcomes_response import OutcomesResponse from datadog_api_client.v2.model.outcomes_response_data_item import OutcomesResponseDataItem +from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest from datadog_api_client.v2.model.outcomes_batch_response import OutcomesBatchResponse from datadog_api_client.v2.model.outcomes_batch_request import OutcomesBatchRequest from datadog_api_client.v2.model.list_rules_response import ListRulesResponse @@ -235,6 +236,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_scorecard_outcomes_async_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/scorecard/outcomes", + "operation_id": "update_scorecard_outcomes_async", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (UpdateOutcomesAsyncRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_scorecard_rule_endpoint = _Endpoint( settings={ "response_type": (UpdateRuleResponse,), @@ -628,6 +649,23 @@ def list_scorecard_rules_with_pagination( } return endpoint.call_with_http_info_paginated(pagination) + def update_scorecard_outcomes_async( + self, + body: UpdateOutcomesAsyncRequest, + ) -> None: + """Update Scorecard outcomes asynchronously. + + Updates multiple scorecard rule outcomes in a single batched request. + + :param body: Set of scorecard outcomes. + :type body: UpdateOutcomesAsyncRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._update_scorecard_outcomes_async_endpoint.call_with_http_info(**kwargs) + def update_scorecard_rule( self, rule_id: str, diff --git a/src/datadog_api_client/v2/model/update_outcomes_async_attributes.py b/src/datadog_api_client/v2/model/update_outcomes_async_attributes.py new file mode 100644 index 0000000000..32ccccee28 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_outcomes_async_attributes.py @@ -0,0 +1,42 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem + + +class UpdateOutcomesAsyncAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem + + return { + "results": ([UpdateOutcomesAsyncRequestItem],), + } + + attribute_map = { + "results": "results", + } + + def __init__(self_, results: Union[List[UpdateOutcomesAsyncRequestItem], UnsetType] = unset, **kwargs): + """ + The JSON:API attributes for a batched set of scorecard outcomes. + + :param results: Set of scorecard outcomes to update asynchronously. + :type results: [UpdateOutcomesAsyncRequestItem], optional + """ + if results is not unset: + kwargs["results"] = results + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/update_outcomes_async_request.py b/src/datadog_api_client/v2/model/update_outcomes_async_request.py new file mode 100644 index 0000000000..72a6b65e27 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_outcomes_async_request.py @@ -0,0 +1,42 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_outcomes_async_request_data import UpdateOutcomesAsyncRequestData + + +class UpdateOutcomesAsyncRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_outcomes_async_request_data import UpdateOutcomesAsyncRequestData + + return { + "data": (UpdateOutcomesAsyncRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[UpdateOutcomesAsyncRequestData, UnsetType] = unset, **kwargs): + """ + Scorecard outcomes batch request. + + :param data: Scorecard outcomes batch request data. + :type data: UpdateOutcomesAsyncRequestData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/update_outcomes_async_request_data.py b/src/datadog_api_client/v2/model/update_outcomes_async_request_data.py new file mode 100644 index 0000000000..f1e183d42f --- /dev/null +++ b/src/datadog_api_client/v2/model/update_outcomes_async_request_data.py @@ -0,0 +1,56 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_outcomes_async_attributes import UpdateOutcomesAsyncAttributes + from datadog_api_client.v2.model.update_outcomes_async_type import UpdateOutcomesAsyncType + + +class UpdateOutcomesAsyncRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_outcomes_async_attributes import UpdateOutcomesAsyncAttributes + from datadog_api_client.v2.model.update_outcomes_async_type import UpdateOutcomesAsyncType + + return { + "attributes": (UpdateOutcomesAsyncAttributes,), + "type": (UpdateOutcomesAsyncType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: Union[UpdateOutcomesAsyncAttributes, UnsetType] = unset, + type: Union[UpdateOutcomesAsyncType, UnsetType] = unset, + **kwargs, + ): + """ + Scorecard outcomes batch request data. + + :param attributes: The JSON:API attributes for a batched set of scorecard outcomes. + :type attributes: UpdateOutcomesAsyncAttributes, optional + + :param type: The JSON:API type for scorecard outcomes. + :type type: UpdateOutcomesAsyncType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/update_outcomes_async_request_item.py b/src/datadog_api_client/v2/model/update_outcomes_async_request_item.py new file mode 100644 index 0000000000..62aedccdfb --- /dev/null +++ b/src/datadog_api_client/v2/model/update_outcomes_async_request_item.py @@ -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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.state import State + + +class UpdateOutcomesAsyncRequestItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.state import State + + return { + "entity_reference": (str,), + "remarks": (str,), + "rule_id": (str,), + "state": (State,), + } + + attribute_map = { + "entity_reference": "entity_reference", + "remarks": "remarks", + "rule_id": "rule_id", + "state": "state", + } + + def __init__( + self_, entity_reference: str, rule_id: str, state: State, remarks: Union[str, UnsetType] = unset, **kwargs + ): + """ + Scorecard outcome for a single entity and rule. + + :param entity_reference: The unique reference for an IDP entity. + :type entity_reference: str + + :param remarks: Any remarks regarding the scorecard rule's evaluation, and supports HTML hyperlinks. + :type remarks: str, optional + + :param rule_id: The unique ID for a scorecard rule. + :type rule_id: str + + :param state: The state of the rule evaluation. + :type state: State + """ + if remarks is not unset: + kwargs["remarks"] = remarks + super().__init__(kwargs) + + self_.entity_reference = entity_reference + self_.rule_id = rule_id + self_.state = state diff --git a/src/datadog_api_client/v2/model/update_outcomes_async_type.py b/src/datadog_api_client/v2/model/update_outcomes_async_type.py new file mode 100644 index 0000000000..ce7c4bf5cc --- /dev/null +++ b/src/datadog_api_client/v2/model/update_outcomes_async_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class UpdateOutcomesAsyncType(ModelSimple): + """ + The JSON:API type for scorecard outcomes. + + :param value: If omitted defaults to "batched-outcome". Must be one of ["batched-outcome"]. + :type value: str + """ + + allowed_values = { + "batched-outcome", + } + BATCHED_OUTCOME: ClassVar["UpdateOutcomesAsyncType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +UpdateOutcomesAsyncType.BATCHED_OUTCOME = UpdateOutcomesAsyncType("batched-outcome") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 52e92ab3f7..d6e499d1a5 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3676,6 +3676,11 @@ from datadog_api_client.v2.model.update_open_api_response import UpdateOpenAPIResponse from datadog_api_client.v2.model.update_open_api_response_attributes import UpdateOpenAPIResponseAttributes from datadog_api_client.v2.model.update_open_api_response_data import UpdateOpenAPIResponseData +from datadog_api_client.v2.model.update_outcomes_async_attributes import UpdateOutcomesAsyncAttributes +from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest +from datadog_api_client.v2.model.update_outcomes_async_request_data import UpdateOutcomesAsyncRequestData +from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem +from datadog_api_client.v2.model.update_outcomes_async_type import UpdateOutcomesAsyncType from datadog_api_client.v2.model.update_resource_evaluation_filters_request import ( UpdateResourceEvaluationFiltersRequest, ) @@ -6559,6 +6564,11 @@ "UpdateOpenAPIResponse", "UpdateOpenAPIResponseAttributes", "UpdateOpenAPIResponseData", + "UpdateOutcomesAsyncAttributes", + "UpdateOutcomesAsyncRequest", + "UpdateOutcomesAsyncRequestData", + "UpdateOutcomesAsyncRequestItem", + "UpdateOutcomesAsyncType", "UpdateResourceEvaluationFiltersRequest", "UpdateResourceEvaluationFiltersRequestData", "UpdateResourceEvaluationFiltersResponse", diff --git a/tests/v2/features/service_scorecards.feature b/tests/v2/features/service_scorecards.feature index 11d2c7f432..8ecf48ff1d 100644 --- a/tests/v2/features/service_scorecards.feature +++ b/tests/v2/features/service_scorecards.feature @@ -121,6 +121,22 @@ Feature: Service Scorecards Then the response status is 200 OK And the response has 4 items + @generated @skip @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes asynchronously returns "Accepted" response + Given operation "UpdateScorecardOutcomesAsync" enabled + And new "UpdateScorecardOutcomesAsync" request + And body with value {"data": {"attributes": {"results": [{"entity_reference": "service:my-service", "remarks": "See: Services", "rule_id": "q8MQxk8TCqrHnWkx", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes asynchronously returns "Bad Request" response + Given operation "UpdateScorecardOutcomesAsync" enabled + And new "UpdateScorecardOutcomesAsync" request + And body with value {"data": {"attributes": {"results": [{"entity_reference": "service:my-service", "remarks": "See: Services", "rule_id": "q8MQxk8TCqrHnWkx", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/service-catalog Scenario: Update an existing rule returns "Bad Request" response Given operation "UpdateScorecardRule" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index fd14fad093..54c7d933a1 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2742,6 +2742,12 @@ "type": "safe" } }, + "UpdateScorecardOutcomesAsync": { + "tag": "Service Scorecards", + "undo": { + "type": "idempotent" + } + }, "CreateScorecardOutcomesBatch": { "tag": "Service Scorecards", "undo": {