diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4476905298..e33b2c11c5 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -93017,6 +93017,8 @@ components: $ref: "#/components/schemas/OutcomesResponseIncluded" links: $ref: "#/components/schemas/OutcomesResponseLinks" + meta: + $ref: "#/components/schemas/PaginatedResponseMeta" type: object OutcomesResponseData: description: List of rule outcomes. @@ -93064,11 +93066,27 @@ components: type: string type: object OutcomesResponseLinks: - description: Links attributes. + description: Pagination links for rule outcomes. properties: + first: + description: Link for the first set of results. + example: "/api/v2/scorecard/outcomes?include=rule&page%5Blimit%5D=100&page%5Boffset%5D=0" + type: string + last: + description: Link for the last set of results. + example: "/api/v2/scorecard/outcomes?include=rule&page%5Blimit%5D=100&page%5Boffset%5D=200" + type: string next: description: |- Link for the next set of results. + example: "/api/v2/scorecard/outcomes?include=rule&page%5Blimit%5D=100&page%5Boffset%5D=200" + type: string + previous: + description: Link for the previous set of results. + example: "/api/v2/scorecard/outcomes?include=rule&page%5Blimit%5D=100&page%5Boffset%5D=0" + type: string + self: + description: Link for the current set of results. example: "/api/v2/scorecard/outcomes?include=rule&page%5Blimit%5D=100&page%5Boffset%5D=100" type: string type: object diff --git a/examples/v2/scorecards/ListScorecardOutcomes.py b/examples/v2/scorecards/ListScorecardOutcomes.py index f6ac8faf4e..59097d5e76 100644 --- a/examples/v2/scorecards/ListScorecardOutcomes.py +++ b/examples/v2/scorecards/ListScorecardOutcomes.py @@ -10,6 +10,8 @@ configuration.access_token = environ["DD_BEARER_TOKEN"] with ApiClient(configuration) as api_client: api_instance = ScorecardsApi(api_client) - response = api_instance.list_scorecard_outcomes() + response = api_instance.list_scorecard_outcomes( + filter_rule_id="00000000-0000-0000-0000-000000000000", + ) print(response) diff --git a/src/datadog_api_client/v2/model/outcomes_response.py b/src/datadog_api_client/v2/model/outcomes_response.py index 62bcc3f1dc..8eb2363b44 100644 --- a/src/datadog_api_client/v2/model/outcomes_response.py +++ b/src/datadog_api_client/v2/model/outcomes_response.py @@ -17,6 +17,7 @@ from datadog_api_client.v2.model.outcomes_response_data_item import OutcomesResponseDataItem from datadog_api_client.v2.model.outcomes_response_included_item import OutcomesResponseIncludedItem from datadog_api_client.v2.model.outcomes_response_links import OutcomesResponseLinks + from datadog_api_client.v2.model.paginated_response_meta import PaginatedResponseMeta class OutcomesResponse(ModelNormal): @@ -25,17 +26,20 @@ def openapi_types(_): from datadog_api_client.v2.model.outcomes_response_data_item import OutcomesResponseDataItem from datadog_api_client.v2.model.outcomes_response_included_item import OutcomesResponseIncludedItem from datadog_api_client.v2.model.outcomes_response_links import OutcomesResponseLinks + from datadog_api_client.v2.model.paginated_response_meta import PaginatedResponseMeta return { "data": ([OutcomesResponseDataItem],), "included": ([OutcomesResponseIncludedItem],), "links": (OutcomesResponseLinks,), + "meta": (PaginatedResponseMeta,), } attribute_map = { "data": "data", "included": "included", "links": "links", + "meta": "meta", } def __init__( @@ -43,6 +47,7 @@ def __init__( data: Union[List[OutcomesResponseDataItem], UnsetType] = unset, included: Union[List[OutcomesResponseIncludedItem], UnsetType] = unset, links: Union[OutcomesResponseLinks, UnsetType] = unset, + meta: Union[PaginatedResponseMeta, UnsetType] = unset, **kwargs, ): """ @@ -54,8 +59,11 @@ def __init__( :param included: Array of rule details. :type included: [OutcomesResponseIncludedItem], optional - :param links: Links attributes. + :param links: Pagination links for rule outcomes. :type links: OutcomesResponseLinks, optional + + :param meta: Metadata for scores response. + :type meta: PaginatedResponseMeta, optional """ if data is not unset: kwargs["data"] = data @@ -63,4 +71,6 @@ def __init__( kwargs["included"] = included if links is not unset: kwargs["links"] = links + if meta is not unset: + kwargs["meta"] = meta super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/outcomes_response_links.py b/src/datadog_api_client/v2/model/outcomes_response_links.py index 4c49f906a7..09fbc5f48f 100644 --- a/src/datadog_api_client/v2/model/outcomes_response_links.py +++ b/src/datadog_api_client/v2/model/outcomes_response_links.py @@ -17,20 +17,56 @@ class OutcomesResponseLinks(ModelNormal): @cached_property def openapi_types(_): return { + "first": (str,), + "last": (str,), "next": (str,), + "previous": (str,), + "self": (str,), } attribute_map = { + "first": "first", + "last": "last", "next": "next", + "previous": "previous", + "self": "self", } - def __init__(self_, next: Union[str, UnsetType] = unset, **kwargs): + def __init__( + self_, + first: Union[str, UnsetType] = unset, + last: Union[str, UnsetType] = unset, + next: Union[str, UnsetType] = unset, + previous: Union[str, UnsetType] = unset, + self: Union[str, UnsetType] = unset, + **kwargs, + ): """ - Links attributes. + Pagination links for rule outcomes. + + :param first: Link for the first set of results. + :type first: str, optional + + :param last: Link for the last set of results. + :type last: str, optional :param next: Link for the next set of results. :type next: str, optional + + :param previous: Link for the previous set of results. + :type previous: str, optional + + :param self: Link for the current set of results. + :type self: str, optional """ + if first is not unset: + kwargs["first"] = first + if last is not unset: + kwargs["last"] = last if next is not unset: kwargs["next"] = next + if previous is not unset: + kwargs["previous"] = previous + if self is not unset: + kwargs["self"] = self super().__init__(kwargs) diff --git a/tests/generated-test/test-runner-data/v2/scorecards/list-all-rule-outcomes-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/scorecards/list-all-rule-outcomes-returns-ok-response.json index af826fac3c..7ab79fa369 100644 --- a/tests/generated-test/test-runner-data/v2/scorecards/list-all-rule-outcomes-returns-ok-response.json +++ b/tests/generated-test/test-runner-data/v2/scorecards/list-all-rule-outcomes-returns-ok-response.json @@ -9,7 +9,24 @@ "content_type": null, "method": "GET", "pagination": false, - "parameters": [], + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[rule][id]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "00000000-0000-0000-0000-000000000000" + }, + "style": null + } + ], "path": "/api/v2/scorecard/outcomes" }, "scenario": "List all rule outcomes returns \"OK\" response", diff --git a/tests/generated-test/test-server-data/v2/scorecards.json b/tests/generated-test/test-server-data/v2/scorecards.json index 3d20007e88..303ba02b37 100644 --- a/tests/generated-test/test-server-data/v2/scorecards.json +++ b/tests/generated-test/test-server-data/v2/scorecards.json @@ -458,7 +458,7 @@ }, { "feature": "Scorecards", - "frozen_at": "2023-11-01T22:17:32.235Z", + "frozen_at": "2026-10-15T18:17:34.519Z", "interactions": [ { "request": { @@ -469,12 +469,17 @@ "content_type": "", "method": "GET", "path": "/api/v2/scorecard/outcomes", - "query": [] + "query": [ + [ + "filter[rule][id]", + "00000000-0000-0000-0000-000000000000" + ] + ] }, "response": { "body": { "encoding": "text", - "value": "{\"data\":[{\"id\":\"c70e3b5f-a9f7-4ef8-8417-bf28ea153631\\\\my-service\",\"type\":\"outcome\",\"attributes\":{\"modified_at\":\"2023-11-01T20:08:35.478323Z\",\"remarks\":\"See: \\u003ca href=\\\"https://app.datadoghq.com/services\\\"\\u003eServices\\u003c/a\\u003e\",\"service_name\":\"my-service\",\"state\":\"pass\"},\"relationships\":{\"rule\":{\"data\":{\"id\":\"c70e3b5f-a9f7-4ef8-8417-bf28ea153631\",\"type\":\"rule\"}}}},{\"id\":\"2609deb7-bbd0-4277-bf48-2265328bc4ca\\\\my-service\",\"type\":\"outcome\",\"attributes\":{\"modified_at\":\"2023-11-01T20:08:49.202899Z\",\"remarks\":\"See: \\u003ca href=\\\"https://app.datadoghq.com/services\\\"\\u003eServices\\u003c/a\\u003e\",\"service_name\":\"my-service\",\"state\":\"pass\"},\"relationships\":{\"rule\":{\"data\":{\"id\":\"2609deb7-bbd0-4277-bf48-2265328bc4ca\",\"type\":\"rule\"}}}},{\"id\":\"be6867b9-bd71-497f-803f-208d7361fee2\\\\my-service\",\"type\":\"outcome\",\"attributes\":{\"modified_at\":\"2023-11-01T20:25:35.504243Z\",\"remarks\":\"See: \\u003ca href=\\\"https://app.datadoghq.com/services\\\"\\u003eServices\\u003c/a\\u003e\",\"service_name\":\"my-service\",\"state\":\"pass\"},\"relationships\":{\"rule\":{\"data\":{\"id\":\"be6867b9-bd71-497f-803f-208d7361fee2\",\"type\":\"rule\"}}}}],\"links\":{\"next\":\"/api/v2/scorecard/outcomes?page%5Blimit%5D=100\\u0026page%5Boffset%5D=100\"}}" + "value": "{\"data\":[],\"meta\":{\"count\":0,\"limit\":1000,\"offset\":0,\"total\":0},\"links\":{\"self\":\"/api/v2/scorecard/outcomes?filter%5Brule%5D%5Bid%5D=00000000-0000-0000-0000-000000000000\\u0026include=entity\\u0026page%5Blimit%5D=1000\\u0026page%5Boffset%5D=0\",\"first\":\"/api/v2/scorecard/outcomes?filter%5Brule%5D%5Bid%5D=00000000-0000-0000-0000-000000000000\\u0026include=entity\\u0026page%5Blimit%5D=1000\\u0026page%5Boffset%5D=0\",\"last\":\"/api/v2/scorecard/outcomes?filter%5Brule%5D%5Bid%5D=00000000-0000-0000-0000-000000000000\\u0026include=entity\\u0026page%5Blimit%5D=1000\\u0026page%5Boffset%5D=0\"}}" }, "headers": { "content-type": "application/vnd.api+json" diff --git a/tests/v2/features/scorecards.feature b/tests/v2/features/scorecards.feature index 0ae2916d06..5ee08c36f3 100644 --- a/tests/v2/features/scorecards.feature +++ b/tests/v2/features/scorecards.feature @@ -142,8 +142,10 @@ Feature: Scorecards @team:ddoghq/idp Scenario: List all rule outcomes returns "OK" response Given new "ListScorecardOutcomes" request + And request contains "filter[rule][id]" parameter with value "00000000-0000-0000-0000-000000000000" When the request is sent Then the response status is 200 OK + And the response "data" has length 0 @replay-only @skip-validation @team:ddoghq/idp @with-pagination Scenario: List all rule outcomes returns "OK" response with pagination