From 6e6a099528d105ca8e53cfdd2e0fe8896d761e5d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 8 Nov 2024 14:27:14 +0000 Subject: [PATCH] Regenerate client from commit d907813e of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 520 +++++++ .../CancelHistoricalJob.java | 27 + .../ConvertJobResultToSignal.java | 43 + .../DeleteHistoricalJob.java | 23 + .../security-monitoring/GetHistoricalJob.java | 29 + .../ListHistoricalJobs.java | 32 + .../security-monitoring/RunHistoricalJob.java | 75 + .../com/datadog/api/client/ApiClient.java | 6 + .../client/v2/api/SecurityMonitoringApi.java | 1227 +++++++++++++++-- .../api/client/v2/model/CalculatedField.java | 170 +++ .../ConvertJobResultsToSignalsAttributes.java | 280 ++++ .../model/ConvertJobResultsToSignalsData.java | 172 +++ .../ConvertJobResultsToSignalsDataType.java | 60 + .../ConvertJobResultsToSignalsRequest.java | 138 ++ .../v2/model/HistoricalJobDataType.java | 56 + .../v2/model/HistoricalJobListMeta.java | 135 ++ .../v2/model/HistoricalJobResponse.java | 136 ++ .../HistoricalJobResponseAttributes.java | 338 +++++ .../v2/model/HistoricalJobResponseData.java | 197 +++ .../client/v2/model/JobCreateResponse.java | 136 ++ .../v2/model/JobCreateResponseData.java | 168 +++ .../api/client/v2/model/JobDefinition.java | 600 ++++++++ .../v2/model/JobDefinitionFromRule.java | 294 ++++ .../v2/model/ListHistoricalJobsResponse.java | 180 +++ .../v2/model/RunHistoricalJobRequest.java | 136 ++ .../RunHistoricalJobRequestAttributes.java | 195 +++ .../v2/model/RunHistoricalJobRequestData.java | 170 +++ .../RunHistoricalJobRequestDataType.java | 58 + ...al_job_returns_Bad_Request_response.freeze | 1 + ...ical_job_returns_Bad_Request_response.json | 28 + ...ical_job_returns_Not_Found_response.freeze | 1 + ...orical_job_returns_Not_Found_response.json | 28 + ..._historical_job_returns_OK_response.freeze | 1 + ..._a_historical_job_returns_OK_response.json | 53 + ...signal_returns_Bad_Request_response.freeze | 1 + ...a_signal_returns_Bad_Request_response.json | 32 + ...ng_job_returns_Bad_Request_response.freeze | 1 + ...ting_job_returns_Bad_Request_response.json | 28 + ...ting_job_returns_Not_Found_response.freeze | 1 + ...isting_job_returns_Not_Found_response.json | 28 + ...etails_returns_Bad_Request_response.freeze | 1 + ..._details_returns_Bad_Request_response.json | 28 + ..._details_returns_Not_Found_response.freeze | 1 + ..._s_details_returns_Not_Found_response.json | 28 + ...a_job_s_details_returns_OK_response.freeze | 1 + ...t_a_job_s_details_returns_OK_response.json | 58 + ...historical_jobs_returns_OK_response.freeze | 1 + ...t_historical_jobs_returns_OK_response.json | 63 + ...al_job_returns_Bad_Request_response.freeze | 1 + ...ical_job_returns_Bad_Request_response.json | 32 + ...ical_job_returns_Not_Found_response.freeze | 1 + ...orical_job_returns_Not_Found_response.json | 32 + ...job_returns_Status_created_response.freeze | 1 + ...l_job_returns_Status_created_response.json | 32 + .../com/datadog/api/client/v2/api/given.json | 12 + .../client/v2/api/security_monitoring.feature | 157 +++ .../com/datadog/api/client/v2/api/undo.json | 36 + 58 files changed, 6178 insertions(+), 119 deletions(-) create mode 100644 examples/v2/security-monitoring/CancelHistoricalJob.java create mode 100644 examples/v2/security-monitoring/ConvertJobResultToSignal.java create mode 100644 examples/v2/security-monitoring/DeleteHistoricalJob.java create mode 100644 examples/v2/security-monitoring/GetHistoricalJob.java create mode 100644 examples/v2/security-monitoring/ListHistoricalJobs.java create mode 100644 examples/v2/security-monitoring/RunHistoricalJob.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CalculatedField.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/HistoricalJobDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/HistoricalJobListMeta.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/JobCreateResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/JobCreateResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/JobDefinition.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/JobDefinitionFromRule.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ListHistoricalJobsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestDataType.java create mode 100644 src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.json diff --git a/.apigentools-info b/.apigentools-info index ea78cb2b48e..77a84e504bc 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-07 22:36:09.628061", - "spec_repo_commit": "8233abfb" + "regenerated": "2024-11-08 14:25:33.219329", + "spec_repo_commit": "d907813e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-07 22:36:09.647241", - "spec_repo_commit": "8233abfb" + "regenerated": "2024-11-08 14:25:33.237800", + "spec_repo_commit": "d907813e" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ce1fe2fc60d..a3a38ebca93 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -293,6 +293,13 @@ components: required: true schema: type: string + HistoricalJobID: + description: The ID of the job. + in: path + name: job_id + required: true + schema: + type: string IncidentAttachmentFilterQueryParameter: description: Specifies which types of attachments are included in the response. explode: false @@ -3658,6 +3665,21 @@ components: from the other indexes type: string type: object + CalculatedField: + description: Calculated field. + properties: + expression: + description: Expression. + example: '@request_end_timestamp - @request_start_timestamp' + type: string + name: + description: Field name. + example: response_time + type: string + required: + - name + - expression + type: object Case: description: A case properties: @@ -5540,6 +5562,59 @@ components: - IDENTITY - GZIP - DEFLATE + ConvertJobResultsToSignalsAttributes: + description: Attributes for converting historical job results to signals. + properties: + id: + description: Request ID. + type: string + jobResultIds: + description: Job result IDs. + example: + - '' + items: + type: string + type: array + notifications: + description: Notifications sent. + example: + - '' + items: + type: string + type: array + signalMessage: + description: Message of generated signals. + example: A large number of failed login attempts. + type: string + signalSeverity: + $ref: '#/components/schemas/SecurityMonitoringRuleSeverity' + required: + - jobResultIds + - signalSeverity + - signalMessage + - notifications + type: object + ConvertJobResultsToSignalsData: + description: Data for converting historical job results to signals. + properties: + attributes: + $ref: '#/components/schemas/ConvertJobResultsToSignalsAttributes' + type: + $ref: '#/components/schemas/ConvertJobResultsToSignalsDataType' + type: object + ConvertJobResultsToSignalsDataType: + description: Type of payload. + enum: + - historicalDetectionsJobResultSignalConversion + type: string + x-enum-varnames: + - HISTORICALDETECTIONSJOBRESULTSIGNALCONVERSION + ConvertJobResultsToSignalsRequest: + description: Request for converting historical job results to signals. + properties: + data: + $ref: '#/components/schemas/ConvertJobResultsToSignalsData' + type: object CostAttributionAggregates: description: An array of available aggregates. items: @@ -10112,6 +10187,67 @@ components: required: - message type: object + HistoricalJobDataType: + description: Type of payload. + enum: + - historicalDetectionsJob + type: string + x-enum-varnames: + - HISTORICALDETECTIONSJOB + HistoricalJobListMeta: + description: Metadata about the list of jobs. + properties: + totalCount: + description: Number of jobs in the list. + format: int32 + maximum: 2147483647 + type: integer + type: object + HistoricalJobResponse: + description: Historical job response. + properties: + data: + $ref: '#/components/schemas/HistoricalJobResponseData' + type: object + HistoricalJobResponseAttributes: + description: Historical job attributes. + properties: + createdAt: + description: Time when the job was created. + type: string + createdByHandle: + description: The handle of the user who created the job. + type: string + createdByName: + description: The name of the user who created the job. + type: string + createdFromRuleId: + description: ID of the rule used to create the job (if it is created from + a rule). + type: string + jobDefinition: + $ref: '#/components/schemas/JobDefinition' + jobName: + description: Job name. + type: string + jobStatus: + description: Job status. + type: string + modifiedAt: + description: Last modification time of the job. + type: string + type: object + HistoricalJobResponseData: + description: Historical job response data. + properties: + attributes: + $ref: '#/components/schemas/HistoricalJobResponseAttributes' + id: + description: ID of the job. + type: string + type: + $ref: '#/components/schemas/HistoricalJobDataType' + type: object HourlyUsage: description: Hourly usage for a product family for an org. properties: @@ -12542,6 +12678,140 @@ components: description: Jira project key type: string type: object + JobCreateResponse: + description: Run a historical job response. + properties: + data: + $ref: '#/components/schemas/JobCreateResponseData' + type: object + JobCreateResponseData: + description: The definition of `JobCreateResponseData` object. + properties: + id: + description: ID of the created job. + type: string + type: + $ref: '#/components/schemas/HistoricalJobDataType' + type: object + JobDefinition: + description: Definition of a historical job. + properties: + calculatedFields: + description: Calculated fields. + items: + $ref: '#/components/schemas/CalculatedField' + type: array + cases: + description: Cases used for generating job results. + items: + $ref: '#/components/schemas/SecurityMonitoringRuleCaseCreate' + type: array + filters: + description: Additional queries to filter matched events before they are + processed. This field is deprecated for log detection, signal correlation, + and workload security rules. + items: + $ref: '#/components/schemas/SecurityMonitoringFilter' + type: array + from: + description: Starting time of data analyzed by the job. + example: 1729843470000 + format: int64 + type: integer + index: + description: Index used to load the data. + example: cloud_siem + type: string + message: + description: Message for generated results. + example: A large number of failed login attempts. + type: string + name: + description: Job name. + example: Excessive number of failed attempts. + type: string + options: + $ref: '#/components/schemas/SecurityMonitoringRuleOptions' + queries: + description: Queries for selecting logs analyzed by the job. + items: + $ref: '#/components/schemas/SecurityMonitoringStandardRuleQuery' + type: array + referenceTables: + description: Reference tables for the rule. + items: + $ref: '#/components/schemas/SecurityMonitoringReferenceTable' + type: array + tags: + description: Tags for generated signals. + items: + type: string + type: array + thirdPartyCases: + description: Cases for generating results from third-party rules. Only available + for third-party rules. + example: [] + items: + $ref: '#/components/schemas/SecurityMonitoringThirdPartyRuleCaseCreate' + type: array + to: + description: Ending time of data analyzed by the job. + example: 1729847070000 + format: int64 + type: integer + type: + description: Job type. + type: string + required: + - from + - to + - index + - name + - cases + - queries + - message + type: object + JobDefinitionFromRule: + description: Definition of a historical job based on a security monitoring rule. + properties: + caseIndex: + description: Index of the rule case applied by the job. + example: 0 + format: int32 + maximum: 9 + type: integer + from: + description: Starting time of data analyzed by the job. + example: 1729843470000 + format: int64 + type: integer + id: + description: ID of the detection rule used to create the job. + example: abc-def-ghi + type: string + index: + description: Index used to load the data. + example: cloud_siem + type: string + notifications: + description: Notifications sent when the job is completed. + example: + - '@sns-cloudtrail-results' + items: + type: string + type: array + to: + description: Ending time of data analyzed by the job. + example: 1729847070000 + format: int64 + type: integer + required: + - id + - from + - to + - index + - caseIndex + type: object LeakedKey: description: The definition of LeakedKey object. properties: @@ -12772,6 +13042,17 @@ components: - data - meta type: object + ListHistoricalJobsResponse: + description: List of historical jobs. + properties: + data: + description: Array containing the list of historical jobs. + items: + $ref: '#/components/schemas/HistoricalJobResponseData' + type: array + meta: + $ref: '#/components/schemas/HistoricalJobListMeta' + type: object ListPowerpacksResponse: description: Response object which includes all powerpack configurations. properties: @@ -19600,6 +19881,38 @@ components: $ref: '#/components/schemas/RumMetricResponseData' type: array type: object + RunHistoricalJobRequest: + description: Run a historical job request. + properties: + data: + $ref: '#/components/schemas/RunHistoricalJobRequestData' + type: object + RunHistoricalJobRequestAttributes: + description: Run a historical job request. + properties: + fromRule: + $ref: '#/components/schemas/JobDefinitionFromRule' + id: + description: Request ID. + type: string + jobDefinition: + $ref: '#/components/schemas/JobDefinition' + type: object + RunHistoricalJobRequestData: + description: Data for running a historical job request. + properties: + attributes: + $ref: '#/components/schemas/RunHistoricalJobRequestAttributes' + type: + $ref: '#/components/schemas/RunHistoricalJobRequestDataType' + type: object + RunHistoricalJobRequestDataType: + description: Type of data. + enum: + - historicalDetectionsJobCreate + type: string + x-enum-varnames: + - HISTORICALDETECTIONSJOBCREATE SAMLAssertionAttribute: description: SAML assertion attribute. properties: @@ -39611,6 +39924,213 @@ paths: permissions: - incident_settings_write x-unstable: '**Note**: This endpoint is deprecated.' + /api/v2/siem-historical-detections/jobs: + get: + description: List historical jobs. + operationId: ListHistoricalJobs + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + - description: The order of the jobs in results. + example: status + in: query + name: sort + required: false + schema: + type: string + - description: Query used to filter items from the fetched list. + example: security:attack status:high + in: query + name: filter[query] + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListHistoricalJobsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List historical jobs + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in beta and may be subject to changes. + + Please check the documentation regularly for updates.' + post: + description: Run a historical job. + operationId: RunHistoricalJob + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RunHistoricalJobRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/JobCreateResponse' + description: Status created + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/ConcurrentModificationResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Run a historical job + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in beta and may be subject to changes. + + Please check the documentation regularly for updates.' + /api/v2/siem-historical-detections/jobs/signal_convert: + post: + description: Convert a job result to a signal. + operationId: ConvertJobResultToSignal + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConvertJobResultsToSignalsRequest' + required: true + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/ConcurrentModificationResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Convert a job result to a signal + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in beta and may be subject to changes. + + Please check the documentation regularly for updates.' + /api/v2/siem-historical-detections/jobs/{job_id}: + delete: + description: Delete an existing job. + operationId: DeleteHistoricalJob + parameters: + - $ref: '#/components/parameters/HistoricalJobID' + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/ConcurrentModificationResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Delete an existing job + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in beta and may be subject to changes. + + Please check the documentation regularly for updates.' + get: + description: Get a job's details. + operationId: GetHistoricalJob + parameters: + - $ref: '#/components/parameters/HistoricalJobID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/HistoricalJobResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a job's details + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in beta and may be subject to changes. + + Please check the documentation regularly for updates.' + /api/v2/siem-historical-detections/jobs/{job_id}/cancel: + patch: + description: Cancel a historical job. + operationId: CancelHistoricalJob + parameters: + - $ref: '#/components/parameters/HistoricalJobID' + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/ConcurrentModificationResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Cancel a historical job + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in beta and may be subject to changes. + + Please check the documentation regularly for updates.' /api/v2/slo/report: post: description: 'Create a job to generate an SLO report. The report job is processed diff --git a/examples/v2/security-monitoring/CancelHistoricalJob.java b/examples/v2/security-monitoring/CancelHistoricalJob.java new file mode 100644 index 00000000000..9a807dafabb --- /dev/null +++ b/examples/v2/security-monitoring/CancelHistoricalJob.java @@ -0,0 +1,27 @@ +// Cancel a historical job returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.runHistoricalJob", true); + defaultClient.setUnstableOperationEnabled("v2.cancelHistoricalJob", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + // there is a valid "historical_job" in the system + String HISTORICAL_JOB_DATA_ID = System.getenv("HISTORICAL_JOB_DATA_ID"); + + try { + apiInstance.cancelHistoricalJob(HISTORICAL_JOB_DATA_ID); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#cancelHistoricalJob"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/ConvertJobResultToSignal.java b/examples/v2/security-monitoring/ConvertJobResultToSignal.java new file mode 100644 index 00000000000..97fb282e878 --- /dev/null +++ b/examples/v2/security-monitoring/ConvertJobResultToSignal.java @@ -0,0 +1,43 @@ +// Convert a job result to a signal returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.ConvertJobResultsToSignalsAttributes; +import com.datadog.api.client.v2.model.ConvertJobResultsToSignalsData; +import com.datadog.api.client.v2.model.ConvertJobResultsToSignalsDataType; +import com.datadog.api.client.v2.model.ConvertJobResultsToSignalsRequest; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleSeverity; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.convertJobResultToSignal", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + ConvertJobResultsToSignalsRequest body = + new ConvertJobResultsToSignalsRequest() + .data( + new ConvertJobResultsToSignalsData() + .attributes( + new ConvertJobResultsToSignalsAttributes() + .jobResultIds(Collections.singletonList("")) + .notifications(Collections.singletonList("")) + .signalMessage("A large number of failed login attempts.") + .signalSeverity(SecurityMonitoringRuleSeverity.CRITICAL)) + .type( + ConvertJobResultsToSignalsDataType + .HISTORICALDETECTIONSJOBRESULTSIGNALCONVERSION)); + + try { + apiInstance.convertJobResultToSignal(body); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#convertJobResultToSignal"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/DeleteHistoricalJob.java b/examples/v2/security-monitoring/DeleteHistoricalJob.java new file mode 100644 index 00000000000..393d437eb26 --- /dev/null +++ b/examples/v2/security-monitoring/DeleteHistoricalJob.java @@ -0,0 +1,23 @@ +// Delete an existing job returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteHistoricalJob", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + apiInstance.deleteHistoricalJob("job_id"); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#deleteHistoricalJob"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/GetHistoricalJob.java b/examples/v2/security-monitoring/GetHistoricalJob.java new file mode 100644 index 00000000000..fce09111a45 --- /dev/null +++ b/examples/v2/security-monitoring/GetHistoricalJob.java @@ -0,0 +1,29 @@ +// Get a job's details returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.HistoricalJobResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.runHistoricalJob", true); + defaultClient.setUnstableOperationEnabled("v2.getHistoricalJob", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + // there is a valid "historical_job" in the system + String HISTORICAL_JOB_DATA_ID = System.getenv("HISTORICAL_JOB_DATA_ID"); + + try { + HistoricalJobResponse result = apiInstance.getHistoricalJob(HISTORICAL_JOB_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#getHistoricalJob"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/ListHistoricalJobs.java b/examples/v2/security-monitoring/ListHistoricalJobs.java new file mode 100644 index 00000000000..6893dcf67ab --- /dev/null +++ b/examples/v2/security-monitoring/ListHistoricalJobs.java @@ -0,0 +1,32 @@ +// List historical jobs returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.api.SecurityMonitoringApi.ListHistoricalJobsOptionalParameters; +import com.datadog.api.client.v2.model.ListHistoricalJobsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.runHistoricalJob", true); + defaultClient.setUnstableOperationEnabled("v2.listHistoricalJobs", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + // there is a valid "historical_job" in the system + String HISTORICAL_JOB_DATA_ID = System.getenv("HISTORICAL_JOB_DATA_ID"); + + try { + ListHistoricalJobsResponse result = + apiInstance.listHistoricalJobs( + new ListHistoricalJobsOptionalParameters().filterQuery("id:string")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#listHistoricalJobs"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/RunHistoricalJob.java b/examples/v2/security-monitoring/RunHistoricalJob.java new file mode 100644 index 00000000000..2bc7fcb6c11 --- /dev/null +++ b/examples/v2/security-monitoring/RunHistoricalJob.java @@ -0,0 +1,75 @@ +// Run a historical job returns "Status created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.JobCreateResponse; +import com.datadog.api.client.v2.model.JobDefinition; +import com.datadog.api.client.v2.model.RunHistoricalJobRequest; +import com.datadog.api.client.v2.model.RunHistoricalJobRequestAttributes; +import com.datadog.api.client.v2.model.RunHistoricalJobRequestData; +import com.datadog.api.client.v2.model.RunHistoricalJobRequestDataType; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleCaseCreate; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleEvaluationWindow; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleKeepAlive; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleMaxSignalDuration; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleOptions; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleQueryAggregation; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleSeverity; +import com.datadog.api.client.v2.model.SecurityMonitoringStandardRuleQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.runHistoricalJob", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + RunHistoricalJobRequest body = + new RunHistoricalJobRequest() + .data( + new RunHistoricalJobRequestData() + .type(RunHistoricalJobRequestDataType.HISTORICALDETECTIONSJOBCREATE) + .attributes( + new RunHistoricalJobRequestAttributes() + .jobDefinition( + new JobDefinition() + .type("log_detection") + .name("Excessive number of failed attempts.") + .queries( + Collections.singletonList( + new SecurityMonitoringStandardRuleQuery() + .query("source:non_existing_src_weekend") + .aggregation( + SecurityMonitoringRuleQueryAggregation.COUNT))) + .cases( + Collections.singletonList( + new SecurityMonitoringRuleCaseCreate() + .name("Condition 1") + .status(SecurityMonitoringRuleSeverity.INFO) + .condition("a > 1"))) + .options( + new SecurityMonitoringRuleOptions() + .keepAlive(SecurityMonitoringRuleKeepAlive.ONE_HOUR) + .maxSignalDuration( + SecurityMonitoringRuleMaxSignalDuration.ONE_DAY) + .evaluationWindow( + SecurityMonitoringRuleEvaluationWindow + .FIFTEEN_MINUTES)) + .message("A large number of failed login attempts.") + .from(1730387522611L) + .to(1730387532611L) + .index("main")))); + + try { + JobCreateResponse result = apiInstance.runHistoricalJob(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#runHistoricalJob"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index de41d68be38..146b7d871ea 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -400,9 +400,15 @@ public class ApiClient { put("v2.updateIncidentIntegration", false); put("v2.updateIncidentTodo", false); put("v2.updateIncidentType", false); + put("v2.cancelHistoricalJob", false); + put("v2.convertJobResultToSignal", false); + put("v2.deleteHistoricalJob", false); put("v2.getFinding", false); + put("v2.getHistoricalJob", false); put("v2.listFindings", false); + put("v2.listHistoricalJobs", false); put("v2.muteFindings", false); + put("v2.runHistoricalJob", false); put("v2.createScorecardOutcomesBatch", false); put("v2.createScorecardRule", false); put("v2.deleteScorecardRule", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index 3fa3ab9830d..7ec756ded2a 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java @@ -7,12 +7,17 @@ import com.datadog.api.client.Pair; import com.datadog.api.client.v2.model.BulkMuteFindingsRequest; import com.datadog.api.client.v2.model.BulkMuteFindingsResponse; +import com.datadog.api.client.v2.model.ConvertJobResultsToSignalsRequest; import com.datadog.api.client.v2.model.Finding; import com.datadog.api.client.v2.model.FindingEvaluation; import com.datadog.api.client.v2.model.FindingStatus; import com.datadog.api.client.v2.model.FindingVulnerabilityType; import com.datadog.api.client.v2.model.GetFindingResponse; +import com.datadog.api.client.v2.model.HistoricalJobResponse; +import com.datadog.api.client.v2.model.JobCreateResponse; import com.datadog.api.client.v2.model.ListFindingsResponse; +import com.datadog.api.client.v2.model.ListHistoricalJobsResponse; +import com.datadog.api.client.v2.model.RunHistoricalJobRequest; import com.datadog.api.client.v2.model.SecurityFilterCreateRequest; import com.datadog.api.client.v2.model.SecurityFilterResponse; import com.datadog.api.client.v2.model.SecurityFilterUpdateRequest; @@ -81,6 +86,158 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Cancel a historical job. + * + *

See {@link #cancelHistoricalJobWithHttpInfo}. + * + * @param jobId The ID of the job. (required) + * @throws ApiException if fails to make API call + */ + public void cancelHistoricalJob(String jobId) throws ApiException { + cancelHistoricalJobWithHttpInfo(jobId); + } + + /** + * Cancel a historical job. + * + *

See {@link #cancelHistoricalJobWithHttpInfoAsync}. + * + * @param jobId The ID of the job. (required) + * @return CompletableFuture + */ + public CompletableFuture cancelHistoricalJobAsync(String jobId) { + return cancelHistoricalJobWithHttpInfoAsync(jobId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Cancel a historical job. + * + * @param jobId The ID of the job. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
400 Bad Request -
401 Concurrent Modification -
403 Not Authorized -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse cancelHistoricalJobWithHttpInfo(String jobId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "cancelHistoricalJob"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'jobId' is set + if (jobId == null) { + throw new ApiException( + 400, "Missing the required parameter 'jobId' when calling cancelHistoricalJob"); + } + // create path and map variables + String localVarPath = + "/api/v2/siem-historical-detections/jobs/{job_id}/cancel" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.cancelHistoricalJob", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Cancel a historical job. + * + *

See {@link #cancelHistoricalJobWithHttpInfo}. + * + * @param jobId The ID of the job. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> cancelHistoricalJobWithHttpInfoAsync(String jobId) { + // Check if unstable operation is enabled + String operationId = "cancelHistoricalJob"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'jobId' is set + if (jobId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'jobId' when calling cancelHistoricalJob")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/siem-historical-detections/jobs/{job_id}/cancel" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.cancelHistoricalJob", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Convert an existing rule from JSON to Terraform. * @@ -226,6 +383,156 @@ public SecurityMonitoringRuleConvertResponse convertExistingSecurityMonitoringRu new GenericType() {}); } + /** + * Convert a job result to a signal. + * + *

See {@link #convertJobResultToSignalWithHttpInfo}. + * + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void convertJobResultToSignal(ConvertJobResultsToSignalsRequest body) throws ApiException { + convertJobResultToSignalWithHttpInfo(body); + } + + /** + * Convert a job result to a signal. + * + *

See {@link #convertJobResultToSignalWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture convertJobResultToSignalAsync( + ConvertJobResultsToSignalsRequest body) { + return convertJobResultToSignalWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Convert a job result to a signal. + * + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
400 Bad Request -
401 Concurrent Modification -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse convertJobResultToSignalWithHttpInfo( + ConvertJobResultsToSignalsRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "convertJobResultToSignal"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling convertJobResultToSignal"); + } + // create path and map variables + String localVarPath = "/api/v2/siem-historical-detections/jobs/signal_convert"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.convertJobResultToSignal", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Convert a job result to a signal. + * + *

See {@link #convertJobResultToSignalWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> convertJobResultToSignalWithHttpInfoAsync( + ConvertJobResultsToSignalsRequest body) { + // Check if unstable operation is enabled + String operationId = "convertJobResultToSignal"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling convertJobResultToSignal")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/siem-historical-detections/jobs/signal_convert"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.convertJobResultToSignal", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Convert a rule from JSON to Terraform. * @@ -786,6 +1093,158 @@ public SecurityMonitoringSuppressionResponse createSecurityMonitoringSuppression new GenericType() {}); } + /** + * Delete an existing job. + * + *

See {@link #deleteHistoricalJobWithHttpInfo}. + * + * @param jobId The ID of the job. (required) + * @throws ApiException if fails to make API call + */ + public void deleteHistoricalJob(String jobId) throws ApiException { + deleteHistoricalJobWithHttpInfo(jobId); + } + + /** + * Delete an existing job. + * + *

See {@link #deleteHistoricalJobWithHttpInfoAsync}. + * + * @param jobId The ID of the job. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteHistoricalJobAsync(String jobId) { + return deleteHistoricalJobWithHttpInfoAsync(jobId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an existing job. + * + * @param jobId The ID of the job. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
400 Bad Request -
401 Concurrent Modification -
403 Not Authorized -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse deleteHistoricalJobWithHttpInfo(String jobId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteHistoricalJob"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'jobId' is set + if (jobId == null) { + throw new ApiException( + 400, "Missing the required parameter 'jobId' when calling deleteHistoricalJob"); + } + // create path and map variables + String localVarPath = + "/api/v2/siem-historical-detections/jobs/{job_id}" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.deleteHistoricalJob", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an existing job. + * + *

See {@link #deleteHistoricalJobWithHttpInfo}. + * + * @param jobId The ID of the job. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteHistoricalJobWithHttpInfoAsync(String jobId) { + // Check if unstable operation is enabled + String operationId = "deleteHistoricalJob"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'jobId' is set + if (jobId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'jobId' when calling deleteHistoricalJob")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/siem-historical-detections/jobs/{job_id}" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.deleteHistoricalJob", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Delete a security filter. * @@ -1875,50 +2334,203 @@ public ApiResponse getFindingWithHttpInfo( public CompletableFuture> getFindingWithHttpInfoAsync( String findingId, GetFindingOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "getFinding"; + String operationId = "getFinding"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'findingId' is set + if (findingId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'findingId' when calling getFinding")); + return result; + } + Long snapshotTimestamp = parameters.snapshotTimestamp; + // create path and map variables + String localVarPath = + "/api/v2/posture_management/findings/{finding_id}" + .replaceAll("\\{" + "finding_id" + "\\}", apiClient.escapeString(findingId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "snapshot_timestamp", snapshotTimestamp)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getFinding", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a job's details. + * + *

See {@link #getHistoricalJobWithHttpInfo}. + * + * @param jobId The ID of the job. (required) + * @return HistoricalJobResponse + * @throws ApiException if fails to make API call + */ + public HistoricalJobResponse getHistoricalJob(String jobId) throws ApiException { + return getHistoricalJobWithHttpInfo(jobId).getData(); + } + + /** + * Get a job's details. + * + *

See {@link #getHistoricalJobWithHttpInfoAsync}. + * + * @param jobId The ID of the job. (required) + * @return CompletableFuture<HistoricalJobResponse> + */ + public CompletableFuture getHistoricalJobAsync(String jobId) { + return getHistoricalJobWithHttpInfoAsync(jobId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a job's details. + * + * @param jobId The ID of the job. (required) + * @return ApiResponse<HistoricalJobResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getHistoricalJobWithHttpInfo(String jobId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getHistoricalJob"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'jobId' is set + if (jobId == null) { + throw new ApiException( + 400, "Missing the required parameter 'jobId' when calling getHistoricalJob"); + } + // create path and map variables + String localVarPath = + "/api/v2/siem-historical-detections/jobs/{job_id}" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getHistoricalJob", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a job's details. + * + *

See {@link #getHistoricalJobWithHttpInfo}. + * + * @param jobId The ID of the job. (required) + * @return CompletableFuture<ApiResponse<HistoricalJobResponse>> + */ + public CompletableFuture> getHistoricalJobWithHttpInfoAsync( + String jobId) { + // Check if unstable operation is enabled + String operationId = "getHistoricalJob"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } Object localVarPostBody = null; - // verify the required parameter 'findingId' is set - if (findingId == null) { - CompletableFuture> result = new CompletableFuture<>(); + // verify the required parameter 'jobId' is set + if (jobId == null) { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, "Missing the required parameter 'findingId' when calling getFinding")); + 400, "Missing the required parameter 'jobId' when calling getHistoricalJob")); return result; } - Long snapshotTimestamp = parameters.snapshotTimestamp; // create path and map variables String localVarPath = - "/api/v2/posture_management/findings/{finding_id}" - .replaceAll("\\{" + "finding_id" + "\\}", apiClient.escapeString(findingId.toString())); + "/api/v2/siem-historical-detections/jobs/{job_id}" + .replaceAll("\\{" + "job_id" + "\\}", apiClient.escapeString(jobId.toString())); - List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "snapshot_timestamp", snapshotTimestamp)); - Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.SecurityMonitoringApi.getFinding", + "v2.SecurityMonitoringApi.getHistoricalJob", localVarPath, - localVarQueryParams, + new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -1930,7 +2542,7 @@ public CompletableFuture> getFindingWithHttpInfo localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -2817,88 +3429,347 @@ public PaginationIterable listFindingsWithPagination( * Duplicated query parameters (e.g. filter[status]=low&filter[status]=info) are * not allowed. * - *

Response

+ *

Response

+ * + *

The response includes an array of finding objects, pagination metadata, and a count of items + * that match the query. + * + *

Each finding object contains the following: + * + *

+ * + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListFindingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request: The server cannot process the request due to invalid syntax in the request. -
403 Forbidden: Access denied -
404 Not Found: The requested finding cannot be found. -
429 Too many requests: The rate limit set by the API has been exceeded. -
+ */ + public ApiResponse listFindingsWithHttpInfo( + ListFindingsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listFindings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + Long pageLimit = parameters.pageLimit; + Long snapshotTimestamp = parameters.snapshotTimestamp; + String pageCursor = parameters.pageCursor; + String filterTags = parameters.filterTags; + String filterEvaluationChangedAt = parameters.filterEvaluationChangedAt; + Boolean filterMuted = parameters.filterMuted; + String filterRuleId = parameters.filterRuleId; + String filterRuleName = parameters.filterRuleName; + String filterResourceType = parameters.filterResourceType; + String filterDiscoveryTimestamp = parameters.filterDiscoveryTimestamp; + FindingEvaluation filterEvaluation = parameters.filterEvaluation; + FindingStatus filterStatus = parameters.filterStatus; + List filterVulnerabilityType = parameters.filterVulnerabilityType; + // create path and map variables + String localVarPath = "/api/v2/posture_management/findings"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "snapshot_timestamp", snapshotTimestamp)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[evaluation_changed_at]", filterEvaluationChangedAt)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[muted]", filterMuted)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_id]", filterRuleId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_name]", filterRuleName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[resource_type]", filterResourceType)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[discovery_timestamp]", filterDiscoveryTimestamp)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[evaluation]", filterEvaluation)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[vulnerability_type]", filterVulnerabilityType)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.listFindings", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List findings. + * + *

See {@link #listFindingsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListFindingsResponse>> + */ + public CompletableFuture> listFindingsWithHttpInfoAsync( + ListFindingsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listFindings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + Long pageLimit = parameters.pageLimit; + Long snapshotTimestamp = parameters.snapshotTimestamp; + String pageCursor = parameters.pageCursor; + String filterTags = parameters.filterTags; + String filterEvaluationChangedAt = parameters.filterEvaluationChangedAt; + Boolean filterMuted = parameters.filterMuted; + String filterRuleId = parameters.filterRuleId; + String filterRuleName = parameters.filterRuleName; + String filterResourceType = parameters.filterResourceType; + String filterDiscoveryTimestamp = parameters.filterDiscoveryTimestamp; + FindingEvaluation filterEvaluation = parameters.filterEvaluation; + FindingStatus filterStatus = parameters.filterStatus; + List filterVulnerabilityType = parameters.filterVulnerabilityType; + // create path and map variables + String localVarPath = "/api/v2/posture_management/findings"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "snapshot_timestamp", snapshotTimestamp)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[evaluation_changed_at]", filterEvaluationChangedAt)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[muted]", filterMuted)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_id]", filterRuleId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_name]", filterRuleName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[resource_type]", filterResourceType)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[discovery_timestamp]", filterDiscoveryTimestamp)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[evaluation]", filterEvaluation)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[vulnerability_type]", filterVulnerabilityType)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.listFindings", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listHistoricalJobs. */ + public static class ListHistoricalJobsOptionalParameters { + private Long pageSize; + private Long pageNumber; + private String sort; + private String filterQuery; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListHistoricalJobsOptionalParameters + */ + public ListHistoricalJobsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListHistoricalJobsOptionalParameters + */ + public ListHistoricalJobsOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set sort. + * + * @param sort The order of the jobs in results. (optional) + * @return ListHistoricalJobsOptionalParameters + */ + public ListHistoricalJobsOptionalParameters sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set filterQuery. + * + * @param filterQuery Query used to filter items from the fetched list. (optional) + * @return ListHistoricalJobsOptionalParameters + */ + public ListHistoricalJobsOptionalParameters filterQuery(String filterQuery) { + this.filterQuery = filterQuery; + return this; + } + } + + /** + * List historical jobs. + * + *

See {@link #listHistoricalJobsWithHttpInfo}. + * + * @return ListHistoricalJobsResponse + * @throws ApiException if fails to make API call + */ + public ListHistoricalJobsResponse listHistoricalJobs() throws ApiException { + return listHistoricalJobsWithHttpInfo(new ListHistoricalJobsOptionalParameters()).getData(); + } + + /** + * List historical jobs. + * + *

See {@link #listHistoricalJobsWithHttpInfoAsync}. + * + * @return CompletableFuture<ListHistoricalJobsResponse> + */ + public CompletableFuture listHistoricalJobsAsync() { + return listHistoricalJobsWithHttpInfoAsync(new ListHistoricalJobsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List historical jobs. + * + *

See {@link #listHistoricalJobsWithHttpInfo}. * - *

The response includes an array of finding objects, pagination metadata, and a count of items - * that match the query. + * @param parameters Optional parameters for the request. + * @return ListHistoricalJobsResponse + * @throws ApiException if fails to make API call + */ + public ListHistoricalJobsResponse listHistoricalJobs( + ListHistoricalJobsOptionalParameters parameters) throws ApiException { + return listHistoricalJobsWithHttpInfo(parameters).getData(); + } + + /** + * List historical jobs. * - *

Each finding object contains the following: + *

See {@link #listHistoricalJobsWithHttpInfoAsync}. * - *

    - *
  • The finding ID that can be used in a GetFinding request to retrieve the full - * finding details. - *
  • Core attributes, including status, evaluation, high-level resource details, muted state, - * and rule details. - *
  • evaluation_changed_at and resource_discovery_date time stamps. - *
  • An array of associated tags. - *
+ * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListHistoricalJobsResponse> + */ + public CompletableFuture listHistoricalJobsAsync( + ListHistoricalJobsOptionalParameters parameters) { + return listHistoricalJobsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List historical jobs. * * @param parameters Optional parameters for the request. - * @return ApiResponse<ListFindingsResponse> + * @return ApiResponse<ListHistoricalJobsResponse> * @throws ApiException if fails to make API call * @http.response.details * * * * - * - * - * - * + * + * + * *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request: The server cannot process the request due to invalid syntax in the request. -
403 Forbidden: Access denied -
404 Not Found: The requested finding cannot be found. -
429 Too many requests: The rate limit set by the API has been exceeded. -
400 Bad Request -
403 Not Authorized -
429 Too many requests -
*/ - public ApiResponse listFindingsWithHttpInfo( - ListFindingsOptionalParameters parameters) throws ApiException { + public ApiResponse listHistoricalJobsWithHttpInfo( + ListHistoricalJobsOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "listFindings"; + String operationId = "listHistoricalJobs"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); } Object localVarPostBody = null; - Long pageLimit = parameters.pageLimit; - Long snapshotTimestamp = parameters.snapshotTimestamp; - String pageCursor = parameters.pageCursor; - String filterTags = parameters.filterTags; - String filterEvaluationChangedAt = parameters.filterEvaluationChangedAt; - Boolean filterMuted = parameters.filterMuted; - String filterRuleId = parameters.filterRuleId; - String filterRuleName = parameters.filterRuleName; - String filterResourceType = parameters.filterResourceType; - String filterDiscoveryTimestamp = parameters.filterDiscoveryTimestamp; - FindingEvaluation filterEvaluation = parameters.filterEvaluation; - FindingStatus filterStatus = parameters.filterStatus; - List filterVulnerabilityType = parameters.filterVulnerabilityType; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + String sort = parameters.sort; + String filterQuery = parameters.filterQuery; // create path and map variables - String localVarPath = "/api/v2/posture_management/findings"; + String localVarPath = "/api/v2/siem-historical-detections/jobs"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "snapshot_timestamp", snapshotTimestamp)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[evaluation_changed_at]", filterEvaluationChangedAt)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[muted]", filterMuted)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_id]", filterRuleId)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_name]", filterRuleName)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[resource_type]", filterResourceType)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[discovery_timestamp]", filterDiscoveryTimestamp)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[evaluation]", filterEvaluation)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("multi", "filter[vulnerability_type]", filterVulnerabilityType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[query]", filterQuery)); Invocation.Builder builder = apiClient.createBuilder( - "v2.SecurityMonitoringApi.listFindings", + "v2.SecurityMonitoringApi.listHistoricalJobs", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -2913,74 +3784,50 @@ public ApiResponse listFindingsWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * List findings. + * List historical jobs. * - *

See {@link #listFindingsWithHttpInfo}. + *

See {@link #listHistoricalJobsWithHttpInfo}. * * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<ListFindingsResponse>> + * @return CompletableFuture<ApiResponse<ListHistoricalJobsResponse>> */ - public CompletableFuture> listFindingsWithHttpInfoAsync( - ListFindingsOptionalParameters parameters) { + public CompletableFuture> + listHistoricalJobsWithHttpInfoAsync(ListHistoricalJobsOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "listFindings"; + String operationId = "listHistoricalJobs"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } Object localVarPostBody = null; - Long pageLimit = parameters.pageLimit; - Long snapshotTimestamp = parameters.snapshotTimestamp; - String pageCursor = parameters.pageCursor; - String filterTags = parameters.filterTags; - String filterEvaluationChangedAt = parameters.filterEvaluationChangedAt; - Boolean filterMuted = parameters.filterMuted; - String filterRuleId = parameters.filterRuleId; - String filterRuleName = parameters.filterRuleName; - String filterResourceType = parameters.filterResourceType; - String filterDiscoveryTimestamp = parameters.filterDiscoveryTimestamp; - FindingEvaluation filterEvaluation = parameters.filterEvaluation; - FindingStatus filterStatus = parameters.filterStatus; - List filterVulnerabilityType = parameters.filterVulnerabilityType; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + String sort = parameters.sort; + String filterQuery = parameters.filterQuery; // create path and map variables - String localVarPath = "/api/v2/posture_management/findings"; + String localVarPath = "/api/v2/siem-historical-detections/jobs"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "snapshot_timestamp", snapshotTimestamp)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[evaluation_changed_at]", filterEvaluationChangedAt)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[muted]", filterMuted)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_id]", filterRuleId)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule_name]", filterRuleName)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[resource_type]", filterResourceType)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[discovery_timestamp]", filterDiscoveryTimestamp)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[evaluation]", filterEvaluation)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("multi", "filter[vulnerability_type]", filterVulnerabilityType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[query]", filterQuery)); Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.SecurityMonitoringApi.listFindings", + "v2.SecurityMonitoringApi.listHistoricalJobs", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -2988,7 +3835,7 @@ public CompletableFuture> listFindingsWithHttp new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -3000,7 +3847,7 @@ public CompletableFuture> listFindingsWithHttp localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -3919,6 +4766,156 @@ public CompletableFuture> muteFindingsWith new GenericType() {}); } + /** + * Run a historical job. + * + *

See {@link #runHistoricalJobWithHttpInfo}. + * + * @param body (required) + * @return JobCreateResponse + * @throws ApiException if fails to make API call + */ + public JobCreateResponse runHistoricalJob(RunHistoricalJobRequest body) throws ApiException { + return runHistoricalJobWithHttpInfo(body).getData(); + } + + /** + * Run a historical job. + * + *

See {@link #runHistoricalJobWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<JobCreateResponse> + */ + public CompletableFuture runHistoricalJobAsync(RunHistoricalJobRequest body) { + return runHistoricalJobWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Run a historical job. + * + * @param body (required) + * @return ApiResponse<JobCreateResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Status created -
400 Bad Request -
401 Concurrent Modification -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse runHistoricalJobWithHttpInfo(RunHistoricalJobRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "runHistoricalJob"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling runHistoricalJob"); + } + // create path and map variables + String localVarPath = "/api/v2/siem-historical-detections/jobs"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.runHistoricalJob", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Run a historical job. + * + *

See {@link #runHistoricalJobWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<JobCreateResponse>> + */ + public CompletableFuture> runHistoricalJobWithHttpInfoAsync( + RunHistoricalJobRequest body) { + // Check if unstable operation is enabled + String operationId = "runHistoricalJob"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling runHistoricalJob")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/siem-historical-detections/jobs"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.runHistoricalJob", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to searchSecurityMonitoringSignals. */ public static class SearchSecurityMonitoringSignalsOptionalParameters { private SecurityMonitoringSignalListRequest body; diff --git a/src/main/java/com/datadog/api/client/v2/model/CalculatedField.java b/src/main/java/com/datadog/api/client/v2/model/CalculatedField.java new file mode 100644 index 00000000000..4ee71198a2f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CalculatedField.java @@ -0,0 +1,170 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Calculated field. */ +@JsonPropertyOrder({CalculatedField.JSON_PROPERTY_EXPRESSION, CalculatedField.JSON_PROPERTY_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CalculatedField { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXPRESSION = "expression"; + private String expression; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public CalculatedField() {} + + @JsonCreator + public CalculatedField( + @JsonProperty(required = true, value = JSON_PROPERTY_EXPRESSION) String expression, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.expression = expression; + this.name = name; + } + + public CalculatedField expression(String expression) { + this.expression = expression; + return this; + } + + /** + * Expression. + * + * @return expression + */ + @JsonProperty(JSON_PROPERTY_EXPRESSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExpression() { + return expression; + } + + public void setExpression(String expression) { + this.expression = expression; + } + + public CalculatedField name(String name) { + this.name = name; + return this; + } + + /** + * Field name. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CalculatedField + */ + @JsonAnySetter + public CalculatedField putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CalculatedField object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalculatedField calculatedField = (CalculatedField) o; + return Objects.equals(this.expression, calculatedField.expression) + && Objects.equals(this.name, calculatedField.name) + && Objects.equals(this.additionalProperties, calculatedField.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(expression, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalculatedField {\n"); + sb.append(" expression: ").append(toIndentedString(expression)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsAttributes.java new file mode 100644 index 00000000000..c7a084a305c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsAttributes.java @@ -0,0 +1,280 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for converting historical job results to signals. */ +@JsonPropertyOrder({ + ConvertJobResultsToSignalsAttributes.JSON_PROPERTY_ID, + ConvertJobResultsToSignalsAttributes.JSON_PROPERTY_JOB_RESULT_IDS, + ConvertJobResultsToSignalsAttributes.JSON_PROPERTY_NOTIFICATIONS, + ConvertJobResultsToSignalsAttributes.JSON_PROPERTY_SIGNAL_MESSAGE, + ConvertJobResultsToSignalsAttributes.JSON_PROPERTY_SIGNAL_SEVERITY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConvertJobResultsToSignalsAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_JOB_RESULT_IDS = "jobResultIds"; + private List jobResultIds = new ArrayList<>(); + + public static final String JSON_PROPERTY_NOTIFICATIONS = "notifications"; + private List notifications = new ArrayList<>(); + + public static final String JSON_PROPERTY_SIGNAL_MESSAGE = "signalMessage"; + private String signalMessage; + + public static final String JSON_PROPERTY_SIGNAL_SEVERITY = "signalSeverity"; + private SecurityMonitoringRuleSeverity signalSeverity; + + public ConvertJobResultsToSignalsAttributes() {} + + @JsonCreator + public ConvertJobResultsToSignalsAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_JOB_RESULT_IDS) + List jobResultIds, + @JsonProperty(required = true, value = JSON_PROPERTY_NOTIFICATIONS) + List notifications, + @JsonProperty(required = true, value = JSON_PROPERTY_SIGNAL_MESSAGE) String signalMessage, + @JsonProperty(required = true, value = JSON_PROPERTY_SIGNAL_SEVERITY) + SecurityMonitoringRuleSeverity signalSeverity) { + this.jobResultIds = jobResultIds; + this.notifications = notifications; + this.signalMessage = signalMessage; + this.signalSeverity = signalSeverity; + this.unparsed |= !signalSeverity.isValid(); + } + + public ConvertJobResultsToSignalsAttributes id(String id) { + this.id = id; + return this; + } + + /** + * Request ID. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ConvertJobResultsToSignalsAttributes jobResultIds(List jobResultIds) { + this.jobResultIds = jobResultIds; + return this; + } + + public ConvertJobResultsToSignalsAttributes addJobResultIdsItem(String jobResultIdsItem) { + this.jobResultIds.add(jobResultIdsItem); + return this; + } + + /** + * Job result IDs. + * + * @return jobResultIds + */ + @JsonProperty(JSON_PROPERTY_JOB_RESULT_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getJobResultIds() { + return jobResultIds; + } + + public void setJobResultIds(List jobResultIds) { + this.jobResultIds = jobResultIds; + } + + public ConvertJobResultsToSignalsAttributes notifications(List notifications) { + this.notifications = notifications; + return this; + } + + public ConvertJobResultsToSignalsAttributes addNotificationsItem(String notificationsItem) { + this.notifications.add(notificationsItem); + return this; + } + + /** + * Notifications sent. + * + * @return notifications + */ + @JsonProperty(JSON_PROPERTY_NOTIFICATIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getNotifications() { + return notifications; + } + + public void setNotifications(List notifications) { + this.notifications = notifications; + } + + public ConvertJobResultsToSignalsAttributes signalMessage(String signalMessage) { + this.signalMessage = signalMessage; + return this; + } + + /** + * Message of generated signals. + * + * @return signalMessage + */ + @JsonProperty(JSON_PROPERTY_SIGNAL_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSignalMessage() { + return signalMessage; + } + + public void setSignalMessage(String signalMessage) { + this.signalMessage = signalMessage; + } + + public ConvertJobResultsToSignalsAttributes signalSeverity( + SecurityMonitoringRuleSeverity signalSeverity) { + this.signalSeverity = signalSeverity; + this.unparsed |= !signalSeverity.isValid(); + return this; + } + + /** + * Severity of the Security Signal. + * + * @return signalSeverity + */ + @JsonProperty(JSON_PROPERTY_SIGNAL_SEVERITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleSeverity getSignalSeverity() { + return signalSeverity; + } + + public void setSignalSeverity(SecurityMonitoringRuleSeverity signalSeverity) { + if (!signalSeverity.isValid()) { + this.unparsed = true; + } + this.signalSeverity = signalSeverity; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConvertJobResultsToSignalsAttributes + */ + @JsonAnySetter + public ConvertJobResultsToSignalsAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConvertJobResultsToSignalsAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConvertJobResultsToSignalsAttributes convertJobResultsToSignalsAttributes = + (ConvertJobResultsToSignalsAttributes) o; + return Objects.equals(this.id, convertJobResultsToSignalsAttributes.id) + && Objects.equals(this.jobResultIds, convertJobResultsToSignalsAttributes.jobResultIds) + && Objects.equals(this.notifications, convertJobResultsToSignalsAttributes.notifications) + && Objects.equals(this.signalMessage, convertJobResultsToSignalsAttributes.signalMessage) + && Objects.equals(this.signalSeverity, convertJobResultsToSignalsAttributes.signalSeverity) + && Objects.equals( + this.additionalProperties, convertJobResultsToSignalsAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + id, jobResultIds, notifications, signalMessage, signalSeverity, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConvertJobResultsToSignalsAttributes {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" jobResultIds: ").append(toIndentedString(jobResultIds)).append("\n"); + sb.append(" notifications: ").append(toIndentedString(notifications)).append("\n"); + sb.append(" signalMessage: ").append(toIndentedString(signalMessage)).append("\n"); + sb.append(" signalSeverity: ").append(toIndentedString(signalSeverity)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsData.java b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsData.java new file mode 100644 index 00000000000..e654c0f92bf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsData.java @@ -0,0 +1,172 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for converting historical job results to signals. */ +@JsonPropertyOrder({ + ConvertJobResultsToSignalsData.JSON_PROPERTY_ATTRIBUTES, + ConvertJobResultsToSignalsData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConvertJobResultsToSignalsData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ConvertJobResultsToSignalsAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ConvertJobResultsToSignalsDataType type; + + public ConvertJobResultsToSignalsData attributes( + ConvertJobResultsToSignalsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for converting historical job results to signals. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConvertJobResultsToSignalsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ConvertJobResultsToSignalsAttributes attributes) { + this.attributes = attributes; + } + + public ConvertJobResultsToSignalsData type(ConvertJobResultsToSignalsDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of payload. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConvertJobResultsToSignalsDataType getType() { + return type; + } + + public void setType(ConvertJobResultsToSignalsDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConvertJobResultsToSignalsData + */ + @JsonAnySetter + public ConvertJobResultsToSignalsData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConvertJobResultsToSignalsData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConvertJobResultsToSignalsData convertJobResultsToSignalsData = + (ConvertJobResultsToSignalsData) o; + return Objects.equals(this.attributes, convertJobResultsToSignalsData.attributes) + && Objects.equals(this.type, convertJobResultsToSignalsData.type) + && Objects.equals( + this.additionalProperties, convertJobResultsToSignalsData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConvertJobResultsToSignalsData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsDataType.java b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsDataType.java new file mode 100644 index 00000000000..53c340100fd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsDataType.java @@ -0,0 +1,60 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of payload. */ +@JsonSerialize( + using = ConvertJobResultsToSignalsDataType.ConvertJobResultsToSignalsDataTypeSerializer.class) +public class ConvertJobResultsToSignalsDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("historicalDetectionsJobResultSignalConversion")); + + public static final ConvertJobResultsToSignalsDataType + HISTORICALDETECTIONSJOBRESULTSIGNALCONVERSION = + new ConvertJobResultsToSignalsDataType("historicalDetectionsJobResultSignalConversion"); + + ConvertJobResultsToSignalsDataType(String value) { + super(value, allowedValues); + } + + public static class ConvertJobResultsToSignalsDataTypeSerializer + extends StdSerializer { + public ConvertJobResultsToSignalsDataTypeSerializer( + Class t) { + super(t); + } + + public ConvertJobResultsToSignalsDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ConvertJobResultsToSignalsDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ConvertJobResultsToSignalsDataType fromValue(String value) { + return new ConvertJobResultsToSignalsDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsRequest.java b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsRequest.java new file mode 100644 index 00000000000..0548bbbcab4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConvertJobResultsToSignalsRequest.java @@ -0,0 +1,138 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request for converting historical job results to signals. */ +@JsonPropertyOrder({ConvertJobResultsToSignalsRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConvertJobResultsToSignalsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ConvertJobResultsToSignalsData data; + + public ConvertJobResultsToSignalsRequest data(ConvertJobResultsToSignalsData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for converting historical job results to signals. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ConvertJobResultsToSignalsData getData() { + return data; + } + + public void setData(ConvertJobResultsToSignalsData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConvertJobResultsToSignalsRequest + */ + @JsonAnySetter + public ConvertJobResultsToSignalsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConvertJobResultsToSignalsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConvertJobResultsToSignalsRequest convertJobResultsToSignalsRequest = + (ConvertJobResultsToSignalsRequest) o; + return Objects.equals(this.data, convertJobResultsToSignalsRequest.data) + && Objects.equals( + this.additionalProperties, convertJobResultsToSignalsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConvertJobResultsToSignalsRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HistoricalJobDataType.java b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobDataType.java new file mode 100644 index 00000000000..b28fe5e04c8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobDataType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of payload. */ +@JsonSerialize(using = HistoricalJobDataType.HistoricalJobDataTypeSerializer.class) +public class HistoricalJobDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("historicalDetectionsJob")); + + public static final HistoricalJobDataType HISTORICALDETECTIONSJOB = + new HistoricalJobDataType("historicalDetectionsJob"); + + HistoricalJobDataType(String value) { + super(value, allowedValues); + } + + public static class HistoricalJobDataTypeSerializer extends StdSerializer { + public HistoricalJobDataTypeSerializer(Class t) { + super(t); + } + + public HistoricalJobDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + HistoricalJobDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static HistoricalJobDataType fromValue(String value) { + return new HistoricalJobDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HistoricalJobListMeta.java b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobListMeta.java new file mode 100644 index 00000000000..bee924be8a7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobListMeta.java @@ -0,0 +1,135 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Metadata about the list of jobs. */ +@JsonPropertyOrder({HistoricalJobListMeta.JSON_PROPERTY_TOTAL_COUNT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HistoricalJobListMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TOTAL_COUNT = "totalCount"; + private Integer totalCount; + + public HistoricalJobListMeta totalCount(Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Number of jobs in the list. maximum: 2147483647 + * + * @return totalCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return HistoricalJobListMeta + */ + @JsonAnySetter + public HistoricalJobListMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this HistoricalJobListMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HistoricalJobListMeta historicalJobListMeta = (HistoricalJobListMeta) o; + return Objects.equals(this.totalCount, historicalJobListMeta.totalCount) + && Objects.equals(this.additionalProperties, historicalJobListMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(totalCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HistoricalJobListMeta {\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponse.java b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponse.java new file mode 100644 index 00000000000..49ca926a6a2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponse.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Historical job response. */ +@JsonPropertyOrder({HistoricalJobResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HistoricalJobResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private HistoricalJobResponseData data; + + public HistoricalJobResponse data(HistoricalJobResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Historical job response data. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HistoricalJobResponseData getData() { + return data; + } + + public void setData(HistoricalJobResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return HistoricalJobResponse + */ + @JsonAnySetter + public HistoricalJobResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this HistoricalJobResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HistoricalJobResponse historicalJobResponse = (HistoricalJobResponse) o; + return Objects.equals(this.data, historicalJobResponse.data) + && Objects.equals(this.additionalProperties, historicalJobResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HistoricalJobResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseAttributes.java new file mode 100644 index 00000000000..3cc744fcb7c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseAttributes.java @@ -0,0 +1,338 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Historical job attributes. */ +@JsonPropertyOrder({ + HistoricalJobResponseAttributes.JSON_PROPERTY_CREATED_AT, + HistoricalJobResponseAttributes.JSON_PROPERTY_CREATED_BY_HANDLE, + HistoricalJobResponseAttributes.JSON_PROPERTY_CREATED_BY_NAME, + HistoricalJobResponseAttributes.JSON_PROPERTY_CREATED_FROM_RULE_ID, + HistoricalJobResponseAttributes.JSON_PROPERTY_JOB_DEFINITION, + HistoricalJobResponseAttributes.JSON_PROPERTY_JOB_NAME, + HistoricalJobResponseAttributes.JSON_PROPERTY_JOB_STATUS, + HistoricalJobResponseAttributes.JSON_PROPERTY_MODIFIED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HistoricalJobResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_CREATED_BY_HANDLE = "createdByHandle"; + private String createdByHandle; + + public static final String JSON_PROPERTY_CREATED_BY_NAME = "createdByName"; + private String createdByName; + + public static final String JSON_PROPERTY_CREATED_FROM_RULE_ID = "createdFromRuleId"; + private String createdFromRuleId; + + public static final String JSON_PROPERTY_JOB_DEFINITION = "jobDefinition"; + private JobDefinition jobDefinition; + + public static final String JSON_PROPERTY_JOB_NAME = "jobName"; + private String jobName; + + public static final String JSON_PROPERTY_JOB_STATUS = "jobStatus"; + private String jobStatus; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modifiedAt"; + private String modifiedAt; + + public HistoricalJobResponseAttributes createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Time when the job was created. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public HistoricalJobResponseAttributes createdByHandle(String createdByHandle) { + this.createdByHandle = createdByHandle; + return this; + } + + /** + * The handle of the user who created the job. + * + * @return createdByHandle + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY_HANDLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedByHandle() { + return createdByHandle; + } + + public void setCreatedByHandle(String createdByHandle) { + this.createdByHandle = createdByHandle; + } + + public HistoricalJobResponseAttributes createdByName(String createdByName) { + this.createdByName = createdByName; + return this; + } + + /** + * The name of the user who created the job. + * + * @return createdByName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedByName() { + return createdByName; + } + + public void setCreatedByName(String createdByName) { + this.createdByName = createdByName; + } + + public HistoricalJobResponseAttributes createdFromRuleId(String createdFromRuleId) { + this.createdFromRuleId = createdFromRuleId; + return this; + } + + /** + * ID of the rule used to create the job (if it is created from a rule). + * + * @return createdFromRuleId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_FROM_RULE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedFromRuleId() { + return createdFromRuleId; + } + + public void setCreatedFromRuleId(String createdFromRuleId) { + this.createdFromRuleId = createdFromRuleId; + } + + public HistoricalJobResponseAttributes jobDefinition(JobDefinition jobDefinition) { + this.jobDefinition = jobDefinition; + this.unparsed |= jobDefinition.unparsed; + return this; + } + + /** + * Definition of a historical job. + * + * @return jobDefinition + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_JOB_DEFINITION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JobDefinition getJobDefinition() { + return jobDefinition; + } + + public void setJobDefinition(JobDefinition jobDefinition) { + this.jobDefinition = jobDefinition; + } + + public HistoricalJobResponseAttributes jobName(String jobName) { + this.jobName = jobName; + return this; + } + + /** + * Job name. + * + * @return jobName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_JOB_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getJobName() { + return jobName; + } + + public void setJobName(String jobName) { + this.jobName = jobName; + } + + public HistoricalJobResponseAttributes jobStatus(String jobStatus) { + this.jobStatus = jobStatus; + return this; + } + + /** + * Job status. + * + * @return jobStatus + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_JOB_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public HistoricalJobResponseAttributes modifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * Last modification time of the job. + * + * @return modifiedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return HistoricalJobResponseAttributes + */ + @JsonAnySetter + public HistoricalJobResponseAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this HistoricalJobResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HistoricalJobResponseAttributes historicalJobResponseAttributes = + (HistoricalJobResponseAttributes) o; + return Objects.equals(this.createdAt, historicalJobResponseAttributes.createdAt) + && Objects.equals(this.createdByHandle, historicalJobResponseAttributes.createdByHandle) + && Objects.equals(this.createdByName, historicalJobResponseAttributes.createdByName) + && Objects.equals(this.createdFromRuleId, historicalJobResponseAttributes.createdFromRuleId) + && Objects.equals(this.jobDefinition, historicalJobResponseAttributes.jobDefinition) + && Objects.equals(this.jobName, historicalJobResponseAttributes.jobName) + && Objects.equals(this.jobStatus, historicalJobResponseAttributes.jobStatus) + && Objects.equals(this.modifiedAt, historicalJobResponseAttributes.modifiedAt) + && Objects.equals( + this.additionalProperties, historicalJobResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + createdByHandle, + createdByName, + createdFromRuleId, + jobDefinition, + jobName, + jobStatus, + modifiedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HistoricalJobResponseAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdByHandle: ").append(toIndentedString(createdByHandle)).append("\n"); + sb.append(" createdByName: ").append(toIndentedString(createdByName)).append("\n"); + sb.append(" createdFromRuleId: ").append(toIndentedString(createdFromRuleId)).append("\n"); + sb.append(" jobDefinition: ").append(toIndentedString(jobDefinition)).append("\n"); + sb.append(" jobName: ").append(toIndentedString(jobName)).append("\n"); + sb.append(" jobStatus: ").append(toIndentedString(jobStatus)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseData.java b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseData.java new file mode 100644 index 00000000000..bff7e52c787 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HistoricalJobResponseData.java @@ -0,0 +1,197 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Historical job response data. */ +@JsonPropertyOrder({ + HistoricalJobResponseData.JSON_PROPERTY_ATTRIBUTES, + HistoricalJobResponseData.JSON_PROPERTY_ID, + HistoricalJobResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HistoricalJobResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private HistoricalJobResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private HistoricalJobDataType type; + + public HistoricalJobResponseData attributes(HistoricalJobResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Historical job attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HistoricalJobResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(HistoricalJobResponseAttributes attributes) { + this.attributes = attributes; + } + + public HistoricalJobResponseData id(String id) { + this.id = id; + return this; + } + + /** + * ID of the job. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public HistoricalJobResponseData type(HistoricalJobDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of payload. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HistoricalJobDataType getType() { + return type; + } + + public void setType(HistoricalJobDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return HistoricalJobResponseData + */ + @JsonAnySetter + public HistoricalJobResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this HistoricalJobResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HistoricalJobResponseData historicalJobResponseData = (HistoricalJobResponseData) o; + return Objects.equals(this.attributes, historicalJobResponseData.attributes) + && Objects.equals(this.id, historicalJobResponseData.id) + && Objects.equals(this.type, historicalJobResponseData.type) + && Objects.equals( + this.additionalProperties, historicalJobResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HistoricalJobResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/JobCreateResponse.java b/src/main/java/com/datadog/api/client/v2/model/JobCreateResponse.java new file mode 100644 index 00000000000..e9050ef832c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/JobCreateResponse.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Run a historical job response. */ +@JsonPropertyOrder({JobCreateResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class JobCreateResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private JobCreateResponseData data; + + public JobCreateResponse data(JobCreateResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The definition of JobCreateResponseData object. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JobCreateResponseData getData() { + return data; + } + + public void setData(JobCreateResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return JobCreateResponse + */ + @JsonAnySetter + public JobCreateResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this JobCreateResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JobCreateResponse jobCreateResponse = (JobCreateResponse) o; + return Objects.equals(this.data, jobCreateResponse.data) + && Objects.equals(this.additionalProperties, jobCreateResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JobCreateResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/JobCreateResponseData.java b/src/main/java/com/datadog/api/client/v2/model/JobCreateResponseData.java new file mode 100644 index 00000000000..499853d544c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/JobCreateResponseData.java @@ -0,0 +1,168 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of JobCreateResponseData object. */ +@JsonPropertyOrder({ + JobCreateResponseData.JSON_PROPERTY_ID, + JobCreateResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class JobCreateResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private HistoricalJobDataType type; + + public JobCreateResponseData id(String id) { + this.id = id; + return this; + } + + /** + * ID of the created job. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public JobCreateResponseData type(HistoricalJobDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of payload. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HistoricalJobDataType getType() { + return type; + } + + public void setType(HistoricalJobDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return JobCreateResponseData + */ + @JsonAnySetter + public JobCreateResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this JobCreateResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JobCreateResponseData jobCreateResponseData = (JobCreateResponseData) o; + return Objects.equals(this.id, jobCreateResponseData.id) + && Objects.equals(this.type, jobCreateResponseData.type) + && Objects.equals(this.additionalProperties, jobCreateResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JobCreateResponseData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/JobDefinition.java b/src/main/java/com/datadog/api/client/v2/model/JobDefinition.java new file mode 100644 index 00000000000..68575ddd9ff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/JobDefinition.java @@ -0,0 +1,600 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Definition of a historical job. */ +@JsonPropertyOrder({ + JobDefinition.JSON_PROPERTY_CALCULATED_FIELDS, + JobDefinition.JSON_PROPERTY_CASES, + JobDefinition.JSON_PROPERTY_FILTERS, + JobDefinition.JSON_PROPERTY_FROM, + JobDefinition.JSON_PROPERTY_INDEX, + JobDefinition.JSON_PROPERTY_MESSAGE, + JobDefinition.JSON_PROPERTY_NAME, + JobDefinition.JSON_PROPERTY_OPTIONS, + JobDefinition.JSON_PROPERTY_QUERIES, + JobDefinition.JSON_PROPERTY_REFERENCE_TABLES, + JobDefinition.JSON_PROPERTY_TAGS, + JobDefinition.JSON_PROPERTY_THIRD_PARTY_CASES, + JobDefinition.JSON_PROPERTY_TO, + JobDefinition.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class JobDefinition { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CALCULATED_FIELDS = "calculatedFields"; + private List calculatedFields = null; + + public static final String JSON_PROPERTY_CASES = "cases"; + private List cases = new ArrayList<>(); + + public static final String JSON_PROPERTY_FILTERS = "filters"; + private List filters = null; + + public static final String JSON_PROPERTY_FROM = "from"; + private Long from; + + public static final String JSON_PROPERTY_INDEX = "index"; + private String index; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + private SecurityMonitoringRuleOptions options; + + public static final String JSON_PROPERTY_QUERIES = "queries"; + private List queries = new ArrayList<>(); + + public static final String JSON_PROPERTY_REFERENCE_TABLES = "referenceTables"; + private List referenceTables = null; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public static final String JSON_PROPERTY_THIRD_PARTY_CASES = "thirdPartyCases"; + private List thirdPartyCases = null; + + public static final String JSON_PROPERTY_TO = "to"; + private Long to; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public JobDefinition() {} + + @JsonCreator + public JobDefinition( + @JsonProperty(required = true, value = JSON_PROPERTY_CASES) + List cases, + @JsonProperty(required = true, value = JSON_PROPERTY_FROM) Long from, + @JsonProperty(required = true, value = JSON_PROPERTY_INDEX) String index, + @JsonProperty(required = true, value = JSON_PROPERTY_MESSAGE) String message, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERIES) + List queries, + @JsonProperty(required = true, value = JSON_PROPERTY_TO) Long to) { + this.cases = cases; + this.from = from; + this.index = index; + this.message = message; + this.name = name; + this.queries = queries; + this.to = to; + } + + public JobDefinition calculatedFields(List calculatedFields) { + this.calculatedFields = calculatedFields; + for (CalculatedField item : calculatedFields) { + this.unparsed |= item.unparsed; + } + return this; + } + + public JobDefinition addCalculatedFieldsItem(CalculatedField calculatedFieldsItem) { + if (this.calculatedFields == null) { + this.calculatedFields = new ArrayList<>(); + } + this.calculatedFields.add(calculatedFieldsItem); + this.unparsed |= calculatedFieldsItem.unparsed; + return this; + } + + /** + * Calculated fields. + * + * @return calculatedFields + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CALCULATED_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getCalculatedFields() { + return calculatedFields; + } + + public void setCalculatedFields(List calculatedFields) { + this.calculatedFields = calculatedFields; + } + + public JobDefinition cases(List cases) { + this.cases = cases; + for (SecurityMonitoringRuleCaseCreate item : cases) { + this.unparsed |= item.unparsed; + } + return this; + } + + public JobDefinition addCasesItem(SecurityMonitoringRuleCaseCreate casesItem) { + this.cases.add(casesItem); + this.unparsed |= casesItem.unparsed; + return this; + } + + /** + * Cases used for generating job results. + * + * @return cases + */ + @JsonProperty(JSON_PROPERTY_CASES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getCases() { + return cases; + } + + public void setCases(List cases) { + this.cases = cases; + } + + public JobDefinition filters(List filters) { + this.filters = filters; + for (SecurityMonitoringFilter item : filters) { + this.unparsed |= item.unparsed; + } + return this; + } + + public JobDefinition addFiltersItem(SecurityMonitoringFilter filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + this.unparsed |= filtersItem.unparsed; + return this; + } + + /** + * Additional queries to filter matched events before they are processed. This field is deprecated + * for log detection, signal correlation, and workload security rules. + * + * @return filters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFilters() { + return filters; + } + + public void setFilters(List filters) { + this.filters = filters; + } + + public JobDefinition from(Long from) { + this.from = from; + return this; + } + + /** + * Starting time of data analyzed by the job. + * + * @return from + */ + @JsonProperty(JSON_PROPERTY_FROM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getFrom() { + return from; + } + + public void setFrom(Long from) { + this.from = from; + } + + public JobDefinition index(String index) { + this.index = index; + return this; + } + + /** + * Index used to load the data. + * + * @return index + */ + @JsonProperty(JSON_PROPERTY_INDEX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + public JobDefinition message(String message) { + this.message = message; + return this; + } + + /** + * Message for generated results. + * + * @return message + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public JobDefinition name(String name) { + this.name = name; + return this; + } + + /** + * Job name. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public JobDefinition options(SecurityMonitoringRuleOptions options) { + this.options = options; + this.unparsed |= options.unparsed; + return this; + } + + /** + * Options on rules. + * + * @return options + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SecurityMonitoringRuleOptions getOptions() { + return options; + } + + public void setOptions(SecurityMonitoringRuleOptions options) { + this.options = options; + } + + public JobDefinition queries(List queries) { + this.queries = queries; + for (SecurityMonitoringStandardRuleQuery item : queries) { + this.unparsed |= item.unparsed; + } + return this; + } + + public JobDefinition addQueriesItem(SecurityMonitoringStandardRuleQuery queriesItem) { + this.queries.add(queriesItem); + this.unparsed |= queriesItem.unparsed; + return this; + } + + /** + * Queries for selecting logs analyzed by the job. + * + * @return queries + */ + @JsonProperty(JSON_PROPERTY_QUERIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getQueries() { + return queries; + } + + public void setQueries(List queries) { + this.queries = queries; + } + + public JobDefinition referenceTables(List referenceTables) { + this.referenceTables = referenceTables; + for (SecurityMonitoringReferenceTable item : referenceTables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public JobDefinition addReferenceTablesItem( + SecurityMonitoringReferenceTable referenceTablesItem) { + if (this.referenceTables == null) { + this.referenceTables = new ArrayList<>(); + } + this.referenceTables.add(referenceTablesItem); + this.unparsed |= referenceTablesItem.unparsed; + return this; + } + + /** + * Reference tables for the rule. + * + * @return referenceTables + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REFERENCE_TABLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getReferenceTables() { + return referenceTables; + } + + public void setReferenceTables(List referenceTables) { + this.referenceTables = referenceTables; + } + + public JobDefinition tags(List tags) { + this.tags = tags; + return this; + } + + public JobDefinition addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags for generated signals. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public JobDefinition thirdPartyCases( + List thirdPartyCases) { + this.thirdPartyCases = thirdPartyCases; + for (SecurityMonitoringThirdPartyRuleCaseCreate item : thirdPartyCases) { + this.unparsed |= item.unparsed; + } + return this; + } + + public JobDefinition addThirdPartyCasesItem( + SecurityMonitoringThirdPartyRuleCaseCreate thirdPartyCasesItem) { + if (this.thirdPartyCases == null) { + this.thirdPartyCases = new ArrayList<>(); + } + this.thirdPartyCases.add(thirdPartyCasesItem); + this.unparsed |= thirdPartyCasesItem.unparsed; + return this; + } + + /** + * Cases for generating results from third-party rules. Only available for third-party rules. + * + * @return thirdPartyCases + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_THIRD_PARTY_CASES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getThirdPartyCases() { + return thirdPartyCases; + } + + public void setThirdPartyCases(List thirdPartyCases) { + this.thirdPartyCases = thirdPartyCases; + } + + public JobDefinition to(Long to) { + this.to = to; + return this; + } + + /** + * Ending time of data analyzed by the job. + * + * @return to + */ + @JsonProperty(JSON_PROPERTY_TO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTo() { + return to; + } + + public void setTo(Long to) { + this.to = to; + } + + public JobDefinition type(String type) { + this.type = type; + return this; + } + + /** + * Job type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return JobDefinition + */ + @JsonAnySetter + public JobDefinition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this JobDefinition object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JobDefinition jobDefinition = (JobDefinition) o; + return Objects.equals(this.calculatedFields, jobDefinition.calculatedFields) + && Objects.equals(this.cases, jobDefinition.cases) + && Objects.equals(this.filters, jobDefinition.filters) + && Objects.equals(this.from, jobDefinition.from) + && Objects.equals(this.index, jobDefinition.index) + && Objects.equals(this.message, jobDefinition.message) + && Objects.equals(this.name, jobDefinition.name) + && Objects.equals(this.options, jobDefinition.options) + && Objects.equals(this.queries, jobDefinition.queries) + && Objects.equals(this.referenceTables, jobDefinition.referenceTables) + && Objects.equals(this.tags, jobDefinition.tags) + && Objects.equals(this.thirdPartyCases, jobDefinition.thirdPartyCases) + && Objects.equals(this.to, jobDefinition.to) + && Objects.equals(this.type, jobDefinition.type) + && Objects.equals(this.additionalProperties, jobDefinition.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + calculatedFields, + cases, + filters, + from, + index, + message, + name, + options, + queries, + referenceTables, + tags, + thirdPartyCases, + to, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JobDefinition {\n"); + sb.append(" calculatedFields: ").append(toIndentedString(calculatedFields)).append("\n"); + sb.append(" cases: ").append(toIndentedString(cases)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" queries: ").append(toIndentedString(queries)).append("\n"); + sb.append(" referenceTables: ").append(toIndentedString(referenceTables)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" thirdPartyCases: ").append(toIndentedString(thirdPartyCases)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/JobDefinitionFromRule.java b/src/main/java/com/datadog/api/client/v2/model/JobDefinitionFromRule.java new file mode 100644 index 00000000000..4cc15300fa1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/JobDefinitionFromRule.java @@ -0,0 +1,294 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Definition of a historical job based on a security monitoring rule. */ +@JsonPropertyOrder({ + JobDefinitionFromRule.JSON_PROPERTY_CASE_INDEX, + JobDefinitionFromRule.JSON_PROPERTY_FROM, + JobDefinitionFromRule.JSON_PROPERTY_ID, + JobDefinitionFromRule.JSON_PROPERTY_INDEX, + JobDefinitionFromRule.JSON_PROPERTY_NOTIFICATIONS, + JobDefinitionFromRule.JSON_PROPERTY_TO +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class JobDefinitionFromRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CASE_INDEX = "caseIndex"; + private Integer caseIndex; + + public static final String JSON_PROPERTY_FROM = "from"; + private Long from; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_INDEX = "index"; + private String index; + + public static final String JSON_PROPERTY_NOTIFICATIONS = "notifications"; + private List notifications = null; + + public static final String JSON_PROPERTY_TO = "to"; + private Long to; + + public JobDefinitionFromRule() {} + + @JsonCreator + public JobDefinitionFromRule( + @JsonProperty(required = true, value = JSON_PROPERTY_CASE_INDEX) Integer caseIndex, + @JsonProperty(required = true, value = JSON_PROPERTY_FROM) Long from, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_INDEX) String index, + @JsonProperty(required = true, value = JSON_PROPERTY_TO) Long to) { + this.caseIndex = caseIndex; + this.from = from; + this.id = id; + this.index = index; + this.to = to; + } + + public JobDefinitionFromRule caseIndex(Integer caseIndex) { + this.caseIndex = caseIndex; + return this; + } + + /** + * Index of the rule case applied by the job. maximum: 9 + * + * @return caseIndex + */ + @JsonProperty(JSON_PROPERTY_CASE_INDEX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getCaseIndex() { + return caseIndex; + } + + public void setCaseIndex(Integer caseIndex) { + this.caseIndex = caseIndex; + } + + public JobDefinitionFromRule from(Long from) { + this.from = from; + return this; + } + + /** + * Starting time of data analyzed by the job. + * + * @return from + */ + @JsonProperty(JSON_PROPERTY_FROM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getFrom() { + return from; + } + + public void setFrom(Long from) { + this.from = from; + } + + public JobDefinitionFromRule id(String id) { + this.id = id; + return this; + } + + /** + * ID of the detection rule used to create the job. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public JobDefinitionFromRule index(String index) { + this.index = index; + return this; + } + + /** + * Index used to load the data. + * + * @return index + */ + @JsonProperty(JSON_PROPERTY_INDEX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + public JobDefinitionFromRule notifications(List notifications) { + this.notifications = notifications; + return this; + } + + public JobDefinitionFromRule addNotificationsItem(String notificationsItem) { + if (this.notifications == null) { + this.notifications = new ArrayList<>(); + } + this.notifications.add(notificationsItem); + return this; + } + + /** + * Notifications sent when the job is completed. + * + * @return notifications + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOTIFICATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNotifications() { + return notifications; + } + + public void setNotifications(List notifications) { + this.notifications = notifications; + } + + public JobDefinitionFromRule to(Long to) { + this.to = to; + return this; + } + + /** + * Ending time of data analyzed by the job. + * + * @return to + */ + @JsonProperty(JSON_PROPERTY_TO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTo() { + return to; + } + + public void setTo(Long to) { + this.to = to; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return JobDefinitionFromRule + */ + @JsonAnySetter + public JobDefinitionFromRule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this JobDefinitionFromRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JobDefinitionFromRule jobDefinitionFromRule = (JobDefinitionFromRule) o; + return Objects.equals(this.caseIndex, jobDefinitionFromRule.caseIndex) + && Objects.equals(this.from, jobDefinitionFromRule.from) + && Objects.equals(this.id, jobDefinitionFromRule.id) + && Objects.equals(this.index, jobDefinitionFromRule.index) + && Objects.equals(this.notifications, jobDefinitionFromRule.notifications) + && Objects.equals(this.to, jobDefinitionFromRule.to) + && Objects.equals(this.additionalProperties, jobDefinitionFromRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(caseIndex, from, id, index, notifications, to, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JobDefinitionFromRule {\n"); + sb.append(" caseIndex: ").append(toIndentedString(caseIndex)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" notifications: ").append(toIndentedString(notifications)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ListHistoricalJobsResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListHistoricalJobsResponse.java new file mode 100644 index 00000000000..7feea15e2e7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListHistoricalJobsResponse.java @@ -0,0 +1,180 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** List of historical jobs. */ +@JsonPropertyOrder({ + ListHistoricalJobsResponse.JSON_PROPERTY_DATA, + ListHistoricalJobsResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListHistoricalJobsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private HistoricalJobListMeta meta; + + public ListHistoricalJobsResponse data(List data) { + this.data = data; + for (HistoricalJobResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListHistoricalJobsResponse addDataItem(HistoricalJobResponseData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array containing the list of historical jobs. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public ListHistoricalJobsResponse meta(HistoricalJobListMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata about the list of jobs. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HistoricalJobListMeta getMeta() { + return meta; + } + + public void setMeta(HistoricalJobListMeta meta) { + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ListHistoricalJobsResponse + */ + @JsonAnySetter + public ListHistoricalJobsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ListHistoricalJobsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListHistoricalJobsResponse listHistoricalJobsResponse = (ListHistoricalJobsResponse) o; + return Objects.equals(this.data, listHistoricalJobsResponse.data) + && Objects.equals(this.meta, listHistoricalJobsResponse.meta) + && Objects.equals( + this.additionalProperties, listHistoricalJobsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListHistoricalJobsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequest.java b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequest.java new file mode 100644 index 00000000000..c0346611bc8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequest.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Run a historical job request. */ +@JsonPropertyOrder({RunHistoricalJobRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RunHistoricalJobRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RunHistoricalJobRequestData data; + + public RunHistoricalJobRequest data(RunHistoricalJobRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for running a historical job request. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RunHistoricalJobRequestData getData() { + return data; + } + + public void setData(RunHistoricalJobRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RunHistoricalJobRequest + */ + @JsonAnySetter + public RunHistoricalJobRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RunHistoricalJobRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RunHistoricalJobRequest runHistoricalJobRequest = (RunHistoricalJobRequest) o; + return Objects.equals(this.data, runHistoricalJobRequest.data) + && Objects.equals(this.additionalProperties, runHistoricalJobRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RunHistoricalJobRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestAttributes.java new file mode 100644 index 00000000000..92f9dec4c2c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestAttributes.java @@ -0,0 +1,195 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Run a historical job request. */ +@JsonPropertyOrder({ + RunHistoricalJobRequestAttributes.JSON_PROPERTY_FROM_RULE, + RunHistoricalJobRequestAttributes.JSON_PROPERTY_ID, + RunHistoricalJobRequestAttributes.JSON_PROPERTY_JOB_DEFINITION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RunHistoricalJobRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FROM_RULE = "fromRule"; + private JobDefinitionFromRule fromRule; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_JOB_DEFINITION = "jobDefinition"; + private JobDefinition jobDefinition; + + public RunHistoricalJobRequestAttributes fromRule(JobDefinitionFromRule fromRule) { + this.fromRule = fromRule; + this.unparsed |= fromRule.unparsed; + return this; + } + + /** + * Definition of a historical job based on a security monitoring rule. + * + * @return fromRule + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FROM_RULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JobDefinitionFromRule getFromRule() { + return fromRule; + } + + public void setFromRule(JobDefinitionFromRule fromRule) { + this.fromRule = fromRule; + } + + public RunHistoricalJobRequestAttributes id(String id) { + this.id = id; + return this; + } + + /** + * Request ID. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RunHistoricalJobRequestAttributes jobDefinition(JobDefinition jobDefinition) { + this.jobDefinition = jobDefinition; + this.unparsed |= jobDefinition.unparsed; + return this; + } + + /** + * Definition of a historical job. + * + * @return jobDefinition + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_JOB_DEFINITION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JobDefinition getJobDefinition() { + return jobDefinition; + } + + public void setJobDefinition(JobDefinition jobDefinition) { + this.jobDefinition = jobDefinition; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RunHistoricalJobRequestAttributes + */ + @JsonAnySetter + public RunHistoricalJobRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RunHistoricalJobRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RunHistoricalJobRequestAttributes runHistoricalJobRequestAttributes = + (RunHistoricalJobRequestAttributes) o; + return Objects.equals(this.fromRule, runHistoricalJobRequestAttributes.fromRule) + && Objects.equals(this.id, runHistoricalJobRequestAttributes.id) + && Objects.equals(this.jobDefinition, runHistoricalJobRequestAttributes.jobDefinition) + && Objects.equals( + this.additionalProperties, runHistoricalJobRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(fromRule, id, jobDefinition, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RunHistoricalJobRequestAttributes {\n"); + sb.append(" fromRule: ").append(toIndentedString(fromRule)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" jobDefinition: ").append(toIndentedString(jobDefinition)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestData.java b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestData.java new file mode 100644 index 00000000000..8d0d2898694 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestData.java @@ -0,0 +1,170 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for running a historical job request. */ +@JsonPropertyOrder({ + RunHistoricalJobRequestData.JSON_PROPERTY_ATTRIBUTES, + RunHistoricalJobRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RunHistoricalJobRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RunHistoricalJobRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RunHistoricalJobRequestDataType type; + + public RunHistoricalJobRequestData attributes(RunHistoricalJobRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Run a historical job request. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RunHistoricalJobRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RunHistoricalJobRequestAttributes attributes) { + this.attributes = attributes; + } + + public RunHistoricalJobRequestData type(RunHistoricalJobRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of data. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RunHistoricalJobRequestDataType getType() { + return type; + } + + public void setType(RunHistoricalJobRequestDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RunHistoricalJobRequestData + */ + @JsonAnySetter + public RunHistoricalJobRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RunHistoricalJobRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RunHistoricalJobRequestData runHistoricalJobRequestData = (RunHistoricalJobRequestData) o; + return Objects.equals(this.attributes, runHistoricalJobRequestData.attributes) + && Objects.equals(this.type, runHistoricalJobRequestData.type) + && Objects.equals( + this.additionalProperties, runHistoricalJobRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RunHistoricalJobRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestDataType.java new file mode 100644 index 00000000000..f2d57771736 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RunHistoricalJobRequestDataType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of data. */ +@JsonSerialize( + using = RunHistoricalJobRequestDataType.RunHistoricalJobRequestDataTypeSerializer.class) +public class RunHistoricalJobRequestDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("historicalDetectionsJobCreate")); + + public static final RunHistoricalJobRequestDataType HISTORICALDETECTIONSJOBCREATE = + new RunHistoricalJobRequestDataType("historicalDetectionsJobCreate"); + + RunHistoricalJobRequestDataType(String value) { + super(value, allowedValues); + } + + public static class RunHistoricalJobRequestDataTypeSerializer + extends StdSerializer { + public RunHistoricalJobRequestDataTypeSerializer(Class t) { + super(t); + } + + public RunHistoricalJobRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + RunHistoricalJobRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RunHistoricalJobRequestDataType fromValue(String value) { + return new RunHistoricalJobRequestDataType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..bf92f15d9de --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:38.539Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.json new file mode 100644 index 00000000000..2f02af2ca25 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "PATCH", + "path": "/api/v2/siem-historical-detections/jobs/inva-lid/cancel", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"detail\":\"invalid jobId\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "9ee0d12d-c2a7-6c2c-4cd5-598af0680035" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..8bf8faeef38 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.006Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.json new file mode 100644 index 00000000000..53a0295200e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "PATCH", + "path": "/api/v2/siem-historical-detections/jobs/8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93/cancel", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"Job 8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93 was not found.\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "699b2b92-566c-9d92-69d6-d218f57402f8" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.freeze new file mode 100644 index 00000000000..8eee63f586c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.082Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.json new file mode 100644 index 00000000000..c86c865d392 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Cancel_a_historical_job_returns_OK_response.json @@ -0,0 +1,53 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"jobDefinition\":{\"cases\":[{\"condition\":\"a > 1\",\"name\":\"Condition 1\",\"notifications\":[],\"status\":\"info\"}],\"from\":1730387522611,\"index\":\"main\",\"message\":\"A large number of failed login attempts.\",\"name\":\"Excessive number of failed attempts.\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"query\":\"source:non_existing_src_weekend\"}],\"tags\":[],\"to\":1730387532611,\"type\":\"log_detection\"}},\"type\":\"historicalDetectionsJobCreate\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/siem-historical-detections/jobs", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"e332b07e-d573-45fa-b2df-9a1bcc27f17e\",\"type\":\"historicalDetectionsJob\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6bb82102-e994-f0d1-ee96-e1e3f1d81000" + }, + { + "httpRequest": { + "headers": {}, + "method": "PATCH", + "path": "/api/v2/siem-historical-detections/jobs/e332b07e-d573-45fa-b2df-9a1bcc27f17e/cancel", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "43cd9ba3-ae67-113c-4ab1-7f57b600ac37" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..b819957f316 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.280Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.json new file mode 100644 index 00000000000..f61957ebe35 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Convert_a_job_result_to_a_signal_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"jobResultIds\":[\"\"],\"notifications\":[\"\"],\"signalMessage\":\"A large number of failed login attempts.\",\"signalSeverity\":\"critical\"},\"type\":\"historicalDetectionsJobResultSignalConversion\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/siem-historical-detections/jobs/signal_convert", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Generic Error\",\"detail\":\"empty jobResultId provided\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0d4946af-2c85-586b-74dd-eb117a50a4a6" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..553556ed2e1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.371Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.json new file mode 100644 index 00000000000..dda6415382a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/siem-historical-detections/jobs/inva-lid", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Generic Error\",\"detail\":\"invalid jobId\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "74a52942-ee00-2479-0dc5-b284709530a7" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..e02fd6acb10 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.455Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.json new file mode 100644 index 00000000000..b3c30e07ee2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_existing_job_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/siem-historical-detections/jobs/8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"Job 8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93 was not found.\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "9e763f3f-ed9d-995a-c149-75ddbbeec6b1" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..14e96034851 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.538Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.json new file mode 100644 index 00000000000..2f8d99c79ce --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/siem-historical-detections/jobs/inva-lid", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"detail\":\"invalid jobId\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b91d3d2f-868f-0795-c35b-288e8f822892" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..5cc9a16c879 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.611Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.json new file mode 100644 index 00000000000..84ee65a4edb --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/siem-historical-detections/jobs/8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"Job 8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93 was not found.\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "30d26c2a-6439-71ca-9721-8f20041d2227" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.freeze new file mode 100644 index 00000000000..f25fc13ebb0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.695Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.json new file mode 100644 index 00000000000..ccdf3993914 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_job_s_details_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"jobDefinition\":{\"cases\":[{\"condition\":\"a > 1\",\"name\":\"Condition 1\",\"notifications\":[],\"status\":\"info\"}],\"from\":1730387522611,\"index\":\"main\",\"message\":\"A large number of failed login attempts.\",\"name\":\"Excessive number of failed attempts.\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"query\":\"source:non_existing_src_weekend\"}],\"tags\":[],\"to\":1730387532611,\"type\":\"log_detection\"}},\"type\":\"historicalDetectionsJobCreate\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/siem-historical-detections/jobs", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"f1753ed6-8c47-4168-9d6b-d11b9612fb3c\",\"type\":\"historicalDetectionsJob\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6bb82102-e994-f0d1-ee96-e1e3f1d80ffe" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/siem-historical-detections/jobs/f1753ed6-8c47-4168-9d6b-d11b9612fb3c", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"f1753ed6-8c47-4168-9d6b-d11b9612fb3c\",\"type\":\"historicalDetectionsJob\",\"attributes\":{\"createdAt\":\"2024-11-08 09:54:39.761792+00\",\"createdByHandle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"createdByName\":\"CI Account\",\"jobDefinition\":{\"from\":1730387522611,\"to\":1730387532611,\"index\":\"main\",\"name\":\"Excessive number of failed attempts.\",\"cases\":[{\"name\":\"Condition 1\",\"status\":\"info\",\"notifications\":[],\"condition\":\"a \\u003e 1\"}],\"queries\":[{\"query\":\"source:non_existing_src_weekend\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\"}],\"options\":{\"evaluationWindow\":900,\"detectionMethod\":\"threshold\",\"maxSignalDuration\":86400,\"keepAlive\":3600},\"message\":\"A large number of failed login attempts.\",\"tags\":[],\"type\":\"log_detection\",\"filters\":[]},\"jobName\":\"Excessive number of failed attempts.\",\"jobStatus\":\"pending\",\"modifiedAt\":\"2024-11-08 09:54:39.761792+00\"}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fd2565a2-df20-09de-f41e-c75cf6591662" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.freeze new file mode 100644 index 00000000000..b45a44cb78f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:39.932Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.json new file mode 100644 index 00000000000..b5f6efe4156 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_historical_jobs_returns_OK_response.json @@ -0,0 +1,63 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"jobDefinition\":{\"cases\":[{\"condition\":\"a > 1\",\"name\":\"Condition 1\",\"notifications\":[],\"status\":\"info\"}],\"from\":1730387522611,\"index\":\"main\",\"message\":\"A large number of failed login attempts.\",\"name\":\"Excessive number of failed attempts.\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"query\":\"source:non_existing_src_weekend\"}],\"tags\":[],\"to\":1730387532611,\"type\":\"log_detection\"}},\"type\":\"historicalDetectionsJobCreate\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/siem-historical-detections/jobs", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"34df4a54-9d84-4b4c-bc7e-0464d374ee19\",\"type\":\"historicalDetectionsJob\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6bb82102-e994-f0d1-ee96-e1e3f1d80fff" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/siem-historical-detections/jobs", + "queryStringParameters": { + "filter[query]": [ + "id:34df4a54-9d84-4b4c-bc7e-0464d374ee19" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"34df4a54-9d84-4b4c-bc7e-0464d374ee19\",\"type\":\"historicalDetectionsJob\",\"attributes\":{\"createdAt\":\"2024-11-08 09:54:40.000915+00\",\"createdByHandle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"createdByName\":\"CI Account\",\"jobDefinition\":{\"from\":1730387522611,\"to\":1730387532611,\"index\":\"main\",\"name\":\"Excessive number of failed attempts.\",\"cases\":[{\"name\":\"Condition 1\",\"status\":\"info\",\"notifications\":[],\"condition\":\"a \\u003e 1\"}],\"queries\":[{\"query\":\"source:non_existing_src_weekend\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\"}],\"options\":{\"evaluationWindow\":900,\"detectionMethod\":\"threshold\",\"maxSignalDuration\":86400,\"keepAlive\":3600},\"message\":\"A large number of failed login attempts.\",\"tags\":[],\"type\":\"log_detection\",\"filters\":[]},\"jobName\":\"Excessive number of failed attempts.\",\"jobStatus\":\"pending\",\"modifiedAt\":\"2024-11-08 09:54:40.000915+00\"}}],\"meta\":{\"totalCount\":1}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3de0815b-9a4e-5dcb-86f2-d0ef4a3c963f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..9720094d000 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:40.114Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.json new file mode 100644 index 00000000000..4b01ce56c3f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"jobDefinition\":{\"cases\":[{\"condition\":\"a > 1\",\"name\":\"Condition 1\",\"notifications\":[],\"status\":\"info\"}],\"from\":1730387522611,\"index\":\"non_existing_index\",\"message\":\"A large number of failed login attempts.\",\"name\":\"Excessive number of failed attempts.\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"query\":\"source:non_existing_src_weekend\"}],\"tags\":[],\"to\":1730391122611,\"type\":\"log_detection\"}},\"type\":\"historicalDetectionsJobCreate\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/siem-historical-detections/jobs", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"input_validation_error(Field 'index' is invalid: Invalid index): Index must exist\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d6c37d4c-15bf-d57c-afed-ccbe43952e41" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..ee3fdb952b3 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:40.192Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.json new file mode 100644 index 00000000000..a332bfe5b52 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"fromRule\":{\"caseIndex\":0,\"from\":1730201035064,\"id\":\"non-existng\",\"index\":\"main\",\"notifications\":[],\"to\":1730204635115}},\"type\":\"historicalDetectionsJobCreate\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/siem-historical-detections/jobs", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"detail\":\"failed to get rule details\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8056350d-00d9-df6e-525e-771fe22b1354" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.freeze b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.freeze new file mode 100644 index 00000000000..3e9fdecb999 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.freeze @@ -0,0 +1 @@ +2024-11-08T09:54:40.272Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.json b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.json new file mode 100644 index 00000000000..ed6acb6cfaa --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Run_a_historical_job_returns_Status_created_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"jobDefinition\":{\"cases\":[{\"condition\":\"a > 1\",\"name\":\"Condition 1\",\"notifications\":[],\"status\":\"info\"}],\"from\":1730387522611,\"index\":\"main\",\"message\":\"A large number of failed login attempts.\",\"name\":\"Excessive number of failed attempts.\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"query\":\"source:non_existing_src_weekend\"}],\"tags\":[],\"to\":1730387532611,\"type\":\"log_detection\"}},\"type\":\"historicalDetectionsJobCreate\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/siem-historical-detections/jobs", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"6f4c9c40-782b-4d14-900f-65ccc02389db\",\"type\":\"historicalDetectionsJob\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6bb82102-e994-f0d1-ee96-e1e3f1d80ffd" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index d5a158b247b..6271eb23f01 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -649,6 +649,18 @@ "tag": "Service Definition", "operationId": "CreateOrUpdateServiceDefinitions" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"historicalDetectionsJobCreate\",\n \"attributes\": {\n \"jobDefinition\": {\n \"type\": \"log_detection\",\n \"name\": \"Excessive number of failed attempts.\",\n \"queries\": [\n {\n \"query\": \"source:non_existing_src_weekend\",\n \"aggregation\": \"count\",\n \"groupByFields\": [],\n \"distinctFields\": []\n }\n ],\n \"cases\": [\n {\n \"name\": \"Condition 1\",\n \"status\": \"info\",\n \"notifications\": [],\n \"condition\": \"a > 1\"\n }\n ],\n \"options\": {\n \"keepAlive\": 3600,\n \"maxSignalDuration\": 86400,\n \"evaluationWindow\": 900\n },\n \"message\": \"A large number of failed login attempts.\",\n \"tags\": [],\n \"from\": 1730387522611,\n \"to\": 1730387532611,\n \"index\": \"main\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"historical_job\" in the system", + "key": "historical_job", + "tag": "Security Monitoring", + "operationId": "RunHistoricalJob" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index 901edb86b49..a2d77f04939 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature @@ -9,6 +9,40 @@ Feature: Security Monitoring And a valid "appKeyAuth" key in the system And an instance of "SecurityMonitoring" API + @team:DataDog/k9-cloud-security-platform + Scenario: Cancel a historical job returns "Bad Request" response + Given operation "CancelHistoricalJob" enabled + And new "CancelHistoricalJob" request + And request contains "job_id" parameter with value "inva-lid" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Cancel a historical job returns "Conflict" response + Given operation "CancelHistoricalJob" enabled + And new "CancelHistoricalJob" request + And request contains "job_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/k9-cloud-security-platform + Scenario: Cancel a historical job returns "Not Found" response + Given operation "CancelHistoricalJob" enabled + And new "CancelHistoricalJob" request + And request contains "job_id" parameter with value "8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-cloud-security-platform + Scenario: Cancel a historical job returns "OK" response + Given operation "CancelHistoricalJob" enabled + And operation "RunHistoricalJob" enabled + And new "CancelHistoricalJob" request + And there is a valid "historical_job" in the system + And request contains "job_id" parameter from "historical_job.data.id" + When the request is sent + Then the response status is 204 No Content + @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Change the related incidents of a security signal returns "Bad Request" response Given new "EditSecurityMonitoringSignalIncidents" request @@ -57,6 +91,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform + Scenario: Convert a job result to a signal returns "Bad Request" response + Given operation "ConvertJobResultToSignal" enabled + And new "ConvertJobResultToSignal" request + And body with value {"data": {"attributes": {"jobResultIds": [""], "notifications": [""], "signalMessage": "A large number of failed login attempts.", "signalSeverity": "critical"}, "type": "historicalDetectionsJobResultSignalConversion"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Convert a job result to a signal returns "Not Found" response + Given operation "ConvertJobResultToSignal" enabled + And new "ConvertJobResultToSignal" request + And body with value {"data": {"attributes": {"jobResultIds": [""], "notifications": [""], "signalMessage": "A large number of failed login attempts.", "signalSeverity": "critical"}, "type": "historicalDetectionsJobResultSignalConversion"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Convert a job result to a signal returns "OK" response + Given operation "ConvertJobResultToSignal" enabled + And new "ConvertJobResultToSignal" request + And body with value {"data": {"attributes": {"jobResultIds": [""], "notifications": [""], "signalMessage": "A large number of failed login attempts.", "signalSeverity": "critical"}, "type": "historicalDetectionsJobResultSignalConversion"}} + When the request is sent + Then the response status is 204 OK + @skip @team:DataDog/k9-cloud-security-platform Scenario: Convert a rule from JSON to Terraform returns "Bad Request" response Given new "ConvertSecurityMonitoringRuleFromJSONToTerraform" request @@ -282,6 +340,38 @@ Feature: Security Monitoring When the request is sent Then the response status is 204 OK + @team:DataDog/k9-cloud-security-platform + Scenario: Delete an existing job returns "Bad Request" response + Given operation "DeleteHistoricalJob" enabled + And new "DeleteHistoricalJob" request + And request contains "job_id" parameter with value "inva-lid" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Delete an existing job returns "Conflict" response + Given operation "DeleteHistoricalJob" enabled + And new "DeleteHistoricalJob" request + And request contains "job_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/k9-cloud-security-platform + Scenario: Delete an existing job returns "Not Found" response + Given operation "DeleteHistoricalJob" enabled + And new "DeleteHistoricalJob" request + And request contains "job_id" parameter with value "8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Delete an existing job returns "OK" response + Given operation "DeleteHistoricalJob" enabled + And new "DeleteHistoricalJob" request + And request contains "job_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Delete an existing rule returns "Not Found" response Given new "DeleteSecurityMonitoringRule" request @@ -332,6 +422,32 @@ Feature: Security Monitoring Then the response status is 200 OK And the response "data.attributes.evaluation" is equal to "pass" + @team:DataDog/k9-cloud-security-platform + Scenario: Get a job's details returns "Bad Request" response + Given operation "GetHistoricalJob" enabled + And new "GetHistoricalJob" request + And request contains "job_id" parameter with value "inva-lid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-cloud-security-platform + Scenario: Get a job's details returns "Not Found" response + Given operation "GetHistoricalJob" enabled + And new "GetHistoricalJob" request + And request contains "job_id" parameter with value "8e2a37fb-b0c8-4761-a7f0-0a8d6a98ba93" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-cloud-security-platform + Scenario: Get a job's details returns "OK" response + Given operation "GetHistoricalJob" enabled + And operation "RunHistoricalJob" enabled + And new "GetHistoricalJob" request + And there is a valid "historical_job" in the system + And request contains "job_id" parameter from "historical_job.data.id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Get a list of security signals returns "Bad Request" response Given new "SearchSecurityMonitoringSignals" request @@ -493,6 +609,23 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: List historical jobs returns "Bad Request" response + Given operation "ListHistoricalJobs" enabled + And new "ListHistoricalJobs" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-cloud-security-platform + Scenario: List historical jobs returns "OK" response + Given operation "ListHistoricalJobs" enabled + And operation "RunHistoricalJob" enabled + And new "ListHistoricalJobs" request + And there is a valid "historical_job" in the system + And request contains "filter[query]" parameter with value "id:{{historical_job.data.id}}" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: List rules returns "Bad Request" response Given new "ListSecurityMonitoringRules" request @@ -561,6 +694,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform + Scenario: Run a historical job returns "Bad Request" response + Given operation "RunHistoricalJob" enabled + And new "RunHistoricalJob" request + And body with value {"data":{"type":"historicalDetectionsJobCreate","attributes":{"jobDefinition":{"type":"log_detection","name":"Excessive number of failed attempts.","queries":[{"query":"source:non_existing_src_weekend","aggregation":"count","groupByFields":[],"distinctFields":[]}],"cases":[{"name":"Condition 1","status":"info","notifications":[],"condition":"a > 1"}],"options":{"keepAlive":3600,"maxSignalDuration":86400,"evaluationWindow":900},"message":"A large number of failed login attempts.","tags":[],"from":1730387522611,"to":1730391122611,"index":"non_existing_index"}}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-cloud-security-platform + Scenario: Run a historical job returns "Not Found" response + Given operation "RunHistoricalJob" enabled + And new "RunHistoricalJob" request + And body with value {"data": { "type": "historicalDetectionsJobCreate", "attributes": {"fromRule": {"caseIndex": 0, "from": 1730201035064, "id": "non-existng", "index": "main", "notifications": [], "to": 1730204635115}}}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-cloud-security-platform + Scenario: Run a historical job returns "Status created" response + Given operation "RunHistoricalJob" enabled + And new "RunHistoricalJob" request + And body with value {"data":{"type":"historicalDetectionsJobCreate","attributes":{"jobDefinition":{"type":"log_detection","name":"Excessive number of failed attempts.","queries":[{"query":"source:non_existing_src_weekend","aggregation":"count","groupByFields":[],"distinctFields":[]}],"cases":[{"name":"Condition 1","status":"info","notifications":[],"condition":"a > 1"}],"options":{"keepAlive":3600,"maxSignalDuration":86400,"evaluationWindow":900},"message":"A large number of failed login attempts.","tags":[],"from":1730387522611,"to":1730387532611,"index":"main"}}}} + When the request is sent + Then the response status is 201 Status created + @skip @team:DataDog/k9-cloud-security-platform Scenario: Test a rule returns "Bad Request" response Given new "TestSecurityMonitoringRule" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 81c6a29e22c..0e2a5942a9d 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -2272,6 +2272,42 @@ "type": "idempotent" } }, + "ListHistoricalJobs": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "RunHistoricalJob": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "ConvertJobResultToSignal": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "DeleteHistoricalJob": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "GetHistoricalJob": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "CancelHistoricalJob": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "CreateSLOReportJob": { "tag": "Service Level Objectives", "undo": {