diff --git a/.apigentools-info b/.apigentools-info index 822a71f0efc5..17b3d92709ff 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.456241", - "spec_repo_commit": "32fcfc91" + "regenerated": "2024-03-13 14:23:48.888926", + "spec_repo_commit": "113614d8" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-03-12 18:41:36.473521", - "spec_repo_commit": "32fcfc91" + "regenerated": "2024-03-13 14:23:48.908105", + "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 90fbd2bfc1b2..f1c186a85637 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/cassettes/features/v2/logs_custom_destinations/Create-a-Basic-HTTP-custom-destination-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Create-a-Basic-HTTP-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000000..14b4198db7a2 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Create-a-Basic-HTTP-custom-destination-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Create-a-Basic-HTTP-custom-destination-returns-OK-response.yml new file mode 100644 index 000000000000..2c35171890e5 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Create-a-Basic-HTTP-custom-destination-returns-OK-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:07 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:07 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Create-a-Custom-Header-HTTP-custom-destination-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Create-a-Custom-Header-HTTP-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000000..884ab65f4e5e --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Create-a-Custom-Header-HTTP-custom-destination-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Create-a-Custom-Header-HTTP-custom-destination-returns-OK-response.yml new file mode 100644 index 000000000000..b2324cdf02f3 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Create-a-Custom-Header-HTTP-custom-destination-returns-OK-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:08 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:08 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000000..79246244e65d --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-returns-OK-response.yml new file mode 100644 index 000000000000..0bbc15d55b43 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-returns-OK-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:09 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:09 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Create-a-custom-destination-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_custom_destinations/Create-a-custom-destination-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..8f6df3cca078 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Create-a-custom-destination-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_custom_destinations/Create-a-custom-destination-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..562cacc298cf --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Create-a-custom-destination-returns-Bad-Request-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:10 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + string: '{"errors":["The parameter ''forwarder_destination'' is required"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Create-an-Elasticsearch-custom-destination-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Create-an-Elasticsearch-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000000..9f38ea9f8ef5 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Create-an-Elasticsearch-custom-destination-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Create-an-Elasticsearch-custom-destination-returns-OK-response.yml new file mode 100644 index 000000000000..30bdd580a1d3 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Create-an-Elasticsearch-custom-destination-returns-OK-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:10 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:10 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-Not-Found-response.frozen b/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..a66cf29054a1 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-Not-Found-response.yml b/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-Not-Found-response.yml new file mode 100644 index 000000000000..2c54a3e272c6 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-Not-Found-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:11 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/does-not-exist + response: + body: + encoding: UTF-8 + string: '{"errors":["NotFound"]} + + ' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000000..118be029f845 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-OK-response.yml new file mode 100644 index 000000000000..3a9784047d46 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Delete-a-custom-destination-returns-OK-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:12 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:12 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Tue, 12 Mar 2024 09:20:12 GMT + 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: + encoding: UTF-8 + string: '{"errors":["NotFound"]} + + ' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-Not-Found-response.frozen b/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..f247a8b5e0f1 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-Not-Found-response.yml b/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-Not-Found-response.yml new file mode 100644 index 000000000000..276cdd39845e --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-Not-Found-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:13 GMT + 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: + encoding: UTF-8 + string: '{"errors":["NotFound"]} + + ' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000000..1d60a375138b --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-OK-response.yml new file mode 100644 index 000000000000..62c62b34b71b --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Get-a-custom-destination-returns-OK-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:13 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:13 GMT + 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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:13 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Get-all-custom-destinations-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Get-all-custom-destinations-returns-OK-response.frozen new file mode 100644 index 000000000000..65faf1870bc3 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Get-all-custom-destinations-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Get-all-custom-destinations-returns-OK-response.yml new file mode 100644 index 000000000000..c31eb26a1920 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Get-all-custom-destinations-returns-OK-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:15 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:15 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations + response: + body: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:15 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..131ba9254c86 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..bdf643ef08d6 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Bad-Request-response.yml @@ -0,0 +1,68 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:16 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:16 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + string: '{"errors":["Internal error"]} + + ' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +- recorded_at: Tue, 12 Mar 2024 09:20:16 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Not-Found-response.frozen b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..9b964d6ef496 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Not-Found-response.yml b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Not-Found-response.yml new file mode 100644 index 000000000000..479172f190cc --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-Not-Found-response.yml @@ -0,0 +1,27 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:17 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + string: '{"errors":["NotFound"]} + + ' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-OK-response.frozen b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000000..f79f9f1e90d8 --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/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/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-OK-response.yml b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-OK-response.yml new file mode 100644 index 000000000000..06ba690b220d --- /dev/null +++ b/cassettes/features/v2/logs_custom_destinations/Update-a-custom-destination-returns-OK-response.yml @@ -0,0 +1,69 @@ +http_interactions: +- recorded_at: Tue, 12 Mar 2024 09:20:18 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:18 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Tue, 12 Mar 2024 09:20:18 GMT + 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: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination.rb b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination.rb new file mode 100644 index 000000000000..ec71b86b927d --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination.rb @@ -0,0 +1,31 @@ +# Create a custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +body = DatadogAPIClient::V2::CustomDestinationCreateRequest.new({ + data: DatadogAPIClient::V2::CustomDestinationCreateRequestDefinition.new({ + attributes: DatadogAPIClient::V2::CustomDestinationCreateRequestAttributes.new({ + enabled: true, + forward_tags: true, + forward_tags_restriction_list: [ + "datacenter", + "host", + ], + forward_tags_restriction_list_type: DatadogAPIClient::V2::CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST, + forwarder_destination: DatadogAPIClient::V2::CustomDestinationForwardDestinationHttp.new({ + auth: DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthBasic.new({ + password: "datadog-custom-destination-password", + type: DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthBasicType::BASIC, + username: "datadog-custom-destination-username", + }), + endpoint: "https://example.com", + type: DatadogAPIClient::V2::CustomDestinationForwardDestinationHttpType::HTTP, + }), + name: "Nginx logs", + query: "source:nginx", + }), + type: DatadogAPIClient::V2::CustomDestinationType::CUSTOM_DESTINATION, + }), +}) +p api_instance.create_logs_custom_destination(body) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1091442807.rb b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1091442807.rb new file mode 100644 index 000000000000..2c23ae90d6f9 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1091442807.rb @@ -0,0 +1,31 @@ +# Create a Custom Header HTTP custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +body = DatadogAPIClient::V2::CustomDestinationCreateRequest.new({ + data: DatadogAPIClient::V2::CustomDestinationCreateRequestDefinition.new({ + attributes: DatadogAPIClient::V2::CustomDestinationCreateRequestAttributes.new({ + enabled: false, + forward_tags: false, + forward_tags_restriction_list: [ + "datacenter", + "host", + ], + forward_tags_restriction_list_type: DatadogAPIClient::V2::CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST, + forwarder_destination: DatadogAPIClient::V2::CustomDestinationForwardDestinationHttp.new({ + auth: DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthCustomHeader.new({ + header_value: "my-secret", + type: DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthCustomHeaderType::CUSTOM_HEADER, + header_name: "MY-AUTHENTICATION-HEADER", + }), + endpoint: "https://example.com", + type: DatadogAPIClient::V2::CustomDestinationForwardDestinationHttpType::HTTP, + }), + name: "Nginx logs", + query: "source:nginx", + }), + type: DatadogAPIClient::V2::CustomDestinationType::CUSTOM_DESTINATION, + }), +}) +p api_instance.create_logs_custom_destination(body) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1288180912.rb b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1288180912.rb new file mode 100644 index 000000000000..f51ef11bbefa --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1288180912.rb @@ -0,0 +1,27 @@ +# Create a Splunk custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +body = DatadogAPIClient::V2::CustomDestinationCreateRequest.new({ + data: DatadogAPIClient::V2::CustomDestinationCreateRequestDefinition.new({ + attributes: DatadogAPIClient::V2::CustomDestinationCreateRequestAttributes.new({ + enabled: false, + forward_tags: false, + forward_tags_restriction_list: [ + "datacenter", + "host", + ], + forward_tags_restriction_list_type: DatadogAPIClient::V2::CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST, + forwarder_destination: DatadogAPIClient::V2::CustomDestinationForwardDestinationSplunk.new({ + access_token: "my-access-token", + endpoint: "https://example.com", + type: DatadogAPIClient::V2::CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + }), + name: "Nginx logs", + query: "source:nginx", + }), + type: DatadogAPIClient::V2::CustomDestinationType::CUSTOM_DESTINATION, + }), +}) +p api_instance.create_logs_custom_destination(body) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_141236188.rb b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_141236188.rb new file mode 100644 index 000000000000..894a6d0643ff --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_141236188.rb @@ -0,0 +1,32 @@ +# Create an Elasticsearch custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +body = DatadogAPIClient::V2::CustomDestinationCreateRequest.new({ + data: DatadogAPIClient::V2::CustomDestinationCreateRequestDefinition.new({ + attributes: DatadogAPIClient::V2::CustomDestinationCreateRequestAttributes.new({ + enabled: false, + forward_tags: false, + forward_tags_restriction_list: [ + "datacenter", + "host", + ], + forward_tags_restriction_list_type: DatadogAPIClient::V2::CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST, + forwarder_destination: DatadogAPIClient::V2::CustomDestinationForwardDestinationElasticsearch.new({ + auth: DatadogAPIClient::V2::CustomDestinationElasticsearchDestinationAuth.new({ + username: "my-username", + password: "my-password", + }), + index_name: "nginx-logs", + index_rotation: "yyyy-MM-dd", + endpoint: "https://example.com", + type: DatadogAPIClient::V2::CustomDestinationForwardDestinationElasticsearchType::ELASTICSEARCH, + }), + name: "Nginx logs", + query: "source:nginx", + }), + type: DatadogAPIClient::V2::CustomDestinationType::CUSTOM_DESTINATION, + }), +}) +p api_instance.create_logs_custom_destination(body) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2184123765.rb b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2184123765.rb new file mode 100644 index 000000000000..2ce61c925cf8 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2184123765.rb @@ -0,0 +1,31 @@ +# Create a Basic HTTP custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +body = DatadogAPIClient::V2::CustomDestinationCreateRequest.new({ + data: DatadogAPIClient::V2::CustomDestinationCreateRequestDefinition.new({ + attributes: DatadogAPIClient::V2::CustomDestinationCreateRequestAttributes.new({ + enabled: false, + forward_tags: false, + forward_tags_restriction_list: [ + "datacenter", + "host", + ], + forward_tags_restriction_list_type: DatadogAPIClient::V2::CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST, + forwarder_destination: DatadogAPIClient::V2::CustomDestinationForwardDestinationHttp.new({ + auth: DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthBasic.new({ + password: "datadog-custom-destination-password", + type: DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthBasicType::BASIC, + username: "datadog-custom-destination-username", + }), + endpoint: "https://example.com", + type: DatadogAPIClient::V2::CustomDestinationForwardDestinationHttpType::HTTP, + }), + name: "Nginx logs", + query: "source:nginx", + }), + type: DatadogAPIClient::V2::CustomDestinationType::CUSTOM_DESTINATION, + }), +}) +p api_instance.create_logs_custom_destination(body) diff --git a/examples/v2/logs-custom-destinations/DeleteLogsCustomDestination.rb b/examples/v2/logs-custom-destinations/DeleteLogsCustomDestination.rb new file mode 100644 index 000000000000..a823994ad35a --- /dev/null +++ b/examples/v2/logs-custom-destinations/DeleteLogsCustomDestination.rb @@ -0,0 +1,8 @@ +# Delete a custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +# there is a valid "custom_destination" in the system +CUSTOM_DESTINATION_DATA_ID = ENV["CUSTOM_DESTINATION_DATA_ID"] +api_instance.delete_logs_custom_destination(CUSTOM_DESTINATION_DATA_ID) diff --git a/examples/v2/logs-custom-destinations/GetLogsCustomDestination.rb b/examples/v2/logs-custom-destinations/GetLogsCustomDestination.rb new file mode 100644 index 000000000000..a726f7372a86 --- /dev/null +++ b/examples/v2/logs-custom-destinations/GetLogsCustomDestination.rb @@ -0,0 +1,8 @@ +# Get a custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +# there is a valid "custom_destination" in the system +CUSTOM_DESTINATION_DATA_ID = ENV["CUSTOM_DESTINATION_DATA_ID"] +p api_instance.get_logs_custom_destination(CUSTOM_DESTINATION_DATA_ID) diff --git a/examples/v2/logs-custom-destinations/ListLogsCustomDestinations.rb b/examples/v2/logs-custom-destinations/ListLogsCustomDestinations.rb new file mode 100644 index 000000000000..cd86220b6226 --- /dev/null +++ b/examples/v2/logs-custom-destinations/ListLogsCustomDestinations.rb @@ -0,0 +1,5 @@ +# Get all custom destinations returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new +p api_instance.list_logs_custom_destinations() diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination.rb b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination.rb new file mode 100644 index 000000000000..6c72b9b9d9f6 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination.rb @@ -0,0 +1,18 @@ +# Update a custom destination returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::LogsCustomDestinationsAPI.new + +# there is a valid "custom_destination" in the system +CUSTOM_DESTINATION_DATA_ID = ENV["CUSTOM_DESTINATION_DATA_ID"] + +body = DatadogAPIClient::V2::CustomDestinationUpdateRequest.new({ + data: DatadogAPIClient::V2::CustomDestinationUpdateRequestDefinition.new({ + attributes: DatadogAPIClient::V2::CustomDestinationUpdateRequestAttributes.new({ + name: "Nginx logs (Updated)", + }), + type: DatadogAPIClient::V2::CustomDestinationType::CUSTOM_DESTINATION, + id: CUSTOM_DESTINATION_DATA_ID, + }), +}) +p api_instance.update_logs_custom_destination(CUSTOM_DESTINATION_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a04b5b7ee442..259c74b75112 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1431,6 +1431,19 @@ "archive_id" => "String", "body" => "RelationshipToRole", }, + "v2.CreateLogsCustomDestination" => { + "body" => "CustomDestinationCreateRequest", + }, + "v2.DeleteLogsCustomDestination" => { + "custom_destination_id" => "String", + }, + "v2.GetLogsCustomDestination" => { + "custom_destination_id" => "String", + }, + "v2.UpdateLogsCustomDestination" => { + "custom_destination_id" => "String", + "body" => "CustomDestinationUpdateRequest", + }, "v2.CreateLogsMetric" => { "body" => "LogsMetricCreateRequest", }, diff --git a/features/v2/given.json b/features/v2/given.json index 73de3c05e39e..04b3989db8b9 100644 --- a/features/v2/given.json +++ b/features/v2/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/features/v2/logs_custom_destinations.feature b/features/v2/logs_custom_destinations.feature new file mode 100644 index 000000000000..812898736cf1 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 90fee66806c2..f1ce400479cd 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 2bcb378f2c20..64318a4f32bc 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1153,6 +1153,43 @@ def overrides "v2.create_rule_response" => "CreateRuleResponse", "v2.create_rule_response_data" => "CreateRuleResponseData", "v2.creator" => "Creator", + "v2.custom_destination_attribute_tags_restriction_list_type" => "CustomDestinationAttributeTagsRestrictionListType", + "v2.custom_destination_create_request" => "CustomDestinationCreateRequest", + "v2.custom_destination_create_request_attributes" => "CustomDestinationCreateRequestAttributes", + "v2.custom_destination_create_request_definition" => "CustomDestinationCreateRequestDefinition", + "v2.custom_destination_elasticsearch_destination_auth" => "CustomDestinationElasticsearchDestinationAuth", + "v2.custom_destination_forward_destination" => "CustomDestinationForwardDestination", + "v2.custom_destination_forward_destination_elasticsearch" => "CustomDestinationForwardDestinationElasticsearch", + "v2.custom_destination_forward_destination_elasticsearch_type" => "CustomDestinationForwardDestinationElasticsearchType", + "v2.custom_destination_forward_destination_http" => "CustomDestinationForwardDestinationHttp", + "v2.custom_destination_forward_destination_http_type" => "CustomDestinationForwardDestinationHttpType", + "v2.custom_destination_forward_destination_splunk" => "CustomDestinationForwardDestinationSplunk", + "v2.custom_destination_forward_destination_splunk_type" => "CustomDestinationForwardDestinationSplunkType", + "v2.custom_destination_http_destination_auth" => "CustomDestinationHttpDestinationAuth", + "v2.custom_destination_http_destination_auth_basic" => "CustomDestinationHttpDestinationAuthBasic", + "v2.custom_destination_http_destination_auth_basic_type" => "CustomDestinationHttpDestinationAuthBasicType", + "v2.custom_destination_http_destination_auth_custom_header" => "CustomDestinationHttpDestinationAuthCustomHeader", + "v2.custom_destination_http_destination_auth_custom_header_type" => "CustomDestinationHttpDestinationAuthCustomHeaderType", + "v2.custom_destination_response" => "CustomDestinationResponse", + "v2.custom_destination_response_attributes" => "CustomDestinationResponseAttributes", + "v2.custom_destination_response_definition" => "CustomDestinationResponseDefinition", + "v2.custom_destination_response_forward_destination" => "CustomDestinationResponseForwardDestination", + "v2.custom_destination_response_forward_destination_elasticsearch" => "CustomDestinationResponseForwardDestinationElasticsearch", + "v2.custom_destination_response_forward_destination_elasticsearch_type" => "CustomDestinationResponseForwardDestinationElasticsearchType", + "v2.custom_destination_response_forward_destination_http" => "CustomDestinationResponseForwardDestinationHttp", + "v2.custom_destination_response_forward_destination_http_type" => "CustomDestinationResponseForwardDestinationHttpType", + "v2.custom_destination_response_forward_destination_splunk" => "CustomDestinationResponseForwardDestinationSplunk", + "v2.custom_destination_response_forward_destination_splunk_type" => "CustomDestinationResponseForwardDestinationSplunkType", + "v2.custom_destination_response_http_destination_auth" => "CustomDestinationResponseHttpDestinationAuth", + "v2.custom_destination_response_http_destination_auth_basic" => "CustomDestinationResponseHttpDestinationAuthBasic", + "v2.custom_destination_response_http_destination_auth_basic_type" => "CustomDestinationResponseHttpDestinationAuthBasicType", + "v2.custom_destination_response_http_destination_auth_custom_header" => "CustomDestinationResponseHttpDestinationAuthCustomHeader", + "v2.custom_destination_response_http_destination_auth_custom_header_type" => "CustomDestinationResponseHttpDestinationAuthCustomHeaderType", + "v2.custom_destinations_response" => "CustomDestinationsResponse", + "v2.custom_destination_type" => "CustomDestinationType", + "v2.custom_destination_update_request" => "CustomDestinationUpdateRequest", + "v2.custom_destination_update_request_attributes" => "CustomDestinationUpdateRequestAttributes", + "v2.custom_destination_update_request_definition" => "CustomDestinationUpdateRequestDefinition", "v2.dashboard_list_add_items_request" => "DashboardListAddItemsRequest", "v2.dashboard_list_add_items_response" => "DashboardListAddItemsResponse", "v2.dashboard_list_delete_items_request" => "DashboardListDeleteItemsRequest", @@ -2309,6 +2346,7 @@ def overrides "v2.key_management_api" => "KeyManagementAPI", "v2.logs_api" => "LogsAPI", "v2.logs_archives_api" => "LogsArchivesAPI", + "v2.logs_custom_destinations_api" => "LogsCustomDestinationsAPI", "v2.logs_metrics_api" => "LogsMetricsAPI", "v2.metrics_api" => "MetricsAPI", "v2.monitors_api" => "MonitorsAPI", diff --git a/lib/datadog_api_client/v2/api/logs_custom_destinations_api.rb b/lib/datadog_api_client/v2/api/logs_custom_destinations_api.rb new file mode 100644 index 000000000000..dc3707d7d2ad --- /dev/null +++ b/lib/datadog_api_client/v2/api/logs_custom_destinations_api.rb @@ -0,0 +1,355 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class LogsCustomDestinationsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a custom destination. + # + # @see #create_logs_custom_destination_with_http_info + def create_logs_custom_destination(body, opts = {}) + data, _status_code, _headers = create_logs_custom_destination_with_http_info(body, opts) + data + end + + # Create a custom destination. + # + # Create a custom destination in your organization. + # + # @param body [CustomDestinationCreateRequest] The definition of the new custom destination. + # @param opts [Hash] the optional parameters + # @return [Array<(CustomDestinationResponse, Integer, Hash)>] CustomDestinationResponse data, response status code and response headers + def create_logs_custom_destination_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsCustomDestinationsAPI.create_logs_custom_destination ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling LogsCustomDestinationsAPI.create_logs_custom_destination" + end + # resource path + local_var_path = '/api/v2/logs/config/custom-destinations' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CustomDestinationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_logs_custom_destination, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsCustomDestinationsAPI#create_logs_custom_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a custom destination. + # + # @see #delete_logs_custom_destination_with_http_info + def delete_logs_custom_destination(custom_destination_id, opts = {}) + delete_logs_custom_destination_with_http_info(custom_destination_id, opts) + nil + end + + # Delete a custom destination. + # + # Delete a specific custom destination in your organization. + # + # @param custom_destination_id [String] The ID of the custom destination. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_logs_custom_destination_with_http_info(custom_destination_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsCustomDestinationsAPI.delete_logs_custom_destination ...' + end + # verify the required parameter 'custom_destination_id' is set + if @api_client.config.client_side_validation && custom_destination_id.nil? + fail ArgumentError, "Missing the required parameter 'custom_destination_id' when calling LogsCustomDestinationsAPI.delete_logs_custom_destination" + end + # resource path + local_var_path = '/api/v2/logs/config/custom-destinations/{custom_destination_id}'.sub('{custom_destination_id}', CGI.escape(custom_destination_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_logs_custom_destination, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsCustomDestinationsAPI#delete_logs_custom_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a custom destination. + # + # @see #get_logs_custom_destination_with_http_info + def get_logs_custom_destination(custom_destination_id, opts = {}) + data, _status_code, _headers = get_logs_custom_destination_with_http_info(custom_destination_id, opts) + data + end + + # Get a custom destination. + # + # Get a specific custom destination in your organization. + # + # @param custom_destination_id [String] The ID of the custom destination. + # @param opts [Hash] the optional parameters + # @return [Array<(CustomDestinationResponse, Integer, Hash)>] CustomDestinationResponse data, response status code and response headers + def get_logs_custom_destination_with_http_info(custom_destination_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsCustomDestinationsAPI.get_logs_custom_destination ...' + end + # verify the required parameter 'custom_destination_id' is set + if @api_client.config.client_side_validation && custom_destination_id.nil? + fail ArgumentError, "Missing the required parameter 'custom_destination_id' when calling LogsCustomDestinationsAPI.get_logs_custom_destination" + end + # resource path + local_var_path = '/api/v2/logs/config/custom-destinations/{custom_destination_id}'.sub('{custom_destination_id}', CGI.escape(custom_destination_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomDestinationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_logs_custom_destination, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsCustomDestinationsAPI#get_logs_custom_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all custom destinations. + # + # @see #list_logs_custom_destinations_with_http_info + def list_logs_custom_destinations(opts = {}) + data, _status_code, _headers = list_logs_custom_destinations_with_http_info(opts) + data + end + + # Get all custom destinations. + # + # Get the list of configured custom destinations in your organization with their definitions. + # + # @param opts [Hash] the optional parameters + # @return [Array<(CustomDestinationsResponse, Integer, Hash)>] CustomDestinationsResponse data, response status code and response headers + def list_logs_custom_destinations_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsCustomDestinationsAPI.list_logs_custom_destinations ...' + end + # resource path + local_var_path = '/api/v2/logs/config/custom-destinations' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomDestinationsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_logs_custom_destinations, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsCustomDestinationsAPI#list_logs_custom_destinations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a custom destination. + # + # @see #update_logs_custom_destination_with_http_info + def update_logs_custom_destination(custom_destination_id, body, opts = {}) + data, _status_code, _headers = update_logs_custom_destination_with_http_info(custom_destination_id, body, opts) + data + end + + # Update a custom destination. + # + # Update the given fields of a specific custom destination in your organization. + # + # @param custom_destination_id [String] The ID of the custom destination. + # @param body [CustomDestinationUpdateRequest] New definition of the custom destination's fields. + # @param opts [Hash] the optional parameters + # @return [Array<(CustomDestinationResponse, Integer, Hash)>] CustomDestinationResponse data, response status code and response headers + def update_logs_custom_destination_with_http_info(custom_destination_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsCustomDestinationsAPI.update_logs_custom_destination ...' + end + # verify the required parameter 'custom_destination_id' is set + if @api_client.config.client_side_validation && custom_destination_id.nil? + fail ArgumentError, "Missing the required parameter 'custom_destination_id' when calling LogsCustomDestinationsAPI.update_logs_custom_destination" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling LogsCustomDestinationsAPI.update_logs_custom_destination" + end + # resource path + local_var_path = '/api/v2/logs/config/custom-destinations/{custom_destination_id}'.sub('{custom_destination_id}', CGI.escape(custom_destination_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CustomDestinationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_logs_custom_destination, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsCustomDestinationsAPI#update_logs_custom_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_attribute_tags_restriction_list_type.rb b/lib/datadog_api_client/v2/models/custom_destination_attribute_tags_restriction_list_type.rb new file mode 100644 index 000000000000..2ce689311be4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_attribute_tags_restriction_list_type.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class CustomDestinationAttributeTagsRestrictionListType + include BaseEnumModel + + ALLOW_LIST = "ALLOW_LIST".freeze + BLOCK_LIST = "BLOCK_LIST".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_create_request.rb b/lib/datadog_api_client/v2/models/custom_destination_create_request.rb new file mode 100644 index 000000000000..bc9f7b2989df --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_create_request.rb @@ -0,0 +1,80 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The custom destination. + class CustomDestinationCreateRequest + include BaseGenericModel + + # The definition of a custom destination. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomDestinationCreateRequestDefinition' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationCreateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_create_request_attributes.rb b/lib/datadog_api_client/v2/models/custom_destination_create_request_attributes.rb new file mode 100644 index 000000000000..3602b00f3091 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_create_request_attributes.rb @@ -0,0 +1,193 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes associated with the custom destination. + class CustomDestinationCreateRequestAttributes + include BaseGenericModel + + # Whether logs matching this custom destination should be forwarded or not. + attr_accessor :enabled + + # Whether tags from the forwarded logs should be forwarded or not. + attr_accessor :forward_tags + + # 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. + attr_reader :forward_tags_restriction_list + + # 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. + attr_accessor :forward_tags_restriction_list_type + + # A custom destination's location to forward logs. + attr_reader :forwarder_destination + + # The custom destination name. + attr_reader :name + + # The custom destination query and filter. Logs matching this query are forwarded to the destination. + attr_accessor :query + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'forward_tags' => :'Boolean', + :'forward_tags_restriction_list' => :'Array', + :'forward_tags_restriction_list_type' => :'CustomDestinationAttributeTagsRestrictionListType', + :'forwarder_destination' => :'CustomDestinationForwardDestination', + :'name' => :'String', + :'query' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationCreateRequestAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationCreateRequestAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'forward_tags') + self.forward_tags = attributes[:'forward_tags'] + end + + if attributes.key?(:'forward_tags_restriction_list') + if (value = attributes[:'forward_tags_restriction_list']).is_a?(Array) + self.forward_tags_restriction_list = value + end + end + + if attributes.key?(:'forward_tags_restriction_list_type') + self.forward_tags_restriction_list_type = attributes[:'forward_tags_restriction_list_type'] + end + + if attributes.key?(:'forwarder_destination') + self.forwarder_destination = attributes[:'forwarder_destination'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@forward_tags_restriction_list.nil? && @forward_tags_restriction_list.length > 10 + return false if !@forward_tags_restriction_list.nil? && @forward_tags_restriction_list.length < 0 + return false if @forwarder_destination.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param forward_tags_restriction_list [Object] Object to be assigned + # @!visibility private + def forward_tags_restriction_list=(forward_tags_restriction_list) + if !forward_tags_restriction_list.nil? && forward_tags_restriction_list.length > 10 + fail ArgumentError, 'invalid value for "forward_tags_restriction_list", number of items must be less than or equal to 10.' + end + if !forward_tags_restriction_list.nil? && forward_tags_restriction_list.length < 0 + fail ArgumentError, 'invalid value for "forward_tags_restriction_list", number of items must be greater than or equal to 0.' + end + @forward_tags_restriction_list = forward_tags_restriction_list + end + + # Custom attribute writer method with validation + # @param forwarder_destination [Object] Object to be assigned + # @!visibility private + def forwarder_destination=(forwarder_destination) + if forwarder_destination.nil? + fail ArgumentError, 'invalid value for "forwarder_destination", forwarder_destination cannot be nil.' + end + @forwarder_destination = forwarder_destination + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + forward_tags == o.forward_tags && + forward_tags_restriction_list == o.forward_tags_restriction_list && + forward_tags_restriction_list_type == o.forward_tags_restriction_list_type && + forwarder_destination == o.forwarder_destination && + name == o.name && + query == o.query + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, forward_tags, forward_tags_restriction_list, forward_tags_restriction_list_type, forwarder_destination, name, query].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_create_request_definition.rb b/lib/datadog_api_client/v2/models/custom_destination_create_request_definition.rb new file mode 100644 index 000000000000..b670f9daf6d6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_create_request_definition.rb @@ -0,0 +1,119 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The definition of a custom destination. + class CustomDestinationCreateRequestDefinition + include BaseGenericModel + + # The attributes associated with the custom destination. + attr_reader :attributes + + # The type of the resource. The value should always be `custom_destination`. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CustomDestinationCreateRequestAttributes', + :'type' => :'CustomDestinationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationCreateRequestDefinition` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationCreateRequestDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_elasticsearch_destination_auth.rb b/lib/datadog_api_client/v2/models/custom_destination_elasticsearch_destination_auth.rb new file mode 100644 index 000000000000..24bbd7d4577a --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_elasticsearch_destination_auth.rb @@ -0,0 +1,119 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Basic access authentication. + class CustomDestinationElasticsearchDestinationAuth + include BaseGenericModel + + # The password of the authentication. This field is not returned by the API. + attr_reader :password + + # The username of the authentication. This field is not returned by the API. + attr_reader :username + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'password' => :'password', + :'username' => :'username' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'password' => :'String', + :'username' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationElasticsearchDestinationAuth` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationElasticsearchDestinationAuth`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'password') + self.password = attributes[:'password'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @password.nil? + return false if @username.nil? + true + end + + # Custom attribute writer method with validation + # @param password [Object] Object to be assigned + # @!visibility private + def password=(password) + if password.nil? + fail ArgumentError, 'invalid value for "password", password cannot be nil.' + end + @password = password + end + + # Custom attribute writer method with validation + # @param username [Object] Object to be assigned + # @!visibility private + def username=(username) + if username.nil? + fail ArgumentError, 'invalid value for "username", username cannot be nil.' + end + @username = username + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + password == o.password && + username == o.username + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [password, username].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_forward_destination.rb b/lib/datadog_api_client/v2/models/custom_destination_forward_destination.rb new file mode 100644 index 000000000000..8e53ebfe726d --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_forward_destination.rb @@ -0,0 +1,64 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A custom destination's location to forward logs. + module CustomDestinationForwardDestination + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CustomDestinationForwardDestinationHttp', + :'CustomDestinationForwardDestinationSplunk', + :'CustomDestinationForwardDestinationElasticsearch' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_forward_destination_elasticsearch.rb b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_elasticsearch.rb new file mode 100644 index 000000000000..89c34faabb12 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_elasticsearch.rb @@ -0,0 +1,181 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The Elasticsearch destination. + class CustomDestinationForwardDestinationElasticsearch + include BaseGenericModel + + # Basic access authentication. + attr_reader :auth + + # The destination for which logs will be forwarded to. + # Must have HTTPS scheme and forwarding back to Datadog is not allowed. + attr_reader :endpoint + + # 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)). + attr_reader :index_name + + # 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). + attr_accessor :index_rotation + + # Type of the Elasticsearch destination. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'auth' => :'auth', + :'endpoint' => :'endpoint', + :'index_name' => :'index_name', + :'index_rotation' => :'index_rotation', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'auth' => :'CustomDestinationElasticsearchDestinationAuth', + :'endpoint' => :'String', + :'index_name' => :'String', + :'index_rotation' => :'String', + :'type' => :'CustomDestinationForwardDestinationElasticsearchType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationForwardDestinationElasticsearch` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationForwardDestinationElasticsearch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'auth') + self.auth = attributes[:'auth'] + end + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + + if attributes.key?(:'index_name') + self.index_name = attributes[:'index_name'] + end + + if attributes.key?(:'index_rotation') + self.index_rotation = attributes[:'index_rotation'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @auth.nil? + return false if @endpoint.nil? + return false if @index_name.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param auth [Object] Object to be assigned + # @!visibility private + def auth=(auth) + if auth.nil? + fail ArgumentError, 'invalid value for "auth", auth cannot be nil.' + end + @auth = auth + end + + # Custom attribute writer method with validation + # @param endpoint [Object] Object to be assigned + # @!visibility private + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'invalid value for "endpoint", endpoint cannot be nil.' + end + @endpoint = endpoint + end + + # Custom attribute writer method with validation + # @param index_name [Object] Object to be assigned + # @!visibility private + def index_name=(index_name) + if index_name.nil? + fail ArgumentError, 'invalid value for "index_name", index_name cannot be nil.' + end + @index_name = index_name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + auth == o.auth && + endpoint == o.endpoint && + index_name == o.index_name && + index_rotation == o.index_rotation && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [auth, endpoint, index_name, index_rotation, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_forward_destination_elasticsearch_type.rb b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_elasticsearch_type.rb new file mode 100644 index 000000000000..5fd86ca1e7be --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_elasticsearch_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the Elasticsearch destination. + class CustomDestinationForwardDestinationElasticsearchType + include BaseEnumModel + + ELASTICSEARCH = "elasticsearch".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_forward_destination_http.rb b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_http.rb new file mode 100644 index 000000000000..00448a2e97ba --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_http.rb @@ -0,0 +1,141 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The HTTP destination. + class CustomDestinationForwardDestinationHttp + include BaseGenericModel + + # Authentication method of the HTTP requests. + attr_reader :auth + + # The destination for which logs will be forwarded to. + # Must have HTTPS scheme and forwarding back to Datadog is not allowed. + attr_reader :endpoint + + # Type of the HTTP destination. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'auth' => :'auth', + :'endpoint' => :'endpoint', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'auth' => :'CustomDestinationHttpDestinationAuth', + :'endpoint' => :'String', + :'type' => :'CustomDestinationForwardDestinationHttpType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationForwardDestinationHttp` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationForwardDestinationHttp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'auth') + self.auth = attributes[:'auth'] + end + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @auth.nil? + return false if @endpoint.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param auth [Object] Object to be assigned + # @!visibility private + def auth=(auth) + if auth.nil? + fail ArgumentError, 'invalid value for "auth", auth cannot be nil.' + end + @auth = auth + end + + # Custom attribute writer method with validation + # @param endpoint [Object] Object to be assigned + # @!visibility private + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'invalid value for "endpoint", endpoint cannot be nil.' + end + @endpoint = endpoint + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + auth == o.auth && + endpoint == o.endpoint && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [auth, endpoint, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_forward_destination_http_type.rb b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_http_type.rb new file mode 100644 index 000000000000..3d9329e35a66 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_http_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the HTTP destination. + class CustomDestinationForwardDestinationHttpType + include BaseEnumModel + + HTTP = "http".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_forward_destination_splunk.rb b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_splunk.rb new file mode 100644 index 000000000000..2e536cfca93a --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_splunk.rb @@ -0,0 +1,141 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The Splunk HTTP Event Collector (HEC) destination. + class CustomDestinationForwardDestinationSplunk + include BaseGenericModel + + # Access token of the Splunk HTTP Event Collector. This field is not returned by the API. + attr_reader :access_token + + # The destination for which logs will be forwarded to. + # Must have HTTPS scheme and forwarding back to Datadog is not allowed. + attr_reader :endpoint + + # Type of the Splunk HTTP Event Collector (HEC) destination. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'access_token' => :'access_token', + :'endpoint' => :'endpoint', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'access_token' => :'String', + :'endpoint' => :'String', + :'type' => :'CustomDestinationForwardDestinationSplunkType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationForwardDestinationSplunk` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationForwardDestinationSplunk`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'access_token') + self.access_token = attributes[:'access_token'] + end + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @access_token.nil? + return false if @endpoint.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param access_token [Object] Object to be assigned + # @!visibility private + def access_token=(access_token) + if access_token.nil? + fail ArgumentError, 'invalid value for "access_token", access_token cannot be nil.' + end + @access_token = access_token + end + + # Custom attribute writer method with validation + # @param endpoint [Object] Object to be assigned + # @!visibility private + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'invalid value for "endpoint", endpoint cannot be nil.' + end + @endpoint = endpoint + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token == o.access_token && + endpoint == o.endpoint && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [access_token, endpoint, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_forward_destination_splunk_type.rb b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_splunk_type.rb new file mode 100644 index 000000000000..5c0c120a320e --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_forward_destination_splunk_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the Splunk HTTP Event Collector (HEC) destination. + class CustomDestinationForwardDestinationSplunkType + include BaseEnumModel + + SPLUNK_HEC = "splunk_hec".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth.rb b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth.rb new file mode 100644 index 000000000000..f23addf79304 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Authentication method of the HTTP requests. + module CustomDestinationHttpDestinationAuth + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CustomDestinationHttpDestinationAuthBasic', + :'CustomDestinationHttpDestinationAuthCustomHeader' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_basic.rb b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_basic.rb new file mode 100644 index 000000000000..f1ddbe44f9a5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_basic.rb @@ -0,0 +1,140 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Basic access authentication. + class CustomDestinationHttpDestinationAuthBasic + include BaseGenericModel + + # The password of the authentication. This field is not returned by the API. + attr_reader :password + + # Type of the basic access authentication. + attr_reader :type + + # The username of the authentication. This field is not returned by the API. + attr_reader :username + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'password' => :'password', + :'type' => :'type', + :'username' => :'username' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'password' => :'String', + :'type' => :'CustomDestinationHttpDestinationAuthBasicType', + :'username' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthBasic` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthBasic`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'password') + self.password = attributes[:'password'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @password.nil? + return false if @type.nil? + return false if @username.nil? + true + end + + # Custom attribute writer method with validation + # @param password [Object] Object to be assigned + # @!visibility private + def password=(password) + if password.nil? + fail ArgumentError, 'invalid value for "password", password cannot be nil.' + end + @password = password + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param username [Object] Object to be assigned + # @!visibility private + def username=(username) + if username.nil? + fail ArgumentError, 'invalid value for "username", username cannot be nil.' + end + @username = username + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + password == o.password && + type == o.type && + username == o.username + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [password, type, username].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_basic_type.rb b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_basic_type.rb new file mode 100644 index 000000000000..4ce4d4e5dfe1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_basic_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the basic access authentication. + class CustomDestinationHttpDestinationAuthBasicType + include BaseEnumModel + + BASIC = "basic".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_custom_header.rb b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_custom_header.rb new file mode 100644 index 000000000000..464f068e7af2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_custom_header.rb @@ -0,0 +1,140 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Custom header access authentication. + class CustomDestinationHttpDestinationAuthCustomHeader + include BaseGenericModel + + # The header name of the authentication. + attr_reader :header_name + + # The header value of the authentication. This field is not returned by the API. + attr_reader :header_value + + # Type of the custom header access authentication. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'header_name' => :'header_name', + :'header_value' => :'header_value', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'header_name' => :'String', + :'header_value' => :'String', + :'type' => :'CustomDestinationHttpDestinationAuthCustomHeaderType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthCustomHeader` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationHttpDestinationAuthCustomHeader`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'header_name') + self.header_name = attributes[:'header_name'] + end + + if attributes.key?(:'header_value') + self.header_value = attributes[:'header_value'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @header_name.nil? + return false if @header_value.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param header_name [Object] Object to be assigned + # @!visibility private + def header_name=(header_name) + if header_name.nil? + fail ArgumentError, 'invalid value for "header_name", header_name cannot be nil.' + end + @header_name = header_name + end + + # Custom attribute writer method with validation + # @param header_value [Object] Object to be assigned + # @!visibility private + def header_value=(header_value) + if header_value.nil? + fail ArgumentError, 'invalid value for "header_value", header_value cannot be nil.' + end + @header_value = header_value + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + header_name == o.header_name && + header_value == o.header_value && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [header_name, header_value, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_custom_header_type.rb b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_custom_header_type.rb new file mode 100644 index 000000000000..59dceb43b362 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_http_destination_auth_custom_header_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the custom header access authentication. + class CustomDestinationHttpDestinationAuthCustomHeaderType + include BaseEnumModel + + CUSTOM_HEADER = "custom_header".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response.rb b/lib/datadog_api_client/v2/models/custom_destination_response.rb new file mode 100644 index 000000000000..efa7abac339f --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response.rb @@ -0,0 +1,80 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The custom destination. + class CustomDestinationResponse + include BaseGenericModel + + # The definition of a custom destination. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomDestinationResponseDefinition' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_attributes.rb b/lib/datadog_api_client/v2/models/custom_destination_response_attributes.rb new file mode 100644 index 000000000000..ab013208a8cd --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_attributes.rb @@ -0,0 +1,171 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes associated with the custom destination. + class CustomDestinationResponseAttributes + include BaseGenericModel + + # Whether logs matching this custom destination should be forwarded or not. + attr_accessor :enabled + + # Whether tags from the forwarded logs should be forwarded or not. + attr_accessor :forward_tags + + # 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. + attr_reader :forward_tags_restriction_list + + # 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. + attr_accessor :forward_tags_restriction_list_type + + # A custom destination's location to forward logs. + attr_accessor :forwarder_destination + + # The custom destination name. + attr_accessor :name + + # The custom destination query filter. Logs matching this query are forwarded to the destination. + attr_accessor :query + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'forward_tags' => :'Boolean', + :'forward_tags_restriction_list' => :'Array', + :'forward_tags_restriction_list_type' => :'CustomDestinationAttributeTagsRestrictionListType', + :'forwarder_destination' => :'CustomDestinationResponseForwardDestination', + :'name' => :'String', + :'query' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponseAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponseAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'forward_tags') + self.forward_tags = attributes[:'forward_tags'] + end + + if attributes.key?(:'forward_tags_restriction_list') + if (value = attributes[:'forward_tags_restriction_list']).is_a?(Array) + self.forward_tags_restriction_list = value + end + end + + if attributes.key?(:'forward_tags_restriction_list_type') + self.forward_tags_restriction_list_type = attributes[:'forward_tags_restriction_list_type'] + end + + if attributes.key?(:'forwarder_destination') + self.forwarder_destination = attributes[:'forwarder_destination'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@forward_tags_restriction_list.nil? && @forward_tags_restriction_list.length > 10 + return false if !@forward_tags_restriction_list.nil? && @forward_tags_restriction_list.length < 0 + true + end + + # Custom attribute writer method with validation + # @param forward_tags_restriction_list [Object] Object to be assigned + # @!visibility private + def forward_tags_restriction_list=(forward_tags_restriction_list) + if !forward_tags_restriction_list.nil? && forward_tags_restriction_list.length > 10 + fail ArgumentError, 'invalid value for "forward_tags_restriction_list", number of items must be less than or equal to 10.' + end + if !forward_tags_restriction_list.nil? && forward_tags_restriction_list.length < 0 + fail ArgumentError, 'invalid value for "forward_tags_restriction_list", number of items must be greater than or equal to 0.' + end + @forward_tags_restriction_list = forward_tags_restriction_list + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + forward_tags == o.forward_tags && + forward_tags_restriction_list == o.forward_tags_restriction_list && + forward_tags_restriction_list_type == o.forward_tags_restriction_list_type && + forwarder_destination == o.forwarder_destination && + name == o.name && + query == o.query + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, forward_tags, forward_tags_restriction_list, forward_tags_restriction_list_type, forwarder_destination, name, query].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_definition.rb b/lib/datadog_api_client/v2/models/custom_destination_response_definition.rb new file mode 100644 index 000000000000..ddd5494e93c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_definition.rb @@ -0,0 +1,100 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The definition of a custom destination. + class CustomDestinationResponseDefinition + include BaseGenericModel + + # The attributes associated with the custom destination. + attr_accessor :attributes + + # The custom destination ID. + attr_accessor :id + + # The type of the resource. The value should always be `custom_destination`. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CustomDestinationResponseAttributes', + :'id' => :'String', + :'type' => :'CustomDestinationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponseDefinition` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponseDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination.rb b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination.rb new file mode 100644 index 000000000000..f0f355617320 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination.rb @@ -0,0 +1,64 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A custom destination's location to forward logs. + module CustomDestinationResponseForwardDestination + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CustomDestinationResponseForwardDestinationHttp', + :'CustomDestinationResponseForwardDestinationSplunk', + :'CustomDestinationResponseForwardDestinationElasticsearch' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_elasticsearch.rb b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_elasticsearch.rb new file mode 100644 index 000000000000..dd5f19ec8b0f --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_elasticsearch.rb @@ -0,0 +1,181 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The Elasticsearch destination. + class CustomDestinationResponseForwardDestinationElasticsearch + include BaseGenericModel + + # Basic access authentication. + attr_reader :auth + + # The destination for which logs will be forwarded to. + # Must have HTTPS scheme and forwarding back to Datadog is not allowed. + attr_reader :endpoint + + # 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)). + attr_reader :index_name + + # 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). + attr_accessor :index_rotation + + # Type of the Elasticsearch destination. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'auth' => :'auth', + :'endpoint' => :'endpoint', + :'index_name' => :'index_name', + :'index_rotation' => :'index_rotation', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'auth' => :'Hash', + :'endpoint' => :'String', + :'index_name' => :'String', + :'index_rotation' => :'String', + :'type' => :'CustomDestinationResponseForwardDestinationElasticsearchType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponseForwardDestinationElasticsearch` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponseForwardDestinationElasticsearch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'auth') + self.auth = attributes[:'auth'] + end + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + + if attributes.key?(:'index_name') + self.index_name = attributes[:'index_name'] + end + + if attributes.key?(:'index_rotation') + self.index_rotation = attributes[:'index_rotation'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @auth.nil? + return false if @endpoint.nil? + return false if @index_name.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param auth [Object] Object to be assigned + # @!visibility private + def auth=(auth) + if auth.nil? + fail ArgumentError, 'invalid value for "auth", auth cannot be nil.' + end + @auth = auth + end + + # Custom attribute writer method with validation + # @param endpoint [Object] Object to be assigned + # @!visibility private + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'invalid value for "endpoint", endpoint cannot be nil.' + end + @endpoint = endpoint + end + + # Custom attribute writer method with validation + # @param index_name [Object] Object to be assigned + # @!visibility private + def index_name=(index_name) + if index_name.nil? + fail ArgumentError, 'invalid value for "index_name", index_name cannot be nil.' + end + @index_name = index_name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + auth == o.auth && + endpoint == o.endpoint && + index_name == o.index_name && + index_rotation == o.index_rotation && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [auth, endpoint, index_name, index_rotation, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_elasticsearch_type.rb b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_elasticsearch_type.rb new file mode 100644 index 000000000000..427356981bca --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_elasticsearch_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the Elasticsearch destination. + class CustomDestinationResponseForwardDestinationElasticsearchType + include BaseEnumModel + + ELASTICSEARCH = "elasticsearch".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_http.rb b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_http.rb new file mode 100644 index 000000000000..83b814f3e008 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_http.rb @@ -0,0 +1,141 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The HTTP destination. + class CustomDestinationResponseForwardDestinationHttp + include BaseGenericModel + + # Authentication method of the HTTP requests. + attr_reader :auth + + # The destination for which logs will be forwarded to. + # Must have HTTPS scheme and forwarding back to Datadog is not allowed. + attr_reader :endpoint + + # Type of the HTTP destination. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'auth' => :'auth', + :'endpoint' => :'endpoint', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'auth' => :'CustomDestinationResponseHttpDestinationAuth', + :'endpoint' => :'String', + :'type' => :'CustomDestinationResponseForwardDestinationHttpType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponseForwardDestinationHttp` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponseForwardDestinationHttp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'auth') + self.auth = attributes[:'auth'] + end + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @auth.nil? + return false if @endpoint.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param auth [Object] Object to be assigned + # @!visibility private + def auth=(auth) + if auth.nil? + fail ArgumentError, 'invalid value for "auth", auth cannot be nil.' + end + @auth = auth + end + + # Custom attribute writer method with validation + # @param endpoint [Object] Object to be assigned + # @!visibility private + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'invalid value for "endpoint", endpoint cannot be nil.' + end + @endpoint = endpoint + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + auth == o.auth && + endpoint == o.endpoint && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [auth, endpoint, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_http_type.rb b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_http_type.rb new file mode 100644 index 000000000000..523d1786d165 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_http_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the HTTP destination. + class CustomDestinationResponseForwardDestinationHttpType + include BaseEnumModel + + HTTP = "http".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_splunk.rb b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_splunk.rb new file mode 100644 index 000000000000..abb488a94614 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_splunk.rb @@ -0,0 +1,120 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The Splunk HTTP Event Collector (HEC) destination. + class CustomDestinationResponseForwardDestinationSplunk + include BaseGenericModel + + # The destination for which logs will be forwarded to. + # Must have HTTPS scheme and forwarding back to Datadog is not allowed. + attr_reader :endpoint + + # Type of the Splunk HTTP Event Collector (HEC) destination. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'endpoint' => :'endpoint', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'endpoint' => :'String', + :'type' => :'CustomDestinationResponseForwardDestinationSplunkType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponseForwardDestinationSplunk` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponseForwardDestinationSplunk`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @endpoint.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param endpoint [Object] Object to be assigned + # @!visibility private + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'invalid value for "endpoint", endpoint cannot be nil.' + end + @endpoint = endpoint + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + endpoint == o.endpoint && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [endpoint, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_splunk_type.rb b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_splunk_type.rb new file mode 100644 index 000000000000..cf3c27298904 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_forward_destination_splunk_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the Splunk HTTP Event Collector (HEC) destination. + class CustomDestinationResponseForwardDestinationSplunkType + include BaseEnumModel + + SPLUNK_HEC = "splunk_hec".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth.rb b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth.rb new file mode 100644 index 000000000000..70ffcdec50f0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Authentication method of the HTTP requests. + module CustomDestinationResponseHttpDestinationAuth + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CustomDestinationResponseHttpDestinationAuthBasic', + :'CustomDestinationResponseHttpDestinationAuthCustomHeader' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_basic.rb b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_basic.rb new file mode 100644 index 000000000000..825360b48e06 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_basic.rb @@ -0,0 +1,98 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Basic access authentication. + class CustomDestinationResponseHttpDestinationAuthBasic + include BaseGenericModel + + # Type of the basic access authentication. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'type' => :'CustomDestinationResponseHttpDestinationAuthBasicType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponseHttpDestinationAuthBasic` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponseHttpDestinationAuthBasic`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_basic_type.rb b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_basic_type.rb new file mode 100644 index 000000000000..35f64d097190 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_basic_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the basic access authentication. + class CustomDestinationResponseHttpDestinationAuthBasicType + include BaseEnumModel + + BASIC = "basic".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_custom_header.rb b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_custom_header.rb new file mode 100644 index 000000000000..d204b7962c42 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_custom_header.rb @@ -0,0 +1,119 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Custom header access authentication. + class CustomDestinationResponseHttpDestinationAuthCustomHeader + include BaseGenericModel + + # The header name of the authentication. + attr_reader :header_name + + # Type of the custom header access authentication. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'header_name' => :'header_name', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'header_name' => :'String', + :'type' => :'CustomDestinationResponseHttpDestinationAuthCustomHeaderType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationResponseHttpDestinationAuthCustomHeader` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationResponseHttpDestinationAuthCustomHeader`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'header_name') + self.header_name = attributes[:'header_name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @header_name.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param header_name [Object] Object to be assigned + # @!visibility private + def header_name=(header_name) + if header_name.nil? + fail ArgumentError, 'invalid value for "header_name", header_name cannot be nil.' + end + @header_name = header_name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + header_name == o.header_name && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [header_name, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_custom_header_type.rb b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_custom_header_type.rb new file mode 100644 index 000000000000..1757454a658e --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_response_http_destination_auth_custom_header_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the custom header access authentication. + class CustomDestinationResponseHttpDestinationAuthCustomHeaderType + include BaseEnumModel + + CUSTOM_HEADER = "custom_header".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_type.rb b/lib/datadog_api_client/v2/models/custom_destination_type.rb new file mode 100644 index 000000000000..0a32bffad9d7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the resource. The value should always be `custom_destination`. + class CustomDestinationType + include BaseEnumModel + + custom_destination = "custom_destination".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_update_request.rb b/lib/datadog_api_client/v2/models/custom_destination_update_request.rb new file mode 100644 index 000000000000..9778f38a250a --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_update_request.rb @@ -0,0 +1,80 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The custom destination. + class CustomDestinationUpdateRequest + include BaseGenericModel + + # The definition of a custom destination. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomDestinationUpdateRequestDefinition' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationUpdateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_update_request_attributes.rb b/lib/datadog_api_client/v2/models/custom_destination_update_request_attributes.rb new file mode 100644 index 000000000000..8cd7d198a203 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_update_request_attributes.rb @@ -0,0 +1,169 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes associated with the custom destination. + class CustomDestinationUpdateRequestAttributes + include BaseGenericModel + + # Whether logs matching this custom destination should be forwarded or not. + attr_accessor :enabled + + # Whether tags from the forwarded logs should be forwarded or not. + attr_accessor :forward_tags + + # 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. + attr_reader :forward_tags_restriction_list + + # 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. + attr_accessor :forward_tags_restriction_list_type + + # A custom destination's location to forward logs. + attr_accessor :forwarder_destination + + # The custom destination name. + attr_accessor :name + + # The custom destination query and filter. Logs matching this query are forwarded to the destination. + attr_accessor :query + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'forward_tags' => :'Boolean', + :'forward_tags_restriction_list' => :'Array', + :'forward_tags_restriction_list_type' => :'CustomDestinationAttributeTagsRestrictionListType', + :'forwarder_destination' => :'CustomDestinationForwardDestination', + :'name' => :'String', + :'query' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationUpdateRequestAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationUpdateRequestAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'forward_tags') + self.forward_tags = attributes[:'forward_tags'] + end + + if attributes.key?(:'forward_tags_restriction_list') + if (value = attributes[:'forward_tags_restriction_list']).is_a?(Array) + self.forward_tags_restriction_list = value + end + end + + if attributes.key?(:'forward_tags_restriction_list_type') + self.forward_tags_restriction_list_type = attributes[:'forward_tags_restriction_list_type'] + end + + if attributes.key?(:'forwarder_destination') + self.forwarder_destination = attributes[:'forwarder_destination'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@forward_tags_restriction_list.nil? && @forward_tags_restriction_list.length > 10 + return false if !@forward_tags_restriction_list.nil? && @forward_tags_restriction_list.length < 0 + true + end + + # Custom attribute writer method with validation + # @param forward_tags_restriction_list [Object] Object to be assigned + # @!visibility private + def forward_tags_restriction_list=(forward_tags_restriction_list) + if !forward_tags_restriction_list.nil? && forward_tags_restriction_list.length > 10 + fail ArgumentError, 'invalid value for "forward_tags_restriction_list", number of items must be less than or equal to 10.' + end + if !forward_tags_restriction_list.nil? && forward_tags_restriction_list.length < 0 + fail ArgumentError, 'invalid value for "forward_tags_restriction_list", number of items must be greater than or equal to 0.' + end + @forward_tags_restriction_list = forward_tags_restriction_list + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + forward_tags == o.forward_tags && + forward_tags_restriction_list == o.forward_tags_restriction_list && + forward_tags_restriction_list_type == o.forward_tags_restriction_list_type && + forwarder_destination == o.forwarder_destination && + name == o.name && + query == o.query + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, forward_tags, forward_tags_restriction_list, forward_tags_restriction_list_type, forwarder_destination, name, query].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destination_update_request_definition.rb b/lib/datadog_api_client/v2/models/custom_destination_update_request_definition.rb new file mode 100644 index 000000000000..23535e6156b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destination_update_request_definition.rb @@ -0,0 +1,129 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The definition of a custom destination. + class CustomDestinationUpdateRequestDefinition + include BaseGenericModel + + # The attributes associated with the custom destination. + attr_accessor :attributes + + # The custom destination ID. + attr_reader :id + + # The type of the resource. The value should always be `custom_destination`. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CustomDestinationUpdateRequestAttributes', + :'id' => :'String', + :'type' => :'CustomDestinationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationUpdateRequestDefinition` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationUpdateRequestDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_destinations_response.rb b/lib/datadog_api_client/v2/models/custom_destinations_response.rb new file mode 100644 index 000000000000..dc042ba4d918 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_destinations_response.rb @@ -0,0 +1,82 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The available custom destinations. + class CustomDestinationsResponse + include BaseGenericModel + + # A list of custom destinations. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomDestinationsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomDestinationsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end