From 1c5e05722f3a5a2bf046659efb449bb16ecf10b6 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 4 Aug 2026 16:41:31 +0000 Subject: [PATCH] Regenerate client from commit a6fd146 of spec repo --- .generator/schemas/v2/openapi.yaml | 686 ++++++++++++++++++ ...the-severity-modifier-rule-response.frozen | 1 + ...ed-the-severity-modifier-rule-response.yml | 47 ++ ...-Rule-successfully-deleted-response.frozen | 1 + ...rns-Rule-successfully-deleted-response.yml | 61 ++ ...the-severity-modifier-rule-response.frozen | 1 + ...ed-the-severity-modifier-rule-response.yml | 62 ++ ...of-severity-modifier-rules-response.frozen | 1 + ...st-of-severity-modifier-rules-response.yml | 62 ++ ...he-severity-modifier-rules-response.frozen | 1 + ...d-the-severity-modifier-rules-response.yml | 64 ++ ...the-severity-modifier-rule-response.frozen | 1 + ...ed-the-severity-modifier-rule-response.yml | 71 ++ ...yFindingsAutomationSeverityModifierRule.rb | 29 + ...yFindingsAutomationSeverityModifierRule.rb | 11 + ...yFindingsAutomationSeverityModifierRule.rb | 11 + ...FindingsAutomationSeverityModifierRules.rb | 8 + ...FindingsAutomationSeverityModifierRules.rb | 20 + ...yFindingsAutomationSeverityModifierRule.rb | 32 + features/scenarios_model_mapping.rb | 20 + features/v2/given.json | 12 + features/v2/security_monitoring.feature | 131 ++++ features/v2/undo.json | 43 ++ lib/datadog_api_client/configuration.rb | 6 + lib/datadog_api_client/inflector.rb | 18 + .../v2/api/security_monitoring_api.rb | 445 ++++++++++++ .../models/severity_modifier_rule_action.rb | 67 ++ ...everity_modifier_rule_attributes_create.rb | 187 +++++ ...erity_modifier_rule_attributes_response.rb | 282 +++++++ .../severity_modifier_rule_create_request.rb | 123 ++++ .../severity_modifier_rule_data_create.rb | 144 ++++ .../severity_modifier_rule_data_response.rb | 165 +++++ .../severity_modifier_rule_reorder_item.rb | 144 ++++ .../severity_modifier_rule_reorder_request.rb | 125 ++++ .../models/severity_modifier_rule_response.rb | 123 ++++ .../severity_modifier_rule_set_action.rb | 165 +++++ .../severity_modifier_rule_set_action_type.rb | 26 + .../severity_modifier_rule_shift_action.rb | 165 +++++ ...everity_modifier_rule_shift_action_type.rb | 26 + .../v2/models/severity_modifier_rule_type.rb | 26 + .../severity_modifier_rule_update_request.rb | 123 ++++ .../severity_modifier_rules_response.rb | 167 +++++ .../v2/models/severity_modifier_severity.rb | 30 + .../severity_modifier_severity_delta.rb | 27 + 44 files changed, 3960 insertions(+) create mode 100644 cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.yml create mode 100644 examples/v2/security-monitoring/CreateSecurityFindingsAutomationSeverityModifierRule.rb create mode 100644 examples/v2/security-monitoring/DeleteSecurityFindingsAutomationSeverityModifierRule.rb create mode 100644 examples/v2/security-monitoring/GetSecurityFindingsAutomationSeverityModifierRule.rb create mode 100644 examples/v2/security-monitoring/ListSecurityFindingsAutomationSeverityModifierRules.rb create mode 100644 examples/v2/security-monitoring/ReorderSecurityFindingsAutomationSeverityModifierRules.rb create mode 100644 examples/v2/security-monitoring/UpdateSecurityFindingsAutomationSeverityModifierRule.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_action.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_create.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_response.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_data_create.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_data_response.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_item.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_request.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_response.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_set_action.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_set_action_type.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action_type.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_type.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rule_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_rules_response.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_severity.rb create mode 100644 lib/datadog_api_client/v2/models/severity_modifier_severity_delta.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d8f50ea93052..01c9954ae327 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -100798,6 +100798,259 @@ components: required: - type type: object + SeverityModifierRuleAction: + description: |- + The action to take when a severity modifier rule matches a finding. This is a discriminated union on `type`: `set` assigns a fixed severity, while `shift` moves the severity up or down by one rank. + + A severity modifier rule's `rule.query` must not filter on `@severity` or on the `@severity_details.user_adjusted.*` namespace. + + Use `@severity_details.adjusted.value` instead, which reflects the severity before user-defined adjustments. + oneOf: + - $ref: "#/components/schemas/SeverityModifierRuleSetAction" + - $ref: "#/components/schemas/SeverityModifierRuleShiftAction" + SeverityModifierRuleAttributesCreate: + description: Attributes for creating or updating a severity modifier rule. + properties: + action: + $ref: "#/components/schemas/SeverityModifierRuleAction" + enabled: + description: Whether the severity modifier rule is enabled. + example: true + type: boolean + name: + description: The name of the severity modifier rule. + example: "Downgrade misconfigurations in dev" + maxLength: 255 + minLength: 1 + type: string + rule: + $ref: "#/components/schemas/AutomationRuleScope" + required: + - name + - rule + - action + type: object + SeverityModifierRuleAttributesResponse: + description: Attributes of a severity modifier rule as returned by the API. + properties: + action: + $ref: "#/components/schemas/SeverityModifierRuleAction" + created_at: + description: The Unix timestamp in milliseconds when the rule was created. + example: 1722439510282 + format: int64 + type: integer + created_by: + $ref: "#/components/schemas/AutomationRuleCreatedBy" + enabled: + description: Whether the severity modifier rule is enabled. + example: true + type: boolean + modified_at: + description: The Unix timestamp in milliseconds when the rule was last modified. + example: 1722439510282 + format: int64 + type: integer + modified_by: + $ref: "#/components/schemas/AutomationRuleModifiedBy" + name: + description: The name of the severity modifier rule. + example: "Downgrade misconfigurations in dev" + maxLength: 255 + minLength: 1 + type: string + rule: + $ref: "#/components/schemas/AutomationRuleScope" + required: + - name + - enabled + - rule + - action + - created_at + - created_by + - modified_at + - modified_by + type: object + SeverityModifierRuleCreateRequest: + description: The body of a severity modifier rule create request. + properties: + data: + $ref: "#/components/schemas/SeverityModifierRuleDataCreate" + required: + - data + type: object + SeverityModifierRuleDataCreate: + description: The data object for a severity modifier rule create or update request. + properties: + attributes: + $ref: "#/components/schemas/SeverityModifierRuleAttributesCreate" + type: + $ref: "#/components/schemas/SeverityModifierRuleType" + required: + - type + - attributes + type: object + SeverityModifierRuleDataResponse: + description: The data object for a severity modifier rule as returned by the API. + properties: + attributes: + $ref: "#/components/schemas/SeverityModifierRuleAttributesResponse" + id: + description: The ID of the severity modifier rule. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + type: + $ref: "#/components/schemas/SeverityModifierRuleType" + required: + - id + - type + - attributes + type: object + SeverityModifierRuleReorderData: + description: The ordered list of severity modifier rules; every rule must be included. + items: + $ref: "#/components/schemas/SeverityModifierRuleReorderItem" + type: array + SeverityModifierRuleReorderItem: + description: A reference to a severity modifier rule used for reordering. + properties: + id: + description: The ID of the automation rule. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + type: + $ref: "#/components/schemas/SeverityModifierRuleType" + required: + - type + - id + type: object + SeverityModifierRuleReorderRequest: + description: The body of a severity modifier rule reorder request. + properties: + data: + $ref: "#/components/schemas/SeverityModifierRuleReorderData" + required: + - data + type: object + SeverityModifierRuleResponse: + description: A single severity modifier rule response. + properties: + data: + $ref: "#/components/schemas/SeverityModifierRuleDataResponse" + required: + - data + type: object + SeverityModifierRuleSetAction: + description: Sets matched findings to a fixed severity. + properties: + description: + description: An optional free-form explanation for the severity change. + example: "Lower severity for dev environment noise" + maxLength: 20000 + type: string + severity: + $ref: "#/components/schemas/SeverityModifierSeverity" + type: + $ref: "#/components/schemas/SeverityModifierRuleSetActionType" + required: + - type + - severity + type: object + SeverityModifierRuleSetActionType: + description: The type of a severity modifier rule action that sets a fixed severity. + enum: + - set + example: set + type: string + x-enum-varnames: + - SET + SeverityModifierRuleShiftAction: + description: Shifts matched findings up or down by one severity rank. + properties: + description: + description: An optional free-form explanation for the severity change. + example: "Lower severity for dev environment noise" + maxLength: 20000 + type: string + severity_delta: + $ref: "#/components/schemas/SeverityModifierSeverityDelta" + type: + $ref: "#/components/schemas/SeverityModifierRuleShiftActionType" + required: + - type + - severity_delta + type: object + SeverityModifierRuleShiftActionType: + description: The type of a severity modifier rule action that shifts the severity by one rank. + enum: + - shift + example: shift + type: string + x-enum-varnames: + - SHIFT + SeverityModifierRuleType: + description: The JSON:API type for severity modifier rules. + enum: + - severity_modifier_rules + example: severity_modifier_rules + type: string + x-enum-varnames: + - SEVERITY_MODIFIER_RULES + SeverityModifierRuleUpdateRequest: + description: The body of a severity modifier rule update request. + properties: + data: + $ref: "#/components/schemas/SeverityModifierRuleDataCreate" + required: + - data + type: object + SeverityModifierRulesDataList: + description: A list of severity modifier rule data objects. + items: + $ref: "#/components/schemas/SeverityModifierRuleDataResponse" + type: array + SeverityModifierRulesResponse: + description: A list of severity modifier rules with pagination metadata. + properties: + data: + $ref: "#/components/schemas/SeverityModifierRulesDataList" + links: + $ref: "#/components/schemas/SecurityAutomationRulesLinks" + meta: + $ref: "#/components/schemas/SecurityAutomationRulesMeta" + required: + - data + - meta + - links + type: object + SeverityModifierSeverity: + description: The severity to assign to matched findings. `info_none` is not supported for the `iac_misconfiguration`, `runtime_code_vulnerability`, `secret`, or `static_code_vulnerability` finding types. + enum: + - info_none + - low + - medium + - high + - critical + example: low + type: string + x-enum-varnames: + - INFO_NONE + - LOW + - MEDIUM + - HIGH + - CRITICAL + SeverityModifierSeverityDelta: + description: The direction in which to shift the severity of matched findings by one rank. + enum: + - up_one + - down_one + example: up_one + type: string + x-enum-varnames: + - UP_ONE + - DOWN_ONE SharedDashboardGlobalTime: additionalProperties: {} description: Default time range configuration for the shared dashboard. @@ -185952,6 +186205,439 @@ paths: x-unstable: |- **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/security/findings/automation/severity_modifier_rules: + get: + description: Get all severity modifier rules for the current organization. + operationId: ListSecurityFindingsAutomationSeverityModifierRules + parameters: + - description: The number of rules per page. Maximum is 1000. + in: query + name: page[size] + required: false + schema: + default: 1000 + example: 10 + format: int64 + maximum: 1000 + minimum: 1 + type: integer + - description: The page number to return. + in: query + name: page[number] + required: false + schema: + default: 0 + example: 0 + format: int64 + minimum: 0 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + action: + description: "Lower severity for dev environment noise" + severity: low + type: set + created_at: 1722439510282 + created_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + enabled: true + modified_at: 1722439510282 + modified_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + name: "Downgrade misconfigurations in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + id: "00000000-0000-0000-0000-000000000000" + type: severity_modifier_rules + links: + first: "/api/v2/security/findings/automation/severity_modifier_rules?page[size]=1000&page[number]=0" + last: "/api/v2/security/findings/automation/severity_modifier_rules?page[size]=1000&page[number]=0" + meta: + page: + total_filtered_count: 1 + schema: + $ref: "#/components/schemas/SeverityModifierRulesResponse" + description: Successfully retrieved the list of severity modifier rules + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get all severity modifier rules + tags: + - Security Monitoring + x-permission: + operator: OR + permissions: + - security_pipelines_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a new severity modifier rule for the current organization. + operationId: CreateSecurityFindingsAutomationSeverityModifierRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + description: "Lower severity for dev environment noise" + severity: low + type: set + enabled: true + name: "Downgrade misconfigurations in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + type: severity_modifier_rules + schema: + $ref: "#/components/schemas/SeverityModifierRuleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + description: "Lower severity for dev environment noise" + severity: low + type: set + created_at: 1722439510282 + created_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + enabled: true + modified_at: 1722439510282 + modified_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + name: "Downgrade misconfigurations in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + id: "00000000-0000-0000-0000-000000000000" + type: severity_modifier_rules + schema: + $ref: "#/components/schemas/SeverityModifierRuleResponse" + description: Successfully created the severity modifier rule + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/ForbiddenResponse" + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unprocessable Entity + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a severity modifier rule + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_pipelines_write + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/security/findings/automation/severity_modifier_rules/reorder: + post: + description: Reorder the list of severity modifier rules for the current organization. + operationId: ReorderSecurityFindingsAutomationSeverityModifierRules + requestBody: + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: severity_modifier_rules + - id: "11111111-1111-1111-1111-111111111111" + type: severity_modifier_rules + schema: + $ref: "#/components/schemas/SeverityModifierRuleReorderRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: severity_modifier_rules + - id: "11111111-1111-1111-1111-111111111111" + type: severity_modifier_rules + schema: + $ref: "#/components/schemas/SeverityModifierRuleReorderRequest" + description: Successfully reordered the severity modifier rules + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/ForbiddenResponse" + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unprocessable Entity + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Reorder severity modifier rules + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_pipelines_write + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/security/findings/automation/severity_modifier_rules/{rule_id}: + delete: + description: Delete an existing severity modifier rule by ID. + operationId: DeleteSecurityFindingsAutomationSeverityModifierRule + parameters: + - description: The ID of the severity modifier rule. + in: path + name: rule_id + required: true + schema: + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + responses: + "204": + description: "Rule successfully deleted." + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a severity modifier rule + tags: + - Security Monitoring + x-permission: + operator: OR + permissions: + - security_pipelines_write + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get the details of a severity modifier rule by ID. + operationId: GetSecurityFindingsAutomationSeverityModifierRule + parameters: + - description: The ID of the severity modifier rule. + in: path + name: rule_id + required: true + schema: + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + description: "Lower severity for dev environment noise" + severity: low + type: set + created_at: 1722439510282 + created_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + enabled: true + modified_at: 1722439510282 + modified_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + name: "Downgrade misconfigurations in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + id: "00000000-0000-0000-0000-000000000000" + type: severity_modifier_rules + schema: + $ref: "#/components/schemas/SeverityModifierRuleResponse" + description: Successfully retrieved the severity modifier rule + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a severity modifier rule + tags: + - Security Monitoring + x-permission: + operator: OR + permissions: + - security_pipelines_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + put: + description: Update an existing severity modifier rule by ID. + operationId: UpdateSecurityFindingsAutomationSeverityModifierRule + parameters: + - description: The ID of the severity modifier rule. + in: path + name: rule_id + required: true + schema: + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + severity_delta: down_one + type: shift + enabled: false + name: "Downgrade misconfigurations in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + type: severity_modifier_rules + schema: + $ref: "#/components/schemas/SeverityModifierRuleUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + severity_delta: down_one + type: shift + created_at: 1722439510282 + created_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + enabled: false + modified_at: 1722439510999 + modified_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + name: "Downgrade misconfigurations in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + id: "00000000-0000-0000-0000-000000000000" + type: severity_modifier_rules + schema: + $ref: "#/components/schemas/SeverityModifierRuleResponse" + description: Successfully updated the severity modifier rule + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unprocessable Entity + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update a severity modifier rule + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_pipelines_write + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/security/findings/automation/ticket_creation_rules: get: description: Get all ticket creation rules for the current organization. diff --git a/cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.frozen b/cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.frozen new file mode 100644 index 000000000000..cfbb5151e21d --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.frozen @@ -0,0 +1 @@ +2026-08-04T14:46:55.903Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.yml b/cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.yml new file mode 100644 index 000000000000..2f0b02cb8698 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Create-a-severity-modifier-rule-returns-Successfully-created-the-severity-modifier-rule-response.yml @@ -0,0 +1,47 @@ +http_interactions: +- recorded_at: Tue, 04 Aug 2026 14:46:55 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"action":{"description":"Lower severity for + dev environment noise","severity":"low","type":"set"},"enabled":true,"name":"Downgrade + misconfigurations in dev","rule":{"finding_types":["misconfiguration"],"query":"env:prod + team:platform"}},"type":"severity_modifier_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"0e2c6dfd-c591-4bed-a7f2-a1a44a148d61","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low","description":"Lower + severity for dev environment noise"},"created_at":1785854818028,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785854818028,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Downgrade misconfigurations in dev","rule":{"finding_types":["misconfiguration"],"query":"env:prod + team:platform"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 04 Aug 2026 14:46:55 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/0e2c6dfd-c591-4bed-a7f2-a1a44a148d61 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.frozen b/cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.frozen new file mode 100644 index 000000000000..5812a38a0479 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.frozen @@ -0,0 +1 @@ +2026-08-03T09:17:25.445Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.yml b/cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.yml new file mode 100644 index 000000000000..676d018856b4 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Delete-a-severity-modifier-rule-returns-Rule-successfully-deleted-response.yml @@ -0,0 +1,61 @@ +http_interactions: +- recorded_at: Mon, 03 Aug 2026 09:17:25 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"action":{"severity":"low","type":"set"},"enabled":true,"name":"Test-Delete_a_severity_modifier_rule_returns_Rule_successfully_deleted_response-1785748645","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}},"type":"severity_modifier_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"ec796c54-ec53-4b2f-bb14-36d4b224f92c","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low"},"created_at":1785748647705,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785748647705,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Test-Delete_a_severity_modifier_rule_returns_Rule_successfully_deleted_response-1785748645","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 03 Aug 2026 09:17:25 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/ec796c54-ec53-4b2f-bb14-36d4b224f92c + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Mon, 03 Aug 2026 09:17:25 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/ec796c54-ec53-4b2f-bb14-36d4b224f92c + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"rule does + not exist"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.frozen b/cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.frozen new file mode 100644 index 000000000000..87000b7fb8d9 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.frozen @@ -0,0 +1 @@ +2026-08-03T09:17:28.616Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.yml b/cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.yml new file mode 100644 index 000000000000..e7c77c61e37b --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-a-severity-modifier-rule-returns-Successfully-retrieved-the-severity-modifier-rule-response.yml @@ -0,0 +1,62 @@ +http_interactions: +- recorded_at: Mon, 03 Aug 2026 09:17:28 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"action":{"severity":"low","type":"set"},"enabled":true,"name":"Test-Get_a_severity_modifier_rule_returns_Successfully_retrieved_the_severity_modifier_rule_response-1785748648","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}},"type":"severity_modifier_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"fec045ba-40ba-42ef-a107-f7fba8717e11","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low"},"created_at":1785748648838,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785748648838,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Test-Get_a_severity_modifier_rule_returns_Successfully_retrieved_the_severity_modifier_rule_response-1785748648","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 03 Aug 2026 09:17:28 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/fec045ba-40ba-42ef-a107-f7fba8717e11 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"fec045ba-40ba-42ef-a107-f7fba8717e11","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low"},"created_at":1785748648838,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785748648838,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Test-Get_a_severity_modifier_rule_returns_Successfully_retrieved_the_severity_modifier_rule_response-1785748648","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Mon, 03 Aug 2026 09:17:28 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/fec045ba-40ba-42ef-a107-f7fba8717e11 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.frozen b/cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.frozen new file mode 100644 index 000000000000..8cba2e5db7fe --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.frozen @@ -0,0 +1 @@ +2026-08-03T09:17:29.711Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.yml b/cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.yml new file mode 100644 index 000000000000..92220802ad01 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-all-severity-modifier-rules-returns-Successfully-retrieved-the-list-of-severity-modifier-rules-response.yml @@ -0,0 +1,62 @@ +http_interactions: +- recorded_at: Mon, 03 Aug 2026 09:17:29 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"action":{"severity":"low","type":"set"},"enabled":true,"name":"Test-Get_all_severity_modifier_rules_returns_Successfully_retrieved_the_list_of_severity_modifier_rules_r-1785748649","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}},"type":"severity_modifier_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"4c9856fe-1150-45de-813c-3d4d3375bea1","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low"},"created_at":1785748649918,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785748649918,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Test-Get_all_severity_modifier_rules_returns_Successfully_retrieved_the_list_of_severity_modifier_rules_r-1785748649","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 03 Aug 2026 09:17:29 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"4c9856fe-1150-45de-813c-3d4d3375bea1","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low"},"created_at":1785748649918,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785748649918,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Test-Get_all_severity_modifier_rules_returns_Successfully_retrieved_the_list_of_severity_modifier_rules_r-1785748649","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}}}],"meta":{"page":{"total_filtered_count":1}},"links":{"first":"/api/v2/security/findings/automation/severity_modifier_rules?page[size]=1000\u0026page[number]=0","last":"/api/v2/security/findings/automation/severity_modifier_rules?page[size]=1000\u0026page[number]=0"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Mon, 03 Aug 2026 09:17:29 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/4c9856fe-1150-45de-813c-3d4d3375bea1 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.frozen b/cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.frozen new file mode 100644 index 000000000000..6a8d9d11228c --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.frozen @@ -0,0 +1 @@ +2026-08-03T09:17:30.831Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.yml b/cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.yml new file mode 100644 index 000000000000..5c42a7435ff1 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Reorder-severity-modifier-rules-returns-Successfully-reordered-the-severity-modifier-rules-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Mon, 03 Aug 2026 09:17:30 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"action":{"severity":"low","type":"set"},"enabled":true,"name":"Test-Reorder_severity_modifier_rules_returns_Successfully_reordered_the_severity_modifier_rules_response-1785748650","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}},"type":"severity_modifier_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"91bb2eb7-36d4-4b89-af25-1f5a30af5e51","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low"},"created_at":1785748651040,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785748651040,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Test-Reorder_severity_modifier_rules_returns_Successfully_reordered_the_severity_modifier_rules_response-1785748650","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 03 Aug 2026 09:17:30 GMT + request: + body: + encoding: UTF-8 + string: '{"data":[{"id":"91bb2eb7-36d4-4b89-af25-1f5a30af5e51","type":"severity_modifier_rules"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/reorder + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"severity_modifier_rules","id":"91bb2eb7-36d4-4b89-af25-1f5a30af5e51"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Mon, 03 Aug 2026 09:17:30 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/91bb2eb7-36d4-4b89-af25-1f5a30af5e51 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.frozen b/cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.frozen new file mode 100644 index 000000000000..d5f136737ec8 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.frozen @@ -0,0 +1 @@ +2026-08-04T14:46:58.623Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.yml b/cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.yml new file mode 100644 index 000000000000..fc3b2b132250 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Update-a-severity-modifier-rule-returns-Successfully-updated-the-severity-modifier-rule-response.yml @@ -0,0 +1,71 @@ +http_interactions: +- recorded_at: Tue, 04 Aug 2026 14:46:58 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"action":{"severity":"low","type":"set"},"enabled":true,"name":"Test-Update_a_severity_modifier_rule_returns_Successfully_updated_the_severity_modifier_rule_response-1785854818","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}},"type":"severity_modifier_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d243056e-c7bb-44b1-8b46-37222abb4a7f","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low"},"created_at":1785854818709,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785854818709,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Test-Update_a_severity_modifier_rule_returns_Successfully_updated_the_severity_modifier_rule_response-1785854818","rule":{"finding_types":["misconfiguration"],"query":"env:staging"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 04 Aug 2026 14:46:58 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"action":{"description":"Lower severity for + dev environment noise","severity":"low","type":"set"},"enabled":true,"name":"Downgrade + misconfigurations in dev","rule":{"finding_types":["misconfiguration"],"query":"env:prod + team:platform"}},"type":"severity_modifier_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/d243056e-c7bb-44b1-8b46-37222abb4a7f + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d243056e-c7bb-44b1-8b46-37222abb4a7f","type":"severity_modifier_rules","attributes":{"action":{"type":"set","severity":"low","description":"Lower + severity for dev environment noise"},"created_at":1785854818709,"created_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"enabled":true,"modified_at":1785854818954,"modified_by":{"type":"user","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"name":"Downgrade misconfigurations in dev","rule":{"finding_types":["misconfiguration"],"query":"env:prod + team:platform"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 04 Aug 2026 14:46:58 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security/findings/automation/severity_modifier_rules/d243056e-c7bb-44b1-8b46-37222abb4a7f + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/security-monitoring/CreateSecurityFindingsAutomationSeverityModifierRule.rb b/examples/v2/security-monitoring/CreateSecurityFindingsAutomationSeverityModifierRule.rb new file mode 100644 index 000000000000..45bd66932191 --- /dev/null +++ b/examples/v2/security-monitoring/CreateSecurityFindingsAutomationSeverityModifierRule.rb @@ -0,0 +1,29 @@ +# Create a severity modifier rule returns "Successfully created the severity modifier rule" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_security_findings_automation_severity_modifier_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::SeverityModifierRuleCreateRequest.new({ + data: DatadogAPIClient::V2::SeverityModifierRuleDataCreate.new({ + attributes: DatadogAPIClient::V2::SeverityModifierRuleAttributesCreate.new({ + action: DatadogAPIClient::V2::SeverityModifierRuleSetAction.new({ + description: "Lower severity for dev environment noise", + severity: DatadogAPIClient::V2::SeverityModifierSeverity::LOW, + type: DatadogAPIClient::V2::SeverityModifierRuleSetActionType::SET, + }), + enabled: true, + name: "Downgrade misconfigurations in dev", + rule: DatadogAPIClient::V2::AutomationRuleScope.new({ + finding_types: [ + DatadogAPIClient::V2::SecurityFindingType::MISCONFIGURATION, + ], + query: "env:prod team:platform", + }), + }), + type: DatadogAPIClient::V2::SeverityModifierRuleType::SEVERITY_MODIFIER_RULES, + }), +}) +p api_instance.create_security_findings_automation_severity_modifier_rule(body) diff --git a/examples/v2/security-monitoring/DeleteSecurityFindingsAutomationSeverityModifierRule.rb b/examples/v2/security-monitoring/DeleteSecurityFindingsAutomationSeverityModifierRule.rb new file mode 100644 index 000000000000..150d1d36499d --- /dev/null +++ b/examples/v2/security-monitoring/DeleteSecurityFindingsAutomationSeverityModifierRule.rb @@ -0,0 +1,11 @@ +# Delete a severity modifier rule returns "Rule successfully deleted." response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_security_findings_automation_severity_modifier_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +# there is a valid "valid_severity_modifier_rule" in the system +VALID_SEVERITY_MODIFIER_RULE_DATA_ID = ENV["VALID_SEVERITY_MODIFIER_RULE_DATA_ID"] +api_instance.delete_security_findings_automation_severity_modifier_rule(VALID_SEVERITY_MODIFIER_RULE_DATA_ID) diff --git a/examples/v2/security-monitoring/GetSecurityFindingsAutomationSeverityModifierRule.rb b/examples/v2/security-monitoring/GetSecurityFindingsAutomationSeverityModifierRule.rb new file mode 100644 index 000000000000..4f4ec197e558 --- /dev/null +++ b/examples/v2/security-monitoring/GetSecurityFindingsAutomationSeverityModifierRule.rb @@ -0,0 +1,11 @@ +# Get a severity modifier rule returns "Successfully retrieved the severity modifier rule" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_security_findings_automation_severity_modifier_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +# there is a valid "valid_severity_modifier_rule" in the system +VALID_SEVERITY_MODIFIER_RULE_DATA_ID = ENV["VALID_SEVERITY_MODIFIER_RULE_DATA_ID"] +p api_instance.get_security_findings_automation_severity_modifier_rule(VALID_SEVERITY_MODIFIER_RULE_DATA_ID) diff --git a/examples/v2/security-monitoring/ListSecurityFindingsAutomationSeverityModifierRules.rb b/examples/v2/security-monitoring/ListSecurityFindingsAutomationSeverityModifierRules.rb new file mode 100644 index 000000000000..937bf5535d3d --- /dev/null +++ b/examples/v2/security-monitoring/ListSecurityFindingsAutomationSeverityModifierRules.rb @@ -0,0 +1,8 @@ +# Get all severity modifier rules returns "Successfully retrieved the list of severity modifier rules" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_security_findings_automation_severity_modifier_rules".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new +p api_instance.list_security_findings_automation_severity_modifier_rules() diff --git a/examples/v2/security-monitoring/ReorderSecurityFindingsAutomationSeverityModifierRules.rb b/examples/v2/security-monitoring/ReorderSecurityFindingsAutomationSeverityModifierRules.rb new file mode 100644 index 000000000000..980ed5be2b87 --- /dev/null +++ b/examples/v2/security-monitoring/ReorderSecurityFindingsAutomationSeverityModifierRules.rb @@ -0,0 +1,20 @@ +# Reorder severity modifier rules returns "Successfully reordered the severity modifier rules" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.reorder_security_findings_automation_severity_modifier_rules".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +# there is a valid "valid_severity_modifier_rule" in the system +VALID_SEVERITY_MODIFIER_RULE_DATA_ID = ENV["VALID_SEVERITY_MODIFIER_RULE_DATA_ID"] + +body = DatadogAPIClient::V2::SeverityModifierRuleReorderRequest.new({ + data: [ + DatadogAPIClient::V2::SeverityModifierRuleReorderItem.new({ + id: VALID_SEVERITY_MODIFIER_RULE_DATA_ID, + type: DatadogAPIClient::V2::SeverityModifierRuleType::SEVERITY_MODIFIER_RULES, + }), + ], +}) +p api_instance.reorder_security_findings_automation_severity_modifier_rules(body) diff --git a/examples/v2/security-monitoring/UpdateSecurityFindingsAutomationSeverityModifierRule.rb b/examples/v2/security-monitoring/UpdateSecurityFindingsAutomationSeverityModifierRule.rb new file mode 100644 index 000000000000..7414d861437c --- /dev/null +++ b/examples/v2/security-monitoring/UpdateSecurityFindingsAutomationSeverityModifierRule.rb @@ -0,0 +1,32 @@ +# Update a severity modifier rule returns "Successfully updated the severity modifier rule" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_security_findings_automation_severity_modifier_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +# there is a valid "valid_severity_modifier_rule" in the system +VALID_SEVERITY_MODIFIER_RULE_DATA_ID = ENV["VALID_SEVERITY_MODIFIER_RULE_DATA_ID"] + +body = DatadogAPIClient::V2::SeverityModifierRuleUpdateRequest.new({ + data: DatadogAPIClient::V2::SeverityModifierRuleDataCreate.new({ + attributes: DatadogAPIClient::V2::SeverityModifierRuleAttributesCreate.new({ + action: DatadogAPIClient::V2::SeverityModifierRuleSetAction.new({ + description: "Lower severity for dev environment noise", + severity: DatadogAPIClient::V2::SeverityModifierSeverity::LOW, + type: DatadogAPIClient::V2::SeverityModifierRuleSetActionType::SET, + }), + enabled: true, + name: "Downgrade misconfigurations in dev", + rule: DatadogAPIClient::V2::AutomationRuleScope.new({ + finding_types: [ + DatadogAPIClient::V2::SecurityFindingType::MISCONFIGURATION, + ], + query: "env:prod team:platform", + }), + }), + type: DatadogAPIClient::V2::SeverityModifierRuleType::SEVERITY_MODIFIER_RULES, + }), +}) +p api_instance.update_security_findings_automation_severity_modifier_rule(VALID_SEVERITY_MODIFIER_RULE_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index c4bfa9ae1080..16d23fed9340 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2130,6 +2130,26 @@ "rule_id" => "UUID", "body" => "MuteRuleUpdateRequest", }, + "v2.ListSecurityFindingsAutomationSeverityModifierRules" => { + "page_size" => "Integer", + "page_number" => "Integer", + }, + "v2.CreateSecurityFindingsAutomationSeverityModifierRule" => { + "body" => "SeverityModifierRuleCreateRequest", + }, + "v2.ReorderSecurityFindingsAutomationSeverityModifierRules" => { + "body" => "SeverityModifierRuleReorderRequest", + }, + "v2.DeleteSecurityFindingsAutomationSeverityModifierRule" => { + "rule_id" => "UUID", + }, + "v2.GetSecurityFindingsAutomationSeverityModifierRule" => { + "rule_id" => "UUID", + }, + "v2.UpdateSecurityFindingsAutomationSeverityModifierRule" => { + "rule_id" => "UUID", + "body" => "SeverityModifierRuleUpdateRequest", + }, "v2.ListSecurityFindingsAutomationTicketCreationRules" => { "page_size" => "Integer", "page_number" => "Integer", diff --git a/features/v2/given.json b/features/v2/given.json index 6e48ed1fc534..55b45d6012ed 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -1354,6 +1354,18 @@ "tag": "Security Monitoring", "operationId": "CreateSecurityFindingsAutomationMuteRule" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"severity_modifier_rules\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"enabled\": true,\n \"rule\": {\n \"finding_types\": [\"misconfiguration\"],\n \"query\": \"env:staging\"\n },\n \"action\": {\n \"type\": \"set\",\n \"severity\": \"low\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"valid_severity_modifier_rule\" in the system", + "key": "valid_severity_modifier_rule", + "tag": "Security Monitoring", + "operationId": "CreateSecurityFindingsAutomationSeverityModifierRule" + }, { "parameters": [ { diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 14f3d34a11de..e3545d887ef0 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -952,6 +952,30 @@ Feature: Security Monitoring And the response "data.attributes.exclusion_filters[0].name" is equal to "Exclude staging" And the response "data.attributes.exclusion_filters[0].query" is equal to "source:staging" + @generated @skip @team:DataDog/k9-automation + Scenario: Create a severity modifier rule returns "Bad Request" response + Given operation "CreateSecurityFindingsAutomationSeverityModifierRule" enabled + And new "CreateSecurityFindingsAutomationSeverityModifierRule" request + And body with value {"data": {"attributes": {"action": {"description": "Lower severity for dev environment noise", "severity": "low", "type": "set"}, "enabled": true, "name": "Downgrade misconfigurations in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "severity_modifier_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Create a severity modifier rule returns "Successfully created the severity modifier rule" response + Given operation "CreateSecurityFindingsAutomationSeverityModifierRule" enabled + And new "CreateSecurityFindingsAutomationSeverityModifierRule" request + And body with value {"data": {"attributes": {"action": {"description": "Lower severity for dev environment noise", "severity": "low", "type": "set"}, "enabled": true, "name": "Downgrade misconfigurations in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "severity_modifier_rules"}} + When the request is sent + Then the response status is 201 Successfully created the severity modifier rule + + @generated @skip @team:DataDog/k9-automation + Scenario: Create a severity modifier rule returns "Unprocessable Entity" response + Given operation "CreateSecurityFindingsAutomationSeverityModifierRule" enabled + And new "CreateSecurityFindingsAutomationSeverityModifierRule" request + And body with value {"data": {"attributes": {"action": {"description": "Lower severity for dev environment noise", "severity": "low", "type": "set"}, "enabled": true, "name": "Downgrade misconfigurations in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "severity_modifier_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/cloud-siem Scenario: Create a suppression rule returns "Bad Request" response Given new "CreateSecurityMonitoringSuppression" request @@ -1265,6 +1289,23 @@ Feature: Security Monitoring When the request is sent Then the response status is 204 OK + @generated @skip @team:DataDog/k9-automation + Scenario: Delete a severity modifier rule returns "Not Found" response + Given operation "DeleteSecurityFindingsAutomationSeverityModifierRule" enabled + And new "DeleteSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-automation + Scenario: Delete a severity modifier rule returns "Rule successfully deleted." response + Given operation "DeleteSecurityFindingsAutomationSeverityModifierRule" enabled + And there is a valid "valid_severity_modifier_rule" in the system + And new "DeleteSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "valid_severity_modifier_rule.data.id" + When the request is sent + Then the response status is 204 Rule successfully deleted. + @team:DataDog/cloud-security-posture-management Scenario: Delete a signal-based notification rule returns "Not Found" response Given new "DeleteSignalNotificationRule" request @@ -1866,6 +1907,25 @@ Feature: Security Monitoring And the response "data.attributes.exclusion_filters[0].name" is equal to "Exclude logs from staging" And the response "data.attributes.exclusion_filters[0].query" is equal to "source:staging" + @generated @skip @team:DataDog/k9-automation + Scenario: Get a severity modifier rule returns "Not Found" response + Given operation "GetSecurityFindingsAutomationSeverityModifierRule" enabled + And new "GetSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-automation + Scenario: Get a severity modifier rule returns "Successfully retrieved the severity modifier rule" response + Given operation "GetSecurityFindingsAutomationSeverityModifierRule" enabled + And there is a valid "valid_severity_modifier_rule" in the system + And new "GetSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "valid_severity_modifier_rule.data.id" + When the request is sent + Then the response status is 200 Successfully retrieved the severity modifier rule + And the response "data.id" is equal to "{{ valid_severity_modifier_rule.data.id }}" + And the response "data.type" is equal to "severity_modifier_rules" + @replay-only @team:DataDog/cloud-siem Scenario: Get a signal's details returns "Not Found" response Given new "GetSecurityMonitoringSignal" request @@ -1987,6 +2047,15 @@ Feature: Security Monitoring And the response "data" has item with field "attributes.filtered_data_type" with value "logs" And the response "data" has item with field "attributes.is_builtin" with value true + @team:DataDog/k9-automation + Scenario: Get all severity modifier rules returns "Successfully retrieved the list of severity modifier rules" response + Given operation "ListSecurityFindingsAutomationSeverityModifierRules" enabled + And there is a valid "valid_severity_modifier_rule" in the system + And new "ListSecurityFindingsAutomationSeverityModifierRules" request + When the request is sent + Then the response status is 200 Successfully retrieved the list of severity modifier rules + And the response "data" has item with field "id" with value "{{ valid_severity_modifier_rule.data.id }}" + @generated @skip @team:DataDog/cloud-siem Scenario: Get all suppression rules returns "OK" response Given new "ListSecurityMonitoringSuppressions" request @@ -2906,6 +2975,31 @@ Feature: Security Monitoring When the request is sent Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/k9-automation + Scenario: Reorder severity modifier rules returns "Bad Request" response + Given operation "ReorderSecurityFindingsAutomationSeverityModifierRules" enabled + And new "ReorderSecurityFindingsAutomationSeverityModifierRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "severity_modifier_rules"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Reorder severity modifier rules returns "Successfully reordered the severity modifier rules" response + Given operation "ReorderSecurityFindingsAutomationSeverityModifierRules" enabled + And there is a valid "valid_severity_modifier_rule" in the system + And new "ReorderSecurityFindingsAutomationSeverityModifierRules" request + And body with value {"data": [{"id": "{{ valid_severity_modifier_rule.data.id }}", "type": "severity_modifier_rules"}]} + When the request is sent + Then the response status is 200 Successfully reordered the severity modifier rules + + @generated @skip @team:DataDog/k9-automation + Scenario: Reorder severity modifier rules returns "Unprocessable Entity" response + Given operation "ReorderSecurityFindingsAutomationSeverityModifierRules" enabled + And new "ReorderSecurityFindingsAutomationSeverityModifierRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "severity_modifier_rules"}]} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/k9-automation Scenario: Reorder ticket creation rules returns "Bad Request" response Given operation "ReorderSecurityFindingsAutomationTicketCreationRules" enabled @@ -3390,6 +3484,43 @@ Feature: Security Monitoring And the response "data.attributes.filtered_data_type" is equal to "logs" And the response "data.attributes.name" is equal to "{{ unique }}" + @generated @skip @team:DataDog/k9-automation + Scenario: Update a severity modifier rule returns "Bad Request" response + Given operation "UpdateSecurityFindingsAutomationSeverityModifierRule" enabled + And new "UpdateSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"description": "Lower severity for dev environment noise", "severity": "low", "type": "set"}, "enabled": true, "name": "Downgrade misconfigurations in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "severity_modifier_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a severity modifier rule returns "Not Found" response + Given operation "UpdateSecurityFindingsAutomationSeverityModifierRule" enabled + And new "UpdateSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"description": "Lower severity for dev environment noise", "severity": "low", "type": "set"}, "enabled": true, "name": "Downgrade misconfigurations in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "severity_modifier_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-automation + Scenario: Update a severity modifier rule returns "Successfully updated the severity modifier rule" response + Given operation "UpdateSecurityFindingsAutomationSeverityModifierRule" enabled + And there is a valid "valid_severity_modifier_rule" in the system + And new "UpdateSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "valid_severity_modifier_rule.data.id" + And body with value {"data": {"attributes": {"action": {"description": "Lower severity for dev environment noise", "severity": "low", "type": "set"}, "enabled": true, "name": "Downgrade misconfigurations in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "severity_modifier_rules"}} + When the request is sent + Then the response status is 200 Successfully updated the severity modifier rule + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a severity modifier rule returns "Unprocessable Entity" response + Given operation "UpdateSecurityFindingsAutomationSeverityModifierRule" enabled + And new "UpdateSecurityFindingsAutomationSeverityModifierRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"description": "Lower severity for dev environment noise", "severity": "low", "type": "set"}, "enabled": true, "name": "Downgrade misconfigurations in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "severity_modifier_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/cloud-siem Scenario: Update a suppression rule returns "Bad Request" response Given new "UpdateSecurityMonitoringSuppression" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 133ab9ade47d..a62b24af6a89 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -7454,6 +7454,49 @@ "type": "idempotent" } }, + "ListSecurityFindingsAutomationSeverityModifierRules": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "CreateSecurityFindingsAutomationSeverityModifierRule": { + "tag": "Security Monitoring", + "undo": { + "operationId": "DeleteSecurityFindingsAutomationSeverityModifierRule", + "parameters": [ + { + "name": "rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ReorderSecurityFindingsAutomationSeverityModifierRules": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "DeleteSecurityFindingsAutomationSeverityModifierRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "GetSecurityFindingsAutomationSeverityModifierRule": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "UpdateSecurityFindingsAutomationSeverityModifierRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "ListSecurityFindingsAutomationTicketCreationRules": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5a416e62be64..15ba8da4fa4d 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -305,6 +305,7 @@ def initialize "v2.create_sample_log_generation_subscription": false, "v2.create_security_findings_automation_due_date_rule": false, "v2.create_security_findings_automation_mute_rule": false, + "v2.create_security_findings_automation_severity_modifier_rule": false, "v2.create_security_findings_automation_ticket_creation_rule": false, "v2.create_security_monitoring_dataset": false, "v2.create_security_monitoring_integration_config": false, @@ -316,6 +317,7 @@ def initialize "v2.delete_sample_log_generation_subscription": false, "v2.delete_security_findings_automation_due_date_rule": false, "v2.delete_security_findings_automation_mute_rule": false, + "v2.delete_security_findings_automation_severity_modifier_rule": false, "v2.delete_security_findings_automation_ticket_creation_rule": false, "v2.delete_security_monitoring_dataset": false, "v2.delete_security_monitoring_integration_config": false, @@ -330,6 +332,7 @@ def initialize "v2.get_secrets_rules": false, "v2.get_security_findings_automation_due_date_rule": false, "v2.get_security_findings_automation_mute_rule": false, + "v2.get_security_findings_automation_severity_modifier_rule": false, "v2.get_security_findings_automation_ticket_creation_rule": false, "v2.get_security_monitoring_dataset": false, "v2.get_security_monitoring_dataset_by_version": false, @@ -352,6 +355,7 @@ def initialize "v2.list_scanned_assets_metadata": false, "v2.list_security_findings_automation_due_date_rules": false, "v2.list_security_findings_automation_mute_rules": false, + "v2.list_security_findings_automation_severity_modifier_rules": false, "v2.list_security_findings_automation_ticket_creation_rules": false, "v2.list_security_monitoring_datasets": false, "v2.list_security_monitoring_histsignals": false, @@ -361,6 +365,7 @@ def initialize "v2.list_vulnerable_assets": false, "v2.reorder_security_findings_automation_due_date_rules": false, "v2.reorder_security_findings_automation_mute_rules": false, + "v2.reorder_security_findings_automation_severity_modifier_rules": false, "v2.reorder_security_findings_automation_ticket_creation_rules": false, "v2.restore_security_monitoring_rule": false, "v2.run_historical_job": false, @@ -368,6 +373,7 @@ def initialize "v2.update_findings_assignee": false, "v2.update_security_findings_automation_due_date_rule": false, "v2.update_security_findings_automation_mute_rule": false, + "v2.update_security_findings_automation_severity_modifier_rule": false, "v2.update_security_findings_automation_ticket_creation_rule": false, "v2.update_security_monitoring_dataset": false, "v2.update_security_monitoring_integration_config": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1bc8cbc8c62f..1db426691625 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -7268,6 +7268,24 @@ def overrides "v2.service_repository_info_status" => "ServiceRepositoryInfoStatus", "v2.session_id_array" => "SessionIdArray", "v2.session_id_data" => "SessionIdData", + "v2.severity_modifier_rule_action" => "SeverityModifierRuleAction", + "v2.severity_modifier_rule_attributes_create" => "SeverityModifierRuleAttributesCreate", + "v2.severity_modifier_rule_attributes_response" => "SeverityModifierRuleAttributesResponse", + "v2.severity_modifier_rule_create_request" => "SeverityModifierRuleCreateRequest", + "v2.severity_modifier_rule_data_create" => "SeverityModifierRuleDataCreate", + "v2.severity_modifier_rule_data_response" => "SeverityModifierRuleDataResponse", + "v2.severity_modifier_rule_reorder_item" => "SeverityModifierRuleReorderItem", + "v2.severity_modifier_rule_reorder_request" => "SeverityModifierRuleReorderRequest", + "v2.severity_modifier_rule_response" => "SeverityModifierRuleResponse", + "v2.severity_modifier_rule_set_action" => "SeverityModifierRuleSetAction", + "v2.severity_modifier_rule_set_action_type" => "SeverityModifierRuleSetActionType", + "v2.severity_modifier_rule_shift_action" => "SeverityModifierRuleShiftAction", + "v2.severity_modifier_rule_shift_action_type" => "SeverityModifierRuleShiftActionType", + "v2.severity_modifier_rules_response" => "SeverityModifierRulesResponse", + "v2.severity_modifier_rule_type" => "SeverityModifierRuleType", + "v2.severity_modifier_rule_update_request" => "SeverityModifierRuleUpdateRequest", + "v2.severity_modifier_severity" => "SeverityModifierSeverity", + "v2.severity_modifier_severity_delta" => "SeverityModifierSeverityDelta", "v2.shared_dashboard_included" => "SharedDashboardIncluded", "v2.shared_dashboard_included_dashboard" => "SharedDashboardIncludedDashboard", "v2.shared_dashboard_included_dashboard_attributes" => "SharedDashboardIncludedDashboardAttributes", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index c807fd7d9bea..7249277eca65 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -2114,6 +2114,79 @@ def create_security_findings_automation_mute_rule_with_http_info(body, opts = {} return data, status_code, headers end + # Create a severity modifier rule. + # + # @see #create_security_findings_automation_severity_modifier_rule_with_http_info + def create_security_findings_automation_severity_modifier_rule(body, opts = {}) + data, _status_code, _headers = create_security_findings_automation_severity_modifier_rule_with_http_info(body, opts) + data + end + + # Create a severity modifier rule. + # + # Create a new severity modifier rule for the current organization. + # + # @param body [SeverityModifierRuleCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(SeverityModifierRuleResponse, Integer, Hash)>] SeverityModifierRuleResponse data, response status code and response headers + def create_security_findings_automation_severity_modifier_rule_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_security_findings_automation_severity_modifier_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_security_findings_automation_severity_modifier_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_security_findings_automation_severity_modifier_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.create_security_findings_automation_severity_modifier_rule ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.create_security_findings_automation_severity_modifier_rule" + end + # resource path + local_var_path = '/api/v2/security/findings/automation/severity_modifier_rules' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'SeverityModifierRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_security_findings_automation_severity_modifier_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#create_security_findings_automation_severity_modifier_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a ticket creation rule. # # @see #create_security_findings_automation_ticket_creation_rule_with_http_info @@ -3452,6 +3525,77 @@ def delete_security_findings_automation_mute_rule_with_http_info(rule_id, opts = return data, status_code, headers end + # Delete a severity modifier rule. + # + # @see #delete_security_findings_automation_severity_modifier_rule_with_http_info + def delete_security_findings_automation_severity_modifier_rule(rule_id, opts = {}) + delete_security_findings_automation_severity_modifier_rule_with_http_info(rule_id, opts) + nil + end + + # Delete a severity modifier rule. + # + # Delete an existing severity modifier rule by ID. + # + # @param rule_id [UUID] The ID of the severity modifier rule. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_security_findings_automation_severity_modifier_rule_with_http_info(rule_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_security_findings_automation_severity_modifier_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_security_findings_automation_severity_modifier_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_security_findings_automation_severity_modifier_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.delete_security_findings_automation_severity_modifier_rule ...' + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling SecurityMonitoringAPI.delete_security_findings_automation_severity_modifier_rule" + end + # resource path + local_var_path = '/api/v2/security/findings/automation/severity_modifier_rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_security_findings_automation_severity_modifier_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#delete_security_findings_automation_severity_modifier_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete a ticket creation rule. # # @see #delete_security_findings_automation_ticket_creation_rule_with_http_info @@ -5584,6 +5728,77 @@ def get_security_findings_automation_mute_rule_with_http_info(rule_id, opts = {} return data, status_code, headers end + # Get a severity modifier rule. + # + # @see #get_security_findings_automation_severity_modifier_rule_with_http_info + def get_security_findings_automation_severity_modifier_rule(rule_id, opts = {}) + data, _status_code, _headers = get_security_findings_automation_severity_modifier_rule_with_http_info(rule_id, opts) + data + end + + # Get a severity modifier rule. + # + # Get the details of a severity modifier rule by ID. + # + # @param rule_id [UUID] The ID of the severity modifier rule. + # @param opts [Hash] the optional parameters + # @return [Array<(SeverityModifierRuleResponse, Integer, Hash)>] SeverityModifierRuleResponse data, response status code and response headers + def get_security_findings_automation_severity_modifier_rule_with_http_info(rule_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_security_findings_automation_severity_modifier_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_security_findings_automation_severity_modifier_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_security_findings_automation_severity_modifier_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.get_security_findings_automation_severity_modifier_rule ...' + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling SecurityMonitoringAPI.get_security_findings_automation_severity_modifier_rule" + end + # resource path + local_var_path = '/api/v2/security/findings/automation/severity_modifier_rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SeverityModifierRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_security_findings_automation_severity_modifier_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#get_security_findings_automation_severity_modifier_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a ticket creation rule. # # @see #get_security_findings_automation_ticket_creation_rule_with_http_info @@ -8533,6 +8748,85 @@ def list_security_findings_automation_mute_rules_with_http_info(opts = {}) return data, status_code, headers end + # Get all severity modifier rules. + # + # @see #list_security_findings_automation_severity_modifier_rules_with_http_info + def list_security_findings_automation_severity_modifier_rules(opts = {}) + data, _status_code, _headers = list_security_findings_automation_severity_modifier_rules_with_http_info(opts) + data + end + + # Get all severity modifier rules. + # + # Get all severity modifier rules for the current organization. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_size The number of rules per page. Maximum is 1000. + # @option opts [Integer] :page_number The page number to return. + # @return [Array<(SeverityModifierRulesResponse, Integer, Hash)>] SeverityModifierRulesResponse data, response status code and response headers + def list_security_findings_automation_severity_modifier_rules_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_security_findings_automation_severity_modifier_rules".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_security_findings_automation_severity_modifier_rules") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_security_findings_automation_severity_modifier_rules")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.list_security_findings_automation_severity_modifier_rules ...' + end + if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 + fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling SecurityMonitoringAPI.list_security_findings_automation_severity_modifier_rules, must be smaller than or equal to 1000.' + end + if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 + fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling SecurityMonitoringAPI.list_security_findings_automation_severity_modifier_rules, must be greater than or equal to 1.' + end + if @api_client.config.client_side_validation && !opts[:'page_number'].nil? && opts[:'page_number'] < 0 + fail ArgumentError, 'invalid value for "opts[:"page_number"]" when calling SecurityMonitoringAPI.list_security_findings_automation_severity_modifier_rules, must be greater than or equal to 0.' + end + # resource path + local_var_path = '/api/v2/security/findings/automation/severity_modifier_rules' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SeverityModifierRulesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_security_findings_automation_severity_modifier_rules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#list_security_findings_automation_severity_modifier_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get all ticket creation rules. # # @see #list_security_findings_automation_ticket_creation_rules_with_http_info @@ -9993,6 +10287,79 @@ def reorder_security_findings_automation_mute_rules_with_http_info(body, opts = return data, status_code, headers end + # Reorder severity modifier rules. + # + # @see #reorder_security_findings_automation_severity_modifier_rules_with_http_info + def reorder_security_findings_automation_severity_modifier_rules(body, opts = {}) + data, _status_code, _headers = reorder_security_findings_automation_severity_modifier_rules_with_http_info(body, opts) + data + end + + # Reorder severity modifier rules. + # + # Reorder the list of severity modifier rules for the current organization. + # + # @param body [SeverityModifierRuleReorderRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(SeverityModifierRuleReorderRequest, Integer, Hash)>] SeverityModifierRuleReorderRequest data, response status code and response headers + def reorder_security_findings_automation_severity_modifier_rules_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.reorder_security_findings_automation_severity_modifier_rules".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.reorder_security_findings_automation_severity_modifier_rules") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.reorder_security_findings_automation_severity_modifier_rules")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.reorder_security_findings_automation_severity_modifier_rules ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.reorder_security_findings_automation_severity_modifier_rules" + end + # resource path + local_var_path = '/api/v2/security/findings/automation/severity_modifier_rules/reorder' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'SeverityModifierRuleReorderRequest' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :reorder_security_findings_automation_severity_modifier_rules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#reorder_security_findings_automation_severity_modifier_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Reorder ticket creation rules. # # @see #reorder_security_findings_automation_ticket_creation_rules_with_http_info @@ -11119,6 +11486,84 @@ def update_security_findings_automation_mute_rule_with_http_info(rule_id, body, return data, status_code, headers end + # Update a severity modifier rule. + # + # @see #update_security_findings_automation_severity_modifier_rule_with_http_info + def update_security_findings_automation_severity_modifier_rule(rule_id, body, opts = {}) + data, _status_code, _headers = update_security_findings_automation_severity_modifier_rule_with_http_info(rule_id, body, opts) + data + end + + # Update a severity modifier rule. + # + # Update an existing severity modifier rule by ID. + # + # @param rule_id [UUID] The ID of the severity modifier rule. + # @param body [SeverityModifierRuleUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(SeverityModifierRuleResponse, Integer, Hash)>] SeverityModifierRuleResponse data, response status code and response headers + def update_security_findings_automation_severity_modifier_rule_with_http_info(rule_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_security_findings_automation_severity_modifier_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_security_findings_automation_severity_modifier_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_security_findings_automation_severity_modifier_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.update_security_findings_automation_severity_modifier_rule ...' + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling SecurityMonitoringAPI.update_security_findings_automation_severity_modifier_rule" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.update_security_findings_automation_severity_modifier_rule" + end + # resource path + local_var_path = '/api/v2/security/findings/automation/severity_modifier_rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'SeverityModifierRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_security_findings_automation_severity_modifier_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#update_security_findings_automation_severity_modifier_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a ticket creation rule. # # @see #update_security_findings_automation_ticket_creation_rule_with_http_info diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_action.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_action.rb new file mode 100644 index 000000000000..25a83ae4732e --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_action.rb @@ -0,0 +1,67 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The action to take when a severity modifier rule matches a finding. This is a discriminated union on `type`: `set` assigns a fixed severity, while `shift` moves the severity up or down by one rank. + # + # A severity modifier rule's `rule.query` must not filter on `@severity` or on the `@severity_details.user_adjusted.*` namespace. + # + # Use `@severity_details.adjusted.value` instead, which reflects the severity before user-defined adjustments. + module SeverityModifierRuleAction + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'SeverityModifierRuleSetAction', + :'SeverityModifierRuleShiftAction' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_create.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_create.rb new file mode 100644 index 000000000000..c04720e1997f --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_create.rb @@ -0,0 +1,187 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating or updating a severity modifier rule. + class SeverityModifierRuleAttributesCreate + include BaseGenericModel + + # The action to take when a severity modifier rule matches a finding. This is a discriminated union on `type`: `set` assigns a fixed severity, while `shift` moves the severity up or down by one rank. + # + # A severity modifier rule's `rule.query` must not filter on `@severity` or on the `@severity_details.user_adjusted.*` namespace. + # + # Use `@severity_details.adjusted.value` instead, which reflects the severity before user-defined adjustments. + attr_reader :action + + # Whether the severity modifier rule is enabled. + attr_accessor :enabled + + # The name of the severity modifier rule. + attr_reader :name + + # Defines the scope of findings to which the automation rule applies. + attr_reader :rule + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'action' => :'action', + :'enabled' => :'enabled', + :'name' => :'name', + :'rule' => :'rule' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'action' => :'SeverityModifierRuleAction', + :'enabled' => :'Boolean', + :'name' => :'String', + :'rule' => :'AutomationRuleScope' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleAttributesCreate` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'rule') + self.rule = attributes[:'rule'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @action.nil? + return false if @name.nil? + return false if @name.to_s.length > 255 + return false if @name.to_s.length < 1 + return false if @rule.nil? + true + end + + # Custom attribute writer method with validation + # @param action [Object] Object to be assigned + # @!visibility private + def action=(action) + if action.nil? + fail ArgumentError, 'invalid value for "action", action cannot be nil.' + end + @action = action + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + if name.to_s.length > 255 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.' + end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param rule [Object] Object to be assigned + # @!visibility private + def rule=(rule) + if rule.nil? + fail ArgumentError, 'invalid value for "rule", rule cannot be nil.' + end + @rule = rule + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + action == o.action && + enabled == o.enabled && + name == o.name && + rule == o.rule && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [action, enabled, name, rule, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_response.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_response.rb new file mode 100644 index 000000000000..b7852621fb40 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_attributes_response.rb @@ -0,0 +1,282 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a severity modifier rule as returned by the API. + class SeverityModifierRuleAttributesResponse + include BaseGenericModel + + # The action to take when a severity modifier rule matches a finding. This is a discriminated union on `type`: `set` assigns a fixed severity, while `shift` moves the severity up or down by one rank. + # + # A severity modifier rule's `rule.query` must not filter on `@severity` or on the `@severity_details.user_adjusted.*` namespace. + # + # Use `@severity_details.adjusted.value` instead, which reflects the severity before user-defined adjustments. + attr_reader :action + + # The Unix timestamp in milliseconds when the rule was created. + attr_reader :created_at + + # The user or Datadog system who created the rule. + attr_reader :created_by + + # Whether the severity modifier rule is enabled. + attr_reader :enabled + + # The Unix timestamp in milliseconds when the rule was last modified. + attr_reader :modified_at + + # The user or Datadog system who last modified the rule. + attr_reader :modified_by + + # The name of the severity modifier rule. + attr_reader :name + + # Defines the scope of findings to which the automation rule applies. + attr_reader :rule + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'action' => :'action', + :'created_at' => :'created_at', + :'created_by' => :'created_by', + :'enabled' => :'enabled', + :'modified_at' => :'modified_at', + :'modified_by' => :'modified_by', + :'name' => :'name', + :'rule' => :'rule' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'action' => :'SeverityModifierRuleAction', + :'created_at' => :'Integer', + :'created_by' => :'AutomationRuleCreatedBy', + :'enabled' => :'Boolean', + :'modified_at' => :'Integer', + :'modified_by' => :'AutomationRuleModifiedBy', + :'name' => :'String', + :'rule' => :'AutomationRuleScope' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleAttributesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'modified_by') + self.modified_by = attributes[:'modified_by'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'rule') + self.rule = attributes[:'rule'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @action.nil? + return false if @created_at.nil? + return false if @created_by.nil? + return false if @enabled.nil? + return false if @modified_at.nil? + return false if @modified_by.nil? + return false if @name.nil? + return false if @name.to_s.length > 255 + return false if @name.to_s.length < 1 + return false if @rule.nil? + true + end + + # Custom attribute writer method with validation + # @param action [Object] Object to be assigned + # @!visibility private + def action=(action) + if action.nil? + fail ArgumentError, 'invalid value for "action", action cannot be nil.' + end + @action = action + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param created_by [Object] Object to be assigned + # @!visibility private + def created_by=(created_by) + if created_by.nil? + fail ArgumentError, 'invalid value for "created_by", created_by cannot be nil.' + end + @created_by = created_by + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param modified_by [Object] Object to be assigned + # @!visibility private + def modified_by=(modified_by) + if modified_by.nil? + fail ArgumentError, 'invalid value for "modified_by", modified_by cannot be nil.' + end + @modified_by = modified_by + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + if name.to_s.length > 255 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.' + end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param rule [Object] Object to be assigned + # @!visibility private + def rule=(rule) + if rule.nil? + fail ArgumentError, 'invalid value for "rule", rule cannot be nil.' + end + @rule = rule + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + action == o.action && + created_at == o.created_at && + created_by == o.created_by && + enabled == o.enabled && + modified_at == o.modified_at && + modified_by == o.modified_by && + name == o.name && + rule == o.rule && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [action, created_at, created_by, enabled, modified_at, modified_by, name, rule, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_create_request.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_create_request.rb new file mode 100644 index 000000000000..ece7e4de8f19 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The body of a severity modifier rule create request. + class SeverityModifierRuleCreateRequest + include BaseGenericModel + + # The data object for a severity modifier rule create or update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SeverityModifierRuleDataCreate' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_data_create.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_data_create.rb new file mode 100644 index 000000000000..492fda51c48c --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_data_create.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data object for a severity modifier rule create or update request. + class SeverityModifierRuleDataCreate + include BaseGenericModel + + # Attributes for creating or updating a severity modifier rule. + attr_reader :attributes + + # The JSON:API type for severity modifier rules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SeverityModifierRuleAttributesCreate', + :'type' => :'SeverityModifierRuleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleDataCreate` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_data_response.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_data_response.rb new file mode 100644 index 000000000000..210af8d6a880 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_data_response.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data object for a severity modifier rule as returned by the API. + class SeverityModifierRuleDataResponse + include BaseGenericModel + + # Attributes of a severity modifier rule as returned by the API. + attr_reader :attributes + + # The ID of the severity modifier rule. + attr_reader :id + + # The JSON:API type for severity modifier rules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SeverityModifierRuleAttributesResponse', + :'id' => :'UUID', + :'type' => :'SeverityModifierRuleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleDataResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_item.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_item.rb new file mode 100644 index 000000000000..4fd0be55d72e --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_item.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A reference to a severity modifier rule used for reordering. + class SeverityModifierRuleReorderItem + include BaseGenericModel + + # The ID of the automation rule. + attr_reader :id + + # The JSON:API type for severity modifier rules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'UUID', + :'type' => :'SeverityModifierRuleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleReorderItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_request.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_request.rb new file mode 100644 index 000000000000..0a59189535a9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_reorder_request.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The body of a severity modifier rule reorder request. + class SeverityModifierRuleReorderRequest + include BaseGenericModel + + # The ordered list of severity modifier rules; every rule must be included. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleReorderRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_response.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_response.rb new file mode 100644 index 000000000000..380cf702427c --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single severity modifier rule response. + class SeverityModifierRuleResponse + include BaseGenericModel + + # The data object for a severity modifier rule as returned by the API. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SeverityModifierRuleDataResponse' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_set_action.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_set_action.rb new file mode 100644 index 000000000000..4b4c4ba745fa --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_set_action.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Sets matched findings to a fixed severity. + class SeverityModifierRuleSetAction + include BaseGenericModel + + # An optional free-form explanation for the severity change. + attr_reader :description + + # The severity to assign to matched findings. `info_none` is not supported for the `iac_misconfiguration`, `runtime_code_vulnerability`, `secret`, or `static_code_vulnerability` finding types. + attr_reader :severity + + # The type of a severity modifier rule action that sets a fixed severity. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'severity' => :'severity', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'severity' => :'SeverityModifierSeverity', + :'type' => :'SeverityModifierRuleSetActionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleSetAction` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'severity') + self.severity = attributes[:'severity'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@description.nil? && @description.to_s.length > 20000 + return false if @severity.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if !description.nil? && description.to_s.length > 20000 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 20000.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param severity [Object] Object to be assigned + # @!visibility private + def severity=(severity) + if severity.nil? + fail ArgumentError, 'invalid value for "severity", severity cannot be nil.' + end + @severity = severity + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + severity == o.severity && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, severity, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_set_action_type.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_set_action_type.rb new file mode 100644 index 000000000000..34a225fec2ed --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_set_action_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of a severity modifier rule action that sets a fixed severity. + class SeverityModifierRuleSetActionType + include BaseEnumModel + + SET = "set".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action.rb new file mode 100644 index 000000000000..b459a175a4c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Shifts matched findings up or down by one severity rank. + class SeverityModifierRuleShiftAction + include BaseGenericModel + + # An optional free-form explanation for the severity change. + attr_reader :description + + # The direction in which to shift the severity of matched findings by one rank. + attr_reader :severity_delta + + # The type of a severity modifier rule action that shifts the severity by one rank. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'severity_delta' => :'severity_delta', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'severity_delta' => :'SeverityModifierSeverityDelta', + :'type' => :'SeverityModifierRuleShiftActionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleShiftAction` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'severity_delta') + self.severity_delta = attributes[:'severity_delta'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@description.nil? && @description.to_s.length > 20000 + return false if @severity_delta.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if !description.nil? && description.to_s.length > 20000 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 20000.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param severity_delta [Object] Object to be assigned + # @!visibility private + def severity_delta=(severity_delta) + if severity_delta.nil? + fail ArgumentError, 'invalid value for "severity_delta", severity_delta cannot be nil.' + end + @severity_delta = severity_delta + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + severity_delta == o.severity_delta && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, severity_delta, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action_type.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action_type.rb new file mode 100644 index 000000000000..33863dd3717f --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_shift_action_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of a severity modifier rule action that shifts the severity by one rank. + class SeverityModifierRuleShiftActionType + include BaseEnumModel + + SHIFT = "shift".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_type.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_type.rb new file mode 100644 index 000000000000..9c42ee301bf9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API type for severity modifier rules. + class SeverityModifierRuleType + include BaseEnumModel + + SEVERITY_MODIFIER_RULES = "severity_modifier_rules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rule_update_request.rb b/lib/datadog_api_client/v2/models/severity_modifier_rule_update_request.rb new file mode 100644 index 000000000000..a8e095c17fd5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rule_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The body of a severity modifier rule update request. + class SeverityModifierRuleUpdateRequest + include BaseGenericModel + + # The data object for a severity modifier rule create or update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SeverityModifierRuleDataCreate' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRuleUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_rules_response.rb b/lib/datadog_api_client/v2/models/severity_modifier_rules_response.rb new file mode 100644 index 000000000000..6a52558034a7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_rules_response.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A list of severity modifier rules with pagination metadata. + class SeverityModifierRulesResponse + include BaseGenericModel + + # A list of severity modifier rule data objects. + attr_reader :data + + # Pagination links for the list of automation rules. + attr_reader :links + + # Metadata for the list of automation rules. + attr_reader :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'links' => :'links', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'links' => :'SecurityAutomationRulesLinks', + :'meta' => :'SecurityAutomationRulesMeta' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SeverityModifierRulesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'links') + self.links = attributes[:'links'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + return false if @links.nil? + return false if @meta.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Custom attribute writer method with validation + # @param links [Object] Object to be assigned + # @!visibility private + def links=(links) + if links.nil? + fail ArgumentError, 'invalid value for "links", links cannot be nil.' + end + @links = links + end + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + links == o.links && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, links, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_severity.rb b/lib/datadog_api_client/v2/models/severity_modifier_severity.rb new file mode 100644 index 000000000000..4bff93445bd3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_severity.rb @@ -0,0 +1,30 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The severity to assign to matched findings. `info_none` is not supported for the `iac_misconfiguration`, `runtime_code_vulnerability`, `secret`, or `static_code_vulnerability` finding types. + class SeverityModifierSeverity + include BaseEnumModel + + INFO_NONE = "info_none".freeze + LOW = "low".freeze + MEDIUM = "medium".freeze + HIGH = "high".freeze + CRITICAL = "critical".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/severity_modifier_severity_delta.rb b/lib/datadog_api_client/v2/models/severity_modifier_severity_delta.rb new file mode 100644 index 000000000000..58d29f000bcd --- /dev/null +++ b/lib/datadog_api_client/v2/models/severity_modifier_severity_delta.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The direction in which to shift the severity of matched findings by one rank. + class SeverityModifierSeverityDelta + include BaseEnumModel + + UP_ONE = "up_one".freeze + DOWN_ONE = "down_one".freeze + end +end