Skip to content

Adds async Scorecard outcomes batch update endpoint #2763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -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"
}
86 changes: 86 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: <a href="https://app.datadoghq.com/services">Services</a>'
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:
Expand Down Expand Up @@ -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:
Expand Down
35 changes: 35 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------------------------------------------------------------------

Expand Down
34 changes: 34 additions & 0 deletions examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py
Original file line number Diff line number Diff line change
@@ -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: <a href="https://app.datadoghq.com/services">Services</a>',
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)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
38 changes: 38 additions & 0 deletions src/datadog_api_client/v2/api/service_scorecards_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,),
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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)
Loading
Loading