diff --git a/.apigentools-info b/.apigentools-info index 73c70ec52014..6c64a362b444 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-08 20:24:03.678592", - "spec_repo_commit": "037e376a" + "regenerated": "2024-04-09 18:06:05.043770", + "spec_repo_commit": "fc718bc2" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-08 20:24:03.695666", - "spec_repo_commit": "037e376a" + "regenerated": "2024-04-09 18:06:05.061038", + "spec_repo_commit": "fc718bc2" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3ec2a7d6b93a..9010c45c0c0b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -411,6 +411,13 @@ components: required: true schema: type: string + ReportID: + description: The ID of the report job. + in: path + name: report_id + required: true + schema: + type: string ResourceID: description: 'Identifier, formatted as `type:id`. Supported types: `connection`, `dashboard`, `notebook`, `security-rule`, `slo`.' @@ -16574,6 +16581,74 @@ components: type: string x-enum-varnames: - SAML_ASSERTION_ATTRIBUTES + SLOReportInterval: + description: The frequency at which report data is to be generated. + enum: + - weekly + - monthly + example: weekly + type: string + x-enum-varnames: + - WEEKLY + - MONTHLY + SLOReportPostResponse: + description: The SLO report response. + properties: + data: + $ref: '#/components/schemas/SLOReportPostResponseData' + type: object + SLOReportPostResponseData: + description: The data portion of the SLO report response. + properties: + id: + description: The ID of the report job. + example: dc8d92aa-e0af-11ee-af21-1feeaccaa3a3 + type: string + type: + description: The type of ID. + example: report_id + type: string + type: object + SLOReportStatus: + description: The status of the SLO report job. + enum: + - in_progress + - completed + - completed_with_errors + - failed + example: completed + type: string + x-enum-varnames: + - IN_PROGRESS + - COMPLETED + - COMPLETED_WITH_ERRORS + - FAILED + SLOReportStatusGetResponse: + description: The SLO report status response. + properties: + data: + $ref: '#/components/schemas/SLOReportStatusGetResponseData' + type: object + SLOReportStatusGetResponseAttributes: + description: The attributes portion of the SLO report status response. + properties: + status: + $ref: '#/components/schemas/SLOReportStatus' + type: object + SLOReportStatusGetResponseData: + description: The data portion of the SLO report status response. + properties: + attributes: + $ref: '#/components/schemas/SLOReportStatusGetResponseAttributes' + id: + description: The ID of the report job. + example: dc8d92aa-e0af-11ee-af21-1feeaccaa3a3 + type: string + type: + description: The type of ID. + example: report_id + type: string + type: object ScalarColumn: description: A single column in a scalar query response. oneOf: @@ -20216,6 +20291,53 @@ components: - channel_name - redirect_url type: object + SloReportCreateRequest: + description: The SLO report request body. + properties: + data: + $ref: '#/components/schemas/SloReportCreateRequestData' + required: + - data + type: object + SloReportCreateRequestAttributes: + description: The attributes portion of the SLO report request. + properties: + from_ts: + description: The `from` timestamp for the report in epoch seconds. + example: 1690901870 + format: int64 + type: integer + interval: + $ref: '#/components/schemas/SLOReportInterval' + query: + description: The query string used to filter SLO results. Some examples + of queries include `service:` and `slo-name`. + example: slo_type:metric + type: string + timezone: + description: The timezone used to determine the start and end of each interval. + For example, weekly intervals start at 12am on Sunday in the specified + timezone. + example: America/New_York + type: string + to_ts: + description: The `to` timestamp for the report in epoch seconds. + example: 1706803070 + format: int64 + type: integer + required: + - query + - from_ts + - to_ts + type: object + SloReportCreateRequestData: + description: The data portion of the SLO report request. + properties: + attributes: + $ref: '#/components/schemas/SloReportCreateRequestAttributes' + required: + - attributes + type: object SortDirection: default: desc description: The direction to sort by. @@ -33715,6 +33837,149 @@ paths: - Incident Services x-codegen-request-body-name: body x-unstable: '**Note**: This endpoint is deprecated.' + /api/v2/slo/report: + post: + description: 'Create a job to generate an SLO report. The report job is processed + asynchronously and eventually results in a CSV report being available for + download. + + + Check the status of the job and download the CSV report using the returned + `report_id`.' + operationId: CreateSLOReportJob + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SloReportCreateRequest' + description: Create SLO report job request body. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SLOReportPostResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - slos_read + summary: Create a new SLO report + tags: + - Service Level Objectives + x-codegen-request-body-name: body + x-unstable: '**Note**: This feature is in private beta. To request access, use + the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export) + docs.' + /api/v2/slo/report/{report_id}/download: + get: + description: 'Download an SLO report. This can only be performed after the report + job has completed. + + + Reports are not guaranteed to exist indefinitely. Datadog recommends that + you download the report as soon as it is available.' + operationId: GetSLOReport + parameters: + - $ref: '#/components/parameters/ReportID' + responses: + '200': + content: + text/csv: + schema: + type: string + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - slos_read + summary: Get SLO report + tags: + - Service Level Objectives + x-unstable: '**Note**: This feature is in private beta. To request access, use + the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export) + docs.' + /api/v2/slo/report/{report_id}/status: + get: + description: Get the status of the SLO report job. + operationId: GetSLOReportJobStatus + parameters: + - $ref: '#/components/parameters/ReportID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SLOReportStatusGetResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - slos_read + summary: Get SLO report status + tags: + - Service Level Objectives + x-unstable: '**Note**: This feature is in private beta. To request access, use + the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export) + docs.' /api/v2/spans/analytics/aggregate: post: description: 'The API endpoint to aggregate spans into buckets and compute metrics @@ -36129,6 +36394,18 @@ tags: externalDocs: url: https://docs.datadoghq.com/tracing/service_catalog/ name: Service Definition +- description: '[Service Level Objectives](https://docs.datadoghq.com/monitors/service_level_objectives/#configuration) + + (SLOs) are a key part of the site reliability engineering toolkit. + + SLOs provide a framework for defining clear targets around application performance, + + which ultimately help teams provide a consistent customer experience, + + balance feature development with platform stability, + + and improve communication with internal and external users.' + name: Service Level Objectives - description: 'API to create, update scorecard rules and outcomes. See [Service Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for more information. diff --git a/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-Bad-Request-response.frozen b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..838fe01d17df --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-04-09T17:56:36.109Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-Bad-Request-response.yml b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..63f0212eaf30 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-Bad-Request-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"from_ts":1690901870,"interval":"bad-interval","query":"slo_type:metric + \"SLO Reporting Test\"","to_ts":1706803070}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/slo/report + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Invalid Argument","detail":"bad-interval is not + a valid interval"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-OK-response.frozen b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-OK-response.frozen new file mode 100644 index 000000000000..fcb46e0427a7 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-04-09T17:56:36.274Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-OK-response.yml b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-OK-response.yml new file mode 100644 index 000000000000..b44d7dc2484e --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Create-a-new-SLO-report-returns-OK-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"from_ts":1690901870,"interval":"monthly","query":"slo_type:metric + \"SLO Reporting Test\"","timezone":"America/New_York","to_ts":1706803070}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/slo/report + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"8226c9b6-f69a-11ee-8916-13e390f416b9","type":"report_id"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Bad-Request-response.frozen b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..15c9e597705e --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-04-09T17:56:36.430Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Bad-Request-response.yml b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..889321b9bfe7 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Bad-Request-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: null + headers: + Accept: + - text/csv, application/json + method: GET + uri: https://api.datadoghq.com/api/v2/slo/report/invalid-report-id/download + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Invalid Argument","detail":"invalid report ID: + invalid-report-id"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Not-Found-response.frozen b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..2f55536c6173 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-04-09T17:56:36.598Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Not-Found-response.yml b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Not-Found-response.yml new file mode 100644 index 000000000000..9eb262503e1f --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: null + headers: + Accept: + - text/csv, application/json + method: GET + uri: https://api.datadoghq.com/api/v2/slo/report/2b468c54-f2a7-11ee-b0b4-ffe56bb6ad43/download + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Not Found","detail":"report ID not found: 2b468c54-f2a7-11ee-b0b4-ffe56bb6ad43"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-OK-response.frozen b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-OK-response.frozen new file mode 100644 index 000000000000..799db3b28fd1 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-04-04T17:38:45.610Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-OK-response.yml b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-OK-response.yml new file mode 100644 index 000000000000..cf2ca07dcfad --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-returns-OK-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Thu, 04 Apr 2024 17:38:45 GMT + request: + body: null + headers: + Accept: + - text/csv, application/json + method: GET + uri: https://api.datadoghq.com/api/v2/slo/report/9fb2dc2a-ead0-11ee-a174-9fe3a9d7627f/download + response: + body: + encoding: UTF-8 + string: 'id,slo_type,name,target,export_error,2023-08-01,2023-09-01,2023-10-01,2023-11-01,2023-12-01,2024-01-01 + + ' + headers: + Content-Type: + - text/csv + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Bad-Request-response.frozen b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..72c7a27d0584 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-04-09T17:56:36.721Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Bad-Request-response.yml b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..002ddc7cbdd2 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Bad-Request-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/slo/report/invalid-report-id/status + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Invalid Argument","detail":"invalid report ID: + invalid-report-id"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Not-Found-response.frozen b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..132597788dc9 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-04-09T17:56:36.827Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Not-Found-response.yml b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Not-Found-response.yml new file mode 100644 index 000000000000..760d613e0823 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/slo/report/2b468c54-f2a7-11ee-b0b4-ffe56bb6ad43/status + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Not Found","detail":"report ID not found: 2b468c54-f2a7-11ee-b0b4-ffe56bb6ad43"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-OK-response.frozen b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-OK-response.frozen new file mode 100644 index 000000000000..295615549cd8 --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-04-09T17:56:36.931Z \ No newline at end of file diff --git a/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-OK-response.yml b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-OK-response.yml new file mode 100644 index 000000000000..50d4c55f137d --- /dev/null +++ b/cassettes/features/v2/service_level_objectives/Get-SLO-report-status-returns-OK-response.yml @@ -0,0 +1,43 @@ +http_interactions: +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"from_ts":1710870996,"interval":"monthly","query":"slo_type:metric + \"SLO Reporting Test\"","to_ts":1712685396}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/slo/report + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"8288c800-f69a-11ee-aab1-0772aa10fea1","type":"report_id"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 09 Apr 2024 17:56:36 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/slo/report/8288c800-f69a-11ee-aab1-0772aa10fea1/status + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"8288c800-f69a-11ee-aab1-0772aa10fea1","type":"report_id","attributes":{"status":"in_progress"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/service-level-objectives/CreateSLOReportJob.rb b/examples/v2/service-level-objectives/CreateSLOReportJob.rb new file mode 100644 index 000000000000..3f056b7872dc --- /dev/null +++ b/examples/v2/service-level-objectives/CreateSLOReportJob.rb @@ -0,0 +1,20 @@ +# Create a new SLO report returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_slo_report_job".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ServiceLevelObjectivesAPI.new + +body = DatadogAPIClient::V2::SloReportCreateRequest.new({ + data: DatadogAPIClient::V2::SloReportCreateRequestData.new({ + attributes: DatadogAPIClient::V2::SloReportCreateRequestAttributes.new({ + from_ts: 1690901870, + to_ts: 1706803070, + query: 'slo_type:metric "SLO Reporting Test"', + interval: DatadogAPIClient::V2::SLOReportInterval::MONTHLY, + timezone: "America/New_York", + }), + }), +}) +p api_instance.create_slo_report_job(body) diff --git a/examples/v2/service-level-objectives/GetSLOReport.rb b/examples/v2/service-level-objectives/GetSLOReport.rb new file mode 100644 index 000000000000..92a7cb261243 --- /dev/null +++ b/examples/v2/service-level-objectives/GetSLOReport.rb @@ -0,0 +1,8 @@ +# Get SLO report returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_slo_report".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ServiceLevelObjectivesAPI.new +p api_instance.get_slo_report("9fb2dc2a-ead0-11ee-a174-9fe3a9d7627f") diff --git a/examples/v2/service-level-objectives/GetSLOReportJobStatus.rb b/examples/v2/service-level-objectives/GetSLOReportJobStatus.rb new file mode 100644 index 000000000000..4216bd624896 --- /dev/null +++ b/examples/v2/service-level-objectives/GetSLOReportJobStatus.rb @@ -0,0 +1,11 @@ +# Get SLO report status returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_slo_report_job_status".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ServiceLevelObjectivesAPI.new + +# there is a valid "report" in the system +REPORT_DATA_ID = ENV["REPORT_DATA_ID"] +p api_instance.get_slo_report_job_status(REPORT_DATA_ID) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index cb72fd863f93..a6b6e10dcbfc 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1876,6 +1876,15 @@ "service_name" => "String", "schema_version" => "ServiceDefinitionSchemaVersions", }, + "v2.CreateSLOReportJob" => { + "body" => "SloReportCreateRequest", + }, + "v2.GetSLOReport" => { + "report_id" => "String", + }, + "v2.GetSLOReportJobStatus" => { + "report_id" => "String", + }, "v2.AggregateSpans" => { "body" => "SpansAggregateRequest", }, diff --git a/features/v2/given.json b/features/v2/given.json index 5201f7e3c2c4..6178ced33fef 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -601,6 +601,18 @@ "tag": "Service Definition", "operationId": "CreateOrUpdateServiceDefinitions" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"query\": \"slo_type:metric \\\"SLO Reporting Test\\\"\",\n \"interval\": \"monthly\",\n \"from_ts\": {{ timestamp(\"now - 21d\") }},\n \"to_ts\": {{ timestamp(\"now\") }}\n }\n }\n}" + } + ], + "step": "there is a valid \"report\" in the system", + "key": "report", + "tag": "Service Level Objectives", + "operationId": "CreateSLOReportJob" + }, { "parameters": [ { diff --git a/features/v2/service_level_objectives.feature b/features/v2/service_level_objectives.feature new file mode 100644 index 000000000000..1cdcb2635dcf --- /dev/null +++ b/features/v2/service_level_objectives.feature @@ -0,0 +1,82 @@ +@endpoint(service-level-objectives) @endpoint(service-level-objectives-v2) +Feature: Service Level Objectives + [Service Level Objectives](https://docs.datadoghq.com/monitors/service_lev + el_objectives/#configuration) (SLOs) are a key part of the site + reliability engineering toolkit. SLOs provide a framework for defining + clear targets around application performance, which ultimately help teams + provide a consistent customer experience, balance feature development with + platform stability, and improve communication with internal and external + users. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ServiceLevelObjectives" API + + @team:DataDog/slo-app + Scenario: Create a new SLO report returns "Bad Request" response + Given operation "CreateSLOReportJob" enabled + And new "CreateSLOReportJob" request + And body with value {"data": {"attributes": {"from_ts": 1690901870, "to_ts": 1706803070, "query": "slo_type:metric \"SLO Reporting Test\"", "interval": "bad-interval"}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/slo-app + Scenario: Create a new SLO report returns "OK" response + Given operation "CreateSLOReportJob" enabled + And new "CreateSLOReportJob" request + And body with value {"data": {"attributes": {"from_ts": 1690901870, "to_ts": 1706803070, "query": "slo_type:metric \"SLO Reporting Test\"", "interval": "monthly", "timezone": "America/New_York"}}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "report_id" + + @team:DataDog/slo-app + Scenario: Get SLO report returns "Bad Request" response + Given operation "GetSLOReport" enabled + And new "GetSLOReport" request + And request contains "report_id" parameter with value "invalid-report-id" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/slo-app + Scenario: Get SLO report returns "Not Found" response + Given operation "GetSLOReport" enabled + And new "GetSLOReport" request + And request contains "report_id" parameter with value "2b468c54-f2a7-11ee-b0b4-ffe56bb6ad43" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/slo-app + Scenario: Get SLO report returns "OK" response + Given operation "GetSLOReport" enabled + And new "GetSLOReport" request + And request contains "report_id" parameter with value "9fb2dc2a-ead0-11ee-a174-9fe3a9d7627f" + When the request is sent + Then the response status is 200 OK + + @team:DataDog/slo-app + Scenario: Get SLO report status returns "Bad Request" response + Given operation "GetSLOReportJobStatus" enabled + And new "GetSLOReportJobStatus" request + And request contains "report_id" parameter with value "invalid-report-id" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/slo-app + Scenario: Get SLO report status returns "Not Found" response + Given operation "GetSLOReportJobStatus" enabled + And new "GetSLOReportJobStatus" request + And request contains "report_id" parameter with value "2b468c54-f2a7-11ee-b0b4-ffe56bb6ad43" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/slo-app + Scenario: Get SLO report status returns "OK" response + Given operation "GetSLOReportJobStatus" enabled + And new "GetSLOReportJobStatus" request + And there is a valid "report" in the system + And request contains "report_id" parameter from "report.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "report_id" + And the response "data.attributes.status" is equal to "in_progress" diff --git a/features/v2/undo.json b/features/v2/undo.json index 8fdb1cd7becc..94ca6b7575a6 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2016,6 +2016,24 @@ "type": "idempotent" } }, + "CreateSLOReportJob": { + "tag": "Service Level Objectives", + "undo": { + "type": "safe" + } + }, + "GetSLOReport": { + "tag": "Service Level Objectives", + "undo": { + "type": "safe" + } + }, + "GetSLOReportJobStatus": { + "tag": "Service Level Objectives", + "undo": { + "type": "safe" + } + }, "AggregateSpans": { "tag": "Spans", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 1fc265a0f704..7ac54ee6c215 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -230,6 +230,9 @@ def initialize "v2.get_incident_service": false, "v2.list_incident_services": false, "v2.update_incident_service": false, + "v2.create_slo_report_job": false, + "v2.get_slo_report": false, + "v2.get_slo_report_job_status": false, "v2.create_incident_team": false, "v2.delete_incident_team": false, "v2.get_incident_team": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 730c8f297df8..6dd548d8a19f 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2127,6 +2127,16 @@ def overrides "v2.service_now_ticket_result" => "ServiceNowTicketResult", "v2.slack_integration_metadata" => "SlackIntegrationMetadata", "v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem", + "v2.slo_report_create_request" => "SloReportCreateRequest", + "v2.slo_report_create_request_attributes" => "SloReportCreateRequestAttributes", + "v2.slo_report_create_request_data" => "SloReportCreateRequestData", + "v2.slo_report_interval" => "SLOReportInterval", + "v2.slo_report_post_response" => "SLOReportPostResponse", + "v2.slo_report_post_response_data" => "SLOReportPostResponseData", + "v2.slo_report_status" => "SLOReportStatus", + "v2.slo_report_status_get_response" => "SLOReportStatusGetResponse", + "v2.slo_report_status_get_response_attributes" => "SLOReportStatusGetResponseAttributes", + "v2.slo_report_status_get_response_data" => "SLOReportStatusGetResponseData", "v2.sort_direction" => "SortDirection", "v2.span" => "Span", "v2.spans_aggregate_bucket" => "SpansAggregateBucket", @@ -2363,6 +2373,7 @@ def overrides "v2.sensitive_data_scanner_api" => "SensitiveDataScannerAPI", "v2.service_accounts_api" => "ServiceAccountsAPI", "v2.service_definition_api" => "ServiceDefinitionAPI", + "v2.service_level_objectives_api" => "ServiceLevelObjectivesAPI", "v2.service_scorecards_api" => "ServiceScorecardsAPI", "v2.spans_api" => "SpansAPI", "v2.spans_metrics_api" => "SpansMetricsAPI", diff --git a/lib/datadog_api_client/v2/api/service_level_objectives_api.rb b/lib/datadog_api_client/v2/api/service_level_objectives_api.rb new file mode 100644 index 000000000000..9131dd3ccb73 --- /dev/null +++ b/lib/datadog_api_client/v2/api/service_level_objectives_api.rb @@ -0,0 +1,245 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class ServiceLevelObjectivesAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a new SLO report. + # + # @see #create_slo_report_job_with_http_info + def create_slo_report_job(body, opts = {}) + data, _status_code, _headers = create_slo_report_job_with_http_info(body, opts) + data + end + + # Create a new SLO report. + # + # Create a job to generate an SLO report. The report job is processed asynchronously and eventually results in a CSV report being available for download. + # + # Check the status of the job and download the CSV report using the returned `report_id`. + # + # @param body [SloReportCreateRequest] Create SLO report job request body. + # @param opts [Hash] the optional parameters + # @return [Array<(SLOReportPostResponse, Integer, Hash)>] SLOReportPostResponse data, response status code and response headers + def create_slo_report_job_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_slo_report_job".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_slo_report_job") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_slo_report_job")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServiceLevelObjectivesAPI.create_slo_report_job ...' + 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 ServiceLevelObjectivesAPI.create_slo_report_job" + end + # resource path + local_var_path = '/api/v2/slo/report' + + # 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] || 'SLOReportPostResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_slo_report_job, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ServiceLevelObjectivesAPI#create_slo_report_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get SLO report. + # + # @see #get_slo_report_with_http_info + def get_slo_report(report_id, opts = {}) + data, _status_code, _headers = get_slo_report_with_http_info(report_id, opts) + data + end + + # Get SLO report. + # + # Download an SLO report. This can only be performed after the report job has completed. + # + # Reports are not guaranteed to exist indefinitely. Datadog recommends that you download the report as soon as it is available. + # + # @param report_id [String] The ID of the report job. + # @param opts [Hash] the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def get_slo_report_with_http_info(report_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_slo_report".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_slo_report") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_slo_report")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServiceLevelObjectivesAPI.get_slo_report ...' + end + # verify the required parameter 'report_id' is set + if @api_client.config.client_side_validation && report_id.nil? + fail ArgumentError, "Missing the required parameter 'report_id' when calling ServiceLevelObjectivesAPI.get_slo_report" + end + # resource path + local_var_path = '/api/v2/slo/report/{report_id}/download'.sub('{report_id}', CGI.escape(report_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/csv', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_slo_report, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ServiceLevelObjectivesAPI#get_slo_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get SLO report status. + # + # @see #get_slo_report_job_status_with_http_info + def get_slo_report_job_status(report_id, opts = {}) + data, _status_code, _headers = get_slo_report_job_status_with_http_info(report_id, opts) + data + end + + # Get SLO report status. + # + # Get the status of the SLO report job. + # + # @param report_id [String] The ID of the report job. + # @param opts [Hash] the optional parameters + # @return [Array<(SLOReportStatusGetResponse, Integer, Hash)>] SLOReportStatusGetResponse data, response status code and response headers + def get_slo_report_job_status_with_http_info(report_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_slo_report_job_status".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_slo_report_job_status") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_slo_report_job_status")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServiceLevelObjectivesAPI.get_slo_report_job_status ...' + end + # verify the required parameter 'report_id' is set + if @api_client.config.client_side_validation && report_id.nil? + fail ArgumentError, "Missing the required parameter 'report_id' when calling ServiceLevelObjectivesAPI.get_slo_report_job_status" + end + # resource path + local_var_path = '/api/v2/slo/report/{report_id}/status'.sub('{report_id}', CGI.escape(report_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SLOReportStatusGetResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_slo_report_job_status, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ServiceLevelObjectivesAPI#get_slo_report_job_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_create_request.rb b/lib/datadog_api_client/v2/models/slo_report_create_request.rb new file mode 100644 index 000000000000..d5851c86b234 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_create_request.rb @@ -0,0 +1,98 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The SLO report request body. + class SloReportCreateRequest + include BaseGenericModel + + # The data portion of the SLO report request. + attr_reader :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SloReportCreateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SloReportCreateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SloReportCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_create_request_attributes.rb b/lib/datadog_api_client/v2/models/slo_report_create_request_attributes.rb new file mode 100644 index 000000000000..f0ae9d943344 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_create_request_attributes.rb @@ -0,0 +1,160 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes portion of the SLO report request. + class SloReportCreateRequestAttributes + include BaseGenericModel + + # The `from` timestamp for the report in epoch seconds. + attr_reader :from_ts + + # The frequency at which report data is to be generated. + attr_accessor :interval + + # The query string used to filter SLO results. Some examples of queries include `service:` and `slo-name`. + attr_reader :query + + # The timezone used to determine the start and end of each interval. For example, weekly intervals start at 12am on Sunday in the specified timezone. + attr_accessor :timezone + + # The `to` timestamp for the report in epoch seconds. + attr_reader :to_ts + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'from_ts' => :'from_ts', + :'interval' => :'interval', + :'query' => :'query', + :'timezone' => :'timezone', + :'to_ts' => :'to_ts' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'from_ts' => :'Integer', + :'interval' => :'SLOReportInterval', + :'query' => :'String', + :'timezone' => :'String', + :'to_ts' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SloReportCreateRequestAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SloReportCreateRequestAttributes`. 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?(:'from_ts') + self.from_ts = attributes[:'from_ts'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'timezone') + self.timezone = attributes[:'timezone'] + end + + if attributes.key?(:'to_ts') + self.to_ts = attributes[:'to_ts'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @from_ts.nil? + return false if @query.nil? + return false if @to_ts.nil? + true + end + + # Custom attribute writer method with validation + # @param from_ts [Object] Object to be assigned + # @!visibility private + def from_ts=(from_ts) + if from_ts.nil? + fail ArgumentError, 'invalid value for "from_ts", from_ts cannot be nil.' + end + @from_ts = from_ts + end + + # Custom attribute writer method with validation + # @param query [Object] Object to be assigned + # @!visibility private + def query=(query) + if query.nil? + fail ArgumentError, 'invalid value for "query", query cannot be nil.' + end + @query = query + end + + # Custom attribute writer method with validation + # @param to_ts [Object] Object to be assigned + # @!visibility private + def to_ts=(to_ts) + if to_ts.nil? + fail ArgumentError, 'invalid value for "to_ts", to_ts cannot be nil.' + end + @to_ts = to_ts + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from_ts == o.from_ts && + interval == o.interval && + query == o.query && + timezone == o.timezone && + to_ts == o.to_ts + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [from_ts, interval, query, timezone, to_ts].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_create_request_data.rb b/lib/datadog_api_client/v2/models/slo_report_create_request_data.rb new file mode 100644 index 000000000000..4b04fdc909c9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_create_request_data.rb @@ -0,0 +1,98 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data portion of the SLO report request. + class SloReportCreateRequestData + include BaseGenericModel + + # The attributes portion of the SLO report request. + attr_reader :attributes + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SloReportCreateRequestAttributes' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SloReportCreateRequestData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SloReportCreateRequestData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_interval.rb b/lib/datadog_api_client/v2/models/slo_report_interval.rb new file mode 100644 index 000000000000..d4768719b956 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_interval.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The frequency at which report data is to be generated. + class SLOReportInterval + include BaseEnumModel + + WEEKLY = "weekly".freeze + MONTHLY = "monthly".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_post_response.rb b/lib/datadog_api_client/v2/models/slo_report_post_response.rb new file mode 100644 index 000000000000..bd2127a2ae51 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_post_response.rb @@ -0,0 +1,80 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The SLO report response. + class SLOReportPostResponse + include BaseGenericModel + + # The data portion of the SLO report response. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SLOReportPostResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SLOReportPostResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SLOReportPostResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_post_response_data.rb b/lib/datadog_api_client/v2/models/slo_report_post_response_data.rb new file mode 100644 index 000000000000..b414b0bbd4c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_post_response_data.rb @@ -0,0 +1,90 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data portion of the SLO report response. + class SLOReportPostResponseData + include BaseGenericModel + + # The ID of the report job. + attr_accessor :id + + # The type of ID. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SLOReportPostResponseData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SLOReportPostResponseData`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_status.rb b/lib/datadog_api_client/v2/models/slo_report_status.rb new file mode 100644 index 000000000000..8d2d365b5b1b --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_status.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The status of the SLO report job. + class SLOReportStatus + include BaseEnumModel + + IN_PROGRESS = "in_progress".freeze + COMPLETED = "completed".freeze + COMPLETED_WITH_ERRORS = "completed_with_errors".freeze + FAILED = "failed".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_status_get_response.rb b/lib/datadog_api_client/v2/models/slo_report_status_get_response.rb new file mode 100644 index 000000000000..907b271b7b86 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_status_get_response.rb @@ -0,0 +1,80 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The SLO report status response. + class SLOReportStatusGetResponse + include BaseGenericModel + + # The data portion of the SLO report status response. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SLOReportStatusGetResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SLOReportStatusGetResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SLOReportStatusGetResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_status_get_response_attributes.rb b/lib/datadog_api_client/v2/models/slo_report_status_get_response_attributes.rb new file mode 100644 index 000000000000..f272b1eb2cf8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_status_get_response_attributes.rb @@ -0,0 +1,80 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes portion of the SLO report status response. + class SLOReportStatusGetResponseAttributes + include BaseGenericModel + + # The status of the SLO report job. + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'status' => :'SLOReportStatus' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SLOReportStatusGetResponseAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SLOReportStatusGetResponseAttributes`. 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 + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [status].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slo_report_status_get_response_data.rb b/lib/datadog_api_client/v2/models/slo_report_status_get_response_data.rb new file mode 100644 index 000000000000..8e86c34c52df --- /dev/null +++ b/lib/datadog_api_client/v2/models/slo_report_status_get_response_data.rb @@ -0,0 +1,100 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data portion of the SLO report status response. + class SLOReportStatusGetResponseData + include BaseGenericModel + + # The attributes portion of the SLO report status response. + attr_accessor :attributes + + # The ID of the report job. + attr_accessor :id + + # The type of ID. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SLOReportStatusGetResponseAttributes', + :'id' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SLOReportStatusGetResponseData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SLOReportStatusGetResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end