Skip to content

Commit

Permalink
Regenerate client from commit e4382f34 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Nov 15, 2023
1 parent 6cf238b commit 7195142
Show file tree
Hide file tree
Showing 13 changed files with 482 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-11-14 15:18:19.873863",
"spec_repo_commit": "b95546fe"
"regenerated": "2023-11-15 14:15:34.004426",
"spec_repo_commit": "e4382f34"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-11-14 15:18:19.888396",
"spec_repo_commit": "b95546fe"
"regenerated": "2023-11-15 14:15:34.019096",
"spec_repo_commit": "e4382f34"
}
}
}
105 changes: 104 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14705,6 +14705,55 @@ components:
type:
$ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptionsType'
type: object
SyntheticsPatchTestBody:
description: Wrapper around an array of [JSON Patch](https://jsonpatch.com)
operations to perform on the test
properties:
data:
description: Array of [JSON Patch](https://jsonpatch.com) operations to
perform on the test
example:
- op: replace
path: /name
value: New test name
- op: remove
path: /config/assertion/0
items:
$ref: '#/components/schemas/SyntheticsPatchTestOperation'
type: array
type: object
SyntheticsPatchTestOperation:
description: A single [JSON Patch](https://jsonpatch.com) operation to perform
on the test
properties:
op:
$ref: '#/components/schemas/SyntheticsPatchTestOperationName'
path:
description: The path to the value to modify
example: /name
type: string
value:
description: A value to use in a [JSON Patch](https://jsonpatch.com) operation
example: New Test Name
type: object
SyntheticsPatchTestOperationName:
description: The operation to perform
enum:
- add
- remove
- replace
- move
- copy
- test
example: replace
type: string
x-enum-varnames:
- ADD
- REMOVE
- REPLACE
- MOVE
- COPY
- TEST
SyntheticsPlayingTab:
description: Navigate between different tabs for your browser test.
enum:
Expand Down Expand Up @@ -29650,7 +29699,7 @@ paths:
description: Edit the configuration of a Synthetic browser test.
operationId: UpdateBrowserTest
parameters:
- description: The public ID of the test to get details from.
- description: The public ID of the test to edit.
in: path
name: public_id
required: true
Expand Down Expand Up @@ -29989,6 +30038,60 @@ paths:
summary: Get a test configuration
tags:
- Synthetics
patch:
description: Patch the configuration of a Synthetic test with partial data.
operationId: PatchTest
parameters:
- description: The public ID of the test to patch.
in: path
name: public_id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticsPatchTestBody'
description: '[JSON Patch](https://jsonpatch.com/) compliant list of operations'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticsBrowserTest'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: '- JSON format is wrong

- Updating sub-type is forbidden'
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: '- Synthetic Monitoring is not activated for the user

- Test is not owned by the user

- Test can''t be found'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Patch a Synthetics test
tags:
- Synthetics
x-codegen-request-body-name: body
/api/v1/synthetics/tests/{public_id}/results:
get:
description: Get the last 150 test results summaries for a given Synthetic API
Expand Down
21 changes: 21 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4292,6 +4292,27 @@ synthetics\_parsing\_options
:members:
:show-inheritance:

synthetics\_patch\_test\_body
-----------------------------

.. automodule:: datadog_api_client.v1.model.synthetics_patch_test_body
:members:
:show-inheritance:

synthetics\_patch\_test\_operation
----------------------------------

.. automodule:: datadog_api_client.v1.model.synthetics_patch_test_operation
:members:
:show-inheritance:

synthetics\_patch\_test\_operation\_name
----------------------------------------

.. automodule:: datadog_api_client.v1.model.synthetics_patch_test_operation_name
:members:
:show-inheritance:

synthetics\_playing\_tab
------------------------

Expand Down
34 changes: 34 additions & 0 deletions examples/v1/synthetics/PatchTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
Patch a Synthetics test returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_patch_test_body import SyntheticsPatchTestBody
from datadog_api_client.v1.model.synthetics_patch_test_operation import SyntheticsPatchTestOperation
from datadog_api_client.v1.model.synthetics_patch_test_operation_name import SyntheticsPatchTestOperationName

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = environ["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = SyntheticsPatchTestBody(
data=[
SyntheticsPatchTestOperation(
op=SyntheticsPatchTestOperationName.REPLACE,
path="/name",
value="New test name",
),
SyntheticsPatchTestOperation(
op=SyntheticsPatchTestOperationName.REMOVE,
path="/config/assertions/0",
),
],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = SyntheticsApi(api_client)
response = api_instance.patch_test(public_id=SYNTHETICS_API_TEST_PUBLIC_ID, body=body)

print(response)
51 changes: 50 additions & 1 deletion src/datadog_api_client/v1/api/synthetics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from datadog_api_client.v1.model.synthetics_trigger_ci_tests_response import SyntheticsTriggerCITestsResponse
from datadog_api_client.v1.model.synthetics_trigger_body import SyntheticsTriggerBody
from datadog_api_client.v1.model.synthetics_ci_test_body import SyntheticsCITestBody
from datadog_api_client.v1.model.synthetics_patch_test_body import SyntheticsPatchTestBody
from datadog_api_client.v1.model.synthetics_get_api_test_latest_results_response import (
SyntheticsGetAPITestLatestResultsResponse,
)
Expand Down Expand Up @@ -581,6 +582,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._patch_test_endpoint = _Endpoint(
settings={
"response_type": (SyntheticsBrowserTest,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v1/synthetics/tests/{public_id}",
"operation_id": "patch_test",
"http_method": "PATCH",
"version": "v1",
},
params_map={
"public_id": {
"required": True,
"openapi_types": (str,),
"attribute": "public_id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (SyntheticsPatchTestBody,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

self._trigger_ci_tests_endpoint = _Endpoint(
settings={
"response_type": (SyntheticsTriggerCITestsResponse,),
Expand Down Expand Up @@ -1187,6 +1214,28 @@ def list_tests_with_pagination(
}
return endpoint.call_with_http_info_paginated(pagination)

def patch_test(
self,
public_id: str,
body: SyntheticsPatchTestBody,
) -> SyntheticsBrowserTest:
"""Patch a Synthetics test.
Patch the configuration of a Synthetic test with partial data.
:param public_id: The public ID of the test to patch.
:type public_id: str
:param body: `JSON Patch <https://jsonpatch.com/>`_ compliant list of operations
:type body: SyntheticsPatchTestBody
:rtype: SyntheticsBrowserTest
"""
kwargs: Dict[str, Any] = {}
kwargs["public_id"] = public_id

kwargs["body"] = body

return self._patch_test_endpoint.call_with_http_info(**kwargs)

def trigger_ci_tests(
self,
body: SyntheticsCITestBody,
Expand Down Expand Up @@ -1252,7 +1301,7 @@ def update_browser_test(
Edit the configuration of a Synthetic browser test.
:param public_id: The public ID of the test to get details from.
:param public_id: The public ID of the test to edit.
:type public_id: str
:param body: New test details to be saved.
:type body: SyntheticsBrowserTest
Expand Down
42 changes: 42 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_patch_test_body.py
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.v1.model.synthetics_patch_test_operation import SyntheticsPatchTestOperation


class SyntheticsPatchTestBody(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_patch_test_operation import SyntheticsPatchTestOperation

return {
"data": ([SyntheticsPatchTestOperation],),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: Union[List[SyntheticsPatchTestOperation], UnsetType] = unset, **kwargs):
"""
Wrapper around an array of `JSON Patch <https://jsonpatch.com>`_ operations to perform on the test
:param data: Array of `JSON Patch <https://jsonpatch.com>`_ operations to perform on the test
:type data: [SyntheticsPatchTestOperation], optional
"""
if data is not unset:
kwargs["data"] = data
super().__init__(kwargs)
Loading

0 comments on commit 7195142

Please sign in to comment.