Skip to content
Merged
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": "62a19e4",
"generated": "2025-08-27 15:01:27.781"
"spec_repo_commit": "6d9663b",
"generated": "2025-08-27 16:38:12.845"
}
97 changes: 97 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14485,6 +14485,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 @@ -34444,6 +34448,8 @@ components:
description: If enabled, the rule is calculated as part of the score.
example: true
type: boolean
level:
$ref: '#/components/schemas/RuleLevel'
modified_at:
description: Time of the last rule outcome modification.
format: date-time
Expand All @@ -34464,6 +34470,13 @@ components:
description: The unique ID for a scorecard rule.
example: q8MQxk8TCqrHnWkx
type: string
RuleLevel:
description: The maturity level of the rule (1, 2, or 3).
example: 2
format: int32
maximum: 3
minimum: 1
type: integer
RuleName:
description: Name of the notification rule.
example: Rule 1
Expand Down Expand Up @@ -43835,6 +43848,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. 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 @@ -61882,6 +61946,39 @@ 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'
'409':
$ref: '#/components/responses/ConflictResponse'
'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 @@ -19527,6 +19527,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
38 changes: 38 additions & 0 deletions examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
Update Scorecard outcomes asynchronously returns "Accepted" response
"""

from os import environ
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

# there is a valid "create_scorecard_rule" in the system
CREATE_SCORECARD_RULE_DATA_ID = environ["CREATE_SCORECARD_RULE_DATA_ID"]

body = UpdateOutcomesAsyncRequest(
data=UpdateOutcomesAsyncRequestData(
attributes=UpdateOutcomesAsyncAttributes(
results=[
UpdateOutcomesAsyncRequestItem(
rule_id=CREATE_SCORECARD_RULE_DATA_ID,
entity_reference="service:my-service",
remarks='See: <a href="https://app.datadoghq.com/services">Services</a>',
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
15 changes: 15 additions & 0 deletions src/datadog_api_client/v2/model/rule_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@


class RuleAttributes(ModelNormal):
validations = {
"level": {
"inclusive_maximum": 3,
"inclusive_minimum": 1,
},
}

@cached_property
def openapi_types(_):
return {
Expand All @@ -23,6 +30,7 @@ def openapi_types(_):
"custom": (bool,),
"description": (str,),
"enabled": (bool,),
"level": (int,),
"modified_at": (datetime,),
"name": (str,),
"owner": (str,),
Expand All @@ -35,6 +43,7 @@ def openapi_types(_):
"custom": "custom",
"description": "description",
"enabled": "enabled",
"level": "level",
"modified_at": "modified_at",
"name": "name",
"owner": "owner",
Expand All @@ -48,6 +57,7 @@ def __init__(
custom: Union[bool, UnsetType] = unset,
description: Union[str, UnsetType] = unset,
enabled: Union[bool, UnsetType] = unset,
level: Union[int, UnsetType] = unset,
modified_at: Union[datetime, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
owner: Union[str, UnsetType] = unset,
Expand All @@ -72,6 +82,9 @@ def __init__(
:param enabled: If enabled, the rule is calculated as part of the score.
:type enabled: bool, optional

:param level: The maturity level of the rule (1, 2, or 3).
:type level: int, optional

:param modified_at: Time of the last rule outcome modification.
:type modified_at: datetime, optional

Expand All @@ -94,6 +107,8 @@ def __init__(
kwargs["description"] = description
if enabled is not unset:
kwargs["enabled"] = enabled
if level is not unset:
kwargs["level"] = level
if modified_at is not unset:
kwargs["modified_at"] = modified_at
if name is not unset:
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)
Loading
Loading