|
| 1 | +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +# This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +# Copyright 2019-Present Datadog, Inc. |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +from typing import List, Union, TYPE_CHECKING |
| 7 | + |
| 8 | +from datadog_api_client.model_utils import ( |
| 9 | + ModelNormal, |
| 10 | + cached_property, |
| 11 | + unset, |
| 12 | + UnsetType, |
| 13 | +) |
| 14 | + |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from datadog_api_client.v2.model.observability_pipeline_buffer_options import ObservabilityPipelineBufferOptions |
| 18 | + from datadog_api_client.v2.model.observability_pipeline_splunk_hec_metrics_destination_compression import ( |
| 19 | + ObservabilityPipelineSplunkHecMetricsDestinationCompression, |
| 20 | + ) |
| 21 | + from datadog_api_client.v2.model.observability_pipeline_tls import ObservabilityPipelineTls |
| 22 | + from datadog_api_client.v2.model.observability_pipeline_splunk_hec_metrics_destination_type import ( |
| 23 | + ObservabilityPipelineSplunkHecMetricsDestinationType, |
| 24 | + ) |
| 25 | + from datadog_api_client.v2.model.observability_pipeline_disk_buffer_options import ( |
| 26 | + ObservabilityPipelineDiskBufferOptions, |
| 27 | + ) |
| 28 | + from datadog_api_client.v2.model.observability_pipeline_memory_buffer_options import ( |
| 29 | + ObservabilityPipelineMemoryBufferOptions, |
| 30 | + ) |
| 31 | + from datadog_api_client.v2.model.observability_pipeline_memory_buffer_size_options import ( |
| 32 | + ObservabilityPipelineMemoryBufferSizeOptions, |
| 33 | + ) |
| 34 | + |
| 35 | + |
| 36 | +class ObservabilityPipelineSplunkHecMetricsDestination(ModelNormal): |
| 37 | + @cached_property |
| 38 | + def openapi_types(_): |
| 39 | + from datadog_api_client.v2.model.observability_pipeline_buffer_options import ObservabilityPipelineBufferOptions |
| 40 | + from datadog_api_client.v2.model.observability_pipeline_splunk_hec_metrics_destination_compression import ( |
| 41 | + ObservabilityPipelineSplunkHecMetricsDestinationCompression, |
| 42 | + ) |
| 43 | + from datadog_api_client.v2.model.observability_pipeline_tls import ObservabilityPipelineTls |
| 44 | + from datadog_api_client.v2.model.observability_pipeline_splunk_hec_metrics_destination_type import ( |
| 45 | + ObservabilityPipelineSplunkHecMetricsDestinationType, |
| 46 | + ) |
| 47 | + |
| 48 | + return { |
| 49 | + "buffer": (ObservabilityPipelineBufferOptions,), |
| 50 | + "compression": (ObservabilityPipelineSplunkHecMetricsDestinationCompression,), |
| 51 | + "default_namespace": (str,), |
| 52 | + "endpoint_url_key": (str,), |
| 53 | + "id": (str,), |
| 54 | + "index": (str,), |
| 55 | + "inputs": ([str],), |
| 56 | + "source": (str,), |
| 57 | + "sourcetype": (str,), |
| 58 | + "tls": (ObservabilityPipelineTls,), |
| 59 | + "token_key": (str,), |
| 60 | + "type": (ObservabilityPipelineSplunkHecMetricsDestinationType,), |
| 61 | + } |
| 62 | + |
| 63 | + attribute_map = { |
| 64 | + "buffer": "buffer", |
| 65 | + "compression": "compression", |
| 66 | + "default_namespace": "default_namespace", |
| 67 | + "endpoint_url_key": "endpoint_url_key", |
| 68 | + "id": "id", |
| 69 | + "index": "index", |
| 70 | + "inputs": "inputs", |
| 71 | + "source": "source", |
| 72 | + "sourcetype": "sourcetype", |
| 73 | + "tls": "tls", |
| 74 | + "token_key": "token_key", |
| 75 | + "type": "type", |
| 76 | + } |
| 77 | + |
| 78 | + def __init__( |
| 79 | + self_, |
| 80 | + id: str, |
| 81 | + inputs: List[str], |
| 82 | + type: ObservabilityPipelineSplunkHecMetricsDestinationType, |
| 83 | + buffer: Union[ |
| 84 | + ObservabilityPipelineBufferOptions, |
| 85 | + ObservabilityPipelineDiskBufferOptions, |
| 86 | + ObservabilityPipelineMemoryBufferOptions, |
| 87 | + ObservabilityPipelineMemoryBufferSizeOptions, |
| 88 | + UnsetType, |
| 89 | + ] = unset, |
| 90 | + compression: Union[ObservabilityPipelineSplunkHecMetricsDestinationCompression, UnsetType] = unset, |
| 91 | + default_namespace: Union[str, UnsetType] = unset, |
| 92 | + endpoint_url_key: Union[str, UnsetType] = unset, |
| 93 | + index: Union[str, UnsetType] = unset, |
| 94 | + source: Union[str, UnsetType] = unset, |
| 95 | + sourcetype: Union[str, UnsetType] = unset, |
| 96 | + tls: Union[ObservabilityPipelineTls, UnsetType] = unset, |
| 97 | + token_key: Union[str, UnsetType] = unset, |
| 98 | + **kwargs, |
| 99 | + ): |
| 100 | + """ |
| 101 | + The ``splunk_hec_metrics`` destination forwards metrics to Splunk using the HTTP Event Collector (HEC). |
| 102 | +
|
| 103 | + **Supported pipeline types:** metrics |
| 104 | +
|
| 105 | + :param buffer: Configuration for buffer settings on destination components. |
| 106 | + :type buffer: ObservabilityPipelineBufferOptions, optional |
| 107 | +
|
| 108 | + :param compression: Compression algorithm applied when sending metrics to Splunk HEC. |
| 109 | + :type compression: ObservabilityPipelineSplunkHecMetricsDestinationCompression, optional |
| 110 | +
|
| 111 | + :param default_namespace: Optional default namespace for metrics sent to Splunk HEC. |
| 112 | + :type default_namespace: str, optional |
| 113 | +
|
| 114 | + :param endpoint_url_key: Name of the environment variable or secret that holds the Splunk HEC endpoint URL. |
| 115 | + :type endpoint_url_key: str, optional |
| 116 | +
|
| 117 | + :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). |
| 118 | + :type id: str |
| 119 | +
|
| 120 | + :param index: Optional name of the Splunk index where metrics are written. |
| 121 | + :type index: str, optional |
| 122 | +
|
| 123 | + :param inputs: A list of component IDs whose output is used as the ``input`` for this component. |
| 124 | + :type inputs: [str] |
| 125 | +
|
| 126 | + :param source: The Splunk source field value for metric events. |
| 127 | + :type source: str, optional |
| 128 | +
|
| 129 | + :param sourcetype: The Splunk sourcetype to assign to metric events. |
| 130 | + :type sourcetype: str, optional |
| 131 | +
|
| 132 | + :param tls: Configuration for enabling TLS encryption between the pipeline component and external services. |
| 133 | + :type tls: ObservabilityPipelineTls, optional |
| 134 | +
|
| 135 | + :param token_key: Name of the environment variable or secret that holds the Splunk HEC token. |
| 136 | + :type token_key: str, optional |
| 137 | +
|
| 138 | + :param type: The destination type. Always ``splunk_hec_metrics``. |
| 139 | + :type type: ObservabilityPipelineSplunkHecMetricsDestinationType |
| 140 | + """ |
| 141 | + if buffer is not unset: |
| 142 | + kwargs["buffer"] = buffer |
| 143 | + if compression is not unset: |
| 144 | + kwargs["compression"] = compression |
| 145 | + if default_namespace is not unset: |
| 146 | + kwargs["default_namespace"] = default_namespace |
| 147 | + if endpoint_url_key is not unset: |
| 148 | + kwargs["endpoint_url_key"] = endpoint_url_key |
| 149 | + if index is not unset: |
| 150 | + kwargs["index"] = index |
| 151 | + if source is not unset: |
| 152 | + kwargs["source"] = source |
| 153 | + if sourcetype is not unset: |
| 154 | + kwargs["sourcetype"] = sourcetype |
| 155 | + if tls is not unset: |
| 156 | + kwargs["tls"] = tls |
| 157 | + if token_key is not unset: |
| 158 | + kwargs["token_key"] = token_key |
| 159 | + super().__init__(kwargs) |
| 160 | + |
| 161 | + self_.id = id |
| 162 | + self_.inputs = inputs |
| 163 | + self_.type = type |
0 commit comments