diff --git a/.apigentools-info b/.apigentools-info index 53d70b06f4..e0df482896 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-03-12 18:41:36.795198", - "spec_repo_commit": "32fcfc91" + "regenerated": "2024-03-13 14:23:23.963757", + "spec_repo_commit": "113614d8" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-03-12 18:41:36.811808", - "spec_repo_commit": "32fcfc91" + "regenerated": "2024-03-13 14:23:23.990153", + "spec_repo_commit": "113614d8" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 90fbd2bfc1..f1c186a856 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -195,6 +195,13 @@ components: required: true schema: type: string + CustomDestinationId: + description: The ID of the custom destination. + in: path + name: custom_destination_id + required: true + schema: + type: string FastlyAccountID: description: Fastly Account id. in: path @@ -5341,6 +5348,621 @@ components: nullable: true type: string type: object + CustomDestinationAttributeTagsRestrictionListType: + default: ALLOW_LIST + description: 'How `forward_tags_restriction_list` parameter should be interpreted. + + If `ALLOW_LIST`, then only tags whose keys on the forwarded logs match the + ones on the restriction list + + are forwarded. + + + `BLOCK_LIST` works the opposite way. It does not forward the tags matching + the ones on the list.' + enum: + - ALLOW_LIST + - BLOCK_LIST + example: ALLOW_LIST + type: string + x-enum-varnames: + - ALLOW_LIST + - BLOCK_LIST + CustomDestinationCreateRequest: + description: The custom destination. + properties: + data: + $ref: '#/components/schemas/CustomDestinationCreateRequestDefinition' + type: object + CustomDestinationCreateRequestAttributes: + description: The attributes associated with the custom destination. + properties: + enabled: + default: true + description: Whether logs matching this custom destination should be forwarded + or not. + example: true + type: boolean + forward_tags: + default: true + description: Whether tags from the forwarded logs should be forwarded or + not. + example: true + type: boolean + forward_tags_restriction_list: + default: [] + description: 'List of [keys of tags](https://docs.datadoghq.com/getting_started/tagging/#define-tags) + to be filtered. + + + An empty list represents no restriction is in place and either all or + no tags will be + + forwarded depending on `forward_tags_restriction_list_type` parameter.' + example: + - datacenter + - host + items: + description: The [key part of a tag](https://docs.datadoghq.com/getting_started/tagging/#define-tags). + type: string + maxItems: 10 + minItems: 0 + type: array + forward_tags_restriction_list_type: + $ref: '#/components/schemas/CustomDestinationAttributeTagsRestrictionListType' + forwarder_destination: + $ref: '#/components/schemas/CustomDestinationForwardDestination' + name: + description: The custom destination name. + example: Nginx logs + type: string + query: + default: '' + description: The custom destination query and filter. Logs matching this + query are forwarded to the destination. + example: source:nginx + type: string + required: + - name + - forwarder_destination + type: object + CustomDestinationCreateRequestDefinition: + description: The definition of a custom destination. + properties: + attributes: + $ref: '#/components/schemas/CustomDestinationCreateRequestAttributes' + type: + $ref: '#/components/schemas/CustomDestinationType' + required: + - type + - attributes + type: object + CustomDestinationElasticsearchDestinationAuth: + description: Basic access authentication. + properties: + password: + description: The password of the authentication. This field is not returned + by the API. + example: datadog-custom-destination-password + type: string + writeOnly: true + username: + description: The username of the authentication. This field is not returned + by the API. + example: datadog-custom-destination-username + type: string + writeOnly: true + required: + - username + - password + type: object + CustomDestinationForwardDestination: + description: A custom destination's location to forward logs. + oneOf: + - $ref: '#/components/schemas/CustomDestinationForwardDestinationHttp' + - $ref: '#/components/schemas/CustomDestinationForwardDestinationSplunk' + - $ref: '#/components/schemas/CustomDestinationForwardDestinationElasticsearch' + type: object + CustomDestinationForwardDestinationElasticsearch: + description: The Elasticsearch destination. + properties: + auth: + $ref: '#/components/schemas/CustomDestinationElasticsearchDestinationAuth' + endpoint: + description: 'The destination for which logs will be forwarded to. + + Must have HTTPS scheme and forwarding back to Datadog is not allowed.' + example: https://example.com + type: string + index_name: + description: Name of the Elasticsearch index (must follow [Elasticsearch's + criteria](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-create-index.html#indices-create-api-path-params)). + example: nginx-logs + type: string + index_rotation: + description: 'Date pattern with US locale and UTC timezone to be appended + to the index name after adding `-` + + (that is, `${index_name}-${indexPattern}`). + + You can customize the index rotation naming pattern by choosing one of + these options: + + - Hourly: `yyyy-MM-dd-HH` (as an example, it would render: `2022-10-19-09`) + + - Daily: `yyyy-MM-dd` (as an example, it would render: `2022-10-19`) + + - Weekly: `yyyy-''W''ww` (as an example, it would render: `2022-W42`) + + - Monthly: `yyyy-MM` (as an example, it would render: `2022-10`) + + + If this field is missing or is blank, it means that the index name will + always be the same + + (that is, no rotation).' + example: yyyy-MM-dd + type: string + type: + $ref: '#/components/schemas/CustomDestinationForwardDestinationElasticsearchType' + required: + - type + - endpoint + - auth + - index_name + type: object + CustomDestinationForwardDestinationElasticsearchType: + default: elasticsearch + description: Type of the Elasticsearch destination. + enum: + - elasticsearch + example: elasticsearch + type: string + x-enum-varnames: + - ELASTICSEARCH + CustomDestinationForwardDestinationHttp: + description: The HTTP destination. + properties: + auth: + $ref: '#/components/schemas/CustomDestinationHttpDestinationAuth' + endpoint: + description: 'The destination for which logs will be forwarded to. + + Must have HTTPS scheme and forwarding back to Datadog is not allowed.' + example: https://example.com + type: string + type: + $ref: '#/components/schemas/CustomDestinationForwardDestinationHttpType' + required: + - type + - endpoint + - auth + type: object + CustomDestinationForwardDestinationHttpType: + default: http + description: Type of the HTTP destination. + enum: + - http + example: http + type: string + x-enum-varnames: + - HTTP + CustomDestinationForwardDestinationSplunk: + description: The Splunk HTTP Event Collector (HEC) destination. + properties: + access_token: + description: Access token of the Splunk HTTP Event Collector. This field + is not returned by the API. + example: splunk_access_token + type: string + writeOnly: true + endpoint: + description: 'The destination for which logs will be forwarded to. + + Must have HTTPS scheme and forwarding back to Datadog is not allowed.' + example: https://example.com + type: string + type: + $ref: '#/components/schemas/CustomDestinationForwardDestinationSplunkType' + required: + - type + - endpoint + - access_token + type: object + CustomDestinationForwardDestinationSplunkType: + default: splunk_hec + description: Type of the Splunk HTTP Event Collector (HEC) destination. + enum: + - splunk_hec + example: splunk_hec + type: string + x-enum-varnames: + - SPLUNK_HEC + CustomDestinationHttpDestinationAuth: + description: Authentication method of the HTTP requests. + oneOf: + - $ref: '#/components/schemas/CustomDestinationHttpDestinationAuthBasic' + - $ref: '#/components/schemas/CustomDestinationHttpDestinationAuthCustomHeader' + type: object + CustomDestinationHttpDestinationAuthBasic: + description: Basic access authentication. + properties: + password: + description: The password of the authentication. This field is not returned + by the API. + example: datadog-custom-destination-password + type: string + writeOnly: true + type: + $ref: '#/components/schemas/CustomDestinationHttpDestinationAuthBasicType' + username: + description: The username of the authentication. This field is not returned + by the API. + example: datadog-custom-destination-username + type: string + writeOnly: true + required: + - type + - username + - password + type: object + CustomDestinationHttpDestinationAuthBasicType: + default: basic + description: Type of the basic access authentication. + enum: + - basic + example: basic + type: string + x-enum-varnames: + - BASIC + CustomDestinationHttpDestinationAuthCustomHeader: + description: Custom header access authentication. + properties: + header_name: + description: The header name of the authentication. + example: CUSTOM-HEADER-NAME + type: string + header_value: + description: The header value of the authentication. This field is not returned + by the API. + example: CUSTOM-HEADER-AUTHENTICATION-VALUE + type: string + writeOnly: true + type: + $ref: '#/components/schemas/CustomDestinationHttpDestinationAuthCustomHeaderType' + required: + - type + - header_name + - header_value + type: object + CustomDestinationHttpDestinationAuthCustomHeaderType: + default: custom_header + description: Type of the custom header access authentication. + enum: + - custom_header + example: custom_header + type: string + x-enum-varnames: + - CUSTOM_HEADER + CustomDestinationResponse: + description: The custom destination. + properties: + data: + $ref: '#/components/schemas/CustomDestinationResponseDefinition' + type: object + CustomDestinationResponseAttributes: + description: The attributes associated with the custom destination. + properties: + enabled: + default: true + description: Whether logs matching this custom destination should be forwarded + or not. + example: true + type: boolean + forward_tags: + default: true + description: Whether tags from the forwarded logs should be forwarded or + not. + example: true + type: boolean + forward_tags_restriction_list: + default: [] + description: 'List of [keys of tags](https://docs.datadoghq.com/getting_started/tagging/#define-tags) + to be filtered. + + + An empty list represents no restriction is in place and either all or + no tags will be + + forwarded depending on `forward_tags_restriction_list_type` parameter.' + example: + - datacenter + - host + items: + description: The [key part of a tag](https://docs.datadoghq.com/getting_started/tagging/#define-tags). + type: string + maxItems: 10 + minItems: 0 + type: array + forward_tags_restriction_list_type: + $ref: '#/components/schemas/CustomDestinationAttributeTagsRestrictionListType' + forwarder_destination: + $ref: '#/components/schemas/CustomDestinationResponseForwardDestination' + name: + description: The custom destination name. + example: Nginx logs + type: string + query: + default: '' + description: The custom destination query filter. Logs matching this query + are forwarded to the destination. + example: source:nginx + type: string + type: object + CustomDestinationResponseDefinition: + description: The definition of a custom destination. + properties: + attributes: + $ref: '#/components/schemas/CustomDestinationResponseAttributes' + id: + description: The custom destination ID. + example: be5d7a69-d0c8-4d4d-8ee8-bba292d98139 + readOnly: true + type: string + type: + $ref: '#/components/schemas/CustomDestinationType' + type: object + CustomDestinationResponseElasticsearchDestinationAuth: + additionalProperties: + description: Basic access authentication. + description: Basic access authentication. + type: object + CustomDestinationResponseForwardDestination: + description: A custom destination's location to forward logs. + oneOf: + - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationHttp' + - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationSplunk' + - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationElasticsearch' + type: object + CustomDestinationResponseForwardDestinationElasticsearch: + description: The Elasticsearch destination. + properties: + auth: + $ref: '#/components/schemas/CustomDestinationResponseElasticsearchDestinationAuth' + endpoint: + description: 'The destination for which logs will be forwarded to. + + Must have HTTPS scheme and forwarding back to Datadog is not allowed.' + example: https://example.com + type: string + index_name: + description: Name of the Elasticsearch index (must follow [Elasticsearch's + criteria](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-create-index.html#indices-create-api-path-params)). + example: nginx-logs + type: string + index_rotation: + description: 'Date pattern with US locale and UTC timezone to be appended + to the index name after adding `-` + + (that is, `${index_name}-${indexPattern}`). + + You can customize the index rotation naming pattern by choosing one of + these options: + + - Hourly: `yyyy-MM-dd-HH` (as an example, it would render: `2022-10-19-09`) + + - Daily: `yyyy-MM-dd` (as an example, it would render: `2022-10-19`) + + - Weekly: `yyyy-''W''ww` (as an example, it would render: `2022-W42`) + + - Monthly: `yyyy-MM` (as an example, it would render: `2022-10`) + + + If this field is missing or is blank, it means that the index name will + always be the same + + (that is, no rotation).' + example: yyyy-MM-dd + type: string + type: + $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationElasticsearchType' + required: + - type + - endpoint + - auth + - index_name + type: object + CustomDestinationResponseForwardDestinationElasticsearchType: + default: elasticsearch + description: Type of the Elasticsearch destination. + enum: + - elasticsearch + example: elasticsearch + type: string + x-enum-varnames: + - ELASTICSEARCH + CustomDestinationResponseForwardDestinationHttp: + description: The HTTP destination. + properties: + auth: + $ref: '#/components/schemas/CustomDestinationResponseHttpDestinationAuth' + endpoint: + description: 'The destination for which logs will be forwarded to. + + Must have HTTPS scheme and forwarding back to Datadog is not allowed.' + example: https://example.com + type: string + type: + $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationHttpType' + required: + - type + - endpoint + - auth + type: object + CustomDestinationResponseForwardDestinationHttpType: + default: http + description: Type of the HTTP destination. + enum: + - http + example: http + type: string + x-enum-varnames: + - HTTP + CustomDestinationResponseForwardDestinationSplunk: + description: The Splunk HTTP Event Collector (HEC) destination. + properties: + endpoint: + description: 'The destination for which logs will be forwarded to. + + Must have HTTPS scheme and forwarding back to Datadog is not allowed.' + example: https://example.com + type: string + type: + $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationSplunkType' + required: + - type + - endpoint + type: object + CustomDestinationResponseForwardDestinationSplunkType: + default: splunk_hec + description: Type of the Splunk HTTP Event Collector (HEC) destination. + enum: + - splunk_hec + example: splunk_hec + type: string + x-enum-varnames: + - SPLUNK_HEC + CustomDestinationResponseHttpDestinationAuth: + description: Authentication method of the HTTP requests. + oneOf: + - $ref: '#/components/schemas/CustomDestinationResponseHttpDestinationAuthBasic' + - $ref: '#/components/schemas/CustomDestinationResponseHttpDestinationAuthCustomHeader' + type: object + CustomDestinationResponseHttpDestinationAuthBasic: + description: Basic access authentication. + properties: + type: + $ref: '#/components/schemas/CustomDestinationResponseHttpDestinationAuthBasicType' + required: + - type + type: object + CustomDestinationResponseHttpDestinationAuthBasicType: + default: basic + description: Type of the basic access authentication. + enum: + - basic + example: basic + type: string + x-enum-varnames: + - BASIC + CustomDestinationResponseHttpDestinationAuthCustomHeader: + description: Custom header access authentication. + properties: + header_name: + description: The header name of the authentication. + example: CUSTOM-HEADER-NAME + type: string + type: + $ref: '#/components/schemas/CustomDestinationResponseHttpDestinationAuthCustomHeaderType' + required: + - type + - header_name + type: object + CustomDestinationResponseHttpDestinationAuthCustomHeaderType: + default: custom_header + description: Type of the custom header access authentication. + enum: + - custom_header + example: custom_header + type: string + x-enum-varnames: + - CUSTOM_HEADER + CustomDestinationType: + default: custom_destination + description: The type of the resource. The value should always be `custom_destination`. + enum: + - custom_destination + example: custom_destination + type: string + x-enum-varnames: + - custom_destination + CustomDestinationUpdateRequest: + description: The custom destination. + properties: + data: + $ref: '#/components/schemas/CustomDestinationUpdateRequestDefinition' + type: object + CustomDestinationUpdateRequestAttributes: + description: The attributes associated with the custom destination. + properties: + enabled: + default: true + description: Whether logs matching this custom destination should be forwarded + or not. + example: true + type: boolean + forward_tags: + default: true + description: Whether tags from the forwarded logs should be forwarded or + not. + example: true + type: boolean + forward_tags_restriction_list: + default: [] + description: 'List of [keys of tags](https://docs.datadoghq.com/getting_started/tagging/#define-tags) + to be restricted from being forwarded. + + An empty list represents no restriction is in place and either all or + no tags will be forwarded depending on `forward_tags_restriction_list_type` + parameter.' + example: + - datacenter + - host + items: + description: The [key part of a tag](https://docs.datadoghq.com/getting_started/tagging/#define-tags). + type: string + maxItems: 10 + minItems: 0 + type: array + forward_tags_restriction_list_type: + $ref: '#/components/schemas/CustomDestinationAttributeTagsRestrictionListType' + forwarder_destination: + $ref: '#/components/schemas/CustomDestinationForwardDestination' + name: + description: The custom destination name. + example: Nginx logs + type: string + query: + default: '' + description: The custom destination query and filter. Logs matching this + query are forwarded to the destination. + example: source:nginx + type: string + type: object + CustomDestinationUpdateRequestDefinition: + description: The definition of a custom destination. + properties: + attributes: + $ref: '#/components/schemas/CustomDestinationUpdateRequestAttributes' + id: + description: The custom destination ID. + example: be5d7a69-d0c8-4d4d-8ee8-bba292d98139 + type: string + type: + $ref: '#/components/schemas/CustomDestinationType' + required: + - type + - id + type: object + CustomDestinationsResponse: + description: The available custom destinations. + properties: + data: + description: A list of custom destinations. + items: + $ref: '#/components/schemas/CustomDestinationResponseDefinition' + type: array + type: object DORADeploymentRequest: description: Request to create a DORA deployment event. properties: @@ -27752,6 +28374,135 @@ paths: tags: - Logs Archives x-codegen-request-body-name: body + /api/v2/logs/config/custom-destinations: + get: + description: Get the list of configured custom destinations in your organization + with their definitions. + operationId: ListLogsCustomDestinations + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomDestinationsResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all custom destinations + tags: + - Logs Custom Destinations + post: + description: Create a custom destination in your organization. + operationId: CreateLogsCustomDestination + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomDestinationCreateRequest' + description: The definition of the new custom destination. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomDestinationResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a custom destination + tags: + - Logs Custom Destinations + x-codegen-request-body-name: body + /api/v2/logs/config/custom-destinations/{custom_destination_id}: + delete: + description: Delete a specific custom destination in your organization. + operationId: DeleteLogsCustomDestination + parameters: + - $ref: '#/components/parameters/CustomDestinationId' + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a custom destination + tags: + - Logs Custom Destinations + get: + description: Get a specific custom destination in your organization. + operationId: GetLogsCustomDestination + parameters: + - $ref: '#/components/parameters/CustomDestinationId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomDestinationResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a custom destination + tags: + - Logs Custom Destinations + patch: + description: Update the given fields of a specific custom destination in your + organization. + operationId: UpdateLogsCustomDestination + parameters: + - $ref: '#/components/parameters/CustomDestinationId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomDestinationUpdateRequest' + description: New definition of the custom destination's fields. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomDestinationResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a custom destination + tags: + - Logs Custom Destinations + x-codegen-request-body-name: body /api/v2/logs/config/metrics: get: description: Get the list of configured log-based metrics with their definitions. @@ -35114,6 +35865,16 @@ tags: description: Find out more at url: https://docs.datadoghq.com/logs/archives/ name: Logs Archives +- description: 'Custom Destinations forward all the logs ingested to an external destination. + + + See the [Custom Destinations Page](https://app.datadoghq.com/logs/pipelines/log-forwarding/custom-destinations) + + for a list of the custom destinations currently configured in web UI.' + externalDocs: + description: Find out more at + url: https://docs.datadoghq.com/logs/log_configuration/forwarding_custom_destinations/ + name: Logs Custom Destinations - description: Manage configuration of [log-based metrics](https://app.datadoghq.com/logs/pipelines/generate-metrics) for your organization. externalDocs: diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index f8dab48025..416f337bb5 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -183,6 +183,13 @@ logs\_archives\_api :members: :show-inheritance: +logs\_custom\_destinations\_api +------------------------------- + +.. automodule:: datadog_api_client.v2.api.logs_custom_destinations_api + :members: + :show-inheritance: + logs\_metrics\_api ------------------ diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index d00c99e95e..a8706ef002 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -2150,6 +2150,272 @@ creator :members: :show-inheritance: +custom\_destination\_attribute\_tags\_restriction\_list\_type +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type + :members: + :show-inheritance: + +custom\_destination\_create\_request +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_create_request + :members: + :show-inheritance: + +custom\_destination\_create\_request\_attributes +------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_create_request_attributes + :members: + :show-inheritance: + +custom\_destination\_create\_request\_definition +------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_create_request_definition + :members: + :show-inheritance: + +custom\_destination\_elasticsearch\_destination\_auth +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_elasticsearch_destination_auth + :members: + :show-inheritance: + +custom\_destination\_forward\_destination +----------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_forward_destination + :members: + :show-inheritance: + +custom\_destination\_forward\_destination\_elasticsearch +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch + :members: + :show-inheritance: + +custom\_destination\_forward\_destination\_elasticsearch\_type +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch_type + :members: + :show-inheritance: + +custom\_destination\_forward\_destination\_http +----------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_forward_destination_http + :members: + :show-inheritance: + +custom\_destination\_forward\_destination\_http\_type +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_forward_destination_http_type + :members: + :show-inheritance: + +custom\_destination\_forward\_destination\_splunk +------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_forward_destination_splunk + :members: + :show-inheritance: + +custom\_destination\_forward\_destination\_splunk\_type +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type + :members: + :show-inheritance: + +custom\_destination\_http\_destination\_auth +-------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_http_destination_auth + :members: + :show-inheritance: + +custom\_destination\_http\_destination\_auth\_basic +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_http_destination_auth_basic + :members: + :show-inheritance: + +custom\_destination\_http\_destination\_auth\_basic\_type +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_http_destination_auth_basic_type + :members: + :show-inheritance: + +custom\_destination\_http\_destination\_auth\_custom\_header +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header + :members: + :show-inheritance: + +custom\_destination\_http\_destination\_auth\_custom\_header\_type +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header_type + :members: + :show-inheritance: + +custom\_destination\_response +----------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response + :members: + :show-inheritance: + +custom\_destination\_response\_attributes +----------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_attributes + :members: + :show-inheritance: + +custom\_destination\_response\_definition +----------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_definition + :members: + :show-inheritance: + +custom\_destination\_response\_elasticsearch\_destination\_auth +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_elasticsearch_destination_auth + :members: + :show-inheritance: + +custom\_destination\_response\_forward\_destination +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_forward_destination + :members: + :show-inheritance: + +custom\_destination\_response\_forward\_destination\_elasticsearch +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch + :members: + :show-inheritance: + +custom\_destination\_response\_forward\_destination\_elasticsearch\_type +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch_type + :members: + :show-inheritance: + +custom\_destination\_response\_forward\_destination\_http +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_forward_destination_http + :members: + :show-inheritance: + +custom\_destination\_response\_forward\_destination\_http\_type +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_forward_destination_http_type + :members: + :show-inheritance: + +custom\_destination\_response\_forward\_destination\_splunk +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk + :members: + :show-inheritance: + +custom\_destination\_response\_forward\_destination\_splunk\_type +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk_type + :members: + :show-inheritance: + +custom\_destination\_response\_http\_destination\_auth +------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_http_destination_auth + :members: + :show-inheritance: + +custom\_destination\_response\_http\_destination\_auth\_basic +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_http_destination_auth_basic + :members: + :show-inheritance: + +custom\_destination\_response\_http\_destination\_auth\_basic\_type +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_http_destination_auth_basic_type + :members: + :show-inheritance: + +custom\_destination\_response\_http\_destination\_auth\_custom\_header +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header + :members: + :show-inheritance: + +custom\_destination\_response\_http\_destination\_auth\_custom\_header\_type +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header_type + :members: + :show-inheritance: + +custom\_destination\_type +------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_destination_type + :members: + :show-inheritance: + +custom\_destination\_update\_request +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_update_request + :members: + :show-inheritance: + +custom\_destination\_update\_request\_attributes +------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_update_request_attributes + :members: + :show-inheritance: + +custom\_destination\_update\_request\_definition +------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destination_update_request_definition + :members: + :show-inheritance: + +custom\_destinations\_response +------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_destinations_response + :members: + :show-inheritance: + dashboard\_list\_add\_items\_request ------------------------------------ diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination.py new file mode 100644 index 0000000000..2ff8370c3d --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination.py @@ -0,0 +1,62 @@ +""" +Create a custom destination returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, +) +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http import ( + CustomDestinationForwardDestinationHttp, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http_type import ( + CustomDestinationForwardDestinationHttpType, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic import ( + CustomDestinationHttpDestinationAuthBasic, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic_type import ( + CustomDestinationHttpDestinationAuthBasicType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=True, + forward_tags=True, + forward_tags_restriction_list=[ + "datacenter", + "host", + ], + forward_tags_restriction_list_type=CustomDestinationAttributeTagsRestrictionListType.ALLOW_LIST, + forwarder_destination=CustomDestinationForwardDestinationHttp( + auth=CustomDestinationHttpDestinationAuthBasic( + password="datadog-custom-destination-password", + type=CustomDestinationHttpDestinationAuthBasicType.BASIC, + username="datadog-custom-destination-username", + ), + endpoint="https://example.com", + type=CustomDestinationForwardDestinationHttpType.HTTP, + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.custom_destination, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1091442807.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1091442807.py new file mode 100644 index 0000000000..973316729d --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1091442807.py @@ -0,0 +1,62 @@ +""" +Create a Custom Header HTTP custom destination returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, +) +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http import ( + CustomDestinationForwardDestinationHttp, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http_type import ( + CustomDestinationForwardDestinationHttpType, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header import ( + CustomDestinationHttpDestinationAuthCustomHeader, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header_type import ( + CustomDestinationHttpDestinationAuthCustomHeaderType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forward_tags_restriction_list=[ + "datacenter", + "host", + ], + forward_tags_restriction_list_type=CustomDestinationAttributeTagsRestrictionListType.ALLOW_LIST, + forwarder_destination=CustomDestinationForwardDestinationHttp( + auth=CustomDestinationHttpDestinationAuthCustomHeader( + header_value="my-secret", + type=CustomDestinationHttpDestinationAuthCustomHeaderType.CUSTOM_HEADER, + header_name="MY-AUTHENTICATION-HEADER", + ), + endpoint="https://example.com", + type=CustomDestinationForwardDestinationHttpType.HTTP, + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.custom_destination, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1288180912.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1288180912.py new file mode 100644 index 0000000000..a2c30c21eb --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1288180912.py @@ -0,0 +1,52 @@ +""" +Create a Splunk custom destination returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, +) +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forward_tags_restriction_list=[ + "datacenter", + "host", + ], + forward_tags_restriction_list_type=CustomDestinationAttributeTagsRestrictionListType.ALLOW_LIST, + forwarder_destination=CustomDestinationForwardDestinationSplunk( + access_token="my-access-token", + endpoint="https://example.com", + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.custom_destination, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_141236188.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_141236188.py new file mode 100644 index 0000000000..11bd3c6497 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_141236188.py @@ -0,0 +1,60 @@ +""" +Create an Elasticsearch custom destination returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, +) +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_elasticsearch_destination_auth import ( + CustomDestinationElasticsearchDestinationAuth, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch import ( + CustomDestinationForwardDestinationElasticsearch, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch_type import ( + CustomDestinationForwardDestinationElasticsearchType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forward_tags_restriction_list=[ + "datacenter", + "host", + ], + forward_tags_restriction_list_type=CustomDestinationAttributeTagsRestrictionListType.ALLOW_LIST, + forwarder_destination=CustomDestinationForwardDestinationElasticsearch( + auth=CustomDestinationElasticsearchDestinationAuth( + username="my-username", + password="my-password", + ), + index_name="nginx-logs", + index_rotation="yyyy-MM-dd", + endpoint="https://example.com", + type=CustomDestinationForwardDestinationElasticsearchType.ELASTICSEARCH, + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.custom_destination, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2184123765.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2184123765.py new file mode 100644 index 0000000000..b6f346f0aa --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2184123765.py @@ -0,0 +1,62 @@ +""" +Create a Basic HTTP custom destination returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, +) +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http import ( + CustomDestinationForwardDestinationHttp, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http_type import ( + CustomDestinationForwardDestinationHttpType, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic import ( + CustomDestinationHttpDestinationAuthBasic, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic_type import ( + CustomDestinationHttpDestinationAuthBasicType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forward_tags_restriction_list=[ + "datacenter", + "host", + ], + forward_tags_restriction_list_type=CustomDestinationAttributeTagsRestrictionListType.ALLOW_LIST, + forwarder_destination=CustomDestinationForwardDestinationHttp( + auth=CustomDestinationHttpDestinationAuthBasic( + password="datadog-custom-destination-password", + type=CustomDestinationHttpDestinationAuthBasicType.BASIC, + username="datadog-custom-destination-username", + ), + endpoint="https://example.com", + type=CustomDestinationForwardDestinationHttpType.HTTP, + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.custom_destination, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/DeleteLogsCustomDestination.py b/examples/v2/logs-custom-destinations/DeleteLogsCustomDestination.py new file mode 100644 index 0000000000..5dd03f339a --- /dev/null +++ b/examples/v2/logs-custom-destinations/DeleteLogsCustomDestination.py @@ -0,0 +1,17 @@ +""" +Delete a custom destination returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi + +# there is a valid "custom_destination" in the system +CUSTOM_DESTINATION_DATA_ID = environ["CUSTOM_DESTINATION_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + api_instance.delete_logs_custom_destination( + custom_destination_id=CUSTOM_DESTINATION_DATA_ID, + ) diff --git a/examples/v2/logs-custom-destinations/GetLogsCustomDestination.py b/examples/v2/logs-custom-destinations/GetLogsCustomDestination.py new file mode 100644 index 0000000000..5223453dee --- /dev/null +++ b/examples/v2/logs-custom-destinations/GetLogsCustomDestination.py @@ -0,0 +1,19 @@ +""" +Get a custom destination returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi + +# there is a valid "custom_destination" in the system +CUSTOM_DESTINATION_DATA_ID = environ["CUSTOM_DESTINATION_DATA_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.get_logs_custom_destination( + custom_destination_id=CUSTOM_DESTINATION_DATA_ID, + ) + + print(response) diff --git a/examples/v2/logs-custom-destinations/ListLogsCustomDestinations.py b/examples/v2/logs-custom-destinations/ListLogsCustomDestinations.py new file mode 100644 index 0000000000..6d04c373b9 --- /dev/null +++ b/examples/v2/logs-custom-destinations/ListLogsCustomDestinations.py @@ -0,0 +1,13 @@ +""" +Get all custom destinations returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.list_logs_custom_destinations() + + print(response) diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination.py b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination.py new file mode 100644 index 0000000000..ca97a87038 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination.py @@ -0,0 +1,35 @@ +""" +Update a custom destination returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest +from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, +) + +# there is a valid "custom_destination" in the system +CUSTOM_DESTINATION_DATA_ID = environ["CUSTOM_DESTINATION_DATA_ID"] + +body = CustomDestinationUpdateRequest( + data=CustomDestinationUpdateRequestDefinition( + attributes=CustomDestinationUpdateRequestAttributes( + name="Nginx logs (Updated)", + ), + type=CustomDestinationType.custom_destination, + id=CUSTOM_DESTINATION_DATA_ID, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.update_logs_custom_destination(custom_destination_id=CUSTOM_DESTINATION_DATA_ID, body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/logs_custom_destinations_api.py b/src/datadog_api_client/v2/api/logs_custom_destinations_api.py new file mode 100644 index 0000000000..c7e0616113 --- /dev/null +++ b/src/datadog_api_client/v2/api/logs_custom_destinations_api.py @@ -0,0 +1,220 @@ +# 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, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.v2.model.custom_destinations_response import CustomDestinationsResponse +from datadog_api_client.v2.model.custom_destination_response import CustomDestinationResponse +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest + + +class LogsCustomDestinationsApi: + """ + Custom Destinations forward all the logs ingested to an external destination. + + See the `Custom Destinations Page `_ + for a list of the custom destinations currently configured in web UI. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_logs_custom_destination_endpoint = _Endpoint( + settings={ + "response_type": (CustomDestinationResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/logs/config/custom-destinations", + "operation_id": "create_logs_custom_destination", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CustomDestinationCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_logs_custom_destination_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/logs/config/custom-destinations/{custom_destination_id}", + "operation_id": "delete_logs_custom_destination", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "custom_destination_id": { + "required": True, + "openapi_types": (str,), + "attribute": "custom_destination_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_logs_custom_destination_endpoint = _Endpoint( + settings={ + "response_type": (CustomDestinationResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/logs/config/custom-destinations/{custom_destination_id}", + "operation_id": "get_logs_custom_destination", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "custom_destination_id": { + "required": True, + "openapi_types": (str,), + "attribute": "custom_destination_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_logs_custom_destinations_endpoint = _Endpoint( + settings={ + "response_type": (CustomDestinationsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/logs/config/custom-destinations", + "operation_id": "list_logs_custom_destinations", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_logs_custom_destination_endpoint = _Endpoint( + settings={ + "response_type": (CustomDestinationResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/logs/config/custom-destinations/{custom_destination_id}", + "operation_id": "update_logs_custom_destination", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "custom_destination_id": { + "required": True, + "openapi_types": (str,), + "attribute": "custom_destination_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CustomDestinationUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_logs_custom_destination( + self, + body: CustomDestinationCreateRequest, + ) -> CustomDestinationResponse: + """Create a custom destination. + + Create a custom destination in your organization. + + :param body: The definition of the new custom destination. + :type body: CustomDestinationCreateRequest + :rtype: CustomDestinationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_logs_custom_destination_endpoint.call_with_http_info(**kwargs) + + def delete_logs_custom_destination( + self, + custom_destination_id: str, + ) -> None: + """Delete a custom destination. + + Delete a specific custom destination in your organization. + + :param custom_destination_id: The ID of the custom destination. + :type custom_destination_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["custom_destination_id"] = custom_destination_id + + return self._delete_logs_custom_destination_endpoint.call_with_http_info(**kwargs) + + def get_logs_custom_destination( + self, + custom_destination_id: str, + ) -> CustomDestinationResponse: + """Get a custom destination. + + Get a specific custom destination in your organization. + + :param custom_destination_id: The ID of the custom destination. + :type custom_destination_id: str + :rtype: CustomDestinationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["custom_destination_id"] = custom_destination_id + + return self._get_logs_custom_destination_endpoint.call_with_http_info(**kwargs) + + def list_logs_custom_destinations( + self, + ) -> CustomDestinationsResponse: + """Get all custom destinations. + + Get the list of configured custom destinations in your organization with their definitions. + + :rtype: CustomDestinationsResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_logs_custom_destinations_endpoint.call_with_http_info(**kwargs) + + def update_logs_custom_destination( + self, + custom_destination_id: str, + body: CustomDestinationUpdateRequest, + ) -> CustomDestinationResponse: + """Update a custom destination. + + Update the given fields of a specific custom destination in your organization. + + :param custom_destination_id: The ID of the custom destination. + :type custom_destination_id: str + :param body: New definition of the custom destination's fields. + :type body: CustomDestinationUpdateRequest + :rtype: CustomDestinationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["custom_destination_id"] = custom_destination_id + + kwargs["body"] = body + + return self._update_logs_custom_destination_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index bd90e265fd..1db033c6b6 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -24,6 +24,7 @@ from datadog_api_client.v2.api.key_management_api import KeyManagementApi from datadog_api_client.v2.api.logs_api import LogsApi from datadog_api_client.v2.api.logs_archives_api import LogsArchivesApi +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi from datadog_api_client.v2.api.logs_metrics_api import LogsMetricsApi from datadog_api_client.v2.api.metrics_api import MetricsApi from datadog_api_client.v2.api.monitors_api import MonitorsApi @@ -75,6 +76,7 @@ "KeyManagementApi", "LogsApi", "LogsArchivesApi", + "LogsCustomDestinationsApi", "LogsMetricsApi", "MetricsApi", "MonitorsApi", diff --git a/src/datadog_api_client/v2/model/custom_destination_attribute_tags_restriction_list_type.py b/src/datadog_api_client/v2/model/custom_destination_attribute_tags_restriction_list_type.py new file mode 100644 index 0000000000..d58a56e17e --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_attribute_tags_restriction_list_type.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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CustomDestinationAttributeTagsRestrictionListType(ModelSimple): + """ + How `forward_tags_restriction_list` parameter should be interpreted. + If `ALLOW_LIST`, then only tags whose keys on the forwarded logs match the ones on the restriction list + are forwarded. + + `BLOCK_LIST` works the opposite way. It does not forward the tags matching the ones on the list. + + :param value: If omitted defaults to "ALLOW_LIST". Must be one of ["ALLOW_LIST", "BLOCK_LIST"]. + :type value: str + """ + + allowed_values = { + "ALLOW_LIST", + "BLOCK_LIST", + } + ALLOW_LIST: ClassVar["CustomDestinationAttributeTagsRestrictionListType"] + BLOCK_LIST: ClassVar["CustomDestinationAttributeTagsRestrictionListType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationAttributeTagsRestrictionListType.ALLOW_LIST = CustomDestinationAttributeTagsRestrictionListType( + "ALLOW_LIST" +) +CustomDestinationAttributeTagsRestrictionListType.BLOCK_LIST = CustomDestinationAttributeTagsRestrictionListType( + "BLOCK_LIST" +) diff --git a/src/datadog_api_client/v2/model/custom_destination_create_request.py b/src/datadog_api_client/v2/model/custom_destination_create_request.py new file mode 100644 index 0000000000..82f0bbb2b1 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_create_request.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.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, + ) + + +class CustomDestinationCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, + ) + + return { + "data": (CustomDestinationCreateRequestDefinition,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CustomDestinationCreateRequestDefinition, UnsetType] = unset, **kwargs): + """ + The custom destination. + + :param data: The definition of a custom destination. + :type data: CustomDestinationCreateRequestDefinition, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_destination_create_request_attributes.py b/src/datadog_api_client/v2/model/custom_destination_create_request_attributes.py new file mode 100644 index 0000000000..554e9cadda --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_create_request_attributes.py @@ -0,0 +1,129 @@ +# 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.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination import CustomDestinationForwardDestination + from datadog_api_client.v2.model.custom_destination_forward_destination_http import ( + CustomDestinationForwardDestinationHttp, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch import ( + CustomDestinationForwardDestinationElasticsearch, + ) + + +class CustomDestinationCreateRequestAttributes(ModelNormal): + validations = { + "forward_tags_restriction_list": { + "max_items": 10, + "min_items": 0, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination import ( + CustomDestinationForwardDestination, + ) + + return { + "enabled": (bool,), + "forward_tags": (bool,), + "forward_tags_restriction_list": ([str],), + "forward_tags_restriction_list_type": (CustomDestinationAttributeTagsRestrictionListType,), + "forwarder_destination": (CustomDestinationForwardDestination,), + "name": (str,), + "query": (str,), + } + + attribute_map = { + "enabled": "enabled", + "forward_tags": "forward_tags", + "forward_tags_restriction_list": "forward_tags_restriction_list", + "forward_tags_restriction_list_type": "forward_tags_restriction_list_type", + "forwarder_destination": "forwarder_destination", + "name": "name", + "query": "query", + } + + def __init__( + self_, + forwarder_destination: Union[ + CustomDestinationForwardDestination, + CustomDestinationForwardDestinationHttp, + CustomDestinationForwardDestinationSplunk, + CustomDestinationForwardDestinationElasticsearch, + ], + name: str, + enabled: Union[bool, UnsetType] = unset, + forward_tags: Union[bool, UnsetType] = unset, + forward_tags_restriction_list: Union[List[str], UnsetType] = unset, + forward_tags_restriction_list_type: Union[CustomDestinationAttributeTagsRestrictionListType, UnsetType] = unset, + query: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The attributes associated with the custom destination. + + :param enabled: Whether logs matching this custom destination should be forwarded or not. + :type enabled: bool, optional + + :param forward_tags: Whether tags from the forwarded logs should be forwarded or not. + :type forward_tags: bool, optional + + :param forward_tags_restriction_list: List of `keys of tags `_ to be filtered. + + An empty list represents no restriction is in place and either all or no tags will be + forwarded depending on ``forward_tags_restriction_list_type`` parameter. + :type forward_tags_restriction_list: [str], optional + + :param forward_tags_restriction_list_type: How ``forward_tags_restriction_list`` parameter should be interpreted. + If ``ALLOW_LIST`` , then only tags whose keys on the forwarded logs match the ones on the restriction list + are forwarded. + + ``BLOCK_LIST`` works the opposite way. It does not forward the tags matching the ones on the list. + :type forward_tags_restriction_list_type: CustomDestinationAttributeTagsRestrictionListType, optional + + :param forwarder_destination: A custom destination's location to forward logs. + :type forwarder_destination: CustomDestinationForwardDestination + + :param name: The custom destination name. + :type name: str + + :param query: The custom destination query and filter. Logs matching this query are forwarded to the destination. + :type query: str, optional + """ + if enabled is not unset: + kwargs["enabled"] = enabled + if forward_tags is not unset: + kwargs["forward_tags"] = forward_tags + if forward_tags_restriction_list is not unset: + kwargs["forward_tags_restriction_list"] = forward_tags_restriction_list + if forward_tags_restriction_list_type is not unset: + kwargs["forward_tags_restriction_list_type"] = forward_tags_restriction_list_type + if query is not unset: + kwargs["query"] = query + super().__init__(kwargs) + + self_.forwarder_destination = forwarder_destination + self_.name = name diff --git a/src/datadog_api_client/v2/model/custom_destination_create_request_definition.py b/src/datadog_api_client/v2/model/custom_destination_create_request_definition.py new file mode 100644 index 0000000000..aaa65d1eb2 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_create_request_definition.py @@ -0,0 +1,52 @@ +# 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.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, + ) + from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + + +class CustomDestinationCreateRequestDefinition(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, + ) + from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + + return { + "attributes": (CustomDestinationCreateRequestAttributes,), + "type": (CustomDestinationType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CustomDestinationCreateRequestAttributes, type: CustomDestinationType, **kwargs): + """ + The definition of a custom destination. + + :param attributes: The attributes associated with the custom destination. + :type attributes: CustomDestinationCreateRequestAttributes + + :param type: The type of the resource. The value should always be ``custom_destination``. + :type type: CustomDestinationType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_elasticsearch_destination_auth.py b/src/datadog_api_client/v2/model/custom_destination_elasticsearch_destination_auth.py new file mode 100644 index 0000000000..fd913be26d --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_elasticsearch_destination_auth.py @@ -0,0 +1,39 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class CustomDestinationElasticsearchDestinationAuth(ModelNormal): + @cached_property + def openapi_types(_): + return { + "password": (str,), + "username": (str,), + } + + attribute_map = { + "password": "password", + "username": "username", + } + + def __init__(self_, password: str, username: str, **kwargs): + """ + Basic access authentication. + + :param password: The password of the authentication. This field is not returned by the API. + :type password: str + + :param username: The username of the authentication. This field is not returned by the API. + :type username: str + """ + super().__init__(kwargs) + + self_.password = password + self_.username = username diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination.py new file mode 100644 index 0000000000..891625aeb6 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination.py @@ -0,0 +1,73 @@ +# 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 CustomDestinationForwardDestination(ModelComposed): + def __init__(self, **kwargs): + """ + A custom destination's location to forward logs. + + :param auth: Authentication method of the HTTP requests. + :type auth: CustomDestinationHttpDestinationAuth + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param type: Type of the HTTP destination. + :type type: CustomDestinationForwardDestinationHttpType + + :param access_token: Access token of the Splunk HTTP Event Collector. This field is not returned by the API. + :type access_token: str + + :param index_name: Name of the Elasticsearch index (must follow [Elasticsearch's criteria](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-create-index.html#indices-create-api-path-params)). + :type index_name: str + + :param index_rotation: Date pattern with US locale and UTC timezone to be appended to the index name after adding `-` + (that is, `${index_name}-${indexPattern}`). + You can customize the index rotation naming pattern by choosing one of these options: + - Hourly: `yyyy-MM-dd-HH` (as an example, it would render: `2022-10-19-09`) + - Daily: `yyyy-MM-dd` (as an example, it would render: `2022-10-19`) + - Weekly: `yyyy-'W'ww` (as an example, it would render: `2022-W42`) + - Monthly: `yyyy-MM` (as an example, it would render: `2022-10`) + + If this field is missing or is blank, it means that the index name will always be the same + (that is, no rotation). + :type index_rotation: 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.custom_destination_forward_destination_http import ( + CustomDestinationForwardDestinationHttp, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch import ( + CustomDestinationForwardDestinationElasticsearch, + ) + + return { + "oneOf": [ + CustomDestinationForwardDestinationHttp, + CustomDestinationForwardDestinationSplunk, + CustomDestinationForwardDestinationElasticsearch, + ], + } diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination_elasticsearch.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination_elasticsearch.py new file mode 100644 index 0000000000..8c8a4c81fa --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination_elasticsearch.py @@ -0,0 +1,96 @@ +# 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.custom_destination_elasticsearch_destination_auth import ( + CustomDestinationElasticsearchDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch_type import ( + CustomDestinationForwardDestinationElasticsearchType, + ) + + +class CustomDestinationForwardDestinationElasticsearch(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_elasticsearch_destination_auth import ( + CustomDestinationElasticsearchDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch_type import ( + CustomDestinationForwardDestinationElasticsearchType, + ) + + return { + "auth": (CustomDestinationElasticsearchDestinationAuth,), + "endpoint": (str,), + "index_name": (str,), + "index_rotation": (str,), + "type": (CustomDestinationForwardDestinationElasticsearchType,), + } + + attribute_map = { + "auth": "auth", + "endpoint": "endpoint", + "index_name": "index_name", + "index_rotation": "index_rotation", + "type": "type", + } + + def __init__( + self_, + auth: CustomDestinationElasticsearchDestinationAuth, + endpoint: str, + index_name: str, + type: CustomDestinationForwardDestinationElasticsearchType, + index_rotation: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The Elasticsearch destination. + + :param auth: Basic access authentication. + :type auth: CustomDestinationElasticsearchDestinationAuth + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param index_name: Name of the Elasticsearch index (must follow `Elasticsearch's criteria `_ ). + :type index_name: str + + :param index_rotation: Date pattern with US locale and UTC timezone to be appended to the index name after adding ``-`` + (that is, ``${index_name}-${indexPattern}`` ). + You can customize the index rotation naming pattern by choosing one of these options: + + * Hourly: ``yyyy-MM-dd-HH`` (as an example, it would render: ``2022-10-19-09`` ) + * Daily: ``yyyy-MM-dd`` (as an example, it would render: ``2022-10-19`` ) + * Weekly: ``yyyy-'W'ww`` (as an example, it would render: ``2022-W42`` ) + * Monthly: ``yyyy-MM`` (as an example, it would render: ``2022-10`` ) + + If this field is missing or is blank, it means that the index name will always be the same + (that is, no rotation). + :type index_rotation: str, optional + + :param type: Type of the Elasticsearch destination. + :type type: CustomDestinationForwardDestinationElasticsearchType + """ + if index_rotation is not unset: + kwargs["index_rotation"] = index_rotation + super().__init__(kwargs) + + self_.auth = auth + self_.endpoint = endpoint + self_.index_name = index_name + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination_elasticsearch_type.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination_elasticsearch_type.py new file mode 100644 index 0000000000..7f7f59ce50 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination_elasticsearch_type.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 CustomDestinationForwardDestinationElasticsearchType(ModelSimple): + """ + Type of the Elasticsearch destination. + + :param value: If omitted defaults to "elasticsearch". Must be one of ["elasticsearch"]. + :type value: str + """ + + allowed_values = { + "elasticsearch", + } + ELASTICSEARCH: ClassVar["CustomDestinationForwardDestinationElasticsearchType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationForwardDestinationElasticsearchType.ELASTICSEARCH = ( + CustomDestinationForwardDestinationElasticsearchType("elasticsearch") +) diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination_http.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination_http.py new file mode 100644 index 0000000000..18205b728d --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination_http.py @@ -0,0 +1,79 @@ +# 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, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_destination_http_destination_auth import ( + CustomDestinationHttpDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_http_type import ( + CustomDestinationForwardDestinationHttpType, + ) + from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic import ( + CustomDestinationHttpDestinationAuthBasic, + ) + from datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header import ( + CustomDestinationHttpDestinationAuthCustomHeader, + ) + + +class CustomDestinationForwardDestinationHttp(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_http_destination_auth import ( + CustomDestinationHttpDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_http_type import ( + CustomDestinationForwardDestinationHttpType, + ) + + return { + "auth": (CustomDestinationHttpDestinationAuth,), + "endpoint": (str,), + "type": (CustomDestinationForwardDestinationHttpType,), + } + + attribute_map = { + "auth": "auth", + "endpoint": "endpoint", + "type": "type", + } + + def __init__( + self_, + auth: Union[ + CustomDestinationHttpDestinationAuth, + CustomDestinationHttpDestinationAuthBasic, + CustomDestinationHttpDestinationAuthCustomHeader, + ], + endpoint: str, + type: CustomDestinationForwardDestinationHttpType, + **kwargs, + ): + """ + The HTTP destination. + + :param auth: Authentication method of the HTTP requests. + :type auth: CustomDestinationHttpDestinationAuth + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param type: Type of the HTTP destination. + :type type: CustomDestinationForwardDestinationHttpType + """ + super().__init__(kwargs) + + self_.auth = auth + self_.endpoint = endpoint + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination_http_type.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination_http_type.py new file mode 100644 index 0000000000..fcef0c6437 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination_http_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 CustomDestinationForwardDestinationHttpType(ModelSimple): + """ + Type of the HTTP destination. + + :param value: If omitted defaults to "http". Must be one of ["http"]. + :type value: str + """ + + allowed_values = { + "http", + } + HTTP: ClassVar["CustomDestinationForwardDestinationHttpType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationForwardDestinationHttpType.HTTP = CustomDestinationForwardDestinationHttpType("http") diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk.py new file mode 100644 index 0000000000..9f562e7331 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk.py @@ -0,0 +1,59 @@ +# 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.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, + ) + + +class CustomDestinationForwardDestinationSplunk(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, + ) + + return { + "access_token": (str,), + "endpoint": (str,), + "type": (CustomDestinationForwardDestinationSplunkType,), + } + + attribute_map = { + "access_token": "access_token", + "endpoint": "endpoint", + "type": "type", + } + + def __init__( + self_, access_token: str, endpoint: str, type: CustomDestinationForwardDestinationSplunkType, **kwargs + ): + """ + The Splunk HTTP Event Collector (HEC) destination. + + :param access_token: Access token of the Splunk HTTP Event Collector. This field is not returned by the API. + :type access_token: str + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param type: Type of the Splunk HTTP Event Collector (HEC) destination. + :type type: CustomDestinationForwardDestinationSplunkType + """ + super().__init__(kwargs) + + self_.access_token = access_token + self_.endpoint = endpoint + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk_type.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk_type.py new file mode 100644 index 0000000000..badb5bd27c --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk_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 CustomDestinationForwardDestinationSplunkType(ModelSimple): + """ + Type of the Splunk HTTP Event Collector (HEC) destination. + + :param value: If omitted defaults to "splunk_hec". Must be one of ["splunk_hec"]. + :type value: str + """ + + allowed_values = { + "splunk_hec", + } + SPLUNK_HEC: ClassVar["CustomDestinationForwardDestinationSplunkType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC = CustomDestinationForwardDestinationSplunkType("splunk_hec") diff --git a/src/datadog_api_client/v2/model/custom_destination_http_destination_auth.py b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth.py new file mode 100644 index 0000000000..711b60878c --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth.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 CustomDestinationHttpDestinationAuth(ModelComposed): + def __init__(self, **kwargs): + """ + Authentication method of the HTTP requests. + + :param password: The password of the authentication. This field is not returned by the API. + :type password: str + + :param type: Type of the basic access authentication. + :type type: CustomDestinationHttpDestinationAuthBasicType + + :param username: The username of the authentication. This field is not returned by the API. + :type username: str + + :param header_name: The header name of the authentication. + :type header_name: str + + :param header_value: The header value of the authentication. This field is not returned by the API. + :type header_value: str + """ + 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.custom_destination_http_destination_auth_basic import ( + CustomDestinationHttpDestinationAuthBasic, + ) + from datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header import ( + CustomDestinationHttpDestinationAuthCustomHeader, + ) + + return { + "oneOf": [ + CustomDestinationHttpDestinationAuthBasic, + CustomDestinationHttpDestinationAuthCustomHeader, + ], + } diff --git a/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_basic.py b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_basic.py new file mode 100644 index 0000000000..8d3802b72a --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_basic.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic_type import ( + CustomDestinationHttpDestinationAuthBasicType, + ) + + +class CustomDestinationHttpDestinationAuthBasic(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic_type import ( + CustomDestinationHttpDestinationAuthBasicType, + ) + + return { + "password": (str,), + "type": (CustomDestinationHttpDestinationAuthBasicType,), + "username": (str,), + } + + attribute_map = { + "password": "password", + "type": "type", + "username": "username", + } + + def __init__(self_, password: str, type: CustomDestinationHttpDestinationAuthBasicType, username: str, **kwargs): + """ + Basic access authentication. + + :param password: The password of the authentication. This field is not returned by the API. + :type password: str + + :param type: Type of the basic access authentication. + :type type: CustomDestinationHttpDestinationAuthBasicType + + :param username: The username of the authentication. This field is not returned by the API. + :type username: str + """ + super().__init__(kwargs) + + self_.password = password + self_.type = type + self_.username = username diff --git a/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_basic_type.py b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_basic_type.py new file mode 100644 index 0000000000..68e29541aa --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_basic_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 CustomDestinationHttpDestinationAuthBasicType(ModelSimple): + """ + Type of the basic access authentication. + + :param value: If omitted defaults to "basic". Must be one of ["basic"]. + :type value: str + """ + + allowed_values = { + "basic", + } + BASIC: ClassVar["CustomDestinationHttpDestinationAuthBasicType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationHttpDestinationAuthBasicType.BASIC = CustomDestinationHttpDestinationAuthBasicType("basic") diff --git a/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_custom_header.py b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_custom_header.py new file mode 100644 index 0000000000..4d3323c3df --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_custom_header.py @@ -0,0 +1,58 @@ +# 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.custom_destination_http_destination_auth_custom_header_type import ( + CustomDestinationHttpDestinationAuthCustomHeaderType, + ) + + +class CustomDestinationHttpDestinationAuthCustomHeader(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header_type import ( + CustomDestinationHttpDestinationAuthCustomHeaderType, + ) + + return { + "header_name": (str,), + "header_value": (str,), + "type": (CustomDestinationHttpDestinationAuthCustomHeaderType,), + } + + attribute_map = { + "header_name": "header_name", + "header_value": "header_value", + "type": "type", + } + + def __init__( + self_, header_name: str, header_value: str, type: CustomDestinationHttpDestinationAuthCustomHeaderType, **kwargs + ): + """ + Custom header access authentication. + + :param header_name: The header name of the authentication. + :type header_name: str + + :param header_value: The header value of the authentication. This field is not returned by the API. + :type header_value: str + + :param type: Type of the custom header access authentication. + :type type: CustomDestinationHttpDestinationAuthCustomHeaderType + """ + super().__init__(kwargs) + + self_.header_name = header_name + self_.header_value = header_value + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_custom_header_type.py b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_custom_header_type.py new file mode 100644 index 0000000000..7c4eae31dc --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_http_destination_auth_custom_header_type.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 CustomDestinationHttpDestinationAuthCustomHeaderType(ModelSimple): + """ + Type of the custom header access authentication. + + :param value: If omitted defaults to "custom_header". Must be one of ["custom_header"]. + :type value: str + """ + + allowed_values = { + "custom_header", + } + CUSTOM_HEADER: ClassVar["CustomDestinationHttpDestinationAuthCustomHeaderType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationHttpDestinationAuthCustomHeaderType.CUSTOM_HEADER = ( + CustomDestinationHttpDestinationAuthCustomHeaderType("custom_header") +) diff --git a/src/datadog_api_client/v2/model/custom_destination_response.py b/src/datadog_api_client/v2/model/custom_destination_response.py new file mode 100644 index 0000000000..b46715a74f --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response.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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_destination_response_definition import CustomDestinationResponseDefinition + + +class CustomDestinationResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_definition import ( + CustomDestinationResponseDefinition, + ) + + return { + "data": (CustomDestinationResponseDefinition,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CustomDestinationResponseDefinition, UnsetType] = unset, **kwargs): + """ + The custom destination. + + :param data: The definition of a custom destination. + :type data: CustomDestinationResponseDefinition, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_destination_response_attributes.py b/src/datadog_api_client/v2/model/custom_destination_response_attributes.py new file mode 100644 index 0000000000..01275a938d --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_attributes.py @@ -0,0 +1,133 @@ +# 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.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination import ( + CustomDestinationResponseForwardDestination, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_http import ( + CustomDestinationResponseForwardDestinationHttp, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk import ( + CustomDestinationResponseForwardDestinationSplunk, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch import ( + CustomDestinationResponseForwardDestinationElasticsearch, + ) + + +class CustomDestinationResponseAttributes(ModelNormal): + validations = { + "forward_tags_restriction_list": { + "max_items": 10, + "min_items": 0, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination import ( + CustomDestinationResponseForwardDestination, + ) + + return { + "enabled": (bool,), + "forward_tags": (bool,), + "forward_tags_restriction_list": ([str],), + "forward_tags_restriction_list_type": (CustomDestinationAttributeTagsRestrictionListType,), + "forwarder_destination": (CustomDestinationResponseForwardDestination,), + "name": (str,), + "query": (str,), + } + + attribute_map = { + "enabled": "enabled", + "forward_tags": "forward_tags", + "forward_tags_restriction_list": "forward_tags_restriction_list", + "forward_tags_restriction_list_type": "forward_tags_restriction_list_type", + "forwarder_destination": "forwarder_destination", + "name": "name", + "query": "query", + } + + def __init__( + self_, + enabled: Union[bool, UnsetType] = unset, + forward_tags: Union[bool, UnsetType] = unset, + forward_tags_restriction_list: Union[List[str], UnsetType] = unset, + forward_tags_restriction_list_type: Union[CustomDestinationAttributeTagsRestrictionListType, UnsetType] = unset, + forwarder_destination: Union[ + CustomDestinationResponseForwardDestination, + CustomDestinationResponseForwardDestinationHttp, + CustomDestinationResponseForwardDestinationSplunk, + CustomDestinationResponseForwardDestinationElasticsearch, + UnsetType, + ] = unset, + name: Union[str, UnsetType] = unset, + query: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The attributes associated with the custom destination. + + :param enabled: Whether logs matching this custom destination should be forwarded or not. + :type enabled: bool, optional + + :param forward_tags: Whether tags from the forwarded logs should be forwarded or not. + :type forward_tags: bool, optional + + :param forward_tags_restriction_list: List of `keys of tags `_ to be filtered. + + An empty list represents no restriction is in place and either all or no tags will be + forwarded depending on ``forward_tags_restriction_list_type`` parameter. + :type forward_tags_restriction_list: [str], optional + + :param forward_tags_restriction_list_type: How ``forward_tags_restriction_list`` parameter should be interpreted. + If ``ALLOW_LIST`` , then only tags whose keys on the forwarded logs match the ones on the restriction list + are forwarded. + + ``BLOCK_LIST`` works the opposite way. It does not forward the tags matching the ones on the list. + :type forward_tags_restriction_list_type: CustomDestinationAttributeTagsRestrictionListType, optional + + :param forwarder_destination: A custom destination's location to forward logs. + :type forwarder_destination: CustomDestinationResponseForwardDestination, optional + + :param name: The custom destination name. + :type name: str, optional + + :param query: The custom destination query filter. Logs matching this query are forwarded to the destination. + :type query: str, optional + """ + if enabled is not unset: + kwargs["enabled"] = enabled + if forward_tags is not unset: + kwargs["forward_tags"] = forward_tags + if forward_tags_restriction_list is not unset: + kwargs["forward_tags_restriction_list"] = forward_tags_restriction_list + if forward_tags_restriction_list_type is not unset: + kwargs["forward_tags_restriction_list_type"] = forward_tags_restriction_list_type + if forwarder_destination is not unset: + kwargs["forwarder_destination"] = forwarder_destination + if name is not unset: + kwargs["name"] = name + if query is not unset: + kwargs["query"] = query + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_destination_response_definition.py b/src/datadog_api_client/v2/model/custom_destination_response_definition.py new file mode 100644 index 0000000000..4ce14402e9 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_definition.py @@ -0,0 +1,69 @@ +# 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.custom_destination_response_attributes import CustomDestinationResponseAttributes + from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + + +class CustomDestinationResponseDefinition(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_attributes import ( + CustomDestinationResponseAttributes, + ) + from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + + return { + "attributes": (CustomDestinationResponseAttributes,), + "id": (str,), + "type": (CustomDestinationType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + read_only_vars = { + "id", + } + + def __init__( + self_, + attributes: Union[CustomDestinationResponseAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[CustomDestinationType, UnsetType] = unset, + **kwargs, + ): + """ + The definition of a custom destination. + + :param attributes: The attributes associated with the custom destination. + :type attributes: CustomDestinationResponseAttributes, optional + + :param id: The custom destination ID. + :type id: str, optional + + :param type: The type of the resource. The value should always be ``custom_destination``. + :type type: CustomDestinationType, 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/custom_destination_response_elasticsearch_destination_auth.py b/src/datadog_api_client/v2/model/custom_destination_response_elasticsearch_destination_auth.py new file mode 100644 index 0000000000..627433a648 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_elasticsearch_destination_auth.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 ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + UUID, +) + + +class CustomDestinationResponseElasticsearchDestinationAuth(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + def __init__(self_, **kwargs): + """ + Basic access authentication. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination.py new file mode 100644 index 0000000000..9673acdcac --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination.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 datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class CustomDestinationResponseForwardDestination(ModelComposed): + def __init__(self, **kwargs): + """ + A custom destination's location to forward logs. + + :param auth: Authentication method of the HTTP requests. + :type auth: CustomDestinationResponseHttpDestinationAuth + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param type: Type of the HTTP destination. + :type type: CustomDestinationResponseForwardDestinationHttpType + + :param index_name: Name of the Elasticsearch index (must follow [Elasticsearch's criteria](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-create-index.html#indices-create-api-path-params)). + :type index_name: str + + :param index_rotation: Date pattern with US locale and UTC timezone to be appended to the index name after adding `-` + (that is, `${index_name}-${indexPattern}`). + You can customize the index rotation naming pattern by choosing one of these options: + - Hourly: `yyyy-MM-dd-HH` (as an example, it would render: `2022-10-19-09`) + - Daily: `yyyy-MM-dd` (as an example, it would render: `2022-10-19`) + - Weekly: `yyyy-'W'ww` (as an example, it would render: `2022-W42`) + - Monthly: `yyyy-MM` (as an example, it would render: `2022-10`) + + If this field is missing or is blank, it means that the index name will always be the same + (that is, no rotation). + :type index_rotation: 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.custom_destination_response_forward_destination_http import ( + CustomDestinationResponseForwardDestinationHttp, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk import ( + CustomDestinationResponseForwardDestinationSplunk, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch import ( + CustomDestinationResponseForwardDestinationElasticsearch, + ) + + return { + "oneOf": [ + CustomDestinationResponseForwardDestinationHttp, + CustomDestinationResponseForwardDestinationSplunk, + CustomDestinationResponseForwardDestinationElasticsearch, + ], + } diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_elasticsearch.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_elasticsearch.py new file mode 100644 index 0000000000..2729cb250a --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_elasticsearch.py @@ -0,0 +1,96 @@ +# 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.custom_destination_response_elasticsearch_destination_auth import ( + CustomDestinationResponseElasticsearchDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch_type import ( + CustomDestinationResponseForwardDestinationElasticsearchType, + ) + + +class CustomDestinationResponseForwardDestinationElasticsearch(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_elasticsearch_destination_auth import ( + CustomDestinationResponseElasticsearchDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch_type import ( + CustomDestinationResponseForwardDestinationElasticsearchType, + ) + + return { + "auth": (CustomDestinationResponseElasticsearchDestinationAuth,), + "endpoint": (str,), + "index_name": (str,), + "index_rotation": (str,), + "type": (CustomDestinationResponseForwardDestinationElasticsearchType,), + } + + attribute_map = { + "auth": "auth", + "endpoint": "endpoint", + "index_name": "index_name", + "index_rotation": "index_rotation", + "type": "type", + } + + def __init__( + self_, + auth: CustomDestinationResponseElasticsearchDestinationAuth, + endpoint: str, + index_name: str, + type: CustomDestinationResponseForwardDestinationElasticsearchType, + index_rotation: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The Elasticsearch destination. + + :param auth: Basic access authentication. + :type auth: CustomDestinationResponseElasticsearchDestinationAuth + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param index_name: Name of the Elasticsearch index (must follow `Elasticsearch's criteria `_ ). + :type index_name: str + + :param index_rotation: Date pattern with US locale and UTC timezone to be appended to the index name after adding ``-`` + (that is, ``${index_name}-${indexPattern}`` ). + You can customize the index rotation naming pattern by choosing one of these options: + + * Hourly: ``yyyy-MM-dd-HH`` (as an example, it would render: ``2022-10-19-09`` ) + * Daily: ``yyyy-MM-dd`` (as an example, it would render: ``2022-10-19`` ) + * Weekly: ``yyyy-'W'ww`` (as an example, it would render: ``2022-W42`` ) + * Monthly: ``yyyy-MM`` (as an example, it would render: ``2022-10`` ) + + If this field is missing or is blank, it means that the index name will always be the same + (that is, no rotation). + :type index_rotation: str, optional + + :param type: Type of the Elasticsearch destination. + :type type: CustomDestinationResponseForwardDestinationElasticsearchType + """ + if index_rotation is not unset: + kwargs["index_rotation"] = index_rotation + super().__init__(kwargs) + + self_.auth = auth + self_.endpoint = endpoint + self_.index_name = index_name + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_elasticsearch_type.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_elasticsearch_type.py new file mode 100644 index 0000000000..500cb6b636 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_elasticsearch_type.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 CustomDestinationResponseForwardDestinationElasticsearchType(ModelSimple): + """ + Type of the Elasticsearch destination. + + :param value: If omitted defaults to "elasticsearch". Must be one of ["elasticsearch"]. + :type value: str + """ + + allowed_values = { + "elasticsearch", + } + ELASTICSEARCH: ClassVar["CustomDestinationResponseForwardDestinationElasticsearchType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationResponseForwardDestinationElasticsearchType.ELASTICSEARCH = ( + CustomDestinationResponseForwardDestinationElasticsearchType("elasticsearch") +) diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_http.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_http.py new file mode 100644 index 0000000000..fe382b2469 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_http.py @@ -0,0 +1,79 @@ +# 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, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth import ( + CustomDestinationResponseHttpDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_http_type import ( + CustomDestinationResponseForwardDestinationHttpType, + ) + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_basic import ( + CustomDestinationResponseHttpDestinationAuthBasic, + ) + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header import ( + CustomDestinationResponseHttpDestinationAuthCustomHeader, + ) + + +class CustomDestinationResponseForwardDestinationHttp(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth import ( + CustomDestinationResponseHttpDestinationAuth, + ) + from datadog_api_client.v2.model.custom_destination_response_forward_destination_http_type import ( + CustomDestinationResponseForwardDestinationHttpType, + ) + + return { + "auth": (CustomDestinationResponseHttpDestinationAuth,), + "endpoint": (str,), + "type": (CustomDestinationResponseForwardDestinationHttpType,), + } + + attribute_map = { + "auth": "auth", + "endpoint": "endpoint", + "type": "type", + } + + def __init__( + self_, + auth: Union[ + CustomDestinationResponseHttpDestinationAuth, + CustomDestinationResponseHttpDestinationAuthBasic, + CustomDestinationResponseHttpDestinationAuthCustomHeader, + ], + endpoint: str, + type: CustomDestinationResponseForwardDestinationHttpType, + **kwargs, + ): + """ + The HTTP destination. + + :param auth: Authentication method of the HTTP requests. + :type auth: CustomDestinationResponseHttpDestinationAuth + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param type: Type of the HTTP destination. + :type type: CustomDestinationResponseForwardDestinationHttpType + """ + super().__init__(kwargs) + + self_.auth = auth + self_.endpoint = endpoint + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_http_type.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_http_type.py new file mode 100644 index 0000000000..1b6c8217b2 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_http_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 CustomDestinationResponseForwardDestinationHttpType(ModelSimple): + """ + Type of the HTTP destination. + + :param value: If omitted defaults to "http". Must be one of ["http"]. + :type value: str + """ + + allowed_values = { + "http", + } + HTTP: ClassVar["CustomDestinationResponseForwardDestinationHttpType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationResponseForwardDestinationHttpType.HTTP = CustomDestinationResponseForwardDestinationHttpType("http") diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk.py new file mode 100644 index 0000000000..a671870c22 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk_type import ( + CustomDestinationResponseForwardDestinationSplunkType, + ) + + +class CustomDestinationResponseForwardDestinationSplunk(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk_type import ( + CustomDestinationResponseForwardDestinationSplunkType, + ) + + return { + "endpoint": (str,), + "type": (CustomDestinationResponseForwardDestinationSplunkType,), + } + + attribute_map = { + "endpoint": "endpoint", + "type": "type", + } + + def __init__(self_, endpoint: str, type: CustomDestinationResponseForwardDestinationSplunkType, **kwargs): + """ + The Splunk HTTP Event Collector (HEC) destination. + + :param endpoint: The destination for which logs will be forwarded to. + Must have HTTPS scheme and forwarding back to Datadog is not allowed. + :type endpoint: str + + :param type: Type of the Splunk HTTP Event Collector (HEC) destination. + :type type: CustomDestinationResponseForwardDestinationSplunkType + """ + super().__init__(kwargs) + + self_.endpoint = endpoint + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk_type.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk_type.py new file mode 100644 index 0000000000..8b6081f5b6 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk_type.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 CustomDestinationResponseForwardDestinationSplunkType(ModelSimple): + """ + Type of the Splunk HTTP Event Collector (HEC) destination. + + :param value: If omitted defaults to "splunk_hec". Must be one of ["splunk_hec"]. + :type value: str + """ + + allowed_values = { + "splunk_hec", + } + SPLUNK_HEC: ClassVar["CustomDestinationResponseForwardDestinationSplunkType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationResponseForwardDestinationSplunkType.SPLUNK_HEC = ( + CustomDestinationResponseForwardDestinationSplunkType("splunk_hec") +) diff --git a/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth.py b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth.py new file mode 100644 index 0000000000..21f1995432 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth.py @@ -0,0 +1,47 @@ +# 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 CustomDestinationResponseHttpDestinationAuth(ModelComposed): + def __init__(self, **kwargs): + """ + Authentication method of the HTTP requests. + + :param type: Type of the basic access authentication. + :type type: CustomDestinationResponseHttpDestinationAuthBasicType + + :param header_name: The header name of the authentication. + :type header_name: str + """ + 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.custom_destination_response_http_destination_auth_basic import ( + CustomDestinationResponseHttpDestinationAuthBasic, + ) + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header import ( + CustomDestinationResponseHttpDestinationAuthCustomHeader, + ) + + return { + "oneOf": [ + CustomDestinationResponseHttpDestinationAuthBasic, + CustomDestinationResponseHttpDestinationAuthCustomHeader, + ], + } diff --git a/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_basic.py b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_basic.py new file mode 100644 index 0000000000..0b3313c583 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_basic.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.custom_destination_response_http_destination_auth_basic_type import ( + CustomDestinationResponseHttpDestinationAuthBasicType, + ) + + +class CustomDestinationResponseHttpDestinationAuthBasic(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_basic_type import ( + CustomDestinationResponseHttpDestinationAuthBasicType, + ) + + return { + "type": (CustomDestinationResponseHttpDestinationAuthBasicType,), + } + + attribute_map = { + "type": "type", + } + + def __init__(self_, type: CustomDestinationResponseHttpDestinationAuthBasicType, **kwargs): + """ + Basic access authentication. + + :param type: Type of the basic access authentication. + :type type: CustomDestinationResponseHttpDestinationAuthBasicType + """ + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_basic_type.py b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_basic_type.py new file mode 100644 index 0000000000..296cbca699 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_basic_type.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 CustomDestinationResponseHttpDestinationAuthBasicType(ModelSimple): + """ + Type of the basic access authentication. + + :param value: If omitted defaults to "basic". Must be one of ["basic"]. + :type value: str + """ + + allowed_values = { + "basic", + } + BASIC: ClassVar["CustomDestinationResponseHttpDestinationAuthBasicType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationResponseHttpDestinationAuthBasicType.BASIC = CustomDestinationResponseHttpDestinationAuthBasicType( + "basic" +) diff --git a/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_custom_header.py b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_custom_header.py new file mode 100644 index 0000000000..d312aa3a9b --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_custom_header.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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header_type import ( + CustomDestinationResponseHttpDestinationAuthCustomHeaderType, + ) + + +class CustomDestinationResponseHttpDestinationAuthCustomHeader(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header_type import ( + CustomDestinationResponseHttpDestinationAuthCustomHeaderType, + ) + + return { + "header_name": (str,), + "type": (CustomDestinationResponseHttpDestinationAuthCustomHeaderType,), + } + + attribute_map = { + "header_name": "header_name", + "type": "type", + } + + def __init__(self_, header_name: str, type: CustomDestinationResponseHttpDestinationAuthCustomHeaderType, **kwargs): + """ + Custom header access authentication. + + :param header_name: The header name of the authentication. + :type header_name: str + + :param type: Type of the custom header access authentication. + :type type: CustomDestinationResponseHttpDestinationAuthCustomHeaderType + """ + super().__init__(kwargs) + + self_.header_name = header_name + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_custom_header_type.py b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_custom_header_type.py new file mode 100644 index 0000000000..7ccd87f95f --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_response_http_destination_auth_custom_header_type.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 CustomDestinationResponseHttpDestinationAuthCustomHeaderType(ModelSimple): + """ + Type of the custom header access authentication. + + :param value: If omitted defaults to "custom_header". Must be one of ["custom_header"]. + :type value: str + """ + + allowed_values = { + "custom_header", + } + CUSTOM_HEADER: ClassVar["CustomDestinationResponseHttpDestinationAuthCustomHeaderType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationResponseHttpDestinationAuthCustomHeaderType.CUSTOM_HEADER = ( + CustomDestinationResponseHttpDestinationAuthCustomHeaderType("custom_header") +) diff --git a/src/datadog_api_client/v2/model/custom_destination_type.py b/src/datadog_api_client/v2/model/custom_destination_type.py new file mode 100644 index 0000000000..0ecf2dbc63 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_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 CustomDestinationType(ModelSimple): + """ + The type of the resource. The value should always be `custom_destination`. + + :param value: If omitted defaults to "custom_destination". Must be one of ["custom_destination"]. + :type value: str + """ + + allowed_values = { + "custom_destination", + } + custom_destination: ClassVar["CustomDestinationType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomDestinationType.custom_destination = CustomDestinationType("custom_destination") diff --git a/src/datadog_api_client/v2/model/custom_destination_update_request.py b/src/datadog_api_client/v2/model/custom_destination_update_request.py new file mode 100644 index 0000000000..5ecc19241d --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_update_request.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.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, + ) + + +class CustomDestinationUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, + ) + + return { + "data": (CustomDestinationUpdateRequestDefinition,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CustomDestinationUpdateRequestDefinition, UnsetType] = unset, **kwargs): + """ + The custom destination. + + :param data: The definition of a custom destination. + :type data: CustomDestinationUpdateRequestDefinition, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_destination_update_request_attributes.py b/src/datadog_api_client/v2/model/custom_destination_update_request_attributes.py new file mode 100644 index 0000000000..84067571fd --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_update_request_attributes.py @@ -0,0 +1,129 @@ +# 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.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination import CustomDestinationForwardDestination + from datadog_api_client.v2.model.custom_destination_forward_destination_http import ( + CustomDestinationForwardDestinationHttp, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch import ( + CustomDestinationForwardDestinationElasticsearch, + ) + + +class CustomDestinationUpdateRequestAttributes(ModelNormal): + validations = { + "forward_tags_restriction_list": { + "max_items": 10, + "min_items": 0, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, + ) + from datadog_api_client.v2.model.custom_destination_forward_destination import ( + CustomDestinationForwardDestination, + ) + + return { + "enabled": (bool,), + "forward_tags": (bool,), + "forward_tags_restriction_list": ([str],), + "forward_tags_restriction_list_type": (CustomDestinationAttributeTagsRestrictionListType,), + "forwarder_destination": (CustomDestinationForwardDestination,), + "name": (str,), + "query": (str,), + } + + attribute_map = { + "enabled": "enabled", + "forward_tags": "forward_tags", + "forward_tags_restriction_list": "forward_tags_restriction_list", + "forward_tags_restriction_list_type": "forward_tags_restriction_list_type", + "forwarder_destination": "forwarder_destination", + "name": "name", + "query": "query", + } + + def __init__( + self_, + enabled: Union[bool, UnsetType] = unset, + forward_tags: Union[bool, UnsetType] = unset, + forward_tags_restriction_list: Union[List[str], UnsetType] = unset, + forward_tags_restriction_list_type: Union[CustomDestinationAttributeTagsRestrictionListType, UnsetType] = unset, + forwarder_destination: Union[ + CustomDestinationForwardDestination, + CustomDestinationForwardDestinationHttp, + CustomDestinationForwardDestinationSplunk, + CustomDestinationForwardDestinationElasticsearch, + UnsetType, + ] = unset, + name: Union[str, UnsetType] = unset, + query: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The attributes associated with the custom destination. + + :param enabled: Whether logs matching this custom destination should be forwarded or not. + :type enabled: bool, optional + + :param forward_tags: Whether tags from the forwarded logs should be forwarded or not. + :type forward_tags: bool, optional + + :param forward_tags_restriction_list: List of `keys of tags `_ to be restricted from being forwarded. + An empty list represents no restriction is in place and either all or no tags will be forwarded depending on ``forward_tags_restriction_list_type`` parameter. + :type forward_tags_restriction_list: [str], optional + + :param forward_tags_restriction_list_type: How ``forward_tags_restriction_list`` parameter should be interpreted. + If ``ALLOW_LIST`` , then only tags whose keys on the forwarded logs match the ones on the restriction list + are forwarded. + + ``BLOCK_LIST`` works the opposite way. It does not forward the tags matching the ones on the list. + :type forward_tags_restriction_list_type: CustomDestinationAttributeTagsRestrictionListType, optional + + :param forwarder_destination: A custom destination's location to forward logs. + :type forwarder_destination: CustomDestinationForwardDestination, optional + + :param name: The custom destination name. + :type name: str, optional + + :param query: The custom destination query and filter. Logs matching this query are forwarded to the destination. + :type query: str, optional + """ + if enabled is not unset: + kwargs["enabled"] = enabled + if forward_tags is not unset: + kwargs["forward_tags"] = forward_tags + if forward_tags_restriction_list is not unset: + kwargs["forward_tags_restriction_list"] = forward_tags_restriction_list + if forward_tags_restriction_list_type is not unset: + kwargs["forward_tags_restriction_list_type"] = forward_tags_restriction_list_type + if forwarder_destination is not unset: + kwargs["forwarder_destination"] = forwarder_destination + if name is not unset: + kwargs["name"] = name + if query is not unset: + kwargs["query"] = query + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_destination_update_request_definition.py b/src/datadog_api_client/v2/model/custom_destination_update_request_definition.py new file mode 100644 index 0000000000..8f15f5b8fe --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destination_update_request_definition.py @@ -0,0 +1,67 @@ +# 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.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, + ) + from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + + +class CustomDestinationUpdateRequestDefinition(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, + ) + from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + + return { + "attributes": (CustomDestinationUpdateRequestAttributes,), + "id": (str,), + "type": (CustomDestinationType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + id: str, + type: CustomDestinationType, + attributes: Union[CustomDestinationUpdateRequestAttributes, UnsetType] = unset, + **kwargs, + ): + """ + The definition of a custom destination. + + :param attributes: The attributes associated with the custom destination. + :type attributes: CustomDestinationUpdateRequestAttributes, optional + + :param id: The custom destination ID. + :type id: str + + :param type: The type of the resource. The value should always be ``custom_destination``. + :type type: CustomDestinationType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_destinations_response.py b/src/datadog_api_client/v2/model/custom_destinations_response.py new file mode 100644 index 0000000000..d4d8536de3 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_destinations_response.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 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.custom_destination_response_definition import CustomDestinationResponseDefinition + + +class CustomDestinationsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_destination_response_definition import ( + CustomDestinationResponseDefinition, + ) + + return { + "data": ([CustomDestinationResponseDefinition],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[CustomDestinationResponseDefinition], UnsetType] = unset, **kwargs): + """ + The available custom destinations. + + :param data: A list of custom destinations. + :type data: [CustomDestinationResponseDefinition], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index e45c5284e6..03dc5f80b7 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -353,6 +353,102 @@ from datadog_api_client.v2.model.create_rule_response import CreateRuleResponse from datadog_api_client.v2.model.create_rule_response_data import CreateRuleResponseData from datadog_api_client.v2.model.creator import Creator +from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( + CustomDestinationAttributeTagsRestrictionListType, +) +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_elasticsearch_destination_auth import ( + CustomDestinationElasticsearchDestinationAuth, +) +from datadog_api_client.v2.model.custom_destination_forward_destination import CustomDestinationForwardDestination +from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch import ( + CustomDestinationForwardDestinationElasticsearch, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_elasticsearch_type import ( + CustomDestinationForwardDestinationElasticsearchType, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http import ( + CustomDestinationForwardDestinationHttp, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_http_type import ( + CustomDestinationForwardDestinationHttpType, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth import CustomDestinationHttpDestinationAuth +from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic import ( + CustomDestinationHttpDestinationAuthBasic, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_basic_type import ( + CustomDestinationHttpDestinationAuthBasicType, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header import ( + CustomDestinationHttpDestinationAuthCustomHeader, +) +from datadog_api_client.v2.model.custom_destination_http_destination_auth_custom_header_type import ( + CustomDestinationHttpDestinationAuthCustomHeaderType, +) +from datadog_api_client.v2.model.custom_destination_response import CustomDestinationResponse +from datadog_api_client.v2.model.custom_destination_response_attributes import CustomDestinationResponseAttributes +from datadog_api_client.v2.model.custom_destination_response_definition import CustomDestinationResponseDefinition +from datadog_api_client.v2.model.custom_destination_response_elasticsearch_destination_auth import ( + CustomDestinationResponseElasticsearchDestinationAuth, +) +from datadog_api_client.v2.model.custom_destination_response_forward_destination import ( + CustomDestinationResponseForwardDestination, +) +from datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch import ( + CustomDestinationResponseForwardDestinationElasticsearch, +) +from datadog_api_client.v2.model.custom_destination_response_forward_destination_elasticsearch_type import ( + CustomDestinationResponseForwardDestinationElasticsearchType, +) +from datadog_api_client.v2.model.custom_destination_response_forward_destination_http import ( + CustomDestinationResponseForwardDestinationHttp, +) +from datadog_api_client.v2.model.custom_destination_response_forward_destination_http_type import ( + CustomDestinationResponseForwardDestinationHttpType, +) +from datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk import ( + CustomDestinationResponseForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_response_forward_destination_splunk_type import ( + CustomDestinationResponseForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_response_http_destination_auth import ( + CustomDestinationResponseHttpDestinationAuth, +) +from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_basic import ( + CustomDestinationResponseHttpDestinationAuthBasic, +) +from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_basic_type import ( + CustomDestinationResponseHttpDestinationAuthBasicType, +) +from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header import ( + CustomDestinationResponseHttpDestinationAuthCustomHeader, +) +from datadog_api_client.v2.model.custom_destination_response_http_destination_auth_custom_header_type import ( + CustomDestinationResponseHttpDestinationAuthCustomHeaderType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest +from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destinations_response import CustomDestinationsResponse from datadog_api_client.v2.model.dora_deployment_request import DORADeploymentRequest from datadog_api_client.v2.model.dora_deployment_request_attributes import DORADeploymentRequestAttributes from datadog_api_client.v2.model.dora_deployment_request_data import DORADeploymentRequestData @@ -1987,6 +2083,44 @@ "CreateRuleResponse", "CreateRuleResponseData", "Creator", + "CustomDestinationAttributeTagsRestrictionListType", + "CustomDestinationCreateRequest", + "CustomDestinationCreateRequestAttributes", + "CustomDestinationCreateRequestDefinition", + "CustomDestinationElasticsearchDestinationAuth", + "CustomDestinationForwardDestination", + "CustomDestinationForwardDestinationElasticsearch", + "CustomDestinationForwardDestinationElasticsearchType", + "CustomDestinationForwardDestinationHttp", + "CustomDestinationForwardDestinationHttpType", + "CustomDestinationForwardDestinationSplunk", + "CustomDestinationForwardDestinationSplunkType", + "CustomDestinationHttpDestinationAuth", + "CustomDestinationHttpDestinationAuthBasic", + "CustomDestinationHttpDestinationAuthBasicType", + "CustomDestinationHttpDestinationAuthCustomHeader", + "CustomDestinationHttpDestinationAuthCustomHeaderType", + "CustomDestinationResponse", + "CustomDestinationResponseAttributes", + "CustomDestinationResponseDefinition", + "CustomDestinationResponseElasticsearchDestinationAuth", + "CustomDestinationResponseForwardDestination", + "CustomDestinationResponseForwardDestinationElasticsearch", + "CustomDestinationResponseForwardDestinationElasticsearchType", + "CustomDestinationResponseForwardDestinationHttp", + "CustomDestinationResponseForwardDestinationHttpType", + "CustomDestinationResponseForwardDestinationSplunk", + "CustomDestinationResponseForwardDestinationSplunkType", + "CustomDestinationResponseHttpDestinationAuth", + "CustomDestinationResponseHttpDestinationAuthBasic", + "CustomDestinationResponseHttpDestinationAuthBasicType", + "CustomDestinationResponseHttpDestinationAuthCustomHeader", + "CustomDestinationResponseHttpDestinationAuthCustomHeaderType", + "CustomDestinationType", + "CustomDestinationUpdateRequest", + "CustomDestinationUpdateRequestAttributes", + "CustomDestinationUpdateRequestDefinition", + "CustomDestinationsResponse", "DORADeploymentRequest", "DORADeploymentRequestAttributes", "DORADeploymentRequestData", diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_basic_http_custom_destination_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_basic_http_custom_destination_returns_ok_response.frozen new file mode 100644 index 0000000000..14b4198db7 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_basic_http_custom_destination_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:07.582Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_basic_http_custom_destination_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_basic_http_custom_destination_returns_ok_response.yaml new file mode 100644 index 0000000000..0ba86ac77a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_basic_http_custom_destination_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["datacenter","host"],"forward_tags_restriction_list_type":"ALLOW_LIST","forwarder_destination":{"auth":{"password":"datadog-custom-destination-password","type":"basic","username":"datadog-custom-destination-username"},"endpoint":"https://example.com","type":"http"},"name":"Nginx + logs","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"9608c7d6-8ea4-4487-88da-ab7620dd000c","attributes":{"name":"Nginx + logs","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"ALLOW_LIST","forward_tags_restriction_list":["datacenter","host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/9608c7d6-8ea4-4487-88da-ab7620dd000c + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_custom_destination_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_custom_destination_returns_bad_request_response.frozen new file mode 100644 index 0000000000..8f6df3cca0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_custom_destination_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:10.485Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_custom_destination_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_custom_destination_returns_bad_request_response.yaml new file mode 100644 index 0000000000..122c33455b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_custom_destination_returns_bad_request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"name":"Nginx logs"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"errors":["The parameter ''forwarder_destination'' is required"]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_custom_header_http_custom_destination_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_custom_header_http_custom_destination_returns_ok_response.frozen new file mode 100644 index 0000000000..884ab65f4e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_custom_header_http_custom_destination_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:08.664Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_custom_header_http_custom_destination_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_custom_header_http_custom_destination_returns_ok_response.yaml new file mode 100644 index 0000000000..019d08f5bf --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_custom_header_http_custom_destination_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["datacenter","host"],"forward_tags_restriction_list_type":"ALLOW_LIST","forwarder_destination":{"auth":{"header_name":"MY-AUTHENTICATION-HEADER","header_value":"my-secret","type":"custom_header"},"endpoint":"https://example.com","type":"http"},"name":"Nginx + logs","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"b522ed5a-3fab-47f4-a828-d34bd5632656","attributes":{"name":"Nginx + logs","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"header_name":"MY-AUTHENTICATION-HEADER","type":"custom_header"},"type":"http"},"forward_tags_restriction_list_type":"ALLOW_LIST","forward_tags_restriction_list":["datacenter","host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/b522ed5a-3fab-47f4-a828-d34bd5632656 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_returns_ok_response.frozen new file mode 100644 index 0000000000..79246244e6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:09.499Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_returns_ok_response.yaml new file mode 100644 index 0000000000..1433ea16b7 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["datacenter","host"],"forward_tags_restriction_list_type":"ALLOW_LIST","forwarder_destination":{"access_token":"my-access-token","endpoint":"https://example.com","type":"splunk_hec"},"name":"Nginx + logs","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"dcdf0ca2-b06a-4b75-8b07-0ba1987bd2fe","attributes":{"name":"Nginx + logs","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","type":"splunk_hec"},"forward_tags_restriction_list_type":"ALLOW_LIST","forward_tags_restriction_list":["datacenter","host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/dcdf0ca2-b06a-4b75-8b07-0ba1987bd2fe + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_elasticsearch_custom_destination_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_elasticsearch_custom_destination_returns_ok_response.frozen new file mode 100644 index 0000000000..9f38ea9f8e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_elasticsearch_custom_destination_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:10.813Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_elasticsearch_custom_destination_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_elasticsearch_custom_destination_returns_ok_response.yaml new file mode 100644 index 0000000000..2b47068601 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_elasticsearch_custom_destination_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["datacenter","host"],"forward_tags_restriction_list_type":"ALLOW_LIST","forwarder_destination":{"auth":{"password":"my-password","username":"my-username"},"endpoint":"https://example.com","index_name":"nginx-logs","index_rotation":"yyyy-MM-dd","type":"elasticsearch"},"name":"Nginx + logs","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"922dba96-00c4-49fb-969c-aabf48a3d5c3","attributes":{"name":"Nginx + logs","query":"source:nginx","enabled":false,"forwarder_destination":{"index_name":"nginx-logs","index_rotation":"yyyy-MM-dd","endpoint":"https://example.com","auth":{},"type":"elasticsearch"},"forward_tags_restriction_list_type":"ALLOW_LIST","forward_tags_restriction_list":["datacenter","host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/922dba96-00c4-49fb-969c-aabf48a3d5c3 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_not_found_response.frozen new file mode 100644 index 0000000000..a66cf29054 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_not_found_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:11.769Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_not_found_response.yaml new file mode 100644 index 0000000000..77070b6523 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_not_found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/does-not-exist + response: + body: + string: '{"errors":["NotFound"]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_ok_response.frozen new file mode 100644 index 0000000000..118be029f8 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:12.109Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_ok_response.yaml new file mode 100644 index 0000000000..11f9f052ed --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_custom_destination_returns_ok_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["host"],"forward_tags_restriction_list_type":"BLOCK_LIST","forwarder_destination":{"auth":{"password":"my-password","type":"basic","username":"my-username"},"endpoint":"https://example.com","type":"http"},"name":"Test-Delete_a_custom_destination_returns_OK_response-1710235212","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"596bb741-53be-49c6-939d-b5d4d9307689","attributes":{"name":"Test-Delete_a_custom_destination_returns_OK_response-1710235212","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/596bb741-53be-49c6-939d-b5d4d9307689 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/596bb741-53be-49c6-939d-b5d4d9307689 + response: + body: + string: '{"errors":["NotFound"]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_not_found_response.frozen new file mode 100644 index 0000000000..f247a8b5e0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_not_found_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:13.398Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_not_found_response.yaml new file mode 100644 index 0000000000..1fa7b27d72 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_not_found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/does-not-exist + response: + body: + string: '{"errors":["NotFound"]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_ok_response.frozen new file mode 100644 index 0000000000..1d60a37513 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:13.821Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_ok_response.yaml new file mode 100644 index 0000000000..cfba1363b6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_custom_destination_returns_ok_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["host"],"forward_tags_restriction_list_type":"BLOCK_LIST","forwarder_destination":{"auth":{"password":"my-password","type":"basic","username":"my-username"},"endpoint":"https://example.com","type":"http"},"name":"Test-Get_a_custom_destination_returns_OK_response-1710235213","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"13e3f7e6-307e-4a91-a269-e016da18efc5","attributes":{"name":"Test-Get_a_custom_destination_returns_OK_response-1710235213","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/13e3f7e6-307e-4a91-a269-e016da18efc5 + response: + body: + string: '{"data":{"id":"13e3f7e6-307e-4a91-a269-e016da18efc5","attributes":{"name":"Test-Get_a_custom_destination_returns_OK_response-1710235213","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/13e3f7e6-307e-4a91-a269-e016da18efc5 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_custom_destinations_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_custom_destinations_returns_ok_response.frozen new file mode 100644 index 0000000000..65faf1870b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_custom_destinations_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:15.085Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_custom_destinations_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_custom_destinations_returns_ok_response.yaml new file mode 100644 index 0000000000..63c0767c70 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_custom_destinations_returns_ok_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["host"],"forward_tags_restriction_list_type":"BLOCK_LIST","forwarder_destination":{"auth":{"password":"my-password","type":"basic","username":"my-username"},"endpoint":"https://example.com","type":"http"},"name":"Test-Get_all_custom_destinations_returns_OK_response-1710235215","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"85883e0f-b010-4b8b-816d-a629600a4d0a","attributes":{"name":"Test-Get_all_custom_destinations_returns_OK_response-1710235215","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":[{"id":"85883e0f-b010-4b8b-816d-a629600a4d0a","attributes":{"name":"Test-Get_all_custom_destinations_returns_OK_response-1710235215","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/85883e0f-b010-4b8b-816d-a629600a4d0a + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_bad_request_response.frozen new file mode 100644 index 0000000000..131ba9254c --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:16.332Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_bad_request_response.yaml new file mode 100644 index 0000000000..e0c2bda733 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_bad_request_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["host"],"forward_tags_restriction_list_type":"BLOCK_LIST","forwarder_destination":{"auth":{"password":"my-password","type":"basic","username":"my-username"},"endpoint":"https://example.com","type":"http"},"name":"Test-Update_a_custom_destination_returns_Bad_Request_response-1710235216","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"0f1b60fc-4671-4bd5-834b-bc86c8a5065b","attributes":{"name":"Test-Update_a_custom_destination_returns_Bad_Request_response-1710235216","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"forward_tags_restriction_list_type":"this_list_type_does_not_exist"},"id":"0f1b60fc-4671-4bd5-834b-bc86c8a5065b","type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/0f1b60fc-4671-4bd5-834b-bc86c8a5065b + response: + body: + string: '{"errors":["Internal error"]} + + ' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/0f1b60fc-4671-4bd5-834b-bc86c8a5065b + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_not_found_response.frozen new file mode 100644 index 0000000000..9b964d6ef4 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_not_found_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:17.628Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_not_found_response.yaml new file mode 100644 index 0000000000..85e8544eaa --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_not_found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["datacenter","host"],"forward_tags_restriction_list_type":"ALLOW_LIST","forwarder_destination":{"auth":{"password":"datadog-custom-destination-password","type":"basic","username":"datadog-custom-destination-username"},"endpoint":"https://example.com","type":"http"},"name":"Nginx + logs","query":"source:nginx"},"id":"id-from-non-existing-custom-destination","type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/id-from-non-existing-custom-destination + response: + body: + string: '{"errors":["NotFound"]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_ok_response.frozen new file mode 100644 index 0000000000..f79f9f1e90 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-03-12T09:20:18.077Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_ok_response.yaml new file mode 100644 index 0000000000..5325c249d4 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_custom_destination_returns_ok_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: '{"data":{"attributes":{"enabled":false,"forward_tags":false,"forward_tags_restriction_list":["host"],"forward_tags_restriction_list_type":"BLOCK_LIST","forwarder_destination":{"auth":{"password":"my-password","type":"basic","username":"my-username"},"endpoint":"https://example.com","type":"http"},"name":"Test-Update_a_custom_destination_returns_OK_response-1710235218","query":"source:nginx"},"type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + string: '{"data":{"id":"22ce0782-a48f-4340-98f5-fd3671b66e19","attributes":{"name":"Test-Update_a_custom_destination_returns_OK_response-1710235218","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"name":"Nginx logs (Updated)"},"id":"22ce0782-a48f-4340-98f5-fd3671b66e19","type":"custom_destination"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/22ce0782-a48f-4340-98f5-fd3671b66e19 + response: + body: + string: '{"data":{"id":"22ce0782-a48f-4340-98f5-fd3671b66e19","attributes":{"name":"Nginx + logs (Updated)","query":"source:nginx","enabled":false,"forwarder_destination":{"endpoint":"https://example.com","auth":{"type":"basic"},"type":"http"},"forward_tags_restriction_list_type":"BLOCK_LIST","forward_tags_restriction_list":["host"],"forward_tags":false},"type":"custom_destination"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/22ce0782-a48f-4340-98f5-fd3671b66e19 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 73de3c05e3..04b3989db8 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -284,6 +284,18 @@ "tag": "IP Allowlist", "operationId": "UpdateIPAllowlist" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"query\": \"source:nginx\",\n \"enabled\": false,\n \"forwarder_destination\": {\n \"type\": \"http\",\n \"endpoint\": \"https://example.com\",\n \"auth\": {\n \"type\": \"basic\",\n \"username\": \"my-username\",\n \"password\": \"my-password\"\n }\n },\n \"forward_tags_restriction_list_type\": \"BLOCK_LIST\",\n \"forward_tags_restriction_list\": [\"host\"],\n \"forward_tags\": false\n },\n \"type\": \"custom_destination\"\n }\n}" + } + ], + "step": "there is a valid \"custom_destination\" in the system", + "key": "custom_destination", + "tag": "Logs Custom Destinations", + "operationId": "CreateLogsCustomDestination" + }, { "parameters": [ { diff --git a/tests/v2/features/logs_custom_destinations.feature b/tests/v2/features/logs_custom_destinations.feature new file mode 100644 index 0000000000..812898736c --- /dev/null +++ b/tests/v2/features/logs_custom_destinations.feature @@ -0,0 +1,248 @@ +@endpoint(logs-custom-destinations) @endpoint(logs-custom-destinations-v2) +Feature: Logs Custom Destinations + Custom Destinations forward all the logs ingested to an external + destination. See the [Custom Destinations + Page](https://app.datadoghq.com/logs/pipelines/log-forwarding/custom- + destinations) for a list of the custom destinations currently configured + in web UI. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "LogsCustomDestinations" API + + @team:DataDog/logs-backend + Scenario: Create a Basic HTTP custom destination returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"auth": {"password": "datadog-custom-destination-password", "type": "basic", "username": "datadog-custom-destination-username"}, "endpoint": "https://example.com", "type": "http"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.name" is equal to "Nginx logs" + And the response "data.attributes.query" is equal to "source:nginx" + And the response "data.attributes.forwarder_destination.type" is equal to "http" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination.auth.type" is equal to "basic" + And the response "data.attributes.forwarder_destination.auth" does not have field "username" + And the response "data.attributes.forwarder_destination.auth" does not have field "password" + And the response "data.attributes.enabled" is false + And the response "data.attributes.forward_tags" is false + And the response "data.attributes.forward_tags_restriction_list" has length 2 + And the response "data.attributes.forward_tags_restriction_list" array contains value "datacenter" + And the response "data.attributes.forward_tags_restriction_list" array contains value "host" + And the response "data.attributes.forward_tags_restriction_list_type" is equal to "ALLOW_LIST" + + @team:DataDog/logs-backend + Scenario: Create a Custom Header HTTP custom destination returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"auth": {"header_value": "my-secret", "type": "custom_header", "header_name": "MY-AUTHENTICATION-HEADER"}, "endpoint": "https://example.com", "type": "http"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.name" is equal to "Nginx logs" + And the response "data.attributes.query" is equal to "source:nginx" + And the response "data.attributes.forwarder_destination.type" is equal to "http" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination.auth.type" is equal to "custom_header" + And the response "data.attributes.forwarder_destination.auth.header_name" is equal to "MY-AUTHENTICATION-HEADER" + And the response "data.attributes.forwarder_destination.auth" does not have field "header_value" + And the response "data.attributes.enabled" is false + And the response "data.attributes.forward_tags" is false + And the response "data.attributes.forward_tags_restriction_list" has length 2 + And the response "data.attributes.forward_tags_restriction_list" array contains value "datacenter" + And the response "data.attributes.forward_tags_restriction_list" array contains value "host" + And the response "data.attributes.forward_tags_restriction_list_type" is equal to "ALLOW_LIST" + + @team:DataDog/logs-backend + Scenario: Create a Splunk custom destination returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"access_token": "my-access-token", "endpoint": "https://example.com", "type": "splunk_hec"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.name" is equal to "Nginx logs" + And the response "data.attributes.query" is equal to "source:nginx" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.enabled" is false + And the response "data.attributes.forward_tags" is false + And the response "data.attributes.forward_tags_restriction_list" has length 2 + And the response "data.attributes.forward_tags_restriction_list" array contains value "datacenter" + And the response "data.attributes.forward_tags_restriction_list" array contains value "host" + And the response "data.attributes.forward_tags_restriction_list_type" is equal to "ALLOW_LIST" + + @skip-java @skip-python @skip-typescript @team:DataDog/logs-backend + Scenario: Create a custom destination returns "Bad Request" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"name": "Nginx logs"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/logs-backend + Scenario: Create a custom destination returns "Conflict" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": true, "forward_tags": true, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"auth": {"password": "datadog-custom-destination-password", "type": "basic", "username": "datadog-custom-destination-username"}, "endpoint": "https://example.com", "type": "http"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/logs-backend + Scenario: Create a custom destination returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": true, "forward_tags": true, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"auth": {"password": "datadog-custom-destination-password", "type": "basic", "username": "datadog-custom-destination-username"}, "endpoint": "https://example.com", "type": "http"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/logs-backend + Scenario: Create an Elasticsearch custom destination returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"auth": {"username": "my-username", "password": "my-password"}, "index_name": "nginx-logs", "index_rotation": "yyyy-MM-dd", "endpoint": "https://example.com", "type": "elasticsearch"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.name" is equal to "Nginx logs" + And the response "data.attributes.query" is equal to "source:nginx" + And the response "data.attributes.forwarder_destination.type" is equal to "elasticsearch" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination.index_name" is equal to "nginx-logs" + And the response "data.attributes.forwarder_destination.index_rotation" is equal to "yyyy-MM-dd" + And the response "data.attributes.forwarder_destination.auth" does not have field "username" + And the response "data.attributes.forwarder_destination.auth" does not have field "password" + And the response "data.attributes.enabled" is false + And the response "data.attributes.forward_tags" is false + And the response "data.attributes.forward_tags_restriction_list" has length 2 + And the response "data.attributes.forward_tags_restriction_list" array contains value "datacenter" + And the response "data.attributes.forward_tags_restriction_list" array contains value "host" + And the response "data.attributes.forward_tags_restriction_list_type" is equal to "ALLOW_LIST" + + @generated @skip @team:DataDog/logs-backend + Scenario: Delete a custom destination returns "Bad Request" response + Given new "DeleteLogsCustomDestination" request + And request contains "custom_destination_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-backend + Scenario: Delete a custom destination returns "Not Found" response + Given new "DeleteLogsCustomDestination" request + And request contains "custom_destination_id" parameter with value "does-not-exist" + When the request is sent + Then the response status is 404 Not found + + @team:DataDog/logs-backend + Scenario: Delete a custom destination returns "OK" response + Given new "DeleteLogsCustomDestination" request + And there is a valid "custom_destination" in the system + And request contains "custom_destination_id" parameter from "custom_destination.data.id" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:DataDog/logs-backend + Scenario: Get a custom destination returns "Bad Request" response + Given new "GetLogsCustomDestination" request + And request contains "custom_destination_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-backend + Scenario: Get a custom destination returns "Not Found" response + Given new "GetLogsCustomDestination" request + And request contains "custom_destination_id" parameter with value "does-not-exist" + When the request is sent + Then the response status is 404 Not found + + @team:DataDog/logs-backend + Scenario: Get a custom destination returns "OK" response + Given new "GetLogsCustomDestination" request + And there is a valid "custom_destination" in the system + And request contains "custom_destination_id" parameter from "custom_destination.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data.id" is equal to "{{ custom_destination.data.id }}" + And the response "data.attributes.name" is equal to "{{ custom_destination.data.attributes.name }}" + And the response "data.attributes.query" is equal to "{{ custom_destination.data.attributes.query }}" + And the response "data.attributes.forwarder_destination.type" is equal to "{{ custom_destination.data.attributes.forwarder_destination.type }}" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "{{ custom_destination.data.attributes.forwarder_destination.endpoint }}" + And the response "data.attributes.forwarder_destination.auth.type" is equal to "{{ custom_destination.data.attributes.forwarder_destination.auth.type }}" + And the response "data.attributes.forwarder_destination.auth" does not have field "username" + And the response "data.attributes.forwarder_destination.auth" does not have field "password" + And the response "data.attributes.enabled" is false + And the response "data.attributes.forward_tags" is false + And the response "data.attributes.forward_tags_restriction_list" has length 1 + And the response "data.attributes.forward_tags_restriction_list" array contains value "host" + And the response "data.attributes.forward_tags_restriction_list_type" is equal to "{{ custom_destination.data.attributes.forward_tags_restriction_list_type }}" + + @team:DataDog/logs-backend + Scenario: Get all custom destinations returns "OK" response + Given new "ListLogsCustomDestinations" request + And there is a valid "custom_destination" in the system + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].type" is equal to "custom_destination" + And the response "data[0].id" is equal to "{{ custom_destination.data.id }}" + And the response "data[0].attributes.name" is equal to "{{ custom_destination.data.attributes.name }}" + And the response "data[0].attributes.query" is equal to "{{ custom_destination.data.attributes.query }}" + And the response "data[0].attributes.forwarder_destination.type" is equal to "{{ custom_destination.data.attributes.forwarder_destination.type }}" + And the response "data[0].attributes.forwarder_destination.endpoint" is equal to "{{ custom_destination.data.attributes.forwarder_destination.endpoint }}" + And the response "data[0].attributes.forwarder_destination.auth.type" is equal to "{{ custom_destination.data.attributes.forwarder_destination.auth.type }}" + And the response "data[0].attributes.forwarder_destination.auth" does not have field "username" + And the response "data[0].attributes.forwarder_destination.auth" does not have field "password" + And the response "data[0].attributes.enabled" is false + And the response "data[0].attributes.forward_tags" is false + And the response "data[0].attributes.forward_tags_restriction_list" has length 1 + And the response "data[0].attributes.forward_tags_restriction_list" array contains value "host" + And the response "data[0].attributes.forward_tags_restriction_list_type" is equal to "{{ custom_destination.data.attributes.forward_tags_restriction_list_type }}" + + @team:DataDog/logs-backend + Scenario: Update a custom destination returns "Bad Request" response + Given new "UpdateLogsCustomDestination" request + And there is a valid "custom_destination" in the system + And request contains "custom_destination_id" parameter from "custom_destination.data.id" + And body with value {"data": {"attributes": {"forward_tags_restriction_list_type": "this_list_type_does_not_exist"}, "type": "custom_destination", "id": "{{ custom_destination.data.id }}" }} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/logs-backend + Scenario: Update a custom destination returns "Conflict" response + Given new "UpdateLogsCustomDestination" request + And request contains "custom_destination_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"auth": {"password": "datadog-custom-destination-password", "type": "basic", "username": "datadog-custom-destination-username"}, "endpoint": "https://example.com", "type": "http"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/logs-backend + Scenario: Update a custom destination returns "Not Found" response + Given new "UpdateLogsCustomDestination" request + And request contains "custom_destination_id" parameter with value "id-from-non-existing-custom-destination" + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"auth": {"type": "basic", "username": "datadog-custom-destination-username", "password": "datadog-custom-destination-password"}, "endpoint": "https://example.com", "type": "http"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination", "id": "id-from-non-existing-custom-destination" }} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/logs-backend + Scenario: Update a custom destination returns "OK" response + Given new "UpdateLogsCustomDestination" request + And there is a valid "custom_destination" in the system + And request contains "custom_destination_id" parameter from "custom_destination.data.id" + And body with value {"data": {"attributes": {"name": "Nginx logs (Updated)"}, "type": "custom_destination", "id": "{{ custom_destination.data.id }}" }} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data.id" is equal to "{{ custom_destination.data.id }}" + And the response "data.attributes.name" is equal to "Nginx logs (Updated)" + And the response "data.attributes.query" is equal to "{{ custom_destination.data.attributes.query }}" + And the response "data.attributes.forwarder_destination.type" is equal to "{{ custom_destination.data.attributes.forwarder_destination.type }}" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "{{ custom_destination.data.attributes.forwarder_destination.endpoint }}" + And the response "data.attributes.forwarder_destination.auth.type" is equal to "{{ custom_destination.data.attributes.forwarder_destination.auth.type }}" + And the response "data.attributes.forwarder_destination.auth" does not have field "username" + And the response "data.attributes.forwarder_destination.auth" does not have field "password" + And the response "data.attributes.enabled" is false + And the response "data.attributes.forward_tags" is false + And the response "data.attributes.forward_tags_restriction_list" has length 1 + And the response "data.attributes.forward_tags_restriction_list" array contains value "host" + And the response "data.attributes.forward_tags_restriction_list_type" is equal to "{{ custom_destination.data.attributes.forward_tags_restriction_list_type }}" diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 90fee66806..f1ce400479 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1076,6 +1076,43 @@ "type": "unsafe" } }, + "ListLogsCustomDestinations": { + "tag": "Logs Custom Destinations", + "undo": { + "type": "safe" + } + }, + "CreateLogsCustomDestination": { + "tag": "Logs Custom Destinations", + "undo": { + "operationId": "DeleteLogsCustomDestination", + "parameters": [ + { + "name": "custom_destination_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteLogsCustomDestination": { + "tag": "Logs Custom Destinations", + "undo": { + "type": "idempotent" + } + }, + "GetLogsCustomDestination": { + "tag": "Logs Custom Destinations", + "undo": { + "type": "safe" + } + }, + "UpdateLogsCustomDestination": { + "tag": "Logs Custom Destinations", + "undo": { + "type": "idempotent" + } + }, "ListLogsMetrics": { "tag": "Logs Metrics", "undo": {