diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb71549..1fe0e1f167 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23651,6 +23651,61 @@ components: required: - type type: object + GlobalVariableData: + description: Synthetics global variable data. Wrapper around the global variable + object. + properties: + attributes: + $ref: '#/components/schemas/SyntheticsGlobalVariable' + id: + description: Global variable identifier. + type: string + type: + $ref: '#/components/schemas/GlobalVariableType' + type: object + GlobalVariableJsonPatchRequest: + description: JSON Patch request for global variable. + properties: + data: + $ref: '#/components/schemas/GlobalVariableJsonPatchRequestData' + required: + - data + type: object + GlobalVariableJsonPatchRequestData: + properties: + attributes: + $ref: '#/components/schemas/GlobalVariableJsonPatchRequestDataAttributes' + type: + $ref: '#/components/schemas/GlobalVariableJsonPatchType' + type: object + GlobalVariableJsonPatchRequestDataAttributes: + properties: + json_patch: + description: JSON Patch operations following RFC 6902. + items: + $ref: '#/components/schemas/JsonPatchOperation' + type: array + type: object + GlobalVariableJsonPatchType: + description: Global variable JSON Patch type. + enum: + - global_variables_json_patch + type: string + x-enum-varnames: + - GLOBAL_VARIABLES_JSON_PATCH + GlobalVariableResponse: + description: Global variable response. + properties: + data: + $ref: '#/components/schemas/GlobalVariableData' + type: object + GlobalVariableType: + description: Global variable type. + enum: + - global_variables + type: string + x-enum-varnames: + - GLOBAL_VARIABLES GoogleMeetConfigurationReference: description: A reference to a Google Meet Configuration resource. nullable: true @@ -28404,6 +28459,40 @@ components: - to - index type: object + JsonPatchOperation: + description: A JSON Patch operation as per RFC 6902. + properties: + op: + $ref: '#/components/schemas/JsonPatchOperationOp' + path: + description: A JSON Pointer path (e.g., "/name", "/value/secure"). + example: /name + type: string + value: + description: The value to use for the operation (not applicable for "remove" + and "test" operations). + required: + - op + - path + type: object + JsonPatchOperationOp: + description: The operation to perform. + enum: + - add + - remove + - replace + - move + - copy + - test + example: add + type: string + x-enum-varnames: + - ADD + - REMOVE + - REPLACE + - MOVE + - COPY + - TEST KindAttributes: description: Kind attributes. properties: @@ -51322,6 +51411,178 @@ components: format: double type: number type: object + SyntheticsGlobalVariable: + description: Synthetic global variable. + properties: + attributes: + $ref: '#/components/schemas/SyntheticsGlobalVariableAttributes' + description: + description: Description of the global variable. + example: Example description + type: string + id: + description: Unique identifier of the global variable. + readOnly: true + type: string + is_fido: + description: Determines if the global variable is a FIDO variable. + type: boolean + is_totp: + description: Determines if the global variable is a TOTP/MFA variable. + type: boolean + name: + description: Name of the global variable. Unique across Synthetic global + variables. + example: MY_VARIABLE + type: string + parse_test_options: + $ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptions' + parse_test_public_id: + description: A Synthetic test ID to use as a test to generate the variable + value. + example: abc-def-123 + type: string + tags: + description: Tags of the global variable. + example: + - team:front + - test:workflow-1 + items: + description: Tag name. + type: string + type: array + value: + $ref: '#/components/schemas/SyntheticsGlobalVariableValue' + required: + - description + - name + - tags + - value + type: object + SyntheticsGlobalVariableAttributes: + description: Attributes of the global variable. + properties: + restricted_roles: + $ref: '#/components/schemas/SyntheticsRestrictedRoles' + type: object + SyntheticsGlobalVariableOptions: + description: Options for the Global Variable for MFA. + properties: + totp_parameters: + $ref: '#/components/schemas/SyntheticsGlobalVariableTOTPParameters' + type: object + SyntheticsGlobalVariableParseTestOptions: + description: Parser options to use for retrieving a Synthetic global variable + from a Synthetic test. Used in conjunction with `parse_test_public_id`. + properties: + field: + description: When type is `http_header`, name of the header to use to extract + the value. + example: content-type + type: string + localVariableName: + description: When type is `local_variable`, name of the local variable to + use to extract the value. + example: LOCAL_VARIABLE + type: string + parser: + $ref: '#/components/schemas/SyntheticsVariableParser' + type: + $ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptionsType' + required: + - type + type: object + SyntheticsGlobalVariableParseTestOptionsType: + description: Type of value to extract from a test for a Synthetic global variable. + enum: + - http_body + - http_header + - http_status_code + - local_variable + example: http_body + type: string + x-enum-varnames: + - HTTP_BODY + - HTTP_HEADER + - HTTP_STATUS_CODE + - LOCAL_VARIABLE + SyntheticsGlobalVariableParserType: + description: Type of parser for a Synthetic global variable from a synthetics + test. + enum: + - raw + - json_path + - regex + - x_path + example: raw + type: string + x-enum-varnames: + - RAW + - JSON_PATH + - REGEX + - X_PATH + SyntheticsGlobalVariableTOTPParameters: + description: Parameters for the TOTP/MFA variable + properties: + digits: + description: Number of digits for the OTP code. + example: 6 + format: int32 + maximum: 10 + minimum: 4 + type: integer + refresh_interval: + description: Interval for which to refresh the token (in seconds). + example: 30 + format: int32 + maximum: 999 + minimum: 0 + type: integer + type: object + SyntheticsGlobalVariableValue: + description: Value of the global variable. + example: + secure: true + value: value + properties: + options: + $ref: '#/components/schemas/SyntheticsGlobalVariableOptions' + secure: + description: Determines if the value of the variable is hidden. + type: boolean + value: + description: 'Value of the global variable. When reading a global variable, + + the value will not be present if the variable is hidden with the `secure` + property.' + example: example-value + type: string + type: object + SyntheticsRestrictedRoles: + description: A list of role identifiers that can be pulled from the Roles API, + for restricting read and write access. + example: + - xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + items: + description: UUID for a role. + example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + type: string + type: array + SyntheticsVariableParser: + description: Details of the parser to use for the global variable. + example: + type: regex + value: .* + properties: + type: + $ref: '#/components/schemas/SyntheticsGlobalVariableParserType' + value: + description: Regex or JSON path used for the parser. Not used with type + `raw`. + type: string + required: + - type + type: object TableResultV2: description: A reference table resource containing its full configuration and state. @@ -81694,6 +81955,60 @@ paths: operator: OR permissions: - billing_edit + /api/v2/synthetics/variables/{variable_id}/jsonpatch: + patch: + description: 'Patch a global variable using JSON Patch (RFC 6902). + + This endpoint allows partial updates to a global variable by specifying only + the fields to modify. + + + Common operations include: + + - Replace field values: `{"op": "replace", "path": "/name", "value": "new_name"}` + + - Update nested values: `{"op": "replace", "path": "/value/value", "value": + "new_value"}` + + - Add/update tags: `{"op": "add", "path": "/tags/-", "value": "new_tag"}` + + - Remove fields: `{"op": "remove", "path": "/description"}`' + operationId: PatchGlobalVariable + parameters: + - description: The ID of the global variable. + in: path + name: variable_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GlobalVariableJsonPatchRequest' + description: JSON Patch document with operations to apply. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GlobalVariableResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Patch a global variable + tags: + - Synthetics + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - synthetics_global_variable_write /api/v2/tags/enrichment: get: description: List all tag pipeline rulesets - Retrieve a list of all tag pipeline diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 60fdfd49e2..ecb3b14245 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -10007,6 +10007,55 @@ datadog\_api\_client.v2.model.gitlab\_integration\_update module :members: :show-inheritance: +datadog\_api\_client.v2.model.global\_variable\_data module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.global_variable_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.global\_variable\_json\_patch\_request module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.global_variable_json_patch_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.global\_variable\_json\_patch\_request\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.global_variable_json_patch_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.global\_variable\_json\_patch\_request\_data\_attributes module +--------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.global_variable_json_patch_request_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.global\_variable\_json\_patch\_type module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.global_variable_json_patch_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.global\_variable\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.global_variable_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.global\_variable\_type module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.global_variable_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.google\_meet\_configuration\_reference module --------------------------------------------------------------------------- @@ -12107,6 +12156,20 @@ datadog\_api\_client.v2.model.job\_definition\_from\_rule module :members: :show-inheritance: +datadog\_api\_client.v2.model.json\_patch\_operation module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.json_patch_operation + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.json\_patch\_operation\_op module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.json_patch_operation_op + :members: + :show-inheritance: + datadog\_api\_client.v2.model.jsonapi\_error\_item module --------------------------------------------------------- @@ -22684,6 +22747,69 @@ datadog\_api\_client.v2.model.step\_display\_bounds module :members: :show-inheritance: +datadog\_api\_client.v2.model.synthetics\_global\_variable module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_global\_variable\_attributes module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_global\_variable\_options module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable_options + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_global\_variable\_parse\_test\_options module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable_parse_test_options + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_global\_variable\_parse\_test\_options\_type module +--------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable_parse_test_options_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_global\_variable\_parser\_type module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable_parser_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_global\_variable\_totp\_parameters module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable_totp_parameters + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_global\_variable\_value module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.synthetics_global_variable_value + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.synthetics\_variable\_parser module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.synthetics_variable_parser + :members: + :show-inheritance: + datadog\_api\_client.v2.model.table\_result\_v2 module ------------------------------------------------------ diff --git a/examples/v2/synthetics/PatchGlobalVariable.py b/examples/v2/synthetics/PatchGlobalVariable.py new file mode 100644 index 0000000000..058660eecc --- /dev/null +++ b/examples/v2/synthetics/PatchGlobalVariable.py @@ -0,0 +1,35 @@ +""" +Patch a global variable returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.synthetics_api import SyntheticsApi +from datadog_api_client.v2.model.global_variable_json_patch_request import GlobalVariableJsonPatchRequest +from datadog_api_client.v2.model.global_variable_json_patch_request_data import GlobalVariableJsonPatchRequestData +from datadog_api_client.v2.model.global_variable_json_patch_request_data_attributes import ( + GlobalVariableJsonPatchRequestDataAttributes, +) +from datadog_api_client.v2.model.global_variable_json_patch_type import GlobalVariableJsonPatchType +from datadog_api_client.v2.model.json_patch_operation import JsonPatchOperation +from datadog_api_client.v2.model.json_patch_operation_op import JsonPatchOperationOp + +body = GlobalVariableJsonPatchRequest( + data=GlobalVariableJsonPatchRequestData( + attributes=GlobalVariableJsonPatchRequestDataAttributes( + json_patch=[ + JsonPatchOperation( + op=JsonPatchOperationOp.ADD, + path="/name", + ), + ], + ), + type=GlobalVariableJsonPatchType.GLOBAL_VARIABLES_JSON_PATCH, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = SyntheticsApi(api_client) + response = api_instance.patch_global_variable(variable_id="variable_id", body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/synthetics_api.py b/src/datadog_api_client/v2/api/synthetics_api.py index 7d8b21f8e3..263a5fb12d 100644 --- a/src/datadog_api_client/v2/api/synthetics_api.py +++ b/src/datadog_api_client/v2/api/synthetics_api.py @@ -9,6 +9,8 @@ from datadog_api_client.configuration import Configuration from datadog_api_client.v2.model.on_demand_concurrency_cap_response import OnDemandConcurrencyCapResponse from datadog_api_client.v2.model.on_demand_concurrency_cap_attributes import OnDemandConcurrencyCapAttributes +from datadog_api_client.v2.model.global_variable_response import GlobalVariableResponse +from datadog_api_client.v2.model.global_variable_json_patch_request import GlobalVariableJsonPatchRequest class SyntheticsApi: @@ -43,6 +45,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._patch_global_variable_endpoint = _Endpoint( + settings={ + "response_type": (GlobalVariableResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/synthetics/variables/{variable_id}/jsonpatch", + "operation_id": "patch_global_variable", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "variable_id": { + "required": True, + "openapi_types": (str,), + "attribute": "variable_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (GlobalVariableJsonPatchRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._set_on_demand_concurrency_cap_endpoint = _Endpoint( settings={ "response_type": (OnDemandConcurrencyCapResponse,), @@ -75,6 +103,36 @@ def get_on_demand_concurrency_cap( kwargs: Dict[str, Any] = {} return self._get_on_demand_concurrency_cap_endpoint.call_with_http_info(**kwargs) + def patch_global_variable( + self, + variable_id: str, + body: GlobalVariableJsonPatchRequest, + ) -> GlobalVariableResponse: + """Patch a global variable. + + Patch a global variable using JSON Patch (RFC 6902). + This endpoint allows partial updates to a global variable by specifying only the fields to modify. + + Common operations include: + + * Replace field values: ``{"op": "replace", "path": "/name", "value": "new_name"}`` + * Update nested values: ``{"op": "replace", "path": "/value/value", "value": "new_value"}`` + * Add/update tags: ``{"op": "add", "path": "/tags/-", "value": "new_tag"}`` + * Remove fields: ``{"op": "remove", "path": "/description"}`` + + :param variable_id: The ID of the global variable. + :type variable_id: str + :param body: JSON Patch document with operations to apply. + :type body: GlobalVariableJsonPatchRequest + :rtype: GlobalVariableResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["variable_id"] = variable_id + + kwargs["body"] = body + + return self._patch_global_variable_endpoint.call_with_http_info(**kwargs) + def set_on_demand_concurrency_cap( self, body: OnDemandConcurrencyCapAttributes, diff --git a/src/datadog_api_client/v2/model/global_variable_data.py b/src/datadog_api_client/v2/model/global_variable_data.py new file mode 100644 index 0000000000..23a7546ae7 --- /dev/null +++ b/src/datadog_api_client/v2/model/global_variable_data.py @@ -0,0 +1,64 @@ +# 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.synthetics_global_variable import SyntheticsGlobalVariable + from datadog_api_client.v2.model.global_variable_type import GlobalVariableType + + +class GlobalVariableData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.synthetics_global_variable import SyntheticsGlobalVariable + from datadog_api_client.v2.model.global_variable_type import GlobalVariableType + + return { + "attributes": (SyntheticsGlobalVariable,), + "id": (str,), + "type": (GlobalVariableType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[SyntheticsGlobalVariable, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[GlobalVariableType, UnsetType] = unset, + **kwargs, + ): + """ + Synthetics global variable data. Wrapper around the global variable object. + + :param attributes: Synthetic global variable. + :type attributes: SyntheticsGlobalVariable, optional + + :param id: Global variable identifier. + :type id: str, optional + + :param type: Global variable type. + :type type: GlobalVariableType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/global_variable_json_patch_request.py b/src/datadog_api_client/v2/model/global_variable_json_patch_request.py new file mode 100644 index 0000000000..bd40589abd --- /dev/null +++ b/src/datadog_api_client/v2/model/global_variable_json_patch_request.py @@ -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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.global_variable_json_patch_request_data import GlobalVariableJsonPatchRequestData + + +class GlobalVariableJsonPatchRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.global_variable_json_patch_request_data import ( + GlobalVariableJsonPatchRequestData, + ) + + return { + "data": (GlobalVariableJsonPatchRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: GlobalVariableJsonPatchRequestData, **kwargs): + """ + JSON Patch request for global variable. + + :param data: + :type data: GlobalVariableJsonPatchRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/global_variable_json_patch_request_data.py b/src/datadog_api_client/v2/model/global_variable_json_patch_request_data.py new file mode 100644 index 0000000000..00339f550d --- /dev/null +++ b/src/datadog_api_client/v2/model/global_variable_json_patch_request_data.py @@ -0,0 +1,60 @@ +# 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.global_variable_json_patch_request_data_attributes import ( + GlobalVariableJsonPatchRequestDataAttributes, + ) + from datadog_api_client.v2.model.global_variable_json_patch_type import GlobalVariableJsonPatchType + + +class GlobalVariableJsonPatchRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.global_variable_json_patch_request_data_attributes import ( + GlobalVariableJsonPatchRequestDataAttributes, + ) + from datadog_api_client.v2.model.global_variable_json_patch_type import GlobalVariableJsonPatchType + + return { + "attributes": (GlobalVariableJsonPatchRequestDataAttributes,), + "type": (GlobalVariableJsonPatchType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: Union[GlobalVariableJsonPatchRequestDataAttributes, UnsetType] = unset, + type: Union[GlobalVariableJsonPatchType, UnsetType] = unset, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: GlobalVariableJsonPatchRequestDataAttributes, optional + + :param type: Global variable JSON Patch type. + :type type: GlobalVariableJsonPatchType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/global_variable_json_patch_request_data_attributes.py b/src/datadog_api_client/v2/model/global_variable_json_patch_request_data_attributes.py new file mode 100644 index 0000000000..46808a7afd --- /dev/null +++ b/src/datadog_api_client/v2/model/global_variable_json_patch_request_data_attributes.py @@ -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.json_patch_operation import JsonPatchOperation + + +class GlobalVariableJsonPatchRequestDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.json_patch_operation import JsonPatchOperation + + return { + "json_patch": ([JsonPatchOperation],), + } + + attribute_map = { + "json_patch": "json_patch", + } + + def __init__(self_, json_patch: Union[List[JsonPatchOperation], UnsetType] = unset, **kwargs): + """ + + + :param json_patch: JSON Patch operations following RFC 6902. + :type json_patch: [JsonPatchOperation], optional + """ + if json_patch is not unset: + kwargs["json_patch"] = json_patch + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/global_variable_json_patch_type.py b/src/datadog_api_client/v2/model/global_variable_json_patch_type.py new file mode 100644 index 0000000000..167fbb49d3 --- /dev/null +++ b/src/datadog_api_client/v2/model/global_variable_json_patch_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GlobalVariableJsonPatchType(ModelSimple): + """ + Global variable JSON Patch type. + + :param value: If omitted defaults to "global_variables_json_patch". Must be one of ["global_variables_json_patch"]. + :type value: str + """ + + allowed_values = { + "global_variables_json_patch", + } + GLOBAL_VARIABLES_JSON_PATCH: ClassVar["GlobalVariableJsonPatchType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GlobalVariableJsonPatchType.GLOBAL_VARIABLES_JSON_PATCH = GlobalVariableJsonPatchType("global_variables_json_patch") diff --git a/src/datadog_api_client/v2/model/global_variable_response.py b/src/datadog_api_client/v2/model/global_variable_response.py new file mode 100644 index 0000000000..3b684b321a --- /dev/null +++ b/src/datadog_api_client/v2/model/global_variable_response.py @@ -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.global_variable_data import GlobalVariableData + + +class GlobalVariableResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.global_variable_data import GlobalVariableData + + return { + "data": (GlobalVariableData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[GlobalVariableData, UnsetType] = unset, **kwargs): + """ + Global variable response. + + :param data: Synthetics global variable data. Wrapper around the global variable object. + :type data: GlobalVariableData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/global_variable_type.py b/src/datadog_api_client/v2/model/global_variable_type.py new file mode 100644 index 0000000000..00d7807fa0 --- /dev/null +++ b/src/datadog_api_client/v2/model/global_variable_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class GlobalVariableType(ModelSimple): + """ + Global variable type. + + :param value: If omitted defaults to "global_variables". Must be one of ["global_variables"]. + :type value: str + """ + + allowed_values = { + "global_variables", + } + GLOBAL_VARIABLES: ClassVar["GlobalVariableType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +GlobalVariableType.GLOBAL_VARIABLES = GlobalVariableType("global_variables") diff --git a/src/datadog_api_client/v2/model/json_patch_operation.py b/src/datadog_api_client/v2/model/json_patch_operation.py new file mode 100644 index 0000000000..45cd6be4ad --- /dev/null +++ b/src/datadog_api_client/v2/model/json_patch_operation.py @@ -0,0 +1,70 @@ +# 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 Any, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.json_patch_operation_op import JsonPatchOperationOp + + +class JsonPatchOperation(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.json_patch_operation_op import JsonPatchOperationOp + + return { + "op": (JsonPatchOperationOp,), + "path": (str,), + "value": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ), + } + + attribute_map = { + "op": "op", + "path": "path", + "value": "value", + } + + def __init__(self_, op: JsonPatchOperationOp, path: str, value: Union[Any, UnsetType] = unset, **kwargs): + """ + A JSON Patch operation as per RFC 6902. + + :param op: The operation to perform. + :type op: JsonPatchOperationOp + + :param path: A JSON Pointer path (e.g., "/name", "/value/secure"). + :type path: str + + :param value: The value to use for the operation (not applicable for "remove" and "test" operations). + :type value: bool, date, datetime, dict, float, int, list, str, UUID, none_type, optional + """ + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) + + self_.op = op + self_.path = path diff --git a/src/datadog_api_client/v2/model/json_patch_operation_op.py b/src/datadog_api_client/v2/model/json_patch_operation_op.py new file mode 100644 index 0000000000..9560ee3d19 --- /dev/null +++ b/src/datadog_api_client/v2/model/json_patch_operation_op.py @@ -0,0 +1,50 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class JsonPatchOperationOp(ModelSimple): + """ + The operation to perform. + + :param value: Must be one of ["add", "remove", "replace", "move", "copy", "test"]. + :type value: str + """ + + allowed_values = { + "add", + "remove", + "replace", + "move", + "copy", + "test", + } + ADD: ClassVar["JsonPatchOperationOp"] + REMOVE: ClassVar["JsonPatchOperationOp"] + REPLACE: ClassVar["JsonPatchOperationOp"] + MOVE: ClassVar["JsonPatchOperationOp"] + COPY: ClassVar["JsonPatchOperationOp"] + TEST: ClassVar["JsonPatchOperationOp"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +JsonPatchOperationOp.ADD = JsonPatchOperationOp("add") +JsonPatchOperationOp.REMOVE = JsonPatchOperationOp("remove") +JsonPatchOperationOp.REPLACE = JsonPatchOperationOp("replace") +JsonPatchOperationOp.MOVE = JsonPatchOperationOp("move") +JsonPatchOperationOp.COPY = JsonPatchOperationOp("copy") +JsonPatchOperationOp.TEST = JsonPatchOperationOp("test") diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable.py b/src/datadog_api_client/v2/model/synthetics_global_variable.py new file mode 100644 index 0000000000..079508ac71 --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable.py @@ -0,0 +1,126 @@ +# 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.synthetics_global_variable_attributes import SyntheticsGlobalVariableAttributes + from datadog_api_client.v2.model.synthetics_global_variable_parse_test_options import ( + SyntheticsGlobalVariableParseTestOptions, + ) + from datadog_api_client.v2.model.synthetics_global_variable_value import SyntheticsGlobalVariableValue + + +class SyntheticsGlobalVariable(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.synthetics_global_variable_attributes import SyntheticsGlobalVariableAttributes + from datadog_api_client.v2.model.synthetics_global_variable_parse_test_options import ( + SyntheticsGlobalVariableParseTestOptions, + ) + from datadog_api_client.v2.model.synthetics_global_variable_value import SyntheticsGlobalVariableValue + + return { + "attributes": (SyntheticsGlobalVariableAttributes,), + "description": (str,), + "id": (str,), + "is_fido": (bool,), + "is_totp": (bool,), + "name": (str,), + "parse_test_options": (SyntheticsGlobalVariableParseTestOptions,), + "parse_test_public_id": (str,), + "tags": ([str],), + "value": (SyntheticsGlobalVariableValue,), + } + + attribute_map = { + "attributes": "attributes", + "description": "description", + "id": "id", + "is_fido": "is_fido", + "is_totp": "is_totp", + "name": "name", + "parse_test_options": "parse_test_options", + "parse_test_public_id": "parse_test_public_id", + "tags": "tags", + "value": "value", + } + read_only_vars = { + "id", + } + + def __init__( + self_, + description: str, + name: str, + tags: List[str], + value: SyntheticsGlobalVariableValue, + attributes: Union[SyntheticsGlobalVariableAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + is_fido: Union[bool, UnsetType] = unset, + is_totp: Union[bool, UnsetType] = unset, + parse_test_options: Union[SyntheticsGlobalVariableParseTestOptions, UnsetType] = unset, + parse_test_public_id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Synthetic global variable. + + :param attributes: Attributes of the global variable. + :type attributes: SyntheticsGlobalVariableAttributes, optional + + :param description: Description of the global variable. + :type description: str + + :param id: Unique identifier of the global variable. + :type id: str, optional + + :param is_fido: Determines if the global variable is a FIDO variable. + :type is_fido: bool, optional + + :param is_totp: Determines if the global variable is a TOTP/MFA variable. + :type is_totp: bool, optional + + :param name: Name of the global variable. Unique across Synthetic global variables. + :type name: str + + :param parse_test_options: Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with ``parse_test_public_id``. + :type parse_test_options: SyntheticsGlobalVariableParseTestOptions, optional + + :param parse_test_public_id: A Synthetic test ID to use as a test to generate the variable value. + :type parse_test_public_id: str, optional + + :param tags: Tags of the global variable. + :type tags: [str] + + :param value: Value of the global variable. + :type value: SyntheticsGlobalVariableValue + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if is_fido is not unset: + kwargs["is_fido"] = is_fido + if is_totp is not unset: + kwargs["is_totp"] = is_totp + if parse_test_options is not unset: + kwargs["parse_test_options"] = parse_test_options + if parse_test_public_id is not unset: + kwargs["parse_test_public_id"] = parse_test_public_id + super().__init__(kwargs) + + self_.description = description + self_.name = name + self_.tags = tags + self_.value = value diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable_attributes.py b/src/datadog_api_client/v2/model/synthetics_global_variable_attributes.py new file mode 100644 index 0000000000..00ac9e1f62 --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable_attributes.py @@ -0,0 +1,36 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class SyntheticsGlobalVariableAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "restricted_roles": ([str],), + } + + attribute_map = { + "restricted_roles": "restricted_roles", + } + + def __init__(self_, restricted_roles: Union[List[str], UnsetType] = unset, **kwargs): + """ + Attributes of the global variable. + + :param restricted_roles: A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. + :type restricted_roles: [str], optional + """ + if restricted_roles is not unset: + kwargs["restricted_roles"] = restricted_roles + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable_options.py b/src/datadog_api_client/v2/model/synthetics_global_variable_options.py new file mode 100644 index 0000000000..01fe17c99f --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable_options.py @@ -0,0 +1,46 @@ +# 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.synthetics_global_variable_totp_parameters import ( + SyntheticsGlobalVariableTOTPParameters, + ) + + +class SyntheticsGlobalVariableOptions(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.synthetics_global_variable_totp_parameters import ( + SyntheticsGlobalVariableTOTPParameters, + ) + + return { + "totp_parameters": (SyntheticsGlobalVariableTOTPParameters,), + } + + attribute_map = { + "totp_parameters": "totp_parameters", + } + + def __init__(self_, totp_parameters: Union[SyntheticsGlobalVariableTOTPParameters, UnsetType] = unset, **kwargs): + """ + Options for the Global Variable for MFA. + + :param totp_parameters: Parameters for the TOTP/MFA variable + :type totp_parameters: SyntheticsGlobalVariableTOTPParameters, optional + """ + if totp_parameters is not unset: + kwargs["totp_parameters"] = totp_parameters + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable_parse_test_options.py b/src/datadog_api_client/v2/model/synthetics_global_variable_parse_test_options.py new file mode 100644 index 0000000000..808f173ddd --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable_parse_test_options.py @@ -0,0 +1,76 @@ +# 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.synthetics_variable_parser import SyntheticsVariableParser + from datadog_api_client.v2.model.synthetics_global_variable_parse_test_options_type import ( + SyntheticsGlobalVariableParseTestOptionsType, + ) + + +class SyntheticsGlobalVariableParseTestOptions(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.synthetics_variable_parser import SyntheticsVariableParser + from datadog_api_client.v2.model.synthetics_global_variable_parse_test_options_type import ( + SyntheticsGlobalVariableParseTestOptionsType, + ) + + return { + "field": (str,), + "local_variable_name": (str,), + "parser": (SyntheticsVariableParser,), + "type": (SyntheticsGlobalVariableParseTestOptionsType,), + } + + attribute_map = { + "field": "field", + "local_variable_name": "localVariableName", + "parser": "parser", + "type": "type", + } + + def __init__( + self_, + type: SyntheticsGlobalVariableParseTestOptionsType, + field: Union[str, UnsetType] = unset, + local_variable_name: Union[str, UnsetType] = unset, + parser: Union[SyntheticsVariableParser, UnsetType] = unset, + **kwargs, + ): + """ + Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with ``parse_test_public_id``. + + :param field: When type is ``http_header`` , name of the header to use to extract the value. + :type field: str, optional + + :param local_variable_name: When type is ``local_variable`` , name of the local variable to use to extract the value. + :type local_variable_name: str, optional + + :param parser: Details of the parser to use for the global variable. + :type parser: SyntheticsVariableParser, optional + + :param type: Type of value to extract from a test for a Synthetic global variable. + :type type: SyntheticsGlobalVariableParseTestOptionsType + """ + if field is not unset: + kwargs["field"] = field + if local_variable_name is not unset: + kwargs["local_variable_name"] = local_variable_name + if parser is not unset: + kwargs["parser"] = parser + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable_parse_test_options_type.py b/src/datadog_api_client/v2/model/synthetics_global_variable_parse_test_options_type.py new file mode 100644 index 0000000000..bd8263ec4f --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable_parse_test_options_type.py @@ -0,0 +1,48 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class SyntheticsGlobalVariableParseTestOptionsType(ModelSimple): + """ + Type of value to extract from a test for a Synthetic global variable. + + :param value: Must be one of ["http_body", "http_header", "http_status_code", "local_variable"]. + :type value: str + """ + + allowed_values = { + "http_body", + "http_header", + "http_status_code", + "local_variable", + } + HTTP_BODY: ClassVar["SyntheticsGlobalVariableParseTestOptionsType"] + HTTP_HEADER: ClassVar["SyntheticsGlobalVariableParseTestOptionsType"] + HTTP_STATUS_CODE: ClassVar["SyntheticsGlobalVariableParseTestOptionsType"] + LOCAL_VARIABLE: ClassVar["SyntheticsGlobalVariableParseTestOptionsType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +SyntheticsGlobalVariableParseTestOptionsType.HTTP_BODY = SyntheticsGlobalVariableParseTestOptionsType("http_body") +SyntheticsGlobalVariableParseTestOptionsType.HTTP_HEADER = SyntheticsGlobalVariableParseTestOptionsType("http_header") +SyntheticsGlobalVariableParseTestOptionsType.HTTP_STATUS_CODE = SyntheticsGlobalVariableParseTestOptionsType( + "http_status_code" +) +SyntheticsGlobalVariableParseTestOptionsType.LOCAL_VARIABLE = SyntheticsGlobalVariableParseTestOptionsType( + "local_variable" +) diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable_parser_type.py b/src/datadog_api_client/v2/model/synthetics_global_variable_parser_type.py new file mode 100644 index 0000000000..106997733f --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable_parser_type.py @@ -0,0 +1,44 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class SyntheticsGlobalVariableParserType(ModelSimple): + """ + Type of parser for a Synthetic global variable from a synthetics test. + + :param value: Must be one of ["raw", "json_path", "regex", "x_path"]. + :type value: str + """ + + allowed_values = { + "raw", + "json_path", + "regex", + "x_path", + } + RAW: ClassVar["SyntheticsGlobalVariableParserType"] + JSON_PATH: ClassVar["SyntheticsGlobalVariableParserType"] + REGEX: ClassVar["SyntheticsGlobalVariableParserType"] + X_PATH: ClassVar["SyntheticsGlobalVariableParserType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +SyntheticsGlobalVariableParserType.RAW = SyntheticsGlobalVariableParserType("raw") +SyntheticsGlobalVariableParserType.JSON_PATH = SyntheticsGlobalVariableParserType("json_path") +SyntheticsGlobalVariableParserType.REGEX = SyntheticsGlobalVariableParserType("regex") +SyntheticsGlobalVariableParserType.X_PATH = SyntheticsGlobalVariableParserType("x_path") diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable_totp_parameters.py b/src/datadog_api_client/v2/model/synthetics_global_variable_totp_parameters.py new file mode 100644 index 0000000000..ca474f9f18 --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable_totp_parameters.py @@ -0,0 +1,56 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class SyntheticsGlobalVariableTOTPParameters(ModelNormal): + validations = { + "digits": { + "inclusive_maximum": 10, + "inclusive_minimum": 4, + }, + "refresh_interval": { + "inclusive_maximum": 999, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + return { + "digits": (int,), + "refresh_interval": (int,), + } + + attribute_map = { + "digits": "digits", + "refresh_interval": "refresh_interval", + } + + def __init__( + self_, digits: Union[int, UnsetType] = unset, refresh_interval: Union[int, UnsetType] = unset, **kwargs + ): + """ + Parameters for the TOTP/MFA variable + + :param digits: Number of digits for the OTP code. + :type digits: int, optional + + :param refresh_interval: Interval for which to refresh the token (in seconds). + :type refresh_interval: int, optional + """ + if digits is not unset: + kwargs["digits"] = digits + if refresh_interval is not unset: + kwargs["refresh_interval"] = refresh_interval + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/synthetics_global_variable_value.py b/src/datadog_api_client/v2/model/synthetics_global_variable_value.py new file mode 100644 index 0000000000..f6d443cef2 --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_global_variable_value.py @@ -0,0 +1,63 @@ +# 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.synthetics_global_variable_options import SyntheticsGlobalVariableOptions + + +class SyntheticsGlobalVariableValue(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.synthetics_global_variable_options import SyntheticsGlobalVariableOptions + + return { + "options": (SyntheticsGlobalVariableOptions,), + "secure": (bool,), + "value": (str,), + } + + attribute_map = { + "options": "options", + "secure": "secure", + "value": "value", + } + + def __init__( + self_, + options: Union[SyntheticsGlobalVariableOptions, UnsetType] = unset, + secure: Union[bool, UnsetType] = unset, + value: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Value of the global variable. + + :param options: Options for the Global Variable for MFA. + :type options: SyntheticsGlobalVariableOptions, optional + + :param secure: Determines if the value of the variable is hidden. + :type secure: bool, optional + + :param value: Value of the global variable. When reading a global variable, + the value will not be present if the variable is hidden with the ``secure`` property. + :type value: str, optional + """ + if options is not unset: + kwargs["options"] = options + if secure is not unset: + kwargs["secure"] = secure + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/synthetics_variable_parser.py b/src/datadog_api_client/v2/model/synthetics_variable_parser.py new file mode 100644 index 0000000000..ba7d9f8e12 --- /dev/null +++ b/src/datadog_api_client/v2/model/synthetics_variable_parser.py @@ -0,0 +1,51 @@ +# 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.synthetics_global_variable_parser_type import SyntheticsGlobalVariableParserType + + +class SyntheticsVariableParser(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.synthetics_global_variable_parser_type import ( + SyntheticsGlobalVariableParserType, + ) + + return { + "type": (SyntheticsGlobalVariableParserType,), + "value": (str,), + } + + attribute_map = { + "type": "type", + "value": "value", + } + + def __init__(self_, type: SyntheticsGlobalVariableParserType, value: Union[str, UnsetType] = unset, **kwargs): + """ + Details of the parser to use for the global variable. + + :param type: Type of parser for a Synthetic global variable from a synthetics test. + :type type: SyntheticsGlobalVariableParserType + + :param value: Regex or JSON path used for the parser. Not used with type ``raw``. + :type value: str, optional + """ + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 9cece11cff..c0b7fd1c2a 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1928,6 +1928,15 @@ from datadog_api_client.v2.model.gitlab_integration import GitlabIntegration from datadog_api_client.v2.model.gitlab_integration_type import GitlabIntegrationType from datadog_api_client.v2.model.gitlab_integration_update import GitlabIntegrationUpdate +from datadog_api_client.v2.model.global_variable_data import GlobalVariableData +from datadog_api_client.v2.model.global_variable_json_patch_request import GlobalVariableJsonPatchRequest +from datadog_api_client.v2.model.global_variable_json_patch_request_data import GlobalVariableJsonPatchRequestData +from datadog_api_client.v2.model.global_variable_json_patch_request_data_attributes import ( + GlobalVariableJsonPatchRequestDataAttributes, +) +from datadog_api_client.v2.model.global_variable_json_patch_type import GlobalVariableJsonPatchType +from datadog_api_client.v2.model.global_variable_response import GlobalVariableResponse +from datadog_api_client.v2.model.global_variable_type import GlobalVariableType from datadog_api_client.v2.model.google_meet_configuration_reference import GoogleMeetConfigurationReference from datadog_api_client.v2.model.google_meet_configuration_reference_data import GoogleMeetConfigurationReferenceData from datadog_api_client.v2.model.grey_noise_api_key import GreyNoiseAPIKey @@ -2297,6 +2306,8 @@ from datadog_api_client.v2.model.job_create_response_data import JobCreateResponseData from datadog_api_client.v2.model.job_definition import JobDefinition from datadog_api_client.v2.model.job_definition_from_rule import JobDefinitionFromRule +from datadog_api_client.v2.model.json_patch_operation import JsonPatchOperation +from datadog_api_client.v2.model.json_patch_operation_op import JsonPatchOperationOp from datadog_api_client.v2.model.kind_attributes import KindAttributes from datadog_api_client.v2.model.kind_data import KindData from datadog_api_client.v2.model.kind_metadata import KindMetadata @@ -4541,6 +4552,21 @@ from datadog_api_client.v2.model.step import Step from datadog_api_client.v2.model.step_display import StepDisplay from datadog_api_client.v2.model.step_display_bounds import StepDisplayBounds +from datadog_api_client.v2.model.synthetics_global_variable import SyntheticsGlobalVariable +from datadog_api_client.v2.model.synthetics_global_variable_attributes import SyntheticsGlobalVariableAttributes +from datadog_api_client.v2.model.synthetics_global_variable_options import SyntheticsGlobalVariableOptions +from datadog_api_client.v2.model.synthetics_global_variable_parse_test_options import ( + SyntheticsGlobalVariableParseTestOptions, +) +from datadog_api_client.v2.model.synthetics_global_variable_parse_test_options_type import ( + SyntheticsGlobalVariableParseTestOptionsType, +) +from datadog_api_client.v2.model.synthetics_global_variable_parser_type import SyntheticsGlobalVariableParserType +from datadog_api_client.v2.model.synthetics_global_variable_totp_parameters import ( + SyntheticsGlobalVariableTOTPParameters, +) +from datadog_api_client.v2.model.synthetics_global_variable_value import SyntheticsGlobalVariableValue +from datadog_api_client.v2.model.synthetics_variable_parser import SyntheticsVariableParser from datadog_api_client.v2.model.table_result_v2 import TableResultV2 from datadog_api_client.v2.model.table_result_v2_array import TableResultV2Array from datadog_api_client.v2.model.table_result_v2_data import TableResultV2Data @@ -6380,6 +6406,13 @@ "GitlabIntegration", "GitlabIntegrationType", "GitlabIntegrationUpdate", + "GlobalVariableData", + "GlobalVariableJsonPatchRequest", + "GlobalVariableJsonPatchRequestData", + "GlobalVariableJsonPatchRequestDataAttributes", + "GlobalVariableJsonPatchType", + "GlobalVariableResponse", + "GlobalVariableType", "GoogleMeetConfigurationReference", "GoogleMeetConfigurationReferenceData", "GreyNoiseAPIKey", @@ -6683,6 +6716,8 @@ "JobCreateResponseData", "JobDefinition", "JobDefinitionFromRule", + "JsonPatchOperation", + "JsonPatchOperationOp", "KindAttributes", "KindData", "KindMetadata", @@ -8197,6 +8232,15 @@ "Step", "StepDisplay", "StepDisplayBounds", + "SyntheticsGlobalVariable", + "SyntheticsGlobalVariableAttributes", + "SyntheticsGlobalVariableOptions", + "SyntheticsGlobalVariableParseTestOptions", + "SyntheticsGlobalVariableParseTestOptionsType", + "SyntheticsGlobalVariableParserType", + "SyntheticsGlobalVariableTOTPParameters", + "SyntheticsGlobalVariableValue", + "SyntheticsVariableParser", "TableResultV2", "TableResultV2Array", "TableResultV2Data", diff --git a/tests/v2/features/synthetics.feature b/tests/v2/features/synthetics.feature index 73efa73ec2..133993b11b 100644 --- a/tests/v2/features/synthetics.feature +++ b/tests/v2/features/synthetics.feature @@ -20,6 +20,30 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing + Scenario: Patch a global variable returns "Bad Request" response + Given new "PatchGlobalVariable" request + And request contains "variable_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"json_patch": [{"op": "add", "path": "/name"}]}, "type": "global_variables_json_patch"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Patch a global variable returns "Not Found" response + Given new "PatchGlobalVariable" request + And request contains "variable_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"json_patch": [{"op": "add", "path": "/name"}]}, "type": "global_variables_json_patch"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Patch a global variable returns "OK" response + Given new "PatchGlobalVariable" request + And request contains "variable_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"json_patch": [{"op": "add", "path": "/name"}]}, "type": "global_variables_json_patch"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/synthetics-managing Scenario: Save new value for on-demand concurrency cap returns "OK" response Given new "SetOnDemandConcurrencyCap" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3799e64e63..f4cbbb2baa 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -4284,6 +4284,12 @@ "type": "safe" } }, + "PatchGlobalVariable": { + "tag": "Synthetics", + "undo": { + "type": "safe" + } + }, "ListTagPipelinesRulesets": { "tag": "Cloud Cost Management", "undo": {