From 6b254b8e98e7a10b9dd97c8103cf30e94f08250e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 22 Jun 2026 20:30:02 +0000 Subject: [PATCH] Regenerate client from commit 9acd650 of spec repo --- .generator/schemas/v2/openapi.yaml | 123 +++++++++++++++ docs/datadog_api_client.v2.model.rst | 56 +++++++ .../ValidatePipeline_337125830.py | 95 ++++++++++++ .../v2/model/observability_pipeline_config.py | 2 + ...servability_pipeline_config_source_item.py | 7 + ...observability_pipeline_websocket_source.py | 146 ++++++++++++++++++ ...pipeline_websocket_source_auth_strategy.py | 44 ++++++ ...rvability_pipeline_websocket_source_tls.py | 56 +++++++ ...y_pipeline_websocket_source_tls_enabled.py | 44 ++++++ ...eline_websocket_source_tls_enabled_mode.py | 37 +++++ ...e_websocket_source_tls_with_client_cert.py | 81 ++++++++++ ...socket_source_tls_with_client_cert_mode.py | 37 +++++ ...vability_pipeline_websocket_source_type.py | 35 +++++ src/datadog_api_client/v2/models/__init__.py | 30 ++++ ...rce_bearer_auth_returns_ok_response.frozen | 1 + ...ource_bearer_auth_returns_ok_response.yaml | 23 +++ .../features/observability_pipelines.feature | 8 + 17 files changed, 825 insertions(+) create mode 100644 examples/v2/observability-pipelines/ValidatePipeline_337125830.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source_auth_strategy.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled_mode.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert_mode.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_websocket_source_type.py create mode 100644 tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.yaml diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 99b25f0ac8..6cf281e9b3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -63949,6 +63949,7 @@ components: - $ref: "#/components/schemas/ObservabilityPipelineSplunkTcpSource" - $ref: "#/components/schemas/ObservabilityPipelineSumoLogicSource" - $ref: "#/components/schemas/ObservabilityPipelineSyslogNgSource" + - $ref: "#/components/schemas/ObservabilityPipelineWebsocketSource" - $ref: "#/components/schemas/ObservabilityPipelineOpentelemetrySource" ObservabilityPipelineCrowdStrikeNextGenSiemDestination: description: |- @@ -68605,6 +68606,128 @@ components: required: - crt_file type: object + ObservabilityPipelineWebsocketSource: + description: |- + The `websocket` source ingests logs from a WebSocket server using the `ws://` or `wss://` protocol. + + **Supported pipeline types:** logs. + properties: + auth_strategy: + $ref: "#/components/schemas/ObservabilityPipelineWebsocketSourceAuthStrategy" + custom_key: + description: Name of the environment variable or secret that holds the custom authorization header value. Used when `auth_strategy` is `custom`. + example: WS_AUTH_CUSTOM_HEADER + type: string + decoding: + $ref: "#/components/schemas/ObservabilityPipelineDecoding" + id: + description: The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the `input` to downstream components). + example: websocket-source + type: string + password_key: + description: Name of the environment variable or secret that holds the password. Used when `auth_strategy` is `basic`. + example: WS_AUTH_PASSWORD + type: string + tls: + $ref: "#/components/schemas/ObservabilityPipelineWebsocketSourceTls" + token_key: + description: Name of the environment variable or secret that holds the bearer token. Used when `auth_strategy` is `bearer`. + example: WS_BEARER_TOKEN + type: string + type: + $ref: "#/components/schemas/ObservabilityPipelineWebsocketSourceType" + uri_key: + description: Name of the environment variable or secret that holds the WebSocket server URI (`ws://` or `wss://`). + example: WS_URI + type: string + username_key: + description: Name of the environment variable or secret that holds the username. Used when `auth_strategy` is `basic`. + example: WS_AUTH_USERNAME + type: string + required: + - id + - type + - decoding + - auth_strategy + type: object + x-pipeline-types: [logs] + ObservabilityPipelineWebsocketSourceAuthStrategy: + description: Authentication strategy for the WebSocket source connection. + enum: + - none + - basic + - bearer + - custom + example: bearer + type: string + x-enum-varnames: + - NONE + - BASIC + - BEARER + - CUSTOM + ObservabilityPipelineWebsocketSourceTls: + description: TLS configuration for the WebSocket source. Use `enabled` for standard `wss://` connections, or `with_client_cert` to present a client certificate for mutual TLS. + oneOf: + - $ref: "#/components/schemas/ObservabilityPipelineWebsocketSourceTlsEnabled" + - $ref: "#/components/schemas/ObservabilityPipelineWebsocketSourceTlsWithClientCert" + ObservabilityPipelineWebsocketSourceTlsEnabled: + description: TLS configuration that enables encryption without a client certificate. Use this for standard `wss://` connections that do not require mutual TLS. + properties: + mode: + $ref: "#/components/schemas/ObservabilityPipelineWebsocketSourceTlsEnabledMode" + required: + - mode + type: object + ObservabilityPipelineWebsocketSourceTlsEnabledMode: + description: TLS mode. Must be `enabled`. + enum: + - enabled + example: enabled + type: string + x-enum-varnames: + - ENABLED + ObservabilityPipelineWebsocketSourceTlsWithClientCert: + description: TLS configuration that enables encryption and presents a client certificate for mutual TLS authentication. + properties: + ca_file: + description: Path to the Certificate Authority (CA) file used to validate the remote server's TLS certificate. + example: /path/to/ca.crt + type: string + crt_file: + description: Path to the TLS client certificate file used to identify this source to the remote server. + example: /path/to/client.crt + type: string + key_file: + description: Path to the private key file associated with the client certificate. + example: /path/to/client.key + type: string + key_pass_key: + description: Name of the environment variable or secret that holds the passphrase for the private key file. + example: WS_TLS_KEY_PASSPHRASE + type: string + mode: + $ref: "#/components/schemas/ObservabilityPipelineWebsocketSourceTlsWithClientCertMode" + required: + - mode + - crt_file + type: object + ObservabilityPipelineWebsocketSourceTlsWithClientCertMode: + description: TLS mode. Must be `with_client_cert`. + enum: + - with_client_cert + example: with_client_cert + type: string + x-enum-varnames: + - WITH_CLIENT_CERT + ObservabilityPipelineWebsocketSourceType: + default: websocket + description: The source type. The value should always be `websocket`. + enum: + - websocket + example: websocket + type: string + x-enum-varnames: + - WEBSOCKET OktaAPIToken: description: The definition of the `OktaAPIToken` object. properties: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 14023429c7..c9100627e9 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -28501,6 +28501,62 @@ datadog\_api\_client.v2.model.observability\_pipeline\_tls module :members: :show-inheritance: +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source\_auth\_strategy module +----------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source_auth_strategy + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source\_tls module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source_tls + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source\_tls\_enabled module +--------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source\_tls\_enabled\_mode module +--------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled_mode + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source\_tls\_with\_client\_cert module +-------------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_with_client_cert + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source\_tls\_with\_client\_cert\_mode module +-------------------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_with_client_cert_mode + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.observability\_pipeline\_websocket\_source\_type module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.observability_pipeline_websocket_source_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.oci\_config module ------------------------------------------------ diff --git a/examples/v2/observability-pipelines/ValidatePipeline_337125830.py b/examples/v2/observability-pipelines/ValidatePipeline_337125830.py new file mode 100644 index 0000000000..efb70c5bee --- /dev/null +++ b/examples/v2/observability-pipelines/ValidatePipeline_337125830.py @@ -0,0 +1,95 @@ +""" +Validate an observability pipeline with websocket source bearer auth returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.observability_pipelines_api import ObservabilityPipelinesApi +from datadog_api_client.v2.model.observability_pipeline_config import ObservabilityPipelineConfig +from datadog_api_client.v2.model.observability_pipeline_config_processor_group import ( + ObservabilityPipelineConfigProcessorGroup, +) +from datadog_api_client.v2.model.observability_pipeline_data_attributes import ObservabilityPipelineDataAttributes +from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination import ( + ObservabilityPipelineDatadogLogsDestination, +) +from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_type import ( + ObservabilityPipelineDatadogLogsDestinationType, +) +from datadog_api_client.v2.model.observability_pipeline_decoding import ObservabilityPipelineDecoding +from datadog_api_client.v2.model.observability_pipeline_filter_processor import ObservabilityPipelineFilterProcessor +from datadog_api_client.v2.model.observability_pipeline_filter_processor_type import ( + ObservabilityPipelineFilterProcessorType, +) +from datadog_api_client.v2.model.observability_pipeline_spec import ObservabilityPipelineSpec +from datadog_api_client.v2.model.observability_pipeline_spec_data import ObservabilityPipelineSpecData +from datadog_api_client.v2.model.observability_pipeline_websocket_source import ObservabilityPipelineWebsocketSource +from datadog_api_client.v2.model.observability_pipeline_websocket_source_auth_strategy import ( + ObservabilityPipelineWebsocketSourceAuthStrategy, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled import ( + ObservabilityPipelineWebsocketSourceTlsEnabled, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled_mode import ( + ObservabilityPipelineWebsocketSourceTlsEnabledMode, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_type import ( + ObservabilityPipelineWebsocketSourceType, +) + +body = ObservabilityPipelineSpec( + data=ObservabilityPipelineSpecData( + attributes=ObservabilityPipelineDataAttributes( + config=ObservabilityPipelineConfig( + destinations=[ + ObservabilityPipelineDatadogLogsDestination( + id="datadog-logs-destination", + inputs=[ + "my-processor-group", + ], + type=ObservabilityPipelineDatadogLogsDestinationType.DATADOG_LOGS, + ), + ], + processor_groups=[ + ObservabilityPipelineConfigProcessorGroup( + enabled=True, + id="my-processor-group", + include="service:my-service", + inputs=[ + "websocket-source", + ], + processors=[ + ObservabilityPipelineFilterProcessor( + enabled=True, + id="filter-processor", + include="status:error", + type=ObservabilityPipelineFilterProcessorType.FILTER, + ), + ], + ), + ], + sources=[ + ObservabilityPipelineWebsocketSource( + id="websocket-source", + type=ObservabilityPipelineWebsocketSourceType.WEBSOCKET, + decoding=ObservabilityPipelineDecoding.DECODE_JSON, + auth_strategy=ObservabilityPipelineWebsocketSourceAuthStrategy.BEARER, + token_key="WS_BEARER_TOKEN", + uri_key="WS_URI", + tls=ObservabilityPipelineWebsocketSourceTlsEnabled( + mode=ObservabilityPipelineWebsocketSourceTlsEnabledMode.ENABLED, + ), + ), + ], + ), + name="Pipeline with WebSocket Source", + ), + type="pipelines", + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ObservabilityPipelinesApi(api_client) + response = api_instance.validate_pipeline(body=body) + + print(response) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_config.py b/src/datadog_api_client/v2/model/observability_pipeline_config.py index afd1a78d88..6eb73105eb 100644 --- a/src/datadog_api_client/v2/model/observability_pipeline_config.py +++ b/src/datadog_api_client/v2/model/observability_pipeline_config.py @@ -134,6 +134,7 @@ ObservabilityPipelineSumoLogicSource, ) from datadog_api_client.v2.model.observability_pipeline_syslog_ng_source import ObservabilityPipelineSyslogNgSource + from datadog_api_client.v2.model.observability_pipeline_websocket_source import ObservabilityPipelineWebsocketSource from datadog_api_client.v2.model.observability_pipeline_opentelemetry_source import ( ObservabilityPipelineOpentelemetrySource, ) @@ -225,6 +226,7 @@ def __init__( ObservabilityPipelineSplunkTcpSource, ObservabilityPipelineSumoLogicSource, ObservabilityPipelineSyslogNgSource, + ObservabilityPipelineWebsocketSource, ObservabilityPipelineOpentelemetrySource, ] ], diff --git a/src/datadog_api_client/v2/model/observability_pipeline_config_source_item.py b/src/datadog_api_client/v2/model/observability_pipeline_config_source_item.py index e0cbf5ed38..52aef12c1f 100644 --- a/src/datadog_api_client/v2/model/observability_pipeline_config_source_item.py +++ b/src/datadog_api_client/v2/model/observability_pipeline_config_source_item.py @@ -103,6 +103,9 @@ def __init__(self, **kwargs): This allows downstream components to forward the token to other Splunk HEC destinations. :type store_hec_token: bool, optional + :param uri_key: Name of the environment variable or secret that holds the WebSocket server URI (`ws://` or `wss://`). + :type uri_key: str, optional + :param grpc_address_key: Environment variable name containing the gRPC server address for receiving OTLP data. Must be a valid environment variable name (alphanumeric characters and underscores only). :type grpc_address_key: str, optional @@ -160,6 +163,9 @@ def _composed_schemas(_): from datadog_api_client.v2.model.observability_pipeline_syslog_ng_source import ( ObservabilityPipelineSyslogNgSource, ) + from datadog_api_client.v2.model.observability_pipeline_websocket_source import ( + ObservabilityPipelineWebsocketSource, + ) from datadog_api_client.v2.model.observability_pipeline_opentelemetry_source import ( ObservabilityPipelineOpentelemetrySource, ) @@ -182,6 +188,7 @@ def _composed_schemas(_): ObservabilityPipelineSplunkTcpSource, ObservabilityPipelineSumoLogicSource, ObservabilityPipelineSyslogNgSource, + ObservabilityPipelineWebsocketSource, ObservabilityPipelineOpentelemetrySource, ], } diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source.py new file mode 100644 index 0000000000..81a47efc9a --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source.py @@ -0,0 +1,146 @@ +# 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.observability_pipeline_websocket_source_auth_strategy import ( + ObservabilityPipelineWebsocketSourceAuthStrategy, + ) + from datadog_api_client.v2.model.observability_pipeline_decoding import ObservabilityPipelineDecoding + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls import ( + ObservabilityPipelineWebsocketSourceTls, + ) + from datadog_api_client.v2.model.observability_pipeline_websocket_source_type import ( + ObservabilityPipelineWebsocketSourceType, + ) + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled import ( + ObservabilityPipelineWebsocketSourceTlsEnabled, + ) + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_with_client_cert import ( + ObservabilityPipelineWebsocketSourceTlsWithClientCert, + ) + + +class ObservabilityPipelineWebsocketSource(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.observability_pipeline_websocket_source_auth_strategy import ( + ObservabilityPipelineWebsocketSourceAuthStrategy, + ) + from datadog_api_client.v2.model.observability_pipeline_decoding import ObservabilityPipelineDecoding + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls import ( + ObservabilityPipelineWebsocketSourceTls, + ) + from datadog_api_client.v2.model.observability_pipeline_websocket_source_type import ( + ObservabilityPipelineWebsocketSourceType, + ) + + return { + "auth_strategy": (ObservabilityPipelineWebsocketSourceAuthStrategy,), + "custom_key": (str,), + "decoding": (ObservabilityPipelineDecoding,), + "id": (str,), + "password_key": (str,), + "tls": (ObservabilityPipelineWebsocketSourceTls,), + "token_key": (str,), + "type": (ObservabilityPipelineWebsocketSourceType,), + "uri_key": (str,), + "username_key": (str,), + } + + attribute_map = { + "auth_strategy": "auth_strategy", + "custom_key": "custom_key", + "decoding": "decoding", + "id": "id", + "password_key": "password_key", + "tls": "tls", + "token_key": "token_key", + "type": "type", + "uri_key": "uri_key", + "username_key": "username_key", + } + + def __init__( + self_, + auth_strategy: ObservabilityPipelineWebsocketSourceAuthStrategy, + decoding: ObservabilityPipelineDecoding, + id: str, + type: ObservabilityPipelineWebsocketSourceType, + custom_key: Union[str, UnsetType] = unset, + password_key: Union[str, UnsetType] = unset, + tls: Union[ + ObservabilityPipelineWebsocketSourceTls, + ObservabilityPipelineWebsocketSourceTlsEnabled, + ObservabilityPipelineWebsocketSourceTlsWithClientCert, + UnsetType, + ] = unset, + token_key: Union[str, UnsetType] = unset, + uri_key: Union[str, UnsetType] = unset, + username_key: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The ``websocket`` source ingests logs from a WebSocket server using the ``ws://`` or ``wss://`` protocol. + + **Supported pipeline types:** logs. + + :param auth_strategy: Authentication strategy for the WebSocket source connection. + :type auth_strategy: ObservabilityPipelineWebsocketSourceAuthStrategy + + :param custom_key: Name of the environment variable or secret that holds the custom authorization header value. Used when ``auth_strategy`` is ``custom``. + :type custom_key: str, optional + + :param decoding: The decoding format used to interpret incoming logs. + :type decoding: ObservabilityPipelineDecoding + + :param id: The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the ``input`` to downstream components). + :type id: str + + :param password_key: Name of the environment variable or secret that holds the password. Used when ``auth_strategy`` is ``basic``. + :type password_key: str, optional + + :param tls: TLS configuration for the WebSocket source. Use ``enabled`` for standard ``wss://`` connections, or ``with_client_cert`` to present a client certificate for mutual TLS. + :type tls: ObservabilityPipelineWebsocketSourceTls, optional + + :param token_key: Name of the environment variable or secret that holds the bearer token. Used when ``auth_strategy`` is ``bearer``. + :type token_key: str, optional + + :param type: The source type. The value should always be ``websocket``. + :type type: ObservabilityPipelineWebsocketSourceType + + :param uri_key: Name of the environment variable or secret that holds the WebSocket server URI ( ``ws://`` or ``wss://`` ). + :type uri_key: str, optional + + :param username_key: Name of the environment variable or secret that holds the username. Used when ``auth_strategy`` is ``basic``. + :type username_key: str, optional + """ + if custom_key is not unset: + kwargs["custom_key"] = custom_key + if password_key is not unset: + kwargs["password_key"] = password_key + if tls is not unset: + kwargs["tls"] = tls + if token_key is not unset: + kwargs["token_key"] = token_key + if uri_key is not unset: + kwargs["uri_key"] = uri_key + if username_key is not unset: + kwargs["username_key"] = username_key + super().__init__(kwargs) + + self_.auth_strategy = auth_strategy + self_.decoding = decoding + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_auth_strategy.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_auth_strategy.py new file mode 100644 index 0000000000..3a64b64b12 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_auth_strategy.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 ObservabilityPipelineWebsocketSourceAuthStrategy(ModelSimple): + """ + Authentication strategy for the WebSocket source connection. + + :param value: Must be one of ["none", "basic", "bearer", "custom"]. + :type value: str + """ + + allowed_values = { + "none", + "basic", + "bearer", + "custom", + } + NONE: ClassVar["ObservabilityPipelineWebsocketSourceAuthStrategy"] + BASIC: ClassVar["ObservabilityPipelineWebsocketSourceAuthStrategy"] + BEARER: ClassVar["ObservabilityPipelineWebsocketSourceAuthStrategy"] + CUSTOM: ClassVar["ObservabilityPipelineWebsocketSourceAuthStrategy"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineWebsocketSourceAuthStrategy.NONE = ObservabilityPipelineWebsocketSourceAuthStrategy("none") +ObservabilityPipelineWebsocketSourceAuthStrategy.BASIC = ObservabilityPipelineWebsocketSourceAuthStrategy("basic") +ObservabilityPipelineWebsocketSourceAuthStrategy.BEARER = ObservabilityPipelineWebsocketSourceAuthStrategy("bearer") +ObservabilityPipelineWebsocketSourceAuthStrategy.CUSTOM = ObservabilityPipelineWebsocketSourceAuthStrategy("custom") diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls.py new file mode 100644 index 0000000000..c9cefd5398 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls.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 datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class ObservabilityPipelineWebsocketSourceTls(ModelComposed): + def __init__(self, **kwargs): + """ + TLS configuration for the WebSocket source. Use ``enabled`` for standard ``wss://`` connections, or ``with_client_cert`` to present a client certificate for mutual TLS. + + :param mode: TLS mode. Must be `enabled`. + :type mode: ObservabilityPipelineWebsocketSourceTlsEnabledMode + + :param ca_file: Path to the Certificate Authority (CA) file used to validate the remote server's TLS certificate. + :type ca_file: str, optional + + :param crt_file: Path to the TLS client certificate file used to identify this source to the remote server. + :type crt_file: str + + :param key_file: Path to the private key file associated with the client certificate. + :type key_file: str, optional + + :param key_pass_key: Name of the environment variable or secret that holds the passphrase for the private key file. + :type key_pass_key: str, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled import ( + ObservabilityPipelineWebsocketSourceTlsEnabled, + ) + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_with_client_cert import ( + ObservabilityPipelineWebsocketSourceTlsWithClientCert, + ) + + return { + "oneOf": [ + ObservabilityPipelineWebsocketSourceTlsEnabled, + ObservabilityPipelineWebsocketSourceTlsWithClientCert, + ], + } diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled.py new file mode 100644 index 0000000000..3b9874884e --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled.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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled_mode import ( + ObservabilityPipelineWebsocketSourceTlsEnabledMode, + ) + + +class ObservabilityPipelineWebsocketSourceTlsEnabled(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled_mode import ( + ObservabilityPipelineWebsocketSourceTlsEnabledMode, + ) + + return { + "mode": (ObservabilityPipelineWebsocketSourceTlsEnabledMode,), + } + + attribute_map = { + "mode": "mode", + } + + def __init__(self_, mode: ObservabilityPipelineWebsocketSourceTlsEnabledMode, **kwargs): + """ + TLS configuration that enables encryption without a client certificate. Use this for standard ``wss://`` connections that do not require mutual TLS. + + :param mode: TLS mode. Must be ``enabled``. + :type mode: ObservabilityPipelineWebsocketSourceTlsEnabledMode + """ + super().__init__(kwargs) + + self_.mode = mode diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled_mode.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled_mode.py new file mode 100644 index 0000000000..4f24df408d --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_enabled_mode.py @@ -0,0 +1,37 @@ +# 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 ObservabilityPipelineWebsocketSourceTlsEnabledMode(ModelSimple): + """ + TLS mode. Must be `enabled`. + + :param value: If omitted defaults to "enabled". Must be one of ["enabled"]. + :type value: str + """ + + allowed_values = { + "enabled", + } + ENABLED: ClassVar["ObservabilityPipelineWebsocketSourceTlsEnabledMode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineWebsocketSourceTlsEnabledMode.ENABLED = ObservabilityPipelineWebsocketSourceTlsEnabledMode( + "enabled" +) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert.py new file mode 100644 index 0000000000..e8d03eb57a --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert.py @@ -0,0 +1,81 @@ +# 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.observability_pipeline_websocket_source_tls_with_client_cert_mode import ( + ObservabilityPipelineWebsocketSourceTlsWithClientCertMode, + ) + + +class ObservabilityPipelineWebsocketSourceTlsWithClientCert(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_with_client_cert_mode import ( + ObservabilityPipelineWebsocketSourceTlsWithClientCertMode, + ) + + return { + "ca_file": (str,), + "crt_file": (str,), + "key_file": (str,), + "key_pass_key": (str,), + "mode": (ObservabilityPipelineWebsocketSourceTlsWithClientCertMode,), + } + + attribute_map = { + "ca_file": "ca_file", + "crt_file": "crt_file", + "key_file": "key_file", + "key_pass_key": "key_pass_key", + "mode": "mode", + } + + def __init__( + self_, + crt_file: str, + mode: ObservabilityPipelineWebsocketSourceTlsWithClientCertMode, + ca_file: Union[str, UnsetType] = unset, + key_file: Union[str, UnsetType] = unset, + key_pass_key: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + TLS configuration that enables encryption and presents a client certificate for mutual TLS authentication. + + :param ca_file: Path to the Certificate Authority (CA) file used to validate the remote server's TLS certificate. + :type ca_file: str, optional + + :param crt_file: Path to the TLS client certificate file used to identify this source to the remote server. + :type crt_file: str + + :param key_file: Path to the private key file associated with the client certificate. + :type key_file: str, optional + + :param key_pass_key: Name of the environment variable or secret that holds the passphrase for the private key file. + :type key_pass_key: str, optional + + :param mode: TLS mode. Must be ``with_client_cert``. + :type mode: ObservabilityPipelineWebsocketSourceTlsWithClientCertMode + """ + if ca_file is not unset: + kwargs["ca_file"] = ca_file + if key_file is not unset: + kwargs["key_file"] = key_file + if key_pass_key is not unset: + kwargs["key_pass_key"] = key_pass_key + super().__init__(kwargs) + + self_.crt_file = crt_file + self_.mode = mode diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert_mode.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert_mode.py new file mode 100644 index 0000000000..9fb3a2fb7f --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_tls_with_client_cert_mode.py @@ -0,0 +1,37 @@ +# 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 ObservabilityPipelineWebsocketSourceTlsWithClientCertMode(ModelSimple): + """ + TLS mode. Must be `with_client_cert`. + + :param value: If omitted defaults to "with_client_cert". Must be one of ["with_client_cert"]. + :type value: str + """ + + allowed_values = { + "with_client_cert", + } + WITH_CLIENT_CERT: ClassVar["ObservabilityPipelineWebsocketSourceTlsWithClientCertMode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineWebsocketSourceTlsWithClientCertMode.WITH_CLIENT_CERT = ( + ObservabilityPipelineWebsocketSourceTlsWithClientCertMode("with_client_cert") +) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_type.py b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_type.py new file mode 100644 index 0000000000..6198f20236 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_websocket_source_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 ObservabilityPipelineWebsocketSourceType(ModelSimple): + """ + The source type. The value should always be `websocket`. + + :param value: If omitted defaults to "websocket". Must be one of ["websocket"]. + :type value: str + """ + + allowed_values = { + "websocket", + } + WEBSOCKET: ClassVar["ObservabilityPipelineWebsocketSourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineWebsocketSourceType.WEBSOCKET = ObservabilityPipelineWebsocketSourceType("websocket") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 9413425cce..abf7fe5177 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -5784,6 +5784,28 @@ ObservabilityPipelineThrottleProcessorType, ) from datadog_api_client.v2.model.observability_pipeline_tls import ObservabilityPipelineTls +from datadog_api_client.v2.model.observability_pipeline_websocket_source import ObservabilityPipelineWebsocketSource +from datadog_api_client.v2.model.observability_pipeline_websocket_source_auth_strategy import ( + ObservabilityPipelineWebsocketSourceAuthStrategy, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls import ( + ObservabilityPipelineWebsocketSourceTls, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled import ( + ObservabilityPipelineWebsocketSourceTlsEnabled, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_enabled_mode import ( + ObservabilityPipelineWebsocketSourceTlsEnabledMode, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_with_client_cert import ( + ObservabilityPipelineWebsocketSourceTlsWithClientCert, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_tls_with_client_cert_mode import ( + ObservabilityPipelineWebsocketSourceTlsWithClientCertMode, +) +from datadog_api_client.v2.model.observability_pipeline_websocket_source_type import ( + ObservabilityPipelineWebsocketSourceType, +) from datadog_api_client.v2.model.okta_api_token import OktaAPIToken from datadog_api_client.v2.model.okta_api_token_type import OktaAPITokenType from datadog_api_client.v2.model.okta_api_token_update import OktaAPITokenUpdate @@ -13468,6 +13490,14 @@ "ObservabilityPipelineThrottleProcessor", "ObservabilityPipelineThrottleProcessorType", "ObservabilityPipelineTls", + "ObservabilityPipelineWebsocketSource", + "ObservabilityPipelineWebsocketSourceAuthStrategy", + "ObservabilityPipelineWebsocketSourceTls", + "ObservabilityPipelineWebsocketSourceTlsEnabled", + "ObservabilityPipelineWebsocketSourceTlsEnabledMode", + "ObservabilityPipelineWebsocketSourceTlsWithClientCert", + "ObservabilityPipelineWebsocketSourceTlsWithClientCertMode", + "ObservabilityPipelineWebsocketSourceType", "OktaAPIToken", "OktaAPITokenType", "OktaAPITokenUpdate", diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.frozen new file mode 100644 index 0000000000..e092c16a23 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-22T19:51:31.598Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.yaml new file mode 100644 index 0000000000..4c0a5da0f0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_observability_pipeline_with_websocket_source_bearer_auth_returns_ok_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '{"data":{"attributes":{"config":{"destinations":[{"id":"datadog-logs-destination","inputs":["my-processor-group"],"type":"datadog_logs"}],"processor_groups":[{"enabled":true,"id":"my-processor-group","include":"service:my-service","inputs":["websocket-source"],"processors":[{"enabled":true,"id":"filter-processor","include":"status:error","type":"filter"}]}],"sources":[{"auth_strategy":"bearer","decoding":"json","id":"websocket-source","tls":{"mode":"enabled"},"token_key":"WS_BEARER_TOKEN","type":"websocket","uri_key":"WS_URI"}]},"name":"Pipeline + with WebSocket Source"},"type":"pipelines"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/obs-pipelines/pipelines/validate + response: + body: + string: '{"errors":[]} + + ' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/observability_pipelines.feature b/tests/v2/features/observability_pipelines.feature index 487d6971f8..59706b1ac8 100644 --- a/tests/v2/features/observability_pipelines.feature +++ b/tests/v2/features/observability_pipelines.feature @@ -278,3 +278,11 @@ Feature: Observability Pipelines When the request is sent Then the response status is 200 OK And the response "errors" has length 0 + + @team:DataDog/observability-pipelines + Scenario: Validate an observability pipeline with websocket source bearer auth returns "OK" response + Given new "ValidatePipeline" request + And body with value {"data": {"attributes": {"config": {"destinations": [{"id": "datadog-logs-destination", "inputs": ["my-processor-group"], "type": "datadog_logs"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "service:my-service", "inputs": ["websocket-source"], "processors": [{"enabled": true, "id": "filter-processor", "include": "status:error", "type": "filter"}]}], "sources": [{"id": "websocket-source", "type": "websocket", "decoding": "json", "auth_strategy": "bearer", "token_key": "WS_BEARER_TOKEN", "uri_key": "WS_URI", "tls": {"mode": "enabled"}}]}, "name": "Pipeline with WebSocket Source"}, "type": "pipelines"}} + When the request is sent + Then the response status is 200 OK + And the response "errors" has length 0