From 5ff3ed659042851cdb99388e4332015186b53e33 Mon Sep 17 00:00:00 2001 From: Jiri Kuncar Date: Thu, 4 Mar 2021 10:48:41 +0100 Subject: [PATCH 1/5] Fix rerecord --- run-tests.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 6630c5d79946..619c04b7a72f 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -4,26 +4,24 @@ function finish { } trap finish EXIT -RERUN_RESULT=0 - bundle install bundle exec rspec RSPEC_RESULT=$? -if [ "$RERECORD_FAILED_TESTS" == "true" -a "$RSPEC_RESULT" -ne 0 ]; then +if [ "$RERECORD_FAILED_TESTS" == "true" ] && [ "$RSPEC_RESULT" -ne "0" ]; then RECORD=true bundle exec rspec --only-failures RSPEC_RESULT=$? fi bundle exec cucumber -t 'not @skip' -f rerun -o rerun.txt -f pretty CUCUMBER_RESULT=$? -if [ "$RERECORD_FAILED_TESTS" == "true" -a "$CUCUMBER_RESULT" -ne 0 ]; then +if [ "$RERECORD_FAILED_TESTS" == "true" ] && [ "$CUCUMBER_RESULT" -ne "0" ]; then RECORD=true bundle exec cucumber @rerun.txt CUCUMBER_RESULT=$? fi # Always run integration-only scenarios set -e -if [ "$RECORD" != "none" -a -n $DD_TEST_CLIENT_API_KEY -a -n $DD_TEST_CLIENT_APP_KEY ]; then +if [ "$RECORD" != "none" ] && [ -n "$DD_TEST_CLIENT_API_KEY" ] && [ -n "$DD_TEST_CLIENT_APP_KEY" ]; then RECORD=none bundle exec cucumber -t '@integration-only' -f pretty fi -exit $(($RSPEC_RESULT+$CUCUMBER_RESULT)) +exit "$(($RSPEC_RESULT+$CUCUMBER_RESULT))" From 2e03b21fd23897759f3fe1247a6172f5f1ca46a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Fri, 5 Mar 2021 09:09:41 +0100 Subject: [PATCH 2/5] Add cassettes --- .../Post-an-event-returns-OK-response.yml | 44 +++++++++++++++++++ ...rics-returns-Payload-accepted-response.yml | 43 ++++++++++++++++++ ...heck-returns-Payload-accepted-response.yml | 43 ++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 cassettes/features/v1/events/Post-an-event-returns-OK-response.yml create mode 100644 cassettes/features/v1/metrics/Submit-metrics-returns-Payload-accepted-response.yml create mode 100644 cassettes/features/v1/service_checks/Submit-a-Service-Check-returns-Payload-accepted-response.yml diff --git a/cassettes/features/v1/events/Post-an-event-returns-OK-response.yml b/cassettes/features/v1/events/Post-an-event-returns-OK-response.yml new file mode 100644 index 000000000000..135b4f9d217d --- /dev/null +++ b/cassettes/features/v1/events/Post-an-event-returns-OK-response.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v1/events + body: + encoding: UTF-8 + string: '{"title":"Testing event","text":"A text message.","tags":["test:rubyPostaneventreturnsOKresponse1614854024"]}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.2; os linux-gnu; arch x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 202 + message: Accepted + headers: + Date: + - Thu, 04 Mar 2021 10:33:44 GMT + Content-Type: + - application/json + Content-Length: + - '308' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"status":"ok","event":{"id":5881943591200976676,"title":"Testing event","text":"A + text message.","date_happened":1614854024,"handle":null,"priority":null,"related_event_id":null,"tags":["test:rubyPostaneventreturnsOKresponse1614854024"],"url":"https://app.datadoghq.com/event/event?id=5881943591200976676"}}' + recorded_at: Thu, 04 Mar 2021 10:33:44 GMT +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/metrics/Submit-metrics-returns-Payload-accepted-response.yml b/cassettes/features/v1/metrics/Submit-metrics-returns-Payload-accepted-response.yml new file mode 100644 index 000000000000..60e5866b9503 --- /dev/null +++ b/cassettes/features/v1/metrics/Submit-metrics-returns-Payload-accepted-response.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v1/series + body: + encoding: UTF-8 + string: '{"series":[{"metric":"system.load.1","points":[[1600348600,1.1]],"tags":["test:rubySubmitmetricsreturnsPayloadacceptedresponse1614854024"]}]}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.2; os linux-gnu; arch x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 202 + message: Accepted + headers: + Date: + - Thu, 04 Mar 2021 10:33:44 GMT + Content-Type: + - text/json + Content-Length: + - '16' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"status": "ok"}' + recorded_at: Thu, 04 Mar 2021 10:33:44 GMT +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/service_checks/Submit-a-Service-Check-returns-Payload-accepted-response.yml b/cassettes/features/v1/service_checks/Submit-a-Service-Check-returns-Payload-accepted-response.yml new file mode 100644 index 000000000000..9f9611341a6f --- /dev/null +++ b/cassettes/features/v1/service_checks/Submit-a-Service-Check-returns-Payload-accepted-response.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v1/check_run + body: + encoding: UTF-8 + string: '[{"check":"app.ok","host_name":"host","status":0,"tags":["test:rubySubmitaServiceCheckreturnsPayloadacceptedresponse1614854024"]}]' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.2; os linux-gnu; arch x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 202 + message: Accepted + headers: + Date: + - Thu, 04 Mar 2021 10:33:44 GMT + Content-Type: + - text/json + Content-Length: + - '16' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"status": "ok"}' + recorded_at: Thu, 04 Mar 2021 10:33:44 GMT +recorded_with: VCR 6.0.0 From d83d7e87f8ddd9c04152f50bf456043557a1d436 Mon Sep 17 00:00:00 2001 From: Jiri Kuncar Date: Mon, 8 Mar 2021 12:15:19 +0100 Subject: [PATCH 3/5] cassettes --- ...-server-always-200-empty-JSON-response.yml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 cassettes/features/v1/logs/Send-logs-returns-Response-from-server-always-200-empty-JSON-response.yml diff --git a/cassettes/features/v1/logs/Send-logs-returns-Response-from-server-always-200-empty-JSON-response.yml b/cassettes/features/v1/logs/Send-logs-returns-Response-from-server-always-200-empty-JSON-response.yml new file mode 100644 index 000000000000..6c898cc50e04 --- /dev/null +++ b/cassettes/features/v1/logs/Send-logs-returns-Response-from-server-always-200-empty-JSON-response.yml @@ -0,0 +1,34 @@ +--- +http_interactions: +- request: + method: post + uri: https://http-intake.logs.datadoghq.com/v1/input + body: + encoding: UTF-8 + string: '[{"message":"ruby-Send_logs_returns_Response_from_server_always_200_empty_JSON_response-1615201949","tags":"host:rubySendlogsreturnsResponsefromserveralways200emptyJSONresponse1615201949"}]' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Date: + - Mon, 08 Mar 2021 11:12:29 GMT + Content-Type: + - application/json + Content-Length: + - '2' + body: + encoding: UTF-8 + string: "{}" + recorded_at: Mon, 08 Mar 2021 11:12:29 GMT +recorded_with: VCR 6.0.0 From 13644a1d146cb14ae2e8ca9febdea51135ed5ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Mon, 29 Mar 2021 15:43:54 +0200 Subject: [PATCH 4/5] Apply ruby-text-json-mimetype.patch --- .generator/templates/api_client.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.generator/templates/api_client.mustache b/.generator/templates/api_client.mustache index 2741a73794ed..bce9322f50ba 100644 --- a/.generator/templates/api_client.mustache +++ b/.generator/templates/api_client.mustache @@ -54,7 +54,7 @@ module {{moduleName}} # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? || (mime == 'text/json') end # Deserialize the response to the given return type. From 228f76f435c96874a02a000c3e3993b550f1ce5c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 8 Apr 2021 13:48:23 +0000 Subject: [PATCH 5/5] Regenerate client from commit d890ce4 of spec repo --- .apigentools-info | 8 +- data/v1/openapi.yaml | 702 ++++++++++++++++++ docs/v1/ContentEncoding.md | 15 + docs/v1/EventCreateRequest.md | 44 ++ docs/v1/EventCreateResponse.md | 44 ++ docs/v1/EventsAPI.md | 63 ++ docs/v1/HTTPLogError.md | 20 + docs/v1/HTTPLogItem.md | 26 + docs/v1/IntakePayloadAccepted.md | 18 + docs/v1/LogsAPI.md | 69 ++ docs/v1/MetricsAPI.md | 63 ++ docs/v1/MetricsPayload.md | 18 + docs/v1/README.md | 14 + docs/v1/Series.md | 28 + docs/v1/ServiceCheck.md | 28 + docs/v1/ServiceCheckStatus.md | 15 + docs/v1/ServiceChecksAPI.md | 70 ++ features/v1/events.feature | 26 +- features/v1/logs.feature | 22 +- features/v1/metrics.feature | 61 +- features/v1/service_checks.feature | 43 ++ features/v1/undo.json | 24 + lib/datadog_api_client/v1.rb | 11 + lib/datadog_api_client/v1/api/events_api.rb | 75 ++ lib/datadog_api_client/v1/api/logs_api.rb | 81 ++ lib/datadog_api_client/v1/api/metrics_api.rb | 75 ++ .../v1/api/service_checks_api.rb | 100 +++ lib/datadog_api_client/v1/api_client.rb | 2 +- lib/datadog_api_client/v1/configuration.rb | 50 ++ .../v1/models/content_encoding.rb | 40 + .../v1/models/event_create_request.rb | 416 +++++++++++ .../v1/models/event_create_response.rb | 383 ++++++++++ .../v1/models/http_log_error.rb | 262 +++++++ .../v1/models/http_log_item.rb | 263 +++++++ .../v1/models/intake_payload_accepted.rb | 223 ++++++ .../v1/models/metrics_payload.rb | 230 ++++++ lib/datadog_api_client/v1/models/series.rb | 290 ++++++++ .../v1/models/service_check.rb | 294 ++++++++ .../v1/models/service_check_status.rb | 42 ++ lib/datadog_api_client/v2/api_client.rb | 2 +- spec/v1/api/service_checks_api_spec.rb | 50 ++ spec/v1/models/content_encoding_spec.rb | 31 + spec/v1/models/event_create_request_spec.rb | 115 +++ spec/v1/models/event_create_response_spec.rb | 115 +++ spec/v1/models/http_log_error_spec.rb | 43 ++ spec/v1/models/http_log_item_spec.rb | 61 ++ .../v1/models/intake_payload_accepted_spec.rb | 37 + spec/v1/models/metrics_payload_spec.rb | 37 + spec/v1/models/series_spec.rb | 67 ++ spec/v1/models/service_check_spec.rb | 67 ++ spec/v1/models/service_check_status_spec.rb | 31 + 51 files changed, 4888 insertions(+), 26 deletions(-) create mode 100644 docs/v1/ContentEncoding.md create mode 100644 docs/v1/EventCreateRequest.md create mode 100644 docs/v1/EventCreateResponse.md create mode 100644 docs/v1/HTTPLogError.md create mode 100644 docs/v1/HTTPLogItem.md create mode 100644 docs/v1/IntakePayloadAccepted.md create mode 100644 docs/v1/MetricsPayload.md create mode 100644 docs/v1/Series.md create mode 100644 docs/v1/ServiceCheck.md create mode 100644 docs/v1/ServiceCheckStatus.md create mode 100644 docs/v1/ServiceChecksAPI.md create mode 100644 features/v1/service_checks.feature create mode 100644 lib/datadog_api_client/v1/api/service_checks_api.rb create mode 100644 lib/datadog_api_client/v1/models/content_encoding.rb create mode 100644 lib/datadog_api_client/v1/models/event_create_request.rb create mode 100644 lib/datadog_api_client/v1/models/event_create_response.rb create mode 100644 lib/datadog_api_client/v1/models/http_log_error.rb create mode 100644 lib/datadog_api_client/v1/models/http_log_item.rb create mode 100644 lib/datadog_api_client/v1/models/intake_payload_accepted.rb create mode 100644 lib/datadog_api_client/v1/models/metrics_payload.rb create mode 100644 lib/datadog_api_client/v1/models/series.rb create mode 100644 lib/datadog_api_client/v1/models/service_check.rb create mode 100644 lib/datadog_api_client/v1/models/service_check_status.rb create mode 100644 spec/v1/api/service_checks_api_spec.rb create mode 100644 spec/v1/models/content_encoding_spec.rb create mode 100644 spec/v1/models/event_create_request_spec.rb create mode 100644 spec/v1/models/event_create_response_spec.rb create mode 100644 spec/v1/models/http_log_error_spec.rb create mode 100644 spec/v1/models/http_log_item_spec.rb create mode 100644 spec/v1/models/intake_payload_accepted_spec.rb create mode 100644 spec/v1/models/metrics_payload_spec.rb create mode 100644 spec/v1/models/series_spec.rb create mode 100644 spec/v1/models/service_check_spec.rb create mode 100644 spec/v1/models/service_check_status_spec.rb diff --git a/.apigentools-info b/.apigentools-info index e7de79a1dcc2..dd471b5c6938 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-04-08 12:32:01.464866", - "spec_repo_commit": "3f8036f" + "regenerated": "2021-04-08 13:48:08.783695", + "spec_repo_commit": "d890ce4" }, "v2": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-04-08 12:32:16.153561", - "spec_repo_commit": "3f8036f" + "regenerated": "2021-04-08 13:48:21.664353", + "spec_repo_commit": "d890ce4" } } } \ No newline at end of file diff --git a/data/v1/openapi.yaml b/data/v1/openapi.yaml index cc241890d780..c924b8d75cfd 100644 --- a/data/v1/openapi.yaml +++ b/data/v1/openapi.yaml @@ -823,6 +823,15 @@ components: type: string x-enum-varnames: - CHECK_STATUS + ContentEncoding: + description: HTTP header used to compress the media-type + enum: + - gzip + - deflate + type: string + x-enum-varnames: + - gzip + - deflate Creator: description: Object describing the creator of the shared element. properties: @@ -1449,6 +1458,163 @@ components: - USER_UPDATE - RECOMMENDATION - SNAPSHOT + EventCreateRequest: + description: Object representing an event. + properties: + aggregation_key: + description: 'An arbitrary string to use for aggregation. Limited to 100 + characters. + + If you specify a key, all events using that key are grouped together in + the Event Stream.' + maxLength: 100 + type: string + alert_type: + $ref: '#/components/schemas/EventAlertType' + date_happened: + description: 'POSIX timestamp of the event. Must be sent as an integer (i.e. + no quotes). + + Limited to events no older than 7 days.' + format: int64 + type: integer + device_name: + description: A device name. + type: string + host: + description: 'Host name to associate with the event. + + Any tags associated with the host are also applied to this event.' + type: string + id: + description: Integer ID of the event. + format: int64 + readOnly: true + type: integer + payload: + description: Payload of the event. + example: '{}' + readOnly: true + type: string + priority: + $ref: '#/components/schemas/EventPriority' + related_event_id: + description: ID of the parent event. Must be sent as an integer (i.e. no + quotes). + format: int64 + type: integer + source_type_name: + description: 'The type of event being posted. Option examples include nagios, + hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. + + A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).' + type: string + tags: + description: A list of tags to apply to the event. + example: + - environment:test + items: + description: A tag. + type: string + type: array + text: + description: 'The body of the event. Limited to 4000 characters. The text + supports markdown. + + To use markdown in the event text, start the text block with `%%% \n` + and end the text block with `\n %%%`. + + Use `msg_text` with the Datadog Ruby library.' + example: Oh boy! + maxLength: 4000 + type: string + title: + description: The event title. Limited to 100 characters. Use `msg_title` + with the Datadog Ruby library. + example: Did you hear the news today? + maxLength: 100 + type: string + url: + description: URL of the event. + readOnly: true + type: string + required: + - title + - text + type: object + EventCreateResponse: + description: Object containing an event response. + properties: + alert_type: + $ref: '#/components/schemas/EventAlertType' + date_happened: + description: 'POSIX timestamp of the event. Must be sent as an integer (i.e. + no quotes). + + Limited to events no older than 7 days.' + format: int64 + type: integer + device_name: + description: A device name. + type: string + host: + description: 'Host name to associate with the event. + + Any tags associated with the host are also applied to this event.' + type: string + id: + description: Integer ID of the event. + format: int64 + readOnly: true + type: integer + payload: + description: Payload of the event. + example: '{}' + readOnly: true + type: string + priority: + $ref: '#/components/schemas/EventPriority' + related_event_id: + description: ID of the parent event. Must be sent as an integer (i.e. no + quotes). + format: int64 + type: integer + source_type_name: + description: 'The type of event being posted. Option examples include nagios, + hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. + + A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).' + type: string + status: + description: A status. + type: string + tags: + description: A list of tags to apply to the event. + example: + - environment:test + items: + description: A tag. + type: string + type: array + text: + description: 'The body of the event. Limited to 4000 characters. The text + supports markdown. + + Use `msg_text` with the Datadog Ruby library.' + example: Oh boy! + maxLength: 4000 + type: string + title: + description: The event title. Limited to 100 characters. Use `msg_title` + with the Datadog Ruby library. + example: Did you hear the news today? + maxLength: 100 + type: string + url: + description: URL of the event. + readOnly: true + type: string + type: object EventListResponse: description: An event list response. properties: @@ -2075,6 +2241,72 @@ components: type: string x-enum-varnames: - GROUP + HTTPLog: + description: Structured log message. + items: + $ref: '#/components/schemas/HTTPLogItem' + type: array + HTTPLogError: + description: Invalid query performed. + properties: + code: + description: Error code. + example: 0 + format: int32 + maximum: 2147483647 + type: integer + message: + description: Error message. + example: '' + type: string + required: + - code + - message + type: object + HTTPLogItem: + description: Logs that are sent over HTTP. + properties: + ddsource: + description: 'The integration name associated with your log: the technology + from which the log originated. + + When it matches an integration name, Datadog automatically installs the + corresponding parsers and facets. + + See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes).' + example: nginx + type: string + ddtags: + description: Tags associated with your logs. + example: env:staging,version:5.1 + type: string + hostname: + description: The name of the originating host of the log. + example: i-012345678 + type: string + message: + description: 'The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) + + of your log. By default, Datadog ingests the value of the message attribute + as the body of the log entry. + + That value is then highlighted and displayed in the Logstream, where it + is indexed for full text search.' + example: 2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World + type: string + service: + description: 'The name of the application or service generating the log + events. + + It is used to switch from Logs to APM, so make sure you define the same + value when you use both products. + + See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes).' + example: payment + type: string + required: + - name + type: object HTTPMethod: description: The HTTP method. enum: @@ -2694,6 +2926,14 @@ components: type: string x-enum-varnames: - IMAGE + IntakePayloadAccepted: + description: The payload accepted for intake. + properties: + status: + description: The status of the intake payload. + example: ok + type: string + type: object Log: description: Object describing a log after being processed and stored by Datadog. properties: @@ -4076,6 +4316,22 @@ components: type: string type: array type: object + MetricsPayload: + description: The metrics' payload. + properties: + series: + description: A list of time series to submit to Datadog. + example: + - metric: system.load.1 + points: + - - 1475317847 + - 0.7 + items: + $ref: '#/components/schemas/Series' + type: array + required: + - series + type: object MetricsQueryMetadata: description: Object containing all metric names returned and their associated metadata. @@ -5977,6 +6233,110 @@ components: type: string x-enum-varnames: - SCATTERPLOT + Series: + description: 'A metric to submit to Datadog. + + See [Datadog metrics](https://docs.datadoghq.com/developers/metrics/#custom-metrics-properties).' + properties: + host: + description: The name of the host that produced the metric. + example: test.example.com + type: string + interval: + default: null + description: If the type of the metric is rate or count, define the corresponding + interval. + example: 20 + format: int64 + nullable: true + type: integer + metric: + description: The name of the timeseries. + example: system.load.1 + type: string + points: + description: Points relating to a metric. All points must be tuples with + timestamp and a scalar value (cannot be a string). Timestamps should be + in POSIX time in seconds, and cannot be more than ten minutes in the future + or more than one hour in the past. + example: + - - 1575317847 + - 0.5 + items: + $ref: '#/components/schemas/Point' + type: array + tags: + description: A list of tags associated with the metric. + example: + - environment:test + items: + description: Individual tags. + type: string + type: array + type: + default: gauge + description: The type of the metric either `count`, `gauge`, or `rate`. + example: rate + type: string + required: + - metric + - points + type: object + ServiceCheck: + description: An object containing service check and status. + properties: + check: + description: The check. + example: app.ok + type: string + host_name: + description: The host name correlated with the check. + example: app.host1 + type: string + message: + description: Message containing check status. + example: app is running + type: string + status: + $ref: '#/components/schemas/ServiceCheckStatus' + tags: + description: Tags related to a check. + example: + - environment:test + items: + description: Items related to a check. + type: string + type: array + timestamp: + description: Time of check. + format: int64 + type: integer + required: + - check + - status + - tags + - host_name + type: object + ServiceCheckStatus: + description: The status of a service check. + enum: + - 0 + - 1 + - 2 + - 3 + example: 0 + format: int32 + type: integer + x-enum-varnames: + - OK + - WARNING + - CRITICAL + - UNKNOWN + ServiceChecks: + description: The service checks. + items: + $ref: '#/components/schemas/ServiceCheck' + type: array ServiceLevelObjective: description: 'A service level objective object includes a service level indicator, thresholds @@ -11530,6 +11890,59 @@ paths: x-codegen-request-body-name: body x-undo: type: idempotent + /api/v1/check_run: + post: + description: 'Submit a list of Service Checks. + + + **Note**: A valid API key is required.' + operationId: SubmitServiceCheck + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceChecks' + description: Service Check request body. + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/IntakePayloadAccepted' + description: Payload accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication Error + '408': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Request timeout + '413': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Payload too large + security: + - apiKeyAuth: [] + summary: Submit a Service Check + tags: + - Service Checks + x-codegen-request-body-name: body + x-undo: + type: safe /api/v1/daily_custom_reports: get: description: Get daily custom reports. @@ -12300,6 +12713,39 @@ paths: - Events x-undo: type: safe + post: + description: 'This endpoint allows you to post events to the stream. + + Tag them, set priority and event aggregate them with other events.' + operationId: CreateEvent + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EventCreateRequest' + description: Event request object + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/EventCreateResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + security: + - apiKeyAuth: [] + summary: Post an event + tags: + - Events + x-codegen-request-body-name: body + x-undo: + type: safe /api/v1/events/{event_id}: get: description: "This endpoint allows you to query for event details.\n\n**Note**:\ @@ -15758,6 +16204,75 @@ paths: - Metrics x-undo: type: safe + /api/v1/series: + post: + description: "The metrics end-point allows you to post time-series data that\ + \ can be graphed on Datadog\u2019s dashboards.\nThe maximum payload size is\ + \ 3.2 megabytes (3200000). Compressed payloads must have a decompressed size\ + \ of up to 62 megabytes (62914560).\n\nIf you\u2019re submitting metrics directly\ + \ to the Datadog API without using DogStatsD, expect\n\n- 64 bits for the\ + \ timestamp\n- 32 bits for the value\n- 20 bytes for the metric names\n- 50\ + \ bytes for the timeseries\n- The full payload is approximately ~ 100 bytes.\ + \ However, with the DogStatsD API,\ncompression is applied, which reduces\ + \ the payload size." + operationId: SubmitMetrics + requestBody: + content: + application/json: + examples: + dynamic-points: + description: TODO. + summary: Dynamic Points + value: + series: + - metric: system.load.1 + points: + - - ${NOW} + - '1234.5' + x-variables: + NOW: $(date +%s) + schema: + $ref: '#/components/schemas/MetricsPayload' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/IntakePayloadAccepted' + description: Payload accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '408': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Request timeout + '413': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Payload too large + security: + - apiKeyAuth: [] + summary: Submit metrics + tags: + - Metrics + x-codegen-request-body-name: body + x-undo: + type: safe /api/v1/slo: get: description: Get a list of service level objective objects for your organization. @@ -19169,6 +19684,167 @@ paths: - Authentication x-undo: type: safe + /v1/input: + post: + description: 'Send your logs to your Datadog platform over HTTP. Limits per + HTTP request are: + + + - Maximum content size per payload (uncompressed): 5MB + + - Maximum size for a single log: 1MB + + - Maximum array size if sending multiple logs in an array: 1000 entries + + + Any log exceeding 1MB is accepted and truncated by Datadog: + + - For a single log request, the API truncates the log at 1MB and returns a + 2xx. + + - For a multi-logs request, the API processes all logs, truncates only logs + larger than 1MB, and returns a 2xx. + + + Datadog recommends sending your logs compressed. + + Add the `Content-Encoding: gzip` header to the request when sending compressed + logs. + + + The status codes answered by the HTTP API are: + + - 200: OK + + - 400: Bad request (likely an issue in the payload formatting) + + - 403: Permission issue (likely using an invalid API Key) + + - 413: Payload too large (batch is above 5MB uncompressed) + + - 5xx: Internal error, request should be retried after some time' + operationId: SubmitLog + parameters: + - description: HTTP header used to compress the media-type. + in: header + name: Content-Encoding + required: false + schema: + $ref: '#/components/schemas/ContentEncoding' + - description: Log tags can be passed as query parameters with `text/plain` + content type. + example: env:prod,user:my-user + in: query + name: ddtags + required: false + schema: + type: string + requestBody: + content: + application/json: + examples: + multi-json-messages: + description: Pass multiple log objects at once. + summary: Multi JSON Messages + value: + - message: hello + - message: world + simple-json-message: + description: Log attributes can be passed as `key:value` pairs in + valid JSON messages. + summary: Simple JSON Message + value: + ddsource: agent + ddtags: env:prod,user:joe.doe + hostname: fa1e1e739d95 + message: hello world + schema: + $ref: '#/components/schemas/HTTPLog' + application/logplex-1: + examples: + multi-raw-message: + description: Submit log messages. + summary: Multi Logplex Messages + value: 'hello + + world' + simple-logplex-message: + description: Submit log string. + summary: Simple Logplex Message + value: hello world + schema: + type: string + text/plain: + examples: + multi-raw-message: + description: Submit log string. + summary: Multi Raw Messages + value: 'hello + + world + + ' + simple-raw-message: + description: 'Submit log string. Log attributes can be passed as query + parameters in the URL. This enables the addition of tags or the + source by using the `ddtags` and `ddsource` parameters: `?host=my-hostname&service=my-service&ddsource=my-source&ddtags=env:prod,user:my-user`.' + summary: Simple Raw Message + value: hello world + schema: + type: string + description: Log to send (JSON format). + required: true + responses: + '200': + content: + application/json: + schema: + type: object + description: Response from server (always 200 empty JSON). + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPLogError' + description: unexpected error + security: + - apiKeyAuth: [] + servers: + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: The regional site for our customers. + enum: + - datadoghq.com + - us3.datadoghq.com + - datadoghq.eu + - ddog-gov.com + subdomain: + default: http-intake.logs + description: The subdomain where the API is deployed. + - url: '{protocol}://{name}' + variables: + name: + default: http-intake.logs.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: http-intake.logs + description: The subdomain where the API is deployed. + summary: Send logs + tags: + - Logs + x-codegen-request-body-name: body + x-undo: + type: safe security: - apiKeyAuth: [] appKeyAuth: [] @@ -19339,6 +20015,32 @@ tags: externalDocs: url: https://docs.datadoghq.com/api/?lang=bash#integration-pagerduty name: PagerDuty Integration +- description: 'The service check endpoint allows you to post check statuses for use + with monitors. + + Service check messages are limited to 500 characters. If a check is posted with + a message + + containing more than 500 characters, only the first 500 characters are displayed. + + + - [Read more about Service Check monitors.][1] + + - [Read more about Process Check monitors.][2] + + - [Read more about Network Check monitors.][3] + + - [Read more about Custom Check monitors.][4] + + + [1]: https://docs.datadoghq.com/monitors/monitor_types/host/?tab=checkalert + + [2]: https://docs.datadoghq.com/monitors/monitor_types/process_check/?tab=checkalert + + [3]: https://docs.datadoghq.com/monitors/monitor_types/network/?tab=checkalert + + [4]: https://docs.datadoghq.com/monitors/monitor_types/custom_check/?tab=checkalert' + name: Service Checks - description: "SLO Status Corrections allow you to prevent specific time periods\ \ from negatively impacting\nyour SLO\u2019s status and error budget. You can\ \ use Status Corrections for various purposes, such\nas removing planned maintenance\ diff --git a/docs/v1/ContentEncoding.md b/docs/v1/ContentEncoding.md new file mode 100644 index 000000000000..7fd964cd486c --- /dev/null +++ b/docs/v1/ContentEncoding.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V1::ContentEncoding + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::ContentEncoding.new() +``` + diff --git a/docs/v1/EventCreateRequest.md b/docs/v1/EventCreateRequest.md new file mode 100644 index 000000000000..aff1839403df --- /dev/null +++ b/docs/v1/EventCreateRequest.md @@ -0,0 +1,44 @@ +# DatadogAPIClient::V1::EventCreateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **aggregation_key** | **String** | An arbitrary string to use for aggregation. Limited to 100 characters. If you specify a key, all events using that key are grouped together in the Event Stream. | [optional] | +| **alert_type** | [**EventAlertType**](EventAlertType.md) | | [optional] | +| **date_happened** | **Integer** | POSIX timestamp of the event. Must be sent as an integer (i.e. no quotes). Limited to events no older than 7 days. | [optional] | +| **device_name** | **String** | A device name. | [optional] | +| **host** | **String** | Host name to associate with the event. Any tags associated with the host are also applied to this event. | [optional] | +| **id** | **Integer** | Integer ID of the event. | [optional][readonly] | +| **payload** | **String** | Payload of the event. | [optional][readonly] | +| **priority** | [**EventPriority**](EventPriority.md) | | [optional] | +| **related_event_id** | **Integer** | ID of the parent event. Must be sent as an integer (i.e. no quotes). | [optional] | +| **source_type_name** | **String** | The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). | [optional] | +| **tags** | **Array<String>** | A list of tags to apply to the event. | [optional] | +| **text** | **String** | The body of the event. Limited to 4000 characters. The text supports markdown. To use markdown in the event text, start the text block with `%%% \\n` and end the text block with `\\n %%%`. Use `msg_text` with the Datadog Ruby library. | | +| **title** | **String** | The event title. Limited to 100 characters. Use `msg_title` with the Datadog Ruby library. | | +| **url** | **String** | URL of the event. | [optional][readonly] | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::EventCreateRequest.new( + aggregation_key: null, + alert_type: null, + date_happened: null, + device_name: null, + host: null, + id: null, + payload: {}, + priority: null, + related_event_id: null, + source_type_name: null, + tags: ["environment:test"], + text: Oh boy!, + title: Did you hear the news today?, + url: null +) +``` + diff --git a/docs/v1/EventCreateResponse.md b/docs/v1/EventCreateResponse.md new file mode 100644 index 000000000000..b4de400c05b4 --- /dev/null +++ b/docs/v1/EventCreateResponse.md @@ -0,0 +1,44 @@ +# DatadogAPIClient::V1::EventCreateResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **alert_type** | [**EventAlertType**](EventAlertType.md) | | [optional] | +| **date_happened** | **Integer** | POSIX timestamp of the event. Must be sent as an integer (i.e. no quotes). Limited to events no older than 7 days. | [optional] | +| **device_name** | **String** | A device name. | [optional] | +| **host** | **String** | Host name to associate with the event. Any tags associated with the host are also applied to this event. | [optional] | +| **id** | **Integer** | Integer ID of the event. | [optional][readonly] | +| **payload** | **String** | Payload of the event. | [optional][readonly] | +| **priority** | [**EventPriority**](EventPriority.md) | | [optional] | +| **related_event_id** | **Integer** | ID of the parent event. Must be sent as an integer (i.e. no quotes). | [optional] | +| **source_type_name** | **String** | The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). | [optional] | +| **status** | **String** | A status. | [optional] | +| **tags** | **Array<String>** | A list of tags to apply to the event. | [optional] | +| **text** | **String** | The body of the event. Limited to 4000 characters. The text supports markdown. Use `msg_text` with the Datadog Ruby library. | [optional] | +| **title** | **String** | The event title. Limited to 100 characters. Use `msg_title` with the Datadog Ruby library. | [optional] | +| **url** | **String** | URL of the event. | [optional][readonly] | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::EventCreateResponse.new( + alert_type: null, + date_happened: null, + device_name: null, + host: null, + id: null, + payload: {}, + priority: null, + related_event_id: null, + source_type_name: null, + status: null, + tags: ["environment:test"], + text: Oh boy!, + title: Did you hear the news today?, + url: null +) +``` + diff --git a/docs/v1/EventsAPI.md b/docs/v1/EventsAPI.md index 44ae1adeff66..929ea3b11760 100644 --- a/docs/v1/EventsAPI.md +++ b/docs/v1/EventsAPI.md @@ -4,10 +4,73 @@ All URIs are relative to *https://api.datadoghq.com* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**create_event**](EventsAPI.md#create_event) | **POST** /api/v1/events | Post an event | | [**get_event**](EventsAPI.md#get_event) | **GET** /api/v1/events/{event_id} | Get an event | | [**list_events**](EventsAPI.md#list_events) | **GET** /api/v1/events | Query the event stream | +## create_event + +> create_event(body) + +Post an event + +This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events. + +### Examples + +```ruby +require 'datadog_api_client' +api_instance = DatadogAPIClient::V1::EventsAPI.new +body = DatadogAPIClient::V1::EventCreateRequest.new({text: 'Oh boy!', title: 'Did you hear the news today?'}) # EventCreateRequest | Event request object + +begin + # Post an event + result = api_instance.create_event(body) + p result +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling EventsAPI->create_event: #{e}" +end +``` + +#### Using the create_event_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_event_with_http_info(body) + +```ruby +begin + # Post an event + data, status_code, headers = api_instance.create_event_with_http_info(body) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling EventsAPI->create_event_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **body** | [**EventCreateRequest**](EventCreateRequest.md) | Event request object | | + +### Return type + +[**EventCreateResponse**](EventCreateResponse.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## get_event > get_event(event_id) diff --git a/docs/v1/HTTPLogError.md b/docs/v1/HTTPLogError.md new file mode 100644 index 000000000000..6e681f83f61c --- /dev/null +++ b/docs/v1/HTTPLogError.md @@ -0,0 +1,20 @@ +# DatadogAPIClient::V1::HTTPLogError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **Integer** | Error code. | | +| **message** | **String** | Error message. | | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::HTTPLogError.new( + code: 0, + message: +) +``` + diff --git a/docs/v1/HTTPLogItem.md b/docs/v1/HTTPLogItem.md new file mode 100644 index 000000000000..14ef8835c781 --- /dev/null +++ b/docs/v1/HTTPLogItem.md @@ -0,0 +1,26 @@ +# DatadogAPIClient::V1::HTTPLogItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ddsource** | **String** | The integration name associated with your log: the technology from which the log originated. When it matches an integration name, Datadog automatically installs the corresponding parsers and facets. See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). | [optional] | +| **ddtags** | **String** | Tags associated with your logs. | [optional] | +| **hostname** | **String** | The name of the originating host of the log. | [optional] | +| **message** | **String** | The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. | [optional] | +| **service** | **String** | The name of the application or service generating the log events. It is used to switch from Logs to APM, so make sure you define the same value when you use both products. See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::HTTPLogItem.new( + ddsource: nginx, + ddtags: env:staging,version:5.1, + hostname: i-012345678, + message: 2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World, + service: payment +) +``` + diff --git a/docs/v1/IntakePayloadAccepted.md b/docs/v1/IntakePayloadAccepted.md new file mode 100644 index 000000000000..1fc9d9b48179 --- /dev/null +++ b/docs/v1/IntakePayloadAccepted.md @@ -0,0 +1,18 @@ +# DatadogAPIClient::V1::IntakePayloadAccepted + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status** | **String** | The status of the intake payload. | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::IntakePayloadAccepted.new( + status: ok +) +``` + diff --git a/docs/v1/LogsAPI.md b/docs/v1/LogsAPI.md index 52a03bee6ad5..6a997e522998 100644 --- a/docs/v1/LogsAPI.md +++ b/docs/v1/LogsAPI.md @@ -5,6 +5,7 @@ All URIs are relative to *https://api.datadoghq.com* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**list_logs**](LogsAPI.md#list_logs) | **POST** /api/v1/logs-queries/list | Search logs | +| [**submit_log**](LogsAPI.md#submit_log) | **POST** /v1/input | Send logs | ## list_logs @@ -68,3 +69,71 @@ end - **Content-Type**: application/json - **Accept**: application/json + +## submit_log + +> Object submit_log(body, opts) + +Send logs + +Send your logs to your Datadog platform over HTTP. Limits per HTTP request are: - Maximum content size per payload (uncompressed): 5MB - Maximum size for a single log: 1MB - Maximum array size if sending multiple logs in an array: 1000 entries Any log exceeding 1MB is accepted and truncated by Datadog: - For a single log request, the API truncates the log at 1MB and returns a 2xx. - For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx. Datadog recommends sending your logs compressed. Add the `Content-Encoding: gzip` header to the request when sending compressed logs. The status codes answered by the HTTP API are: - 200: OK - 400: Bad request (likely an issue in the payload formatting) - 403: Permission issue (likely using an invalid API Key) - 413: Payload too large (batch is above 5MB uncompressed) - 5xx: Internal error, request should be retried after some time + +### Examples + +```ruby +require 'datadog_api_client' +api_instance = DatadogAPIClient::V1::LogsAPI.new +body = [DatadogAPIClient::V1::HTTPLogItem.new] # Array | Log to send (JSON format). +opts = { + content_encoding: DatadogAPIClient::V1::ContentEncoding::gzip, # ContentEncoding | HTTP header used to compress the media-type. + ddtags: 'env:prod,user:my-user' # String | Log tags can be passed as query parameters with `text/plain` content type. +} + +begin + # Send logs + result = api_instance.submit_log(body, opts) + p result +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling LogsAPI->submit_log: #{e}" +end +``` + +#### Using the submit_log_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> submit_log_with_http_info(body, opts) + +```ruby +begin + # Send logs + data, status_code, headers = api_instance.submit_log_with_http_info(body, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => Object +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling LogsAPI->submit_log_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **body** | [**Array<HTTPLogItem>**](HTTPLogItem.md) | Log to send (JSON format). | | +| **content_encoding** | **ContentEncoding** | HTTP header used to compress the media-type. | [optional] | +| **ddtags** | **String** | Log tags can be passed as query parameters with `text/plain` content type. | [optional] | + +### Return type + +**Object** + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json, application/logplex-1, text/plain +- **Accept**: application/json + diff --git a/docs/v1/MetricsAPI.md b/docs/v1/MetricsAPI.md index 24b8c30d03a8..07f66107df15 100644 --- a/docs/v1/MetricsAPI.md +++ b/docs/v1/MetricsAPI.md @@ -8,6 +8,7 @@ All URIs are relative to *https://api.datadoghq.com* | [**list_active_metrics**](MetricsAPI.md#list_active_metrics) | **GET** /api/v1/metrics | Get active metrics list | | [**list_metrics**](MetricsAPI.md#list_metrics) | **GET** /api/v1/search | Search metrics | | [**query_metrics**](MetricsAPI.md#query_metrics) | **GET** /api/v1/query | Query timeseries points | +| [**submit_metrics**](MetricsAPI.md#submit_metrics) | **POST** /api/v1/series | Submit metrics | | [**update_metric_metadata**](MetricsAPI.md#update_metric_metadata) | **PUT** /api/v1/metrics/{metric_name} | Edit metric metadata | @@ -269,6 +270,68 @@ end - **Accept**: application/json +## submit_metrics + +> submit_metrics(body) + +Submit metrics + +The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. The maximum payload size is 3.2 megabytes (3200000). Compressed payloads must have a decompressed size of up to 62 megabytes (62914560). If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect - 64 bits for the timestamp - 32 bits for the value - 20 bytes for the metric names - 50 bytes for the timeseries - The full payload is approximately ~ 100 bytes. However, with the DogStatsD API, compression is applied, which reduces the payload size. + +### Examples + +```ruby +require 'datadog_api_client' +api_instance = DatadogAPIClient::V1::MetricsAPI.new +body = DatadogAPIClient::V1::MetricsPayload.new({series: [DatadogAPIClient::V1::Series.new({metric: 'system.load.1', points: [[3.56]]})]}) # MetricsPayload | + +begin + # Submit metrics + result = api_instance.submit_metrics(body) + p result +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling MetricsAPI->submit_metrics: #{e}" +end +``` + +#### Using the submit_metrics_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> submit_metrics_with_http_info(body) + +```ruby +begin + # Submit metrics + data, status_code, headers = api_instance.submit_metrics_with_http_info(body) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling MetricsAPI->submit_metrics_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **body** | [**MetricsPayload**](MetricsPayload.md) | | | + +### Return type + +[**IntakePayloadAccepted**](IntakePayloadAccepted.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## update_metric_metadata > update_metric_metadata(metric_name, body) diff --git a/docs/v1/MetricsPayload.md b/docs/v1/MetricsPayload.md new file mode 100644 index 000000000000..c3eba14e589a --- /dev/null +++ b/docs/v1/MetricsPayload.md @@ -0,0 +1,18 @@ +# DatadogAPIClient::V1::MetricsPayload + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **series** | [**Array<Series>**](Series.md) | A list of time series to submit to Datadog. | | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::MetricsPayload.new( + series: [{"metric":"system.load.1","points":[[1475317847,0.7]]}] +) +``` + diff --git a/docs/v1/README.md b/docs/v1/README.md index 8a2be8820df0..c1fe9a6037c1 100644 --- a/docs/v1/README.md +++ b/docs/v1/README.md @@ -70,6 +70,7 @@ Class | Method | HTTP request | Description *DatadogAPIClient::V1::DowntimesAPI* | [**list_downtimes**](DowntimesAPI.md#list_downtimes) | **GET** /api/v1/downtime | Get all downtimes *DatadogAPIClient::V1::DowntimesAPI* | [**list_monitor_downtimes**](DowntimesAPI.md#list_monitor_downtimes) | **GET** /api/v1/monitor/{monitor_id}/downtimes | Get all downtimes for a monitor *DatadogAPIClient::V1::DowntimesAPI* | [**update_downtime**](DowntimesAPI.md#update_downtime) | **PUT** /api/v1/downtime/{downtime_id} | Update a downtime +*DatadogAPIClient::V1::EventsAPI* | [**create_event**](EventsAPI.md#create_event) | **POST** /api/v1/events | Post an event *DatadogAPIClient::V1::EventsAPI* | [**get_event**](EventsAPI.md#get_event) | **GET** /api/v1/events/{event_id} | Get an event *DatadogAPIClient::V1::EventsAPI* | [**list_events**](EventsAPI.md#list_events) | **GET** /api/v1/events | Query the event stream *DatadogAPIClient::V1::GCPIntegrationAPI* | [**create_gcp_integration**](GCPIntegrationAPI.md#create_gcp_integration) | **POST** /api/v1/integration/gcp | Create a GCP integration @@ -92,6 +93,7 @@ Class | Method | HTTP request | Description *DatadogAPIClient::V1::KeyManagementAPI* | [**update_api_key**](KeyManagementAPI.md#update_api_key) | **PUT** /api/v1/api_key/{key} | Edit an API key *DatadogAPIClient::V1::KeyManagementAPI* | [**update_application_key**](KeyManagementAPI.md#update_application_key) | **PUT** /api/v1/application_key/{key} | Edit an application key *DatadogAPIClient::V1::LogsAPI* | [**list_logs**](LogsAPI.md#list_logs) | **POST** /api/v1/logs-queries/list | Search logs +*DatadogAPIClient::V1::LogsAPI* | [**submit_log**](LogsAPI.md#submit_log) | **POST** /v1/input | Send logs *DatadogAPIClient::V1::LogsIndexesAPI* | [**create_logs_index**](LogsIndexesAPI.md#create_logs_index) | **POST** /api/v1/logs/config/indexes | Create an index *DatadogAPIClient::V1::LogsIndexesAPI* | [**get_logs_index**](LogsIndexesAPI.md#get_logs_index) | **GET** /api/v1/logs/config/indexes/{name} | Get an index *DatadogAPIClient::V1::LogsIndexesAPI* | [**get_logs_index_order**](LogsIndexesAPI.md#get_logs_index_order) | **GET** /api/v1/logs/config/index-order | Get indexes order @@ -109,6 +111,7 @@ Class | Method | HTTP request | Description *DatadogAPIClient::V1::MetricsAPI* | [**list_active_metrics**](MetricsAPI.md#list_active_metrics) | **GET** /api/v1/metrics | Get active metrics list *DatadogAPIClient::V1::MetricsAPI* | [**list_metrics**](MetricsAPI.md#list_metrics) | **GET** /api/v1/search | Search metrics *DatadogAPIClient::V1::MetricsAPI* | [**query_metrics**](MetricsAPI.md#query_metrics) | **GET** /api/v1/query | Query timeseries points +*DatadogAPIClient::V1::MetricsAPI* | [**submit_metrics**](MetricsAPI.md#submit_metrics) | **POST** /api/v1/series | Submit metrics *DatadogAPIClient::V1::MetricsAPI* | [**update_metric_metadata**](MetricsAPI.md#update_metric_metadata) | **PUT** /api/v1/metrics/{metric_name} | Edit metric metadata *DatadogAPIClient::V1::MonitorsAPI* | [**check_can_delete_monitor**](MonitorsAPI.md#check_can_delete_monitor) | **GET** /api/v1/monitor/can_delete | Check if a monitor can be deleted *DatadogAPIClient::V1::MonitorsAPI* | [**create_monitor**](MonitorsAPI.md#create_monitor) | **POST** /api/v1/monitor | Create a monitor @@ -126,6 +129,7 @@ Class | Method | HTTP request | Description *DatadogAPIClient::V1::PagerDutyIntegrationAPI* | [**delete_pager_duty_integration_service**](PagerDutyIntegrationAPI.md#delete_pager_duty_integration_service) | **DELETE** /api/v1/integration/pagerduty/configuration/services/{service_name} | Delete a single service object *DatadogAPIClient::V1::PagerDutyIntegrationAPI* | [**get_pager_duty_integration_service**](PagerDutyIntegrationAPI.md#get_pager_duty_integration_service) | **GET** /api/v1/integration/pagerduty/configuration/services/{service_name} | Get a single service object *DatadogAPIClient::V1::PagerDutyIntegrationAPI* | [**update_pager_duty_integration_service**](PagerDutyIntegrationAPI.md#update_pager_duty_integration_service) | **PUT** /api/v1/integration/pagerduty/configuration/services/{service_name} | Update a single service object +*DatadogAPIClient::V1::ServiceChecksAPI* | [**submit_service_check**](ServiceChecksAPI.md#submit_service_check) | **POST** /api/v1/check_run | Submit a Service Check *DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI* | [**create_slo_correction**](ServiceLevelObjectiveCorrectionsAPI.md#create_slo_correction) | **POST** /api/v1/slo/correction | Create an SLO correction *DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI* | [**delete_slo_correction**](ServiceLevelObjectiveCorrectionsAPI.md#delete_slo_correction) | **DELETE** /api/v1/slo/correction/{slo_correction_id} | Delete an SLO Correction *DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI* | [**get_slo_correction**](ServiceLevelObjectiveCorrectionsAPI.md#get_slo_correction) | **GET** /api/v1/slo/correction/{slo_correction_id} | Get an SLO correction for an SLO @@ -258,6 +262,7 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V1::CheckCanDeleteSLOResponseData](CheckCanDeleteSLOResponseData.md) - [DatadogAPIClient::V1::CheckStatusWidgetDefinition](CheckStatusWidgetDefinition.md) - [DatadogAPIClient::V1::CheckStatusWidgetDefinitionType](CheckStatusWidgetDefinitionType.md) + - [DatadogAPIClient::V1::ContentEncoding](ContentEncoding.md) - [DatadogAPIClient::V1::Creator](Creator.md) - [DatadogAPIClient::V1::Dashboard](Dashboard.md) - [DatadogAPIClient::V1::DashboardDeleteResponse](DashboardDeleteResponse.md) @@ -278,6 +283,8 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V1::DowntimeRecurrence](DowntimeRecurrence.md) - [DatadogAPIClient::V1::Event](Event.md) - [DatadogAPIClient::V1::EventAlertType](EventAlertType.md) + - [DatadogAPIClient::V1::EventCreateRequest](EventCreateRequest.md) + - [DatadogAPIClient::V1::EventCreateResponse](EventCreateResponse.md) - [DatadogAPIClient::V1::EventListResponse](EventListResponse.md) - [DatadogAPIClient::V1::EventPriority](EventPriority.md) - [DatadogAPIClient::V1::EventQueryDefinition](EventQueryDefinition.md) @@ -311,6 +318,8 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V1::GraphSnapshot](GraphSnapshot.md) - [DatadogAPIClient::V1::GroupWidgetDefinition](GroupWidgetDefinition.md) - [DatadogAPIClient::V1::GroupWidgetDefinitionType](GroupWidgetDefinitionType.md) + - [DatadogAPIClient::V1::HTTPLogError](HTTPLogError.md) + - [DatadogAPIClient::V1::HTTPLogItem](HTTPLogItem.md) - [DatadogAPIClient::V1::HTTPMethod](HTTPMethod.md) - [DatadogAPIClient::V1::HeatMapWidgetDefinition](HeatMapWidgetDefinition.md) - [DatadogAPIClient::V1::HeatMapWidgetDefinitionType](HeatMapWidgetDefinitionType.md) @@ -342,6 +351,7 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V1::IdpResponse](IdpResponse.md) - [DatadogAPIClient::V1::ImageWidgetDefinition](ImageWidgetDefinition.md) - [DatadogAPIClient::V1::ImageWidgetDefinitionType](ImageWidgetDefinitionType.md) + - [DatadogAPIClient::V1::IntakePayloadAccepted](IntakePayloadAccepted.md) - [DatadogAPIClient::V1::Log](Log.md) - [DatadogAPIClient::V1::LogContent](LogContent.md) - [DatadogAPIClient::V1::LogQueryDefinition](LogQueryDefinition.md) @@ -403,6 +413,7 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V1::MetricSearchResponse](MetricSearchResponse.md) - [DatadogAPIClient::V1::MetricSearchResponseResults](MetricSearchResponseResults.md) - [DatadogAPIClient::V1::MetricsListResponse](MetricsListResponse.md) + - [DatadogAPIClient::V1::MetricsPayload](MetricsPayload.md) - [DatadogAPIClient::V1::MetricsQueryMetadata](MetricsQueryMetadata.md) - [DatadogAPIClient::V1::MetricsQueryResponse](MetricsQueryResponse.md) - [DatadogAPIClient::V1::MetricsQueryUnit](MetricsQueryUnit.md) @@ -478,6 +489,9 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V1::ScatterPlotWidgetDefinition](ScatterPlotWidgetDefinition.md) - [DatadogAPIClient::V1::ScatterPlotWidgetDefinitionRequests](ScatterPlotWidgetDefinitionRequests.md) - [DatadogAPIClient::V1::ScatterPlotWidgetDefinitionType](ScatterPlotWidgetDefinitionType.md) + - [DatadogAPIClient::V1::Series](Series.md) + - [DatadogAPIClient::V1::ServiceCheck](ServiceCheck.md) + - [DatadogAPIClient::V1::ServiceCheckStatus](ServiceCheckStatus.md) - [DatadogAPIClient::V1::ServiceLevelObjective](ServiceLevelObjective.md) - [DatadogAPIClient::V1::ServiceLevelObjectiveQuery](ServiceLevelObjectiveQuery.md) - [DatadogAPIClient::V1::ServiceLevelObjectiveRequest](ServiceLevelObjectiveRequest.md) diff --git a/docs/v1/Series.md b/docs/v1/Series.md new file mode 100644 index 000000000000..df8e52e44de0 --- /dev/null +++ b/docs/v1/Series.md @@ -0,0 +1,28 @@ +# DatadogAPIClient::V1::Series + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **host** | **String** | The name of the host that produced the metric. | [optional] | +| **interval** | **Integer** | If the type of the metric is rate or count, define the corresponding interval. | [optional] | +| **metric** | **String** | The name of the timeseries. | | +| **points** | **Array<Array>** | Points relating to a metric. All points must be tuples with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past. | | +| **tags** | **Array<String>** | A list of tags associated with the metric. | [optional] | +| **type** | **String** | The type of the metric either `count`, `gauge`, or `rate`. | [optional][default to 'gauge'] | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::Series.new( + host: test.example.com, + interval: 20, + metric: system.load.1, + points: [[1575317847,0.5]], + tags: ["environment:test"], + type: rate +) +``` + diff --git a/docs/v1/ServiceCheck.md b/docs/v1/ServiceCheck.md new file mode 100644 index 000000000000..f328aa1d36b6 --- /dev/null +++ b/docs/v1/ServiceCheck.md @@ -0,0 +1,28 @@ +# DatadogAPIClient::V1::ServiceCheck + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **check** | **String** | The check. | | +| **host_name** | **String** | The host name correlated with the check. | | +| **message** | **String** | Message containing check status. | [optional] | +| **status** | [**ServiceCheckStatus**](ServiceCheckStatus.md) | | | +| **tags** | **Array<String>** | Tags related to a check. | | +| **timestamp** | **Integer** | Time of check. | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::ServiceCheck.new( + check: app.ok, + host_name: app.host1, + message: app is running, + status: null, + tags: ["environment:test"], + timestamp: null +) +``` + diff --git a/docs/v1/ServiceCheckStatus.md b/docs/v1/ServiceCheckStatus.md new file mode 100644 index 000000000000..944bd85c65bb --- /dev/null +++ b/docs/v1/ServiceCheckStatus.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V1::ServiceCheckStatus + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v1' + +instance = DatadogAPIClient::V1::ServiceCheckStatus.new() +``` + diff --git a/docs/v1/ServiceChecksAPI.md b/docs/v1/ServiceChecksAPI.md new file mode 100644 index 000000000000..98cf1d26e686 --- /dev/null +++ b/docs/v1/ServiceChecksAPI.md @@ -0,0 +1,70 @@ +# DatadogAPIClient::V1::ServiceChecksAPI + +All URIs are relative to *https://api.datadoghq.com* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**submit_service_check**](ServiceChecksAPI.md#submit_service_check) | **POST** /api/v1/check_run | Submit a Service Check | + + +## submit_service_check + +> submit_service_check(body) + +Submit a Service Check + +Submit a list of Service Checks. **Note**: A valid API key is required. + +### Examples + +```ruby +require 'datadog_api_client' +api_instance = DatadogAPIClient::V1::ServiceChecksAPI.new +body = [DatadogAPIClient::V1::ServiceCheck.new({check: 'app.ok', host_name: 'app.host1', status: DatadogAPIClient::V1::ServiceCheckStatus::OK, tags: ['tags_example']})] # Array | Service Check request body. + +begin + # Submit a Service Check + result = api_instance.submit_service_check(body) + p result +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling ServiceChecksAPI->submit_service_check: #{e}" +end +``` + +#### Using the submit_service_check_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> submit_service_check_with_http_info(body) + +```ruby +begin + # Submit a Service Check + data, status_code, headers = api_instance.submit_service_check_with_http_info(body) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling ServiceChecksAPI->submit_service_check_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **body** | [**Array<ServiceCheck>**](ServiceCheck.md) | Service Check request body. | | + +### Return type + +[**IntakePayloadAccepted**](IntakePayloadAccepted.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/features/v1/events.feature b/features/v1/events.feature index 1372e3500042..89355bc5de51 100644 --- a/features/v1/events.feature +++ b/features/v1/events.feature @@ -7,31 +7,47 @@ Feature: Events Background: Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system And an instance of "Events" API @generated @skip Scenario: Get an event returns "Item Not Found" response - Given new "GetEvent" request + Given a valid "appKeyAuth" key in the system + And new "GetEvent" request And request contains "event_id" parameter from "" When the request is sent Then the response status is 404 Item Not Found @generated @skip Scenario: Get an event returns "OK" response - Given new "GetEvent" request + Given a valid "appKeyAuth" key in the system + And new "GetEvent" request And request contains "event_id" parameter from "" When the request is sent Then the response status is 200 OK + @generated @skip + Scenario: Post an event returns "Bad Request" response + Given new "CreateEvent" request + And body {} + When the request is sent + Then the response status is 400 Bad Request + + Scenario: Post an event returns "OK" response + Given new "CreateEvent" request + And body {"title": "{{ unique }}", "text": "A text message.", "tags": ["test:{{ unique_alnum }}"]} + When the request is sent + Then the response status is 202 OK + @generated @skip Scenario: Query the event stream returns "Bad Request" response - Given new "ListEvents" request + Given a valid "appKeyAuth" key in the system + And new "ListEvents" request When the request is sent Then the response status is 400 Bad Request @generated @skip Scenario: Query the event stream returns "OK" response - Given new "ListEvents" request + Given a valid "appKeyAuth" key in the system + And new "ListEvents" request When the request is sent Then the response status is 200 OK diff --git a/features/v1/logs.feature b/features/v1/logs.feature index d9d423fbdb9c..35e23bcfbb51 100644 --- a/features/v1/logs.feature +++ b/features/v1/logs.feature @@ -4,17 +4,33 @@ Feature: Logs Background: Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system And an instance of "Logs" API - And new "ListLogs" request - And body {} @generated @skip Scenario: Search logs returns "Bad Request" response + Given body {} + And a valid "appKeyAuth" key in the system + And new "ListLogs" request When the request is sent Then the response status is 400 Bad Request @generated @skip Scenario: Search logs returns "OK" response + Given body {} + And a valid "appKeyAuth" key in the system + And new "ListLogs" request When the request is sent Then the response status is 200 OK + + Scenario: Send logs returns "Response from server (always 200 empty JSON)." response + Given new "SubmitLog" request + And body [{"message": "{{ unique }}", "tags": "host:{{ unique_alnum }}"}] + When the request is sent + Then the response status is 200 Response from server (always 200 empty JSON). + + @generated @skip + Scenario: Send logs returns "unexpected error" response + Given body {} + And new "SubmitLog" request + When the request is sent + Then the response status is 400 unexpected error diff --git a/features/v1/metrics.feature b/features/v1/metrics.feature index 598ea2aaa168..78cf2b1a3ca6 100644 --- a/features/v1/metrics.feature +++ b/features/v1/metrics.feature @@ -11,12 +11,12 @@ Feature: Metrics Background: Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system And an instance of "Metrics" API @generated @skip Scenario: Edit metric metadata returns "Bad Request" response - Given new "UpdateMetricMetadata" request + Given a valid "appKeyAuth" key in the system + And new "UpdateMetricMetadata" request And request contains "metric_name" parameter from "" And body {} When the request is sent @@ -24,7 +24,8 @@ Feature: Metrics @generated @skip Scenario: Edit metric metadata returns "Not Found" response - Given new "UpdateMetricMetadata" request + Given a valid "appKeyAuth" key in the system + And new "UpdateMetricMetadata" request And request contains "metric_name" parameter from "" And body {} When the request is sent @@ -32,7 +33,8 @@ Feature: Metrics @generated @skip Scenario: Edit metric metadata returns "OK" response - Given new "UpdateMetricMetadata" request + Given a valid "appKeyAuth" key in the system + And new "UpdateMetricMetadata" request And request contains "metric_name" parameter from "" And body {} When the request is sent @@ -40,50 +42,85 @@ Feature: Metrics @generated @skip Scenario: Get active metrics list returns "Bad Request" response - Given new "ListActiveMetrics" request + Given a valid "appKeyAuth" key in the system + And new "ListActiveMetrics" request When the request is sent Then the response status is 400 Bad Request @generated @skip Scenario: Get active metrics list returns "OK" response - Given new "ListActiveMetrics" request + Given a valid "appKeyAuth" key in the system + And new "ListActiveMetrics" request When the request is sent Then the response status is 200 OK @generated @skip Scenario: Get metric metadata returns "Not Found" response - Given new "GetMetricMetadata" request + Given a valid "appKeyAuth" key in the system + And new "GetMetricMetadata" request And request contains "metric_name" parameter from "" When the request is sent Then the response status is 404 Not Found @generated @skip Scenario: Get metric metadata returns "OK" response - Given new "GetMetricMetadata" request + Given a valid "appKeyAuth" key in the system + And new "GetMetricMetadata" request And request contains "metric_name" parameter from "" When the request is sent Then the response status is 200 OK @generated @skip Scenario: Query timeseries points returns "Bad Request" response - Given new "QueryMetrics" request + Given a valid "appKeyAuth" key in the system + And new "QueryMetrics" request When the request is sent Then the response status is 400 Bad Request @generated @skip Scenario: Query timeseries points returns "OK" response - Given new "QueryMetrics" request + Given a valid "appKeyAuth" key in the system + And new "QueryMetrics" request When the request is sent Then the response status is 200 OK @generated @skip Scenario: Search metrics returns "Bad Request" response - Given new "ListMetrics" request + Given a valid "appKeyAuth" key in the system + And new "ListMetrics" request When the request is sent Then the response status is 400 Bad Request @generated @skip Scenario: Search metrics returns "OK" response - Given new "ListMetrics" request + Given a valid "appKeyAuth" key in the system + And new "ListMetrics" request When the request is sent Then the response status is 200 OK + + @skip + Scenario: Submit metrics returns "Bad Request" response + Given new "SubmitMetrics" request + And body "invalid" + When the request is sent + Then the response status is 400 Bad Request + + Scenario: Submit metrics returns "Payload accepted" response + Given new "SubmitMetrics" request + And body {"series": [{"metric": "system.load.1", "points": [[1600348600, 1.1]], "tags": ["test:{{ unique_alnum }}"]}]} + When the request is sent + Then the response status is 202 Payload accepted + + @generated @skip + Scenario: Submit metrics returns "Payload too large" response + Given new "SubmitMetrics" request + And body {} + When the request is sent + Then the response status is 413 Payload too large + + @generated @skip + Scenario: Submit metrics returns "Request timeout" response + Given new "SubmitMetrics" request + And body {} + When the request is sent + Then the response status is 408 Request timeout diff --git a/features/v1/service_checks.feature b/features/v1/service_checks.feature new file mode 100644 index 000000000000..8549f755c1b8 --- /dev/null +++ b/features/v1/service_checks.feature @@ -0,0 +1,43 @@ +@endpoint(service-checks) +Feature: Service Checks + The service check endpoint allows you to post check statuses for use with + monitors. Service check messages are limited to 500 characters. If a check + is posted with a message containing more than 500 characters, only the + first 500 characters are displayed. - [Read more about Service Check + monitors.][1] - [Read more about Process Check monitors.][2] - [Read more + about Network Check monitors.][3] - [Read more about Custom Check + monitors.][4] [1]: + https://docs.datadoghq.com/monitors/monitor_types/host/?tab=checkalert + [2]: https://docs.datadoghq.com/monitors/monitor_types/process_check/?tab= + checkalert [3]: + https://docs.datadoghq.com/monitors/monitor_types/network/?tab=checkalert + [4]: https://docs.datadoghq.com/monitors/monitor_types/custom_check/?tab=c + heckalert + + Background: + Given a valid "apiKeyAuth" key in the system + And an instance of "ServiceChecks" API + And new "SubmitServiceCheck" request + + @generated @skip + Scenario: Submit a Service Check returns "Bad Request" response + Given body {} + When the request is sent + Then the response status is 400 Bad Request + + Scenario: Submit a Service Check returns "Payload accepted" response + Given body [{"check": "app.ok", "host_name": "host", "status": 0, "tags": ["test:{{ unique_alnum }}"]}] + When the request is sent + Then the response status is 202 Payload accepted + + @generated @skip + Scenario: Submit a Service Check returns "Payload too large" response + Given body {} + When the request is sent + Then the response status is 413 Payload too large + + @generated @skip + Scenario: Submit a Service Check returns "Request timeout" response + Given body {} + When the request is sent + Then the response status is 408 Request timeout diff --git a/features/v1/undo.json b/features/v1/undo.json index 69e4badc12f6..fd52808d2722 100644 --- a/features/v1/undo.json +++ b/features/v1/undo.json @@ -79,6 +79,12 @@ "type": "idempotent" } }, + "SubmitServiceCheck": { + "tag": "Service Checks", + "undo": { + "type": "safe" + } + }, "GetDailyCustomReports": { "tag": "Usage Metering", "undo": { @@ -209,6 +215,12 @@ "type": "safe" } }, + "CreateEvent": { + "tag": "Events", + "undo": { + "type": "safe" + } + }, "GetEvent": { "tag": "Events", "undo": { @@ -689,6 +701,12 @@ "type": "safe" } }, + "SubmitMetrics": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "ListSLOs": { "tag": "Service Level Objectives", "undo": { @@ -1196,5 +1214,11 @@ "undo": { "type": "safe" } + }, + "SubmitLog": { + "tag": "Logs", + "undo": { + "type": "safe" + } } } diff --git a/lib/datadog_api_client/v1.rb b/lib/datadog_api_client/v1.rb index 42d618b0f8c1..d5223d2a2869 100644 --- a/lib/datadog_api_client/v1.rb +++ b/lib/datadog_api_client/v1.rb @@ -63,6 +63,7 @@ require 'datadog_api_client/v1/models/check_can_delete_slo_response_data' require 'datadog_api_client/v1/models/check_status_widget_definition' require 'datadog_api_client/v1/models/check_status_widget_definition_type' +require 'datadog_api_client/v1/models/content_encoding' require 'datadog_api_client/v1/models/creator' require 'datadog_api_client/v1/models/dashboard' require 'datadog_api_client/v1/models/dashboard_delete_response' @@ -83,6 +84,8 @@ require 'datadog_api_client/v1/models/downtime_recurrence' require 'datadog_api_client/v1/models/event' require 'datadog_api_client/v1/models/event_alert_type' +require 'datadog_api_client/v1/models/event_create_request' +require 'datadog_api_client/v1/models/event_create_response' require 'datadog_api_client/v1/models/event_list_response' require 'datadog_api_client/v1/models/event_priority' require 'datadog_api_client/v1/models/event_query_definition' @@ -116,6 +119,8 @@ require 'datadog_api_client/v1/models/graph_snapshot' require 'datadog_api_client/v1/models/group_widget_definition' require 'datadog_api_client/v1/models/group_widget_definition_type' +require 'datadog_api_client/v1/models/http_log_error' +require 'datadog_api_client/v1/models/http_log_item' require 'datadog_api_client/v1/models/http_method' require 'datadog_api_client/v1/models/heat_map_widget_definition' require 'datadog_api_client/v1/models/heat_map_widget_definition_type' @@ -147,6 +152,7 @@ require 'datadog_api_client/v1/models/idp_response' require 'datadog_api_client/v1/models/image_widget_definition' require 'datadog_api_client/v1/models/image_widget_definition_type' +require 'datadog_api_client/v1/models/intake_payload_accepted' require 'datadog_api_client/v1/models/log' require 'datadog_api_client/v1/models/log_content' require 'datadog_api_client/v1/models/log_query_definition' @@ -208,6 +214,7 @@ require 'datadog_api_client/v1/models/metric_search_response' require 'datadog_api_client/v1/models/metric_search_response_results' require 'datadog_api_client/v1/models/metrics_list_response' +require 'datadog_api_client/v1/models/metrics_payload' require 'datadog_api_client/v1/models/metrics_query_metadata' require 'datadog_api_client/v1/models/metrics_query_response' require 'datadog_api_client/v1/models/metrics_query_unit' @@ -283,6 +290,9 @@ require 'datadog_api_client/v1/models/scatter_plot_widget_definition' require 'datadog_api_client/v1/models/scatter_plot_widget_definition_requests' require 'datadog_api_client/v1/models/scatter_plot_widget_definition_type' +require 'datadog_api_client/v1/models/series' +require 'datadog_api_client/v1/models/service_check' +require 'datadog_api_client/v1/models/service_check_status' require 'datadog_api_client/v1/models/service_level_objective' require 'datadog_api_client/v1/models/service_level_objective_query' require 'datadog_api_client/v1/models/service_level_objective_request' @@ -542,6 +552,7 @@ require 'datadog_api_client/v1/api/monitors_api' require 'datadog_api_client/v1/api/organizations_api' require 'datadog_api_client/v1/api/pager_duty_integration_api' +require 'datadog_api_client/v1/api/service_checks_api' require 'datadog_api_client/v1/api/service_level_objective_corrections_api' require 'datadog_api_client/v1/api/service_level_objectives_api' require 'datadog_api_client/v1/api/slack_integration_api' diff --git a/lib/datadog_api_client/v1/api/events_api.rb b/lib/datadog_api_client/v1/api/events_api.rb index f36af940836c..3280e71a8ebc 100644 --- a/lib/datadog_api_client/v1/api/events_api.rb +++ b/lib/datadog_api_client/v1/api/events_api.rb @@ -22,6 +22,81 @@ class EventsAPI def initialize(api_client = APIClient.default) @api_client = api_client end + # Post an event + # This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events. + # @param body [EventCreateRequest] Event request object + # @param [Hash] opts the optional parameters + # @return [EventCreateResponse] + def create_event(body, opts = {}) + data, _status_code, _headers = create_event_with_http_info(body, opts) + data + end + + # Post an event + # This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events. + # @param body [EventCreateRequest] Event request object + # @param [Hash] opts the optional parameters + # @return [Array<(EventCreateResponse, Integer, Hash)>] EventCreateResponse data, response status code and response headers + def create_event_with_http_info(body, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:create_event) + unstable_enabled = @api_client.config.unstable_operations[:create_event] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "create_event") + else + raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_event")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: EventsAPI.create_event ...' + 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 EventsAPI.create_event" + end + # resource path + local_var_path = '/api/v1/events' + + # 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] || 'EventCreateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth] + + new_options = opts.merge( + :operation => :create_event, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: EventsAPI#create_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get an event # This endpoint allows you to query for event details. **Note**: If the event you’re querying contains markdown formatting of any kind, you may see characters such as `%`,`\\`,`n` in your output. # @param event_id [Integer] The ID of the event. diff --git a/lib/datadog_api_client/v1/api/logs_api.rb b/lib/datadog_api_client/v1/api/logs_api.rb index 5c94dd201355..5a307f3a2932 100644 --- a/lib/datadog_api_client/v1/api/logs_api.rb +++ b/lib/datadog_api_client/v1/api/logs_api.rb @@ -96,5 +96,86 @@ def list_logs_with_http_info(body, opts = {}) end return data, status_code, headers end + + # Send logs + # Send your logs to your Datadog platform over HTTP. Limits per HTTP request are: - Maximum content size per payload (uncompressed): 5MB - Maximum size for a single log: 1MB - Maximum array size if sending multiple logs in an array: 1000 entries Any log exceeding 1MB is accepted and truncated by Datadog: - For a single log request, the API truncates the log at 1MB and returns a 2xx. - For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx. Datadog recommends sending your logs compressed. Add the `Content-Encoding: gzip` header to the request when sending compressed logs. The status codes answered by the HTTP API are: - 200: OK - 400: Bad request (likely an issue in the payload formatting) - 403: Permission issue (likely using an invalid API Key) - 413: Payload too large (batch is above 5MB uncompressed) - 5xx: Internal error, request should be retried after some time + # @param body [Array] Log to send (JSON format). + # @param [Hash] opts the optional parameters + # @option opts [ContentEncoding] :content_encoding HTTP header used to compress the media-type. + # @option opts [String] :ddtags Log tags can be passed as query parameters with `text/plain` content type. + # @return [Object] + def submit_log(body, opts = {}) + data, _status_code, _headers = submit_log_with_http_info(body, opts) + data + end + + # Send logs + # Send your logs to your Datadog platform over HTTP. Limits per HTTP request are: - Maximum content size per payload (uncompressed): 5MB - Maximum size for a single log: 1MB - Maximum array size if sending multiple logs in an array: 1000 entries Any log exceeding 1MB is accepted and truncated by Datadog: - For a single log request, the API truncates the log at 1MB and returns a 2xx. - For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx. Datadog recommends sending your logs compressed. Add the `Content-Encoding: gzip` header to the request when sending compressed logs. The status codes answered by the HTTP API are: - 200: OK - 400: Bad request (likely an issue in the payload formatting) - 403: Permission issue (likely using an invalid API Key) - 413: Payload too large (batch is above 5MB uncompressed) - 5xx: Internal error, request should be retried after some time + # @param body [Array] Log to send (JSON format). + # @param [Hash] opts the optional parameters + # @option opts [ContentEncoding] :content_encoding HTTP header used to compress the media-type. + # @option opts [String] :ddtags Log tags can be passed as query parameters with `text/plain` content type. + # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers + def submit_log_with_http_info(body, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:submit_log) + unstable_enabled = @api_client.config.unstable_operations[:submit_log] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "submit_log") + else + raise APIError.new(message: format("Unstable operation '%s' is disabled", "submit_log")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsAPI.submit_log ...' + 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 LogsAPI.submit_log" + end + # resource path + local_var_path = '/v1/input' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'ddtags'] = opts[:'ddtags'] if !opts[:'ddtags'].nil? + + # 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', 'application/logplex-1', 'text/plain']) + header_params[:'Content-Encoding'] = opts[:'content_encoding'] if !opts[:'content_encoding'].nil? + + # 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] || 'Object' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth] + + new_options = opts.merge( + :operation => :submit_log, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsAPI#submit_log\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/v1/api/metrics_api.rb b/lib/datadog_api_client/v1/api/metrics_api.rb index 06f79fe8a496..a4b23d0236ca 100644 --- a/lib/datadog_api_client/v1/api/metrics_api.rb +++ b/lib/datadog_api_client/v1/api/metrics_api.rb @@ -337,6 +337,81 @@ def query_metrics_with_http_info(from, to, query, opts = {}) return data, status_code, headers end + # Submit metrics + # The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. The maximum payload size is 3.2 megabytes (3200000). Compressed payloads must have a decompressed size of up to 62 megabytes (62914560). If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect - 64 bits for the timestamp - 32 bits for the value - 20 bytes for the metric names - 50 bytes for the timeseries - The full payload is approximately ~ 100 bytes. However, with the DogStatsD API, compression is applied, which reduces the payload size. + # @param body [MetricsPayload] + # @param [Hash] opts the optional parameters + # @return [IntakePayloadAccepted] + def submit_metrics(body, opts = {}) + data, _status_code, _headers = submit_metrics_with_http_info(body, opts) + data + end + + # Submit metrics + # The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. The maximum payload size is 3.2 megabytes (3200000). Compressed payloads must have a decompressed size of up to 62 megabytes (62914560). If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect - 64 bits for the timestamp - 32 bits for the value - 20 bytes for the metric names - 50 bytes for the timeseries - The full payload is approximately ~ 100 bytes. However, with the DogStatsD API, compression is applied, which reduces the payload size. + # @param body [MetricsPayload] + # @param [Hash] opts the optional parameters + # @return [Array<(IntakePayloadAccepted, Integer, Hash)>] IntakePayloadAccepted data, response status code and response headers + def submit_metrics_with_http_info(body, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:submit_metrics) + unstable_enabled = @api_client.config.unstable_operations[:submit_metrics] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "submit_metrics") + else + raise APIError.new(message: format("Unstable operation '%s' is disabled", "submit_metrics")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.submit_metrics ...' + 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 MetricsAPI.submit_metrics" + end + # resource path + local_var_path = '/api/v1/series' + + # 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] || 'IntakePayloadAccepted' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth] + + new_options = opts.merge( + :operation => :submit_metrics, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#submit_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Edit metric metadata # Edit metadata of a specific metric. Find out more about [supported types](https://docs.datadoghq.com/developers/metrics). # @param metric_name [String] Name of the metric for which to edit metadata. diff --git a/lib/datadog_api_client/v1/api/service_checks_api.rb b/lib/datadog_api_client/v1/api/service_checks_api.rb new file mode 100644 index 000000000000..65c6e4de506f --- /dev/null +++ b/lib/datadog_api_client/v1/api/service_checks_api.rb @@ -0,0 +1,100 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + class ServiceChecksAPI + attr_accessor :api_client + + def initialize(api_client = APIClient.default) + @api_client = api_client + end + # Submit a Service Check + # Submit a list of Service Checks. **Note**: A valid API key is required. + # @param body [Array] Service Check request body. + # @param [Hash] opts the optional parameters + # @return [IntakePayloadAccepted] + def submit_service_check(body, opts = {}) + data, _status_code, _headers = submit_service_check_with_http_info(body, opts) + data + end + + # Submit a Service Check + # Submit a list of Service Checks. **Note**: A valid API key is required. + # @param body [Array] Service Check request body. + # @param [Hash] opts the optional parameters + # @return [Array<(IntakePayloadAccepted, Integer, Hash)>] IntakePayloadAccepted data, response status code and response headers + def submit_service_check_with_http_info(body, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:submit_service_check) + unstable_enabled = @api_client.config.unstable_operations[:submit_service_check] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "submit_service_check") + else + raise APIError.new(message: format("Unstable operation '%s' is disabled", "submit_service_check")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServiceChecksAPI.submit_service_check ...' + 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 ServiceChecksAPI.submit_service_check" + end + # resource path + local_var_path = '/api/v1/check_run' + + # 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] || 'IntakePayloadAccepted' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth] + + new_options = opts.merge( + :operation => :submit_service_check, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ServiceChecksAPI#submit_service_check\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/v1/api_client.rb b/lib/datadog_api_client/v1/api_client.rb index ef9cd7e44dfd..5a9c775a185b 100644 --- a/lib/datadog_api_client/v1/api_client.rb +++ b/lib/datadog_api_client/v1/api_client.rb @@ -206,7 +206,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? || (mime == 'text/json') end # Deserialize the response to the given return type. diff --git a/lib/datadog_api_client/v1/configuration.rb b/lib/datadog_api_client/v1/configuration.rb index 4e1879bcf01c..a9f94ea5feb8 100644 --- a/lib/datadog_api_client/v1/configuration.rb +++ b/lib/datadog_api_client/v1/configuration.rb @@ -511,6 +511,56 @@ def operation_server_settings } } ], + submit_log: [ + { + url: "https://{subdomain}.{site}", + description: "No description provided", + variables: { + site: { + description: "The regional site for our customers.", + default_value: "datadoghq.com", + enum_values: [ + "datadoghq.com", + "us3.datadoghq.com", + "datadoghq.eu", + "ddog-gov.com" + ] + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "http-intake.logs", + } + } + }, + { + url: "{protocol}://{name}", + description: "No description provided", + variables: { + name: { + description: "Full site DNS name.", + default_value: "http-intake.logs.datadoghq.com", + }, + protocol: { + description: "The protocol for accessing the API.", + default_value: "https", + } + } + }, + { + url: "https://{subdomain}.{site}", + description: "No description provided", + variables: { + site: { + description: "Any Datadog deployment.", + default_value: "datadoghq.com", + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "http-intake.logs", + } + } + } + ], } end diff --git a/lib/datadog_api_client/v1/models/content_encoding.rb b/lib/datadog_api_client/v1/models/content_encoding.rb new file mode 100644 index 000000000000..0c34877aa22a --- /dev/null +++ b/lib/datadog_api_client/v1/models/content_encoding.rb @@ -0,0 +1,40 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + class ContentEncoding + gzip = "gzip".freeze + deflate = "deflate".freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = ContentEncoding.constants.select { |c| ContentEncoding::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #ContentEncoding" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v1/models/event_create_request.rb b/lib/datadog_api_client/v1/models/event_create_request.rb new file mode 100644 index 000000000000..9cfab4e3b2fc --- /dev/null +++ b/lib/datadog_api_client/v1/models/event_create_request.rb @@ -0,0 +1,416 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # Object representing an event. + class EventCreateRequest + # An arbitrary string to use for aggregation. Limited to 100 characters. If you specify a key, all events using that key are grouped together in the Event Stream. + attr_accessor :aggregation_key + + attr_accessor :alert_type + + # POSIX timestamp of the event. Must be sent as an integer (i.e. no quotes). Limited to events no older than 7 days. + attr_accessor :date_happened + + # A device name. + attr_accessor :device_name + + # Host name to associate with the event. Any tags associated with the host are also applied to this event. + attr_accessor :host + + # Integer ID of the event. + attr_accessor :id + + # Payload of the event. + attr_accessor :payload + + attr_accessor :priority + + # ID of the parent event. Must be sent as an integer (i.e. no quotes). + attr_accessor :related_event_id + + # The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). + attr_accessor :source_type_name + + # A list of tags to apply to the event. + attr_accessor :tags + + # The body of the event. Limited to 4000 characters. The text supports markdown. To use markdown in the event text, start the text block with `%%% \\n` and end the text block with `\\n %%%`. Use `msg_text` with the Datadog Ruby library. + attr_accessor :text + + # The event title. Limited to 100 characters. Use `msg_title` with the Datadog Ruby library. + attr_accessor :title + + # URL of the event. + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'aggregation_key' => :'aggregation_key', + :'alert_type' => :'alert_type', + :'date_happened' => :'date_happened', + :'device_name' => :'device_name', + :'host' => :'host', + :'id' => :'id', + :'payload' => :'payload', + :'priority' => :'priority', + :'related_event_id' => :'related_event_id', + :'source_type_name' => :'source_type_name', + :'tags' => :'tags', + :'text' => :'text', + :'title' => :'title', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'aggregation_key' => :'String', + :'alert_type' => :'EventAlertType', + :'date_happened' => :'Integer', + :'device_name' => :'String', + :'host' => :'String', + :'id' => :'Integer', + :'payload' => :'String', + :'priority' => :'EventPriority', + :'related_event_id' => :'Integer', + :'source_type_name' => :'String', + :'tags' => :'Array', + :'text' => :'String', + :'title' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::EventCreateRequest` 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::V1::EventCreateRequest`. 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?(:'aggregation_key') + self.aggregation_key = attributes[:'aggregation_key'] + end + + if attributes.key?(:'alert_type') + self.alert_type = attributes[:'alert_type'] + end + + if attributes.key?(:'date_happened') + self.date_happened = attributes[:'date_happened'] + end + + if attributes.key?(:'device_name') + self.device_name = attributes[:'device_name'] + end + + if attributes.key?(:'host') + self.host = attributes[:'host'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'payload') + self.payload = attributes[:'payload'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'related_event_id') + self.related_event_id = attributes[:'related_event_id'] + end + + if attributes.key?(:'source_type_name') + self.source_type_name = attributes[:'source_type_name'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@aggregation_key.nil? && @aggregation_key.to_s.length > 100 + invalid_properties.push('invalid value for "aggregation_key", the character length must be smaller than or equal to 100.') + end + + if @text.nil? + invalid_properties.push('invalid value for "text", text cannot be nil.') + end + + if @text.to_s.length > 4000 + invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 4000.') + end + + if @title.nil? + invalid_properties.push('invalid value for "title", title cannot be nil.') + end + + if @title.to_s.length > 100 + invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@aggregation_key.nil? && @aggregation_key.to_s.length > 100 + return false if @text.nil? + return false if @text.to_s.length > 4000 + return false if @title.nil? + return false if @title.to_s.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] aggregation_key Value to be assigned + def aggregation_key=(aggregation_key) + if !aggregation_key.nil? && aggregation_key.to_s.length > 100 + fail ArgumentError, 'invalid value for "aggregation_key", the character length must be smaller than or equal to 100.' + end + + @aggregation_key = aggregation_key + end + + # Custom attribute writer method with validation + # @param [Object] text Value to be assigned + def text=(text) + if text.nil? + fail ArgumentError, 'text cannot be nil' + end + + if text.to_s.length > 4000 + fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 4000.' + end + + @text = text + end + + # Custom attribute writer method with validation + # @param [Object] title Value to be assigned + def title=(title) + if title.nil? + fail ArgumentError, 'title cannot be nil' + end + + if title.to_s.length > 100 + fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 100.' + end + + @title = title + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + aggregation_key == o.aggregation_key && + alert_type == o.alert_type && + date_happened == o.date_happened && + device_name == o.device_name && + host == o.host && + id == o.id && + payload == o.payload && + priority == o.priority && + related_event_id == o.related_event_id && + source_type_name == o.source_type_name && + tags == o.tags && + text == o.text && + title == o.title && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [aggregation_key, alert_type, date_happened, device_name, host, id, payload, priority, related_event_id, source_type_name, tags, text, title, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/event_create_response.rb b/lib/datadog_api_client/v1/models/event_create_response.rb new file mode 100644 index 000000000000..8167e0374ddc --- /dev/null +++ b/lib/datadog_api_client/v1/models/event_create_response.rb @@ -0,0 +1,383 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # Object containing an event response. + class EventCreateResponse + attr_accessor :alert_type + + # POSIX timestamp of the event. Must be sent as an integer (i.e. no quotes). Limited to events no older than 7 days. + attr_accessor :date_happened + + # A device name. + attr_accessor :device_name + + # Host name to associate with the event. Any tags associated with the host are also applied to this event. + attr_accessor :host + + # Integer ID of the event. + attr_accessor :id + + # Payload of the event. + attr_accessor :payload + + attr_accessor :priority + + # ID of the parent event. Must be sent as an integer (i.e. no quotes). + attr_accessor :related_event_id + + # The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). + attr_accessor :source_type_name + + # A status. + attr_accessor :status + + # A list of tags to apply to the event. + attr_accessor :tags + + # The body of the event. Limited to 4000 characters. The text supports markdown. Use `msg_text` with the Datadog Ruby library. + attr_accessor :text + + # The event title. Limited to 100 characters. Use `msg_title` with the Datadog Ruby library. + attr_accessor :title + + # URL of the event. + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'alert_type' => :'alert_type', + :'date_happened' => :'date_happened', + :'device_name' => :'device_name', + :'host' => :'host', + :'id' => :'id', + :'payload' => :'payload', + :'priority' => :'priority', + :'related_event_id' => :'related_event_id', + :'source_type_name' => :'source_type_name', + :'status' => :'status', + :'tags' => :'tags', + :'text' => :'text', + :'title' => :'title', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'alert_type' => :'EventAlertType', + :'date_happened' => :'Integer', + :'device_name' => :'String', + :'host' => :'String', + :'id' => :'Integer', + :'payload' => :'String', + :'priority' => :'EventPriority', + :'related_event_id' => :'Integer', + :'source_type_name' => :'String', + :'status' => :'String', + :'tags' => :'Array', + :'text' => :'String', + :'title' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::EventCreateResponse` 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::V1::EventCreateResponse`. 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?(:'alert_type') + self.alert_type = attributes[:'alert_type'] + end + + if attributes.key?(:'date_happened') + self.date_happened = attributes[:'date_happened'] + end + + if attributes.key?(:'device_name') + self.device_name = attributes[:'device_name'] + end + + if attributes.key?(:'host') + self.host = attributes[:'host'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'payload') + self.payload = attributes[:'payload'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'related_event_id') + self.related_event_id = attributes[:'related_event_id'] + end + + if attributes.key?(:'source_type_name') + self.source_type_name = attributes[:'source_type_name'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@text.nil? && @text.to_s.length > 4000 + invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 4000.') + end + + if !@title.nil? && @title.to_s.length > 100 + invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@text.nil? && @text.to_s.length > 4000 + return false if !@title.nil? && @title.to_s.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] text Value to be assigned + def text=(text) + if !text.nil? && text.to_s.length > 4000 + fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 4000.' + end + + @text = text + end + + # Custom attribute writer method with validation + # @param [Object] title Value to be assigned + def title=(title) + if !title.nil? && title.to_s.length > 100 + fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 100.' + end + + @title = title + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + alert_type == o.alert_type && + date_happened == o.date_happened && + device_name == o.device_name && + host == o.host && + id == o.id && + payload == o.payload && + priority == o.priority && + related_event_id == o.related_event_id && + source_type_name == o.source_type_name && + status == o.status && + tags == o.tags && + text == o.text && + title == o.title && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [alert_type, date_happened, device_name, host, id, payload, priority, related_event_id, source_type_name, status, tags, text, title, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/http_log_error.rb b/lib/datadog_api_client/v1/models/http_log_error.rb new file mode 100644 index 000000000000..fafbee2252e1 --- /dev/null +++ b/lib/datadog_api_client/v1/models/http_log_error.rb @@ -0,0 +1,262 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # Invalid query performed. + class HTTPLogError + # Error code. + attr_accessor :code + + # Error message. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'Integer', + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::HTTPLogError` 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::V1::HTTPLogError`. 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?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @code.nil? + invalid_properties.push('invalid value for "code", code cannot be nil.') + end + + if @code > 2147483647 + invalid_properties.push('invalid value for "code", must be smaller than or equal to 2147483647.') + end + + if @message.nil? + invalid_properties.push('invalid value for "message", message cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @code.nil? + return false if @code > 2147483647 + return false if @message.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] code Value to be assigned + def code=(code) + if code.nil? + fail ArgumentError, 'code cannot be nil' + end + + if code > 2147483647 + fail ArgumentError, 'invalid value for "code", must be smaller than or equal to 2147483647.' + end + + @code = code + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/http_log_item.rb b/lib/datadog_api_client/v1/models/http_log_item.rb new file mode 100644 index 000000000000..3904f5b1ce21 --- /dev/null +++ b/lib/datadog_api_client/v1/models/http_log_item.rb @@ -0,0 +1,263 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # Logs that are sent over HTTP. + class HTTPLogItem + # The integration name associated with your log: the technology from which the log originated. When it matches an integration name, Datadog automatically installs the corresponding parsers and facets. See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). + attr_accessor :ddsource + + # Tags associated with your logs. + attr_accessor :ddtags + + # The name of the originating host of the log. + attr_accessor :hostname + + # The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. + attr_accessor :message + + # The name of the application or service generating the log events. It is used to switch from Logs to APM, so make sure you define the same value when you use both products. See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). + attr_accessor :service + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ddsource' => :'ddsource', + :'ddtags' => :'ddtags', + :'hostname' => :'hostname', + :'message' => :'message', + :'service' => :'service' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ddsource' => :'String', + :'ddtags' => :'String', + :'hostname' => :'String', + :'message' => :'String', + :'service' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::HTTPLogItem` 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::V1::HTTPLogItem`. 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?(:'ddsource') + self.ddsource = attributes[:'ddsource'] + end + + if attributes.key?(:'ddtags') + self.ddtags = attributes[:'ddtags'] + end + + if attributes.key?(:'hostname') + self.hostname = attributes[:'hostname'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ddsource == o.ddsource && + ddtags == o.ddtags && + hostname == o.hostname && + message == o.message && + service == o.service + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ddsource, ddtags, hostname, message, service].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/intake_payload_accepted.rb b/lib/datadog_api_client/v1/models/intake_payload_accepted.rb new file mode 100644 index 000000000000..6cb372e7d172 --- /dev/null +++ b/lib/datadog_api_client/v1/models/intake_payload_accepted.rb @@ -0,0 +1,223 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # The payload accepted for intake. + class IntakePayloadAccepted + # The status of the intake payload. + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::IntakePayloadAccepted` 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::V1::IntakePayloadAccepted`. 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?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/metrics_payload.rb b/lib/datadog_api_client/v1/models/metrics_payload.rb new file mode 100644 index 000000000000..83e51728077f --- /dev/null +++ b/lib/datadog_api_client/v1/models/metrics_payload.rb @@ -0,0 +1,230 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # The metrics' payload. + class MetricsPayload + # A list of time series to submit to Datadog. + attr_accessor :series + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'series' => :'series' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'series' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::MetricsPayload` 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::V1::MetricsPayload`. 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?(:'series') + if (value = attributes[:'series']).is_a?(Array) + self.series = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @series.nil? + invalid_properties.push('invalid value for "series", series cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @series.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + series == o.series + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [series].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/series.rb b/lib/datadog_api_client/v1/models/series.rb new file mode 100644 index 000000000000..3a6f8d878af5 --- /dev/null +++ b/lib/datadog_api_client/v1/models/series.rb @@ -0,0 +1,290 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # A metric to submit to Datadog. See [Datadog metrics](https://docs.datadoghq.com/developers/metrics/#custom-metrics-properties). + class Series + # The name of the host that produced the metric. + attr_accessor :host + + # If the type of the metric is rate or count, define the corresponding interval. + attr_accessor :interval + + # The name of the timeseries. + attr_accessor :metric + + # Points relating to a metric. All points must be tuples with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past. + attr_accessor :points + + # A list of tags associated with the metric. + attr_accessor :tags + + # The type of the metric either `count`, `gauge`, or `rate`. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'host' => :'host', + :'interval' => :'interval', + :'metric' => :'metric', + :'points' => :'points', + :'tags' => :'tags', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'host' => :'String', + :'interval' => :'Integer', + :'metric' => :'String', + :'points' => :'Array', + :'tags' => :'Array', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'interval', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::Series` 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::V1::Series`. 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?(:'host') + self.host = attributes[:'host'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + + if attributes.key?(:'metric') + self.metric = attributes[:'metric'] + end + + if attributes.key?(:'points') + if (value = attributes[:'points']).is_a?(Array) + self.points = value + end + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'gauge' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @metric.nil? + invalid_properties.push('invalid value for "metric", metric cannot be nil.') + end + + if @points.nil? + invalid_properties.push('invalid value for "points", points cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @metric.nil? + return false if @points.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + host == o.host && + interval == o.interval && + metric == o.metric && + points == o.points && + tags == o.tags && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [host, interval, metric, points, tags, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/service_check.rb b/lib/datadog_api_client/v1/models/service_check.rb new file mode 100644 index 000000000000..6829603dc76e --- /dev/null +++ b/lib/datadog_api_client/v1/models/service_check.rb @@ -0,0 +1,294 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + # An object containing service check and status. + class ServiceCheck + # The check. + attr_accessor :check + + # The host name correlated with the check. + attr_accessor :host_name + + # Message containing check status. + attr_accessor :message + + attr_accessor :status + + # Tags related to a check. + attr_accessor :tags + + # Time of check. + attr_accessor :timestamp + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'check' => :'check', + :'host_name' => :'host_name', + :'message' => :'message', + :'status' => :'status', + :'tags' => :'tags', + :'timestamp' => :'timestamp' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'check' => :'String', + :'host_name' => :'String', + :'message' => :'String', + :'status' => :'ServiceCheckStatus', + :'tags' => :'Array', + :'timestamp' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::ServiceCheck` 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::V1::ServiceCheck`. 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?(:'check') + self.check = attributes[:'check'] + end + + if attributes.key?(:'host_name') + self.host_name = attributes[:'host_name'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @check.nil? + invalid_properties.push('invalid value for "check", check cannot be nil.') + end + + if @host_name.nil? + invalid_properties.push('invalid value for "host_name", host_name cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + if @tags.nil? + invalid_properties.push('invalid value for "tags", tags cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @check.nil? + return false if @host_name.nil? + return false if @status.nil? + return false if @tags.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + check == o.check && + host_name == o.host_name && + message == o.message && + status == o.status && + tags == o.tags && + timestamp == o.timestamp + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [check, host_name, message, status, tags, timestamp].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V1.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v1/models/service_check_status.rb b/lib/datadog_api_client/v1/models/service_check_status.rb new file mode 100644 index 000000000000..db38721ffaab --- /dev/null +++ b/lib/datadog_api_client/v1/models/service_check_status.rb @@ -0,0 +1,42 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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::V1 + class ServiceCheckStatus + OK = 0.freeze + WARNING = 1.freeze + CRITICAL = 2.freeze + UNKNOWN = 3.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = ServiceCheckStatus.constants.select { |c| ServiceCheckStatus::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #ServiceCheckStatus" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v2/api_client.rb b/lib/datadog_api_client/v2/api_client.rb index 397b7518fbfc..e1620613a2ee 100644 --- a/lib/datadog_api_client/v2/api_client.rb +++ b/lib/datadog_api_client/v2/api_client.rb @@ -206,7 +206,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? || (mime == 'text/json') end # Deserialize the response to the given return type. diff --git a/spec/v1/api/service_checks_api_spec.rb b/spec/v1/api/service_checks_api_spec.rb new file mode 100644 index 000000000000..cb7fc2ed94c9 --- /dev/null +++ b/spec/v1/api/service_checks_api_spec.rb @@ -0,0 +1,50 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' + +# Unit tests for DatadogAPIClient::V1::ServiceChecksAPI +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ServiceChecksAPI' do + before do + # run before each test + @api_instance = DatadogAPIClient::V1::ServiceChecksAPI.new + end + + after do + # run after each test + end + + describe 'test an instance of ServiceChecksAPI' do + it 'should create an instance of ServiceChecksAPI' do + expect(@api_instance).to be_instance_of(DatadogAPIClient::V1::ServiceChecksAPI) + end + end + + # unit tests for submit_service_check + # Submit a Service Check + # Submit a list of Service Checks. **Note**: A valid API key is required. + # @param body Service Check request body. + # @param [Hash] opts the optional parameters + # @return [IntakePayloadAccepted] + describe 'submit_service_check test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/content_encoding_spec.rb b/spec/v1/models/content_encoding_spec.rb new file mode 100644 index 000000000000..ed737e29b02d --- /dev/null +++ b/spec/v1/models/content_encoding_spec.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::ContentEncoding +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::ContentEncoding do + let(:instance) { DatadogAPIClient::V1::ContentEncoding.new } + + describe 'test an instance of ContentEncoding' do + it 'should create an instance of ContentEncoding' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::ContentEncoding) + end + end +end diff --git a/spec/v1/models/event_create_request_spec.rb b/spec/v1/models/event_create_request_spec.rb new file mode 100644 index 000000000000..ab3e0fdf713f --- /dev/null +++ b/spec/v1/models/event_create_request_spec.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::EventCreateRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::EventCreateRequest do + let(:instance) { DatadogAPIClient::V1::EventCreateRequest.new } + + describe 'test an instance of EventCreateRequest' do + it 'should create an instance of EventCreateRequest' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::EventCreateRequest) + end + end + describe 'test attribute "aggregation_key"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "alert_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date_happened"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "device_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "host"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "payload"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "priority"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "related_event_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "source_type_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "text"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/event_create_response_spec.rb b/spec/v1/models/event_create_response_spec.rb new file mode 100644 index 000000000000..53fa54e7baeb --- /dev/null +++ b/spec/v1/models/event_create_response_spec.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::EventCreateResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::EventCreateResponse do + let(:instance) { DatadogAPIClient::V1::EventCreateResponse.new } + + describe 'test an instance of EventCreateResponse' do + it 'should create an instance of EventCreateResponse' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::EventCreateResponse) + end + end + describe 'test attribute "alert_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date_happened"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "device_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "host"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "payload"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "priority"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "related_event_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "source_type_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "text"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/http_log_error_spec.rb b/spec/v1/models/http_log_error_spec.rb new file mode 100644 index 000000000000..27f34e110d90 --- /dev/null +++ b/spec/v1/models/http_log_error_spec.rb @@ -0,0 +1,43 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::HTTPLogError +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::HTTPLogError do + let(:instance) { DatadogAPIClient::V1::HTTPLogError.new } + + describe 'test an instance of HTTPLogError' do + it 'should create an instance of HTTPLogError' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::HTTPLogError) + end + end + describe 'test attribute "code"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/http_log_item_spec.rb b/spec/v1/models/http_log_item_spec.rb new file mode 100644 index 000000000000..04bb607cf7cc --- /dev/null +++ b/spec/v1/models/http_log_item_spec.rb @@ -0,0 +1,61 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::HTTPLogItem +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::HTTPLogItem do + let(:instance) { DatadogAPIClient::V1::HTTPLogItem.new } + + describe 'test an instance of HTTPLogItem' do + it 'should create an instance of HTTPLogItem' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::HTTPLogItem) + end + end + describe 'test attribute "ddsource"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "ddtags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "hostname"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "service"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/intake_payload_accepted_spec.rb b/spec/v1/models/intake_payload_accepted_spec.rb new file mode 100644 index 000000000000..5675f5386749 --- /dev/null +++ b/spec/v1/models/intake_payload_accepted_spec.rb @@ -0,0 +1,37 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::IntakePayloadAccepted +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::IntakePayloadAccepted do + let(:instance) { DatadogAPIClient::V1::IntakePayloadAccepted.new } + + describe 'test an instance of IntakePayloadAccepted' do + it 'should create an instance of IntakePayloadAccepted' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::IntakePayloadAccepted) + end + end + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/metrics_payload_spec.rb b/spec/v1/models/metrics_payload_spec.rb new file mode 100644 index 000000000000..ae07faa7372e --- /dev/null +++ b/spec/v1/models/metrics_payload_spec.rb @@ -0,0 +1,37 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::MetricsPayload +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::MetricsPayload do + let(:instance) { DatadogAPIClient::V1::MetricsPayload.new } + + describe 'test an instance of MetricsPayload' do + it 'should create an instance of MetricsPayload' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::MetricsPayload) + end + end + describe 'test attribute "series"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/series_spec.rb b/spec/v1/models/series_spec.rb new file mode 100644 index 000000000000..8adcee39cac3 --- /dev/null +++ b/spec/v1/models/series_spec.rb @@ -0,0 +1,67 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::Series +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::Series do + let(:instance) { DatadogAPIClient::V1::Series.new } + + describe 'test an instance of Series' do + it 'should create an instance of Series' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::Series) + end + end + describe 'test attribute "host"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "interval"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "metric"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "points"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/service_check_spec.rb b/spec/v1/models/service_check_spec.rb new file mode 100644 index 000000000000..9f7a62682ab2 --- /dev/null +++ b/spec/v1/models/service_check_spec.rb @@ -0,0 +1,67 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::ServiceCheck +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::ServiceCheck do + let(:instance) { DatadogAPIClient::V1::ServiceCheck.new } + + describe 'test an instance of ServiceCheck' do + it 'should create an instance of ServiceCheck' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::ServiceCheck) + end + end + describe 'test attribute "check"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "host_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "timestamp"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v1/models/service_check_status_spec.rb b/spec/v1/models/service_check_status_spec.rb new file mode 100644 index 000000000000..2fe8834f5d3e --- /dev/null +++ b/spec/v1/models/service_check_status_spec.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V1::ServiceCheckStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V1::ServiceCheckStatus do + let(:instance) { DatadogAPIClient::V1::ServiceCheckStatus.new } + + describe 'test an instance of ServiceCheckStatus' do + it 'should create an instance of ServiceCheckStatus' do + expect(instance).to be_instance_of(DatadogAPIClient::V1::ServiceCheckStatus) + end + end +end