Skip to content

Commit 758771e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Adds async Scorecard outcomes batch update endpoint (#2763)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent c812e28 commit 758771e

27 files changed

+769
-5
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "62a19e4",
3-
"generated": "2025-08-27 15:01:27.781"
2+
"spec_repo_commit": "6d9663b",
3+
"generated": "2025-08-27 16:38:12.845"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14485,6 +14485,10 @@ components:
1448514485
description: Entity definition in raw JSON or YAML representation.
1448614486
example: "apiVersion: v3\nkind: service\nmetadata:\n name: myservice\n"
1448714487
type: string
14488+
EntityReference:
14489+
description: The unique reference for an IDP entity.
14490+
example: service:my-service
14491+
type: string
1448814492
EntityRelationships:
1448914493
description: Entity relationships.
1449014494
properties:
@@ -34444,6 +34448,8 @@ components:
3444434448
description: If enabled, the rule is calculated as part of the score.
3444534449
example: true
3444634450
type: boolean
34451+
level:
34452+
$ref: '#/components/schemas/RuleLevel'
3444734453
modified_at:
3444834454
description: Time of the last rule outcome modification.
3444934455
format: date-time
@@ -34464,6 +34470,13 @@ components:
3446434470
description: The unique ID for a scorecard rule.
3446534471
example: q8MQxk8TCqrHnWkx
3446634472
type: string
34473+
RuleLevel:
34474+
description: The maturity level of the rule (1, 2, or 3).
34475+
example: 2
34476+
format: int32
34477+
maximum: 3
34478+
minimum: 1
34479+
type: integer
3446734480
RuleName:
3446834481
description: Name of the notification rule.
3446934482
example: Rule 1
@@ -43835,6 +43848,57 @@ components:
4383543848
id:
4383643849
$ref: '#/components/schemas/ApiID'
4383743850
type: object
43851+
UpdateOutcomesAsyncAttributes:
43852+
description: The JSON:API attributes for a batched set of scorecard outcomes.
43853+
properties:
43854+
results:
43855+
description: Set of scorecard outcomes to update asynchronously.
43856+
items:
43857+
$ref: '#/components/schemas/UpdateOutcomesAsyncRequestItem'
43858+
type: array
43859+
type: object
43860+
UpdateOutcomesAsyncRequest:
43861+
description: Scorecard outcomes batch request.
43862+
properties:
43863+
data:
43864+
$ref: '#/components/schemas/UpdateOutcomesAsyncRequestData'
43865+
type: object
43866+
UpdateOutcomesAsyncRequestData:
43867+
description: Scorecard outcomes batch request data.
43868+
properties:
43869+
attributes:
43870+
$ref: '#/components/schemas/UpdateOutcomesAsyncAttributes'
43871+
type:
43872+
$ref: '#/components/schemas/UpdateOutcomesAsyncType'
43873+
type: object
43874+
UpdateOutcomesAsyncRequestItem:
43875+
description: Scorecard outcome for a single entity and rule.
43876+
properties:
43877+
entity_reference:
43878+
$ref: '#/components/schemas/EntityReference'
43879+
remarks:
43880+
description: Any remarks regarding the scorecard rule's evaluation. Supports
43881+
HTML hyperlinks.
43882+
example: 'See: <a href="https://app.datadoghq.com/services">Services</a>'
43883+
type: string
43884+
rule_id:
43885+
$ref: '#/components/schemas/RuleId'
43886+
state:
43887+
$ref: '#/components/schemas/State'
43888+
required:
43889+
- rule_id
43890+
- entity_reference
43891+
- state
43892+
type: object
43893+
UpdateOutcomesAsyncType:
43894+
default: batched-outcome
43895+
description: The JSON:API type for scorecard outcomes.
43896+
enum:
43897+
- batched-outcome
43898+
example: batched-outcome
43899+
type: string
43900+
x-enum-varnames:
43901+
- BATCHED_OUTCOME
4383843902
UpdateResourceEvaluationFiltersRequest:
4383943903
description: Request object to update a resource filter.
4384043904
properties:
@@ -61882,6 +61946,39 @@ paths:
6188261946
resultsPath: data
6188361947
x-unstable: '**Note**: This endpoint is in public beta.
6188461948

61949+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
61950+
post:
61951+
description: Updates multiple scorecard rule outcomes in a single batched request.
61952+
operationId: UpdateScorecardOutcomesAsync
61953+
requestBody:
61954+
content:
61955+
application/json:
61956+
schema:
61957+
$ref: '#/components/schemas/UpdateOutcomesAsyncRequest'
61958+
description: Set of scorecard outcomes.
61959+
required: true
61960+
responses:
61961+
'202':
61962+
description: Accepted
61963+
'400':
61964+
$ref: '#/components/responses/BadRequestResponse'
61965+
'403':
61966+
$ref: '#/components/responses/ForbiddenResponse'
61967+
'409':
61968+
$ref: '#/components/responses/ConflictResponse'
61969+
'429':
61970+
$ref: '#/components/responses/TooManyRequestsResponse'
61971+
security:
61972+
- apiKeyAuth: []
61973+
appKeyAuth: []
61974+
- AuthZ:
61975+
- apm_service_catalog_write
61976+
summary: Update Scorecard outcomes asynchronously
61977+
tags:
61978+
- Service Scorecards
61979+
x-codegen-request-body-name: body
61980+
x-unstable: '**Note**: This endpoint is in public beta.
61981+
6188561982
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6188661983
/api/v2/scorecard/outcomes/batch:
6188761984
post:

docs/datadog_api_client.v2.model.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19527,6 +19527,41 @@ datadog\_api\_client.v2.model.update\_open\_api\_response\_data module
1952719527
:members:
1952819528
:show-inheritance:
1952919529

19530+
datadog\_api\_client.v2.model.update\_outcomes\_async\_attributes module
19531+
------------------------------------------------------------------------
19532+
19533+
.. automodule:: datadog_api_client.v2.model.update_outcomes_async_attributes
19534+
:members:
19535+
:show-inheritance:
19536+
19537+
datadog\_api\_client.v2.model.update\_outcomes\_async\_request module
19538+
---------------------------------------------------------------------
19539+
19540+
.. automodule:: datadog_api_client.v2.model.update_outcomes_async_request
19541+
:members:
19542+
:show-inheritance:
19543+
19544+
datadog\_api\_client.v2.model.update\_outcomes\_async\_request\_data module
19545+
---------------------------------------------------------------------------
19546+
19547+
.. automodule:: datadog_api_client.v2.model.update_outcomes_async_request_data
19548+
:members:
19549+
:show-inheritance:
19550+
19551+
datadog\_api\_client.v2.model.update\_outcomes\_async\_request\_item module
19552+
---------------------------------------------------------------------------
19553+
19554+
.. automodule:: datadog_api_client.v2.model.update_outcomes_async_request_item
19555+
:members:
19556+
:show-inheritance:
19557+
19558+
datadog\_api\_client.v2.model.update\_outcomes\_async\_type module
19559+
------------------------------------------------------------------
19560+
19561+
.. automodule:: datadog_api_client.v2.model.update_outcomes_async_type
19562+
:members:
19563+
:show-inheritance:
19564+
1953019565
datadog\_api\_client.v2.model.update\_resource\_evaluation\_filters\_request module
1953119566
-----------------------------------------------------------------------------------
1953219567

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
Update Scorecard outcomes asynchronously returns "Accepted" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi
8+
from datadog_api_client.v2.model.state import State
9+
from datadog_api_client.v2.model.update_outcomes_async_attributes import UpdateOutcomesAsyncAttributes
10+
from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest
11+
from datadog_api_client.v2.model.update_outcomes_async_request_data import UpdateOutcomesAsyncRequestData
12+
from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem
13+
from datadog_api_client.v2.model.update_outcomes_async_type import UpdateOutcomesAsyncType
14+
15+
# there is a valid "create_scorecard_rule" in the system
16+
CREATE_SCORECARD_RULE_DATA_ID = environ["CREATE_SCORECARD_RULE_DATA_ID"]
17+
18+
body = UpdateOutcomesAsyncRequest(
19+
data=UpdateOutcomesAsyncRequestData(
20+
attributes=UpdateOutcomesAsyncAttributes(
21+
results=[
22+
UpdateOutcomesAsyncRequestItem(
23+
rule_id=CREATE_SCORECARD_RULE_DATA_ID,
24+
entity_reference="service:my-service",
25+
remarks='See: <a href="https://app.datadoghq.com/services">Services</a>',
26+
state=State.PASS,
27+
),
28+
],
29+
),
30+
type=UpdateOutcomesAsyncType.BATCHED_OUTCOME,
31+
),
32+
)
33+
34+
configuration = Configuration()
35+
configuration.unstable_operations["update_scorecard_outcomes_async"] = True
36+
with ApiClient(configuration) as api_client:
37+
api_instance = ServiceScorecardsApi(api_client)
38+
api_instance.update_scorecard_outcomes_async(body=body)

src/datadog_api_client/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ def __init__(
312312
"v2.delete_scorecard_rule": False,
313313
"v2.list_scorecard_outcomes": False,
314314
"v2.list_scorecard_rules": False,
315+
"v2.update_scorecard_outcomes_async": False,
315316
"v2.update_scorecard_rule": False,
316317
"v2.create_incident_service": False,
317318
"v2.delete_incident_service": False,

src/datadog_api_client/v2/api/service_scorecards_api.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
)
1717
from datadog_api_client.v2.model.outcomes_response import OutcomesResponse
1818
from datadog_api_client.v2.model.outcomes_response_data_item import OutcomesResponseDataItem
19+
from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest
1920
from datadog_api_client.v2.model.outcomes_batch_response import OutcomesBatchResponse
2021
from datadog_api_client.v2.model.outcomes_batch_request import OutcomesBatchRequest
2122
from datadog_api_client.v2.model.list_rules_response import ListRulesResponse
@@ -235,6 +236,26 @@ def __init__(self, api_client=None):
235236
api_client=api_client,
236237
)
237238

239+
self._update_scorecard_outcomes_async_endpoint = _Endpoint(
240+
settings={
241+
"response_type": None,
242+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
243+
"endpoint_path": "/api/v2/scorecard/outcomes",
244+
"operation_id": "update_scorecard_outcomes_async",
245+
"http_method": "POST",
246+
"version": "v2",
247+
},
248+
params_map={
249+
"body": {
250+
"required": True,
251+
"openapi_types": (UpdateOutcomesAsyncRequest,),
252+
"location": "body",
253+
},
254+
},
255+
headers_map={"accept": ["*/*"], "content_type": ["application/json"]},
256+
api_client=api_client,
257+
)
258+
238259
self._update_scorecard_rule_endpoint = _Endpoint(
239260
settings={
240261
"response_type": (UpdateRuleResponse,),
@@ -628,6 +649,23 @@ def list_scorecard_rules_with_pagination(
628649
}
629650
return endpoint.call_with_http_info_paginated(pagination)
630651

652+
def update_scorecard_outcomes_async(
653+
self,
654+
body: UpdateOutcomesAsyncRequest,
655+
) -> None:
656+
"""Update Scorecard outcomes asynchronously.
657+
658+
Updates multiple scorecard rule outcomes in a single batched request.
659+
660+
:param body: Set of scorecard outcomes.
661+
:type body: UpdateOutcomesAsyncRequest
662+
:rtype: None
663+
"""
664+
kwargs: Dict[str, Any] = {}
665+
kwargs["body"] = body
666+
667+
return self._update_scorecard_outcomes_async_endpoint.call_with_http_info(**kwargs)
668+
631669
def update_scorecard_rule(
632670
self,
633671
rule_id: str,

src/datadog_api_client/v2/model/rule_attributes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515

1616

1717
class RuleAttributes(ModelNormal):
18+
validations = {
19+
"level": {
20+
"inclusive_maximum": 3,
21+
"inclusive_minimum": 1,
22+
},
23+
}
24+
1825
@cached_property
1926
def openapi_types(_):
2027
return {
@@ -23,6 +30,7 @@ def openapi_types(_):
2330
"custom": (bool,),
2431
"description": (str,),
2532
"enabled": (bool,),
33+
"level": (int,),
2634
"modified_at": (datetime,),
2735
"name": (str,),
2836
"owner": (str,),
@@ -35,6 +43,7 @@ def openapi_types(_):
3543
"custom": "custom",
3644
"description": "description",
3745
"enabled": "enabled",
46+
"level": "level",
3847
"modified_at": "modified_at",
3948
"name": "name",
4049
"owner": "owner",
@@ -48,6 +57,7 @@ def __init__(
4857
custom: Union[bool, UnsetType] = unset,
4958
description: Union[str, UnsetType] = unset,
5059
enabled: Union[bool, UnsetType] = unset,
60+
level: Union[int, UnsetType] = unset,
5161
modified_at: Union[datetime, UnsetType] = unset,
5262
name: Union[str, UnsetType] = unset,
5363
owner: Union[str, UnsetType] = unset,
@@ -72,6 +82,9 @@ def __init__(
7282
:param enabled: If enabled, the rule is calculated as part of the score.
7383
:type enabled: bool, optional
7484
85+
:param level: The maturity level of the rule (1, 2, or 3).
86+
:type level: int, optional
87+
7588
:param modified_at: Time of the last rule outcome modification.
7689
:type modified_at: datetime, optional
7790
@@ -94,6 +107,8 @@ def __init__(
94107
kwargs["description"] = description
95108
if enabled is not unset:
96109
kwargs["enabled"] = enabled
110+
if level is not unset:
111+
kwargs["level"] = level
97112
if modified_at is not unset:
98113
kwargs["modified_at"] = modified_at
99114
if name is not unset:
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import List, Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem
18+
19+
20+
class UpdateOutcomesAsyncAttributes(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem
24+
25+
return {
26+
"results": ([UpdateOutcomesAsyncRequestItem],),
27+
}
28+
29+
attribute_map = {
30+
"results": "results",
31+
}
32+
33+
def __init__(self_, results: Union[List[UpdateOutcomesAsyncRequestItem], UnsetType] = unset, **kwargs):
34+
"""
35+
The JSON:API attributes for a batched set of scorecard outcomes.
36+
37+
:param results: Set of scorecard outcomes to update asynchronously.
38+
:type results: [UpdateOutcomesAsyncRequestItem], optional
39+
"""
40+
if results is not unset:
41+
kwargs["results"] = results
42+
super().__init__(kwargs)

0 commit comments

Comments
 (0)