From 8569fc59ece43ab0dd198d346dd1e2badbb35036 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 18 Jun 2026 10:41:10 +0000 Subject: [PATCH] Regenerate client from commit 61df48f of spec repo --- .generator/schemas/v2/openapi.yaml | 2150 +++ ...teSecurityFindingsAutomationDueDateRule.rs | 42 + ...reateSecurityFindingsAutomationMuteRule.rs | 37 + ...ityFindingsAutomationTicketCreationRule.rs | 45 + ...teSecurityFindingsAutomationDueDateRule.rs | 23 + ...eleteSecurityFindingsAutomationMuteRule.rs | 23 + ...ityFindingsAutomationTicketCreationRule.rs | 27 + ...etSecurityFindingsAutomationDueDateRule.rs | 23 + ...g_GetSecurityFindingsAutomationMuteRule.rs | 22 + ...ityFindingsAutomationTicketCreationRule.rs | 26 + ...tSecurityFindingsAutomationDueDateRules.rs | 23 + ...ListSecurityFindingsAutomationMuteRules.rs | 23 + ...tyFindingsAutomationTicketCreationRules.rs | 25 + ...rSecurityFindingsAutomationDueDateRules.rs | 31 + ...rderSecurityFindingsAutomationMuteRules.rs | 30 + ...tyFindingsAutomationTicketCreationRules.rs | 33 + ...teSecurityFindingsAutomationDueDateRule.rs | 49 + ...pdateSecurityFindingsAutomationMuteRule.rs | 41 + ...ityFindingsAutomationTicketCreationRule.rs | 52 + src/datadog/configuration.rs | 72 + src/datadogV2/api/api_security_monitoring.rs | 11151 ++++++++++------ src/datadogV2/model/mod.rs | 100 + .../model/model_automation_rule_actor_type.rs | 51 + .../model/model_automation_rule_created_by.rs | 124 + .../model_automation_rule_modified_by.rs | 124 + .../model/model_automation_rule_scope.rs | 114 + src/datadogV2/model/model_due_date_from.rs | 51 + .../model/model_due_date_per_severity_item.rs | 117 + .../model/model_due_date_rule_action.rs | 137 + .../model_due_date_rule_attributes_create.rs | 133 + ...model_due_date_rule_attributes_response.rs | 176 + .../model_due_date_rule_create_request.rs | 92 + .../model/model_due_date_rule_data_create.rs | 116 + .../model_due_date_rule_data_response.rs | 127 + .../model/model_due_date_rule_reorder_item.rs | 115 + .../model_due_date_rule_reorder_request.rs | 94 + .../model/model_due_date_rule_response.rs | 92 + .../model/model_due_date_rule_type.rs | 48 + .../model_due_date_rule_update_request.rs | 92 + .../model/model_due_date_rules_response.rs | 116 + .../model/model_due_date_severity.rs | 66 + src/datadogV2/model/model_mute_reason.rs | 63 + src/datadogV2/model/model_mute_rule_action.rs | 137 + .../model_mute_rule_attributes_create.rs | 133 + .../model_mute_rule_attributes_response.rs | 176 + .../model/model_mute_rule_create_request.rs | 92 + .../model/model_mute_rule_data_create.rs | 116 + .../model/model_mute_rule_data_response.rs | 127 + .../model/model_mute_rule_reorder_item.rs | 115 + .../model/model_mute_rule_reorder_request.rs | 92 + .../model/model_mute_rule_response.rs | 92 + src/datadogV2/model/model_mute_rule_type.rs | 48 + .../model/model_mute_rule_update_request.rs | 92 + .../model/model_mute_rules_response.rs | 116 + .../model_security_automation_rules_links.rs | 136 + .../model_security_automation_rules_meta.rs | 95 + ...del_security_automation_rules_page_info.rs | 94 + .../model/model_security_finding_type.rs | 80 + .../model_ticket_creation_rule_action.rs | 162 + ...el_ticket_creation_rule_action_response.rs | 180 + ..._ticket_creation_rule_attributes_create.rs | 133 + ...icket_creation_rule_attributes_response.rs | 177 + ...del_ticket_creation_rule_create_request.rs | 94 + .../model_ticket_creation_rule_data_create.rs | 115 + ...odel_ticket_creation_rule_data_response.rs | 126 + ...model_ticket_creation_rule_reorder_item.rs | 113 + ...el_ticket_creation_rule_reorder_request.rs | 95 + .../model_ticket_creation_rule_response.rs | 95 + .../model/model_ticket_creation_rule_type.rs | 48 + ...del_ticket_creation_rule_update_request.rs | 94 + .../model_ticket_creation_rules_response.rs | 117 + .../model/model_ticket_creation_target.rs | 51 + ...-created-the-due-date-rule-response.frozen | 1 + ...ly-created-the-due-date-rule-response.json | 63 + ...ully-created-the-mute-rule-response.frozen | 1 + ...sfully-created-the-mute-rule-response.json | 63 + ...d-the-ticket-creation-rule-response.frozen | 1 + ...ted-the-ticket-creation-rule-response.json | 63 + ...-Rule-successfully-deleted-response.frozen | 1 + ...ns-Rule-successfully-deleted-response.json | 91 + ...-Rule-successfully-deleted-response.frozen | 1 + ...ns-Rule-successfully-deleted-response.json | 91 + ...-Rule-successfully-deleted-response.frozen | 1 + ...ns-Rule-successfully-deleted-response.json | 91 + ...etrieved-the-due-date-rule-response.frozen | 1 + ...-retrieved-the-due-date-rule-response.json | 91 + ...ly-retrieved-the-mute-rule-response.frozen | 1 + ...ully-retrieved-the-mute-rule-response.json | 91 + ...d-the-ticket-creation-rule-response.frozen | 1 + ...ved-the-ticket-creation-rule-response.json | 91 + ...the-list-of-due-date-rules-response.frozen | 1 + ...d-the-list-of-due-date-rules-response.json | 91 + ...ved-the-list-of-mute-rules-response.frozen | 1 + ...ieved-the-list-of-mute-rules-response.json | 91 + ...t-of-ticket-creation-rules-response.frozen | 1 + ...ist-of-ticket-creation-rules-response.json | 91 + ...ordered-the-due-date-rules-response.frozen | 1 + ...reordered-the-due-date-rules-response.json | 97 + ...y-reordered-the-mute-rules-response.frozen | 1 + ...lly-reordered-the-mute-rules-response.json | 97 + ...-the-ticket-creation-rules-response.frozen | 1 + ...ed-the-ticket-creation-rules-response.json | 97 + ...-updated-the-due-date-rule-response.frozen | 1 + ...ly-updated-the-due-date-rule-response.json | 97 + ...ully-updated-the-mute-rule-response.frozen | 1 + ...sfully-updated-the-mute-rule-response.json | 97 + ...d-the-ticket-creation-rule-response.frozen | 1 + ...ted-the-ticket-creation-rule-response.json | 97 + tests/scenarios/features/v2/given.json | 36 + .../features/v2/security_monitoring.feature | 408 + tests/scenarios/features/v2/undo.json | 129 + tests/scenarios/function_mappings.rs | 634 + 112 files changed, 18073 insertions(+), 4179 deletions(-) create mode 100644 examples/v2_security-monitoring_CreateSecurityFindingsAutomationDueDateRule.rs create mode 100644 examples/v2_security-monitoring_CreateSecurityFindingsAutomationMuteRule.rs create mode 100644 examples/v2_security-monitoring_CreateSecurityFindingsAutomationTicketCreationRule.rs create mode 100644 examples/v2_security-monitoring_DeleteSecurityFindingsAutomationDueDateRule.rs create mode 100644 examples/v2_security-monitoring_DeleteSecurityFindingsAutomationMuteRule.rs create mode 100644 examples/v2_security-monitoring_DeleteSecurityFindingsAutomationTicketCreationRule.rs create mode 100644 examples/v2_security-monitoring_GetSecurityFindingsAutomationDueDateRule.rs create mode 100644 examples/v2_security-monitoring_GetSecurityFindingsAutomationMuteRule.rs create mode 100644 examples/v2_security-monitoring_GetSecurityFindingsAutomationTicketCreationRule.rs create mode 100644 examples/v2_security-monitoring_ListSecurityFindingsAutomationDueDateRules.rs create mode 100644 examples/v2_security-monitoring_ListSecurityFindingsAutomationMuteRules.rs create mode 100644 examples/v2_security-monitoring_ListSecurityFindingsAutomationTicketCreationRules.rs create mode 100644 examples/v2_security-monitoring_ReorderSecurityFindingsAutomationDueDateRules.rs create mode 100644 examples/v2_security-monitoring_ReorderSecurityFindingsAutomationMuteRules.rs create mode 100644 examples/v2_security-monitoring_ReorderSecurityFindingsAutomationTicketCreationRules.rs create mode 100644 examples/v2_security-monitoring_UpdateSecurityFindingsAutomationDueDateRule.rs create mode 100644 examples/v2_security-monitoring_UpdateSecurityFindingsAutomationMuteRule.rs create mode 100644 examples/v2_security-monitoring_UpdateSecurityFindingsAutomationTicketCreationRule.rs create mode 100644 src/datadogV2/model/model_automation_rule_actor_type.rs create mode 100644 src/datadogV2/model/model_automation_rule_created_by.rs create mode 100644 src/datadogV2/model/model_automation_rule_modified_by.rs create mode 100644 src/datadogV2/model/model_automation_rule_scope.rs create mode 100644 src/datadogV2/model/model_due_date_from.rs create mode 100644 src/datadogV2/model/model_due_date_per_severity_item.rs create mode 100644 src/datadogV2/model/model_due_date_rule_action.rs create mode 100644 src/datadogV2/model/model_due_date_rule_attributes_create.rs create mode 100644 src/datadogV2/model/model_due_date_rule_attributes_response.rs create mode 100644 src/datadogV2/model/model_due_date_rule_create_request.rs create mode 100644 src/datadogV2/model/model_due_date_rule_data_create.rs create mode 100644 src/datadogV2/model/model_due_date_rule_data_response.rs create mode 100644 src/datadogV2/model/model_due_date_rule_reorder_item.rs create mode 100644 src/datadogV2/model/model_due_date_rule_reorder_request.rs create mode 100644 src/datadogV2/model/model_due_date_rule_response.rs create mode 100644 src/datadogV2/model/model_due_date_rule_type.rs create mode 100644 src/datadogV2/model/model_due_date_rule_update_request.rs create mode 100644 src/datadogV2/model/model_due_date_rules_response.rs create mode 100644 src/datadogV2/model/model_due_date_severity.rs create mode 100644 src/datadogV2/model/model_mute_reason.rs create mode 100644 src/datadogV2/model/model_mute_rule_action.rs create mode 100644 src/datadogV2/model/model_mute_rule_attributes_create.rs create mode 100644 src/datadogV2/model/model_mute_rule_attributes_response.rs create mode 100644 src/datadogV2/model/model_mute_rule_create_request.rs create mode 100644 src/datadogV2/model/model_mute_rule_data_create.rs create mode 100644 src/datadogV2/model/model_mute_rule_data_response.rs create mode 100644 src/datadogV2/model/model_mute_rule_reorder_item.rs create mode 100644 src/datadogV2/model/model_mute_rule_reorder_request.rs create mode 100644 src/datadogV2/model/model_mute_rule_response.rs create mode 100644 src/datadogV2/model/model_mute_rule_type.rs create mode 100644 src/datadogV2/model/model_mute_rule_update_request.rs create mode 100644 src/datadogV2/model/model_mute_rules_response.rs create mode 100644 src/datadogV2/model/model_security_automation_rules_links.rs create mode 100644 src/datadogV2/model/model_security_automation_rules_meta.rs create mode 100644 src/datadogV2/model/model_security_automation_rules_page_info.rs create mode 100644 src/datadogV2/model/model_security_finding_type.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_action.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_action_response.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_attributes_create.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_attributes_response.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_create_request.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_data_create.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_data_response.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_reorder_item.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_reorder_request.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_response.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_type.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rule_update_request.rs create mode 100644 src/datadogV2/model/model_ticket_creation_rules_response.rs create mode 100644 src/datadogV2/model/model_ticket_creation_target.rs create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.json create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.frozen create mode 100644 tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b17c8433b..de1bbc139 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -11426,6 +11426,16 @@ components: x-enum-varnames: - EXECUTE_WORKFLOW - ASSIGN_AGENT + AutomationRuleActorType: + description: Whether the actor is a user or the Datadog system. + enum: + - user + - system + example: user + type: string + x-enum-varnames: + - USER + - SYSTEM AutomationRuleAttributes: description: Core attributes of an automation rule, including its name, trigger condition, action to execute, and current state. properties: @@ -11494,6 +11504,42 @@ components: required: - data type: object + AutomationRuleCreatedBy: + description: The user or Datadog system who created the rule. + properties: + id: + description: The actor's identifier (a user UUID or a system identifier). + example: "00000000-0000-0000-0000-000000000000" + type: string + name: + description: The name of the actor. + example: "Jane Doe" + type: string + type: + $ref: "#/components/schemas/AutomationRuleActorType" + required: + - type + - id + - name + type: object + AutomationRuleModifiedBy: + description: The user or Datadog system who last modified the rule. + properties: + id: + description: The actor's identifier (a user UUID or a system identifier). + example: "00000000-0000-0000-0000-000000000000" + type: string + name: + description: The name of the actor. + example: "Jane Doe" + type: string + type: + $ref: "#/components/schemas/AutomationRuleActorType" + required: + - type + - id + - name + type: object AutomationRuleRelationships: description: Related resources for the automation rule, including the users who created and last modified it. properties: @@ -11510,6 +11556,19 @@ components: required: - data type: object + AutomationRuleScope: + description: Defines the scope of findings to which the automation rule applies. + properties: + finding_types: + $ref: "#/components/schemas/SecurityFindingTypes" + query: + description: A search query to further filter the findings matched by this rule. The `@workflow.*` namespace and `@status` fields are not permitted. For a reference of available fields, see the [Security Findings schema documentation](https://docs.datadoghq.com/security/guide/findings-schema/). + example: "env:prod team:platform" + maxLength: 30000 + type: string + required: + - finding_types + type: object AutomationRuleTrigger: description: Defines when the rule activates. Combines a trigger type (the case event to listen for) with optional trigger data (conditions that narrow when the trigger fires). properties: @@ -31697,6 +31756,242 @@ components: - type - attributes type: object + DueDateFrom: + description: The reference point from which the due date is calculated. When `fix_available` is selected but not applicable to the finding type, `first_seen` is used instead. + enum: + - first_seen + - fix_available + example: first_seen + type: string + x-enum-varnames: + - FIRST_SEEN + - FIX_AVAILABLE + DueDatePerSeverityItem: + description: A mapping of a severity level to the number of days until a finding is due. + properties: + due_in_days: + description: The number of days from the reference point until the finding is due. + example: 7 + format: int64 + maximum: 365 + minimum: 1 + type: integer + severity: + $ref: "#/components/schemas/DueDateSeverity" + required: + - severity + - due_in_days + type: object + DueDatePerSeverityList: + description: A list of severity-to-due-date mappings. Each severity may appear at most once. + items: + $ref: "#/components/schemas/DueDatePerSeverityItem" + type: array + DueDateRuleAction: + description: The action to take when the due date rule matches a finding. + properties: + due_days_per_severity: + $ref: "#/components/schemas/DueDatePerSeverityList" + due_from: + $ref: "#/components/schemas/DueDateFrom" + reason_description: + description: An optional description providing more context for the due date assignment. + example: "Applied for production findings only" + maxLength: 20000 + type: string + required: + - due_days_per_severity + - due_from + type: object + DueDateRuleAttributesCreate: + description: Attributes for creating or updating a due date rule. + properties: + action: + $ref: "#/components/schemas/DueDateRuleAction" + enabled: + description: Whether the due date rule is enabled. + example: true + type: boolean + name: + description: The name of the due date rule. + example: "Critical findings due in 7 days" + maxLength: 255 + minLength: 1 + type: string + rule: + $ref: "#/components/schemas/AutomationRuleScope" + required: + - name + - rule + - action + type: object + DueDateRuleAttributesResponse: + description: Attributes of a due date rule returned by the API. + properties: + action: + $ref: "#/components/schemas/DueDateRuleAction" + 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 due date 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 due date rule. + example: "Critical findings due in 7 days" + 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 + DueDateRuleCreateRequest: + description: The body of a due date rule create request. + properties: + data: + $ref: "#/components/schemas/DueDateRuleDataCreate" + required: + - data + type: object + DueDateRuleDataCreate: + description: The data object for a due date rule create or update request. + properties: + attributes: + $ref: "#/components/schemas/DueDateRuleAttributesCreate" + type: + $ref: "#/components/schemas/DueDateRuleType" + required: + - type + - attributes + type: object + DueDateRuleDataResponse: + description: The data object for a due date rule returned by the API. + properties: + attributes: + $ref: "#/components/schemas/DueDateRuleAttributesResponse" + id: + description: The ID of the due date rule. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + type: + $ref: "#/components/schemas/DueDateRuleType" + required: + - id + - type + - attributes + type: object + DueDateRuleReorderData: + description: The ordered list of all due date rules; every rule must be included. + items: + $ref: "#/components/schemas/DueDateRuleReorderItem" + type: array + DueDateRuleReorderItem: + description: A reference to a due date 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/DueDateRuleType" + required: + - type + - id + type: object + DueDateRuleReorderRequest: + description: The body of the due date rule reorder request. + properties: + data: + $ref: "#/components/schemas/DueDateRuleReorderData" + required: + - data + type: object + DueDateRuleResponse: + description: A single due date rule response. + properties: + data: + $ref: "#/components/schemas/DueDateRuleDataResponse" + required: + - data + type: object + DueDateRuleType: + description: The JSON:API type for due date rules. + enum: + - due_date_rules + example: due_date_rules + type: string + x-enum-varnames: + - DUE_DATE_RULES + DueDateRuleUpdateRequest: + description: The body of a due date rule update request. + properties: + data: + $ref: "#/components/schemas/DueDateRuleDataCreate" + required: + - data + type: object + DueDateRulesDataList: + description: A list of due date rule data objects. + items: + $ref: "#/components/schemas/DueDateRuleDataResponse" + type: array + DueDateRulesResponse: + description: A list of due date rules with pagination metadata. + properties: + data: + $ref: "#/components/schemas/DueDateRulesDataList" + links: + $ref: "#/components/schemas/SecurityAutomationRulesLinks" + meta: + $ref: "#/components/schemas/SecurityAutomationRulesMeta" + required: + - data + - meta + - links + type: object + DueDateSeverity: + description: A severity level used to configure due date thresholds. + enum: + - critical + - high + - medium + - low + - info + - none + - unknown + example: critical + type: string + x-enum-varnames: + - CRITICAL + - HIGH + - MEDIUM + - LOW + - INFO + - NONE + - UNKNOWN ELFSourcemapAttributes: description: Attributes of an ELF symbol file. properties: @@ -61121,6 +61416,211 @@ components: - type - id type: object + MuteReason: + description: The reason for muting a security finding. + enum: + - duplicate + - false_positive + - no_fix + - other + - pending_fix + - risk_accepted + example: risk_accepted + type: string + x-enum-varnames: + - DUPLICATE + - FALSE_POSITIVE + - NO_FIX + - OTHER + - PENDING_FIX + - RISK_ACCEPTED + MuteRuleAction: + description: The action to take when the mute rule matches a finding. + properties: + expire_at: + description: The Unix timestamp in milliseconds at which the mute expires. If omitted, the mute does not expire. + example: 4070908800000 + format: int64 + type: integer + reason: + $ref: "#/components/schemas/MuteReason" + reason_description: + description: An optional description providing more context for the mute reason. + example: "Accepted for dev environments only" + maxLength: 20000 + type: string + required: + - reason + type: object + MuteRuleAttributesCreate: + description: Attributes for creating or updating a mute rule. + properties: + action: + $ref: "#/components/schemas/MuteRuleAction" + enabled: + description: Whether the mute rule is enabled. + example: true + type: boolean + name: + description: The name of the mute rule. + example: "Mute accepted risks in dev" + maxLength: 255 + minLength: 1 + type: string + rule: + $ref: "#/components/schemas/AutomationRuleScope" + required: + - name + - rule + - action + type: object + MuteRuleAttributesResponse: + description: Attributes of a mute rule returned by the API. + properties: + action: + $ref: "#/components/schemas/MuteRuleAction" + 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 mute 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 mute rule. + example: "Mute accepted risks 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 + MuteRuleCreateRequest: + description: The body of a mute rule create request. + properties: + data: + $ref: "#/components/schemas/MuteRuleDataCreate" + required: + - data + type: object + MuteRuleDataCreate: + description: The data object for a mute rule create or update request. + properties: + attributes: + $ref: "#/components/schemas/MuteRuleAttributesCreate" + type: + $ref: "#/components/schemas/MuteRuleType" + required: + - type + - attributes + type: object + MuteRuleDataResponse: + description: The data object for a mute rule returned by the API. + properties: + attributes: + $ref: "#/components/schemas/MuteRuleAttributesResponse" + id: + description: The ID of the mute rule. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + type: + $ref: "#/components/schemas/MuteRuleType" + required: + - id + - type + - attributes + type: object + MuteRuleReorderData: + description: The ordered list of all mute rules; every rule must be included. + items: + $ref: "#/components/schemas/MuteRuleReorderItem" + type: array + MuteRuleReorderItem: + description: A reference to a mute 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/MuteRuleType" + required: + - type + - id + type: object + MuteRuleReorderRequest: + description: The body of the mute rule reorder request. + properties: + data: + $ref: "#/components/schemas/MuteRuleReorderData" + required: + - data + type: object + MuteRuleResponse: + description: A single mute rule response. + properties: + data: + $ref: "#/components/schemas/MuteRuleDataResponse" + required: + - data + type: object + MuteRuleType: + description: The JSON:API type for mute rules. + enum: + - mute_rules + example: mute_rules + type: string + x-enum-varnames: + - MUTE_RULES + MuteRuleUpdateRequest: + description: The body of a mute rule update request. + properties: + data: + $ref: "#/components/schemas/MuteRuleDataCreate" + required: + - data + type: object + MuteRulesDataList: + description: A list of mute rule data objects. + items: + $ref: "#/components/schemas/MuteRuleDataResponse" + type: array + MuteRulesResponse: + description: A list of mute rules with pagination metadata. + properties: + data: + $ref: "#/components/schemas/MuteRulesDataList" + links: + $ref: "#/components/schemas/SecurityAutomationRulesLinks" + meta: + $ref: "#/components/schemas/SecurityAutomationRulesMeta" + required: + - data + - meta + - links + type: object NDKSourcemapAttributes: description: Attributes of an Android NDK symbol file. properties: @@ -82773,6 +83273,48 @@ components: - SYSTEM - LIGHT - DARK + SecurityAutomationRulesLinks: + description: Pagination links for the list of automation rules. + properties: + first: + description: Link to the first page of results. + example: "/api/v2/security/findings/automation/mute_rules?page[size]=10&page[number]=0" + type: string + last: + description: Link to the last page of results. + example: "/api/v2/security/findings/automation/mute_rules?page[size]=10&page[number]=5" + type: string + next: + description: Link to the next page of results. + example: "/api/v2/security/findings/automation/mute_rules?page[size]=10&page[number]=2" + type: string + prev: + description: Link to the previous page of results. + example: "/api/v2/security/findings/automation/mute_rules?page[size]=10&page[number]=0" + type: string + required: + - first + - last + type: object + SecurityAutomationRulesMeta: + description: Metadata for the list of automation rules. + properties: + page: + $ref: "#/components/schemas/SecurityAutomationRulesPageInfo" + required: + - page + type: object + SecurityAutomationRulesPageInfo: + description: Pagination information for the list of automation rules. + properties: + total_filtered_count: + description: The total number of rules matching the current filter. + example: 42 + format: int64 + type: integer + required: + - total_filtered_count + type: object SecurityEntityConfigRisks: description: Configuration risks associated with the entity properties: @@ -83377,6 +83919,42 @@ components: meta: $ref: "#/components/schemas/SecurityFilterMeta" type: object + SecurityFindingType: + description: The type of security finding that the automation rule applies to. + enum: + - api_security + - attack_path + - host_and_container_vulnerability + - iac_misconfiguration + - identity_risk + - library_vulnerability + - misconfiguration + - runtime_code_vulnerability + - secret + - static_code_vulnerability + - workload_activity + example: misconfiguration + type: string + x-enum-varnames: + - API_SECURITY + - ATTACK_PATH + - HOST_AND_CONTAINER_VULNERABILITY + - IAC_MISCONFIGURATION + - IDENTITY_RISK + - LIBRARY_VULNERABILITY + - MISCONFIGURATION + - RUNTIME_CODE_VULNERABILITY + - SECRET + - STATIC_CODE_VULNERABILITY + - WORKLOAD_ACTIVITY + SecurityFindingTypes: + description: The list of security finding types that the automation rule applies to. + example: + - misconfiguration + items: + $ref: "#/components/schemas/SecurityFindingType" + minItems: 1 + type: array SecurityFindingsAttributes: description: The JSON object containing all attributes of the security finding. properties: @@ -101859,6 +102437,255 @@ components: type: string x-enum-varnames: - TEST_OPTIMIZATION_UPDATE_SERVICE_SETTINGS_REQUEST + TicketCreationRuleAction: + description: The action to take when the ticket creation rule matches a finding. + properties: + assignee_id: + description: The UUID of the default assignee for created tickets. + example: "22222222-2222-2222-2222-222222222222" + format: uuid + type: string + fields: + description: Custom fields of the Jira issue to create. For the list of available fields, see [Jira documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-createmeta-projectidorkey-issuetypes-issuetypeid-get). + example: + labels: + - security + type: object + max_tickets_per_day: + description: The maximum number of tickets the rule may create per day. If exceeded, one final ticket will be created, explaining the limit was hit and link back to the responsible rule. + example: 100 + format: int64 + maximum: 500 + minimum: 1 + type: integer + project_id: + description: The UUID of the case management project. + example: "11111111-1111-1111-1111-111111111111" + format: uuid + type: string + target: + $ref: "#/components/schemas/TicketCreationTarget" + required: + - project_id + - target + - max_tickets_per_day + type: object + TicketCreationRuleActionResponse: + description: The action to take when the ticket creation rule matches a finding. + properties: + assignee_id: + description: The UUID of the default assignee for created tickets. + example: "22222222-2222-2222-2222-222222222222" + format: uuid + type: string + auto_disabled_reason: + description: The reason the rule was automatically disabled by the system due to a ticketing integration error. + example: "Daily ticket creation limit exceeded" + type: string + fields: + description: Custom fields of the Jira issue to create. For the list of available fields, see [Jira documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-createmeta-projectidorkey-issuetypes-issuetypeid-get). + example: + labels: + - security + type: object + max_tickets_per_day: + description: The maximum number of tickets the rule may create per day. If exceeded, one final ticket will be created, explaining the limit was hit and link back to the responsible rule. + example: 100 + format: int64 + maximum: 500 + minimum: 1 + type: integer + project_id: + description: The UUID of the case management project. + example: "11111111-1111-1111-1111-111111111111" + format: uuid + type: string + target: + $ref: "#/components/schemas/TicketCreationTarget" + required: + - project_id + - target + - max_tickets_per_day + type: object + TicketCreationRuleAttributesCreate: + description: Attributes for creating or updating a ticket creation rule. + properties: + action: + $ref: "#/components/schemas/TicketCreationRuleAction" + enabled: + description: Whether the ticket creation rule is enabled. + example: true + type: boolean + name: + description: The name of the ticket creation rule. + example: "Auto-create Jira tickets for critical findings" + maxLength: 255 + minLength: 1 + type: string + rule: + $ref: "#/components/schemas/AutomationRuleScope" + required: + - name + - rule + - action + type: object + TicketCreationRuleAttributesResponse: + description: Attributes of a ticket creation rule returned by the API. + properties: + action: + $ref: "#/components/schemas/TicketCreationRuleActionResponse" + 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 ticket creation 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 ticket creation rule. + example: "Auto-create Jira tickets for critical findings" + 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 + TicketCreationRuleCreateRequest: + description: The body of a ticket creation rule create request. + properties: + data: + $ref: "#/components/schemas/TicketCreationRuleDataCreate" + required: + - data + type: object + TicketCreationRuleDataCreate: + description: The data object for a ticket creation rule create or update request. + properties: + attributes: + $ref: "#/components/schemas/TicketCreationRuleAttributesCreate" + type: + $ref: "#/components/schemas/TicketCreationRuleType" + required: + - type + - attributes + type: object + TicketCreationRuleDataResponse: + description: The data object for a ticket creation rule returned by the API. + properties: + attributes: + $ref: "#/components/schemas/TicketCreationRuleAttributesResponse" + id: + description: The ID of the ticket creation rule. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + type: + $ref: "#/components/schemas/TicketCreationRuleType" + required: + - id + - type + - attributes + type: object + TicketCreationRuleReorderData: + description: The ordered list of all ticket creation rules; every rule must be included. + items: + $ref: "#/components/schemas/TicketCreationRuleReorderItem" + type: array + TicketCreationRuleReorderItem: + description: A reference to a ticket creation 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/TicketCreationRuleType" + required: + - type + - id + type: object + TicketCreationRuleReorderRequest: + description: The body of the ticket creation rule reorder request. + properties: + data: + $ref: "#/components/schemas/TicketCreationRuleReorderData" + required: + - data + type: object + TicketCreationRuleResponse: + description: A single ticket creation rule response. + properties: + data: + $ref: "#/components/schemas/TicketCreationRuleDataResponse" + required: + - data + type: object + TicketCreationRuleType: + description: The JSON:API type for ticket creation rules. + enum: + - ticket_creation_rules + example: ticket_creation_rules + type: string + x-enum-varnames: + - TICKET_CREATION_RULES + TicketCreationRuleUpdateRequest: + description: The body of a ticket creation rule update request. + properties: + data: + $ref: "#/components/schemas/TicketCreationRuleDataCreate" + required: + - data + type: object + TicketCreationRulesDataList: + description: A list of ticket creation rule data objects. + items: + $ref: "#/components/schemas/TicketCreationRuleDataResponse" + type: array + TicketCreationRulesResponse: + description: A list of ticket creation rules with pagination metadata. + properties: + data: + $ref: "#/components/schemas/TicketCreationRulesDataList" + links: + $ref: "#/components/schemas/SecurityAutomationRulesLinks" + meta: + $ref: "#/components/schemas/SecurityAutomationRulesMeta" + required: + - data + - meta + - links + type: object + TicketCreationTarget: + description: The ticketing system to create tickets in. + enum: + - jira + - case_management + example: jira + type: string + x-enum-varnames: + - JIRA + - CASE_MANAGEMENT TimeAggregation: description: |- Time aggregation period (in seconds) is used to aggregate the results of the notification rule evaluation. @@ -167038,6 +167865,1329 @@ 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/due_date_rules: + get: + description: Get all due date rules for the current organization. + operationId: ListSecurityFindingsAutomationDueDateRules + 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: + due_days_per_severity: + - due_in_days: 7 + severity: critical + - due_in_days: 30 + severity: high + due_from: first_seen + 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: "Critical findings due in 7 days" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: due_date_rules + links: + first: "/api/v2/security/findings/automation/due_date_rules?page[size]=1000&page[number]=0" + last: "/api/v2/security/findings/automation/due_date_rules?page[size]=1000&page[number]=0" + meta: + page: + total_filtered_count: 1 + schema: + $ref: "#/components/schemas/DueDateRulesResponse" + description: Successfully retrieved the list of due date rules + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get all due date 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 due date rule for the current organization. + operationId: CreateSecurityFindingsAutomationDueDateRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + due_days_per_severity: + - due_in_days: 7 + severity: critical + - due_in_days: 30 + severity: high + due_from: first_seen + enabled: true + name: "Critical findings due in 7 days" + rule: + finding_types: + - misconfiguration + query: "env:prod" + type: due_date_rules + schema: + $ref: "#/components/schemas/DueDateRuleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + due_days_per_severity: + - due_in_days: 7 + severity: critical + - due_in_days: 30 + severity: high + due_from: first_seen + 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: "Critical findings due in 7 days" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: due_date_rules + schema: + $ref: "#/components/schemas/DueDateRuleResponse" + description: Successfully created the due date 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 due date 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/due_date_rules/reorder: + post: + description: Reorder the list of due date rules for the current organization. + operationId: ReorderSecurityFindingsAutomationDueDateRules + requestBody: + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: due_date_rules + - id: "11111111-1111-1111-1111-111111111111" + type: due_date_rules + schema: + $ref: "#/components/schemas/DueDateRuleReorderRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: due_date_rules + - id: "11111111-1111-1111-1111-111111111111" + type: due_date_rules + schema: + $ref: "#/components/schemas/DueDateRuleReorderRequest" + description: Successfully reordered the due date 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 due date 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/due_date_rules/{rule_id}: + delete: + description: Delete an existing due date rule by ID. + operationId: DeleteSecurityFindingsAutomationDueDateRule + parameters: + - description: The ID of the due date 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 due date 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 due date rule by ID. + operationId: GetSecurityFindingsAutomationDueDateRule + parameters: + - description: The ID of the due date 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: + due_days_per_severity: + - due_in_days: 7 + severity: critical + - due_in_days: 30 + severity: high + due_from: first_seen + 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: "Critical findings due in 7 days" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: due_date_rules + schema: + $ref: "#/components/schemas/DueDateRuleResponse" + description: Successfully retrieved the due date rule + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a due date 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 due date rule by ID. + operationId: UpdateSecurityFindingsAutomationDueDateRule + parameters: + - description: The ID of the due date 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: + due_days_per_severity: + - due_in_days: 7 + severity: critical + - due_in_days: 30 + severity: high + - due_in_days: 90 + severity: medium + due_from: fix_available + enabled: true + name: "Critical findings due in 7 days" + rule: + finding_types: + - misconfiguration + query: "env:prod" + type: due_date_rules + schema: + $ref: "#/components/schemas/DueDateRuleUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + due_days_per_severity: + - due_in_days: 7 + severity: critical + - due_in_days: 30 + severity: high + - due_in_days: 90 + severity: medium + due_from: fix_available + created_at: 1722439510282 + created_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + enabled: true + modified_at: 1722439510999 + modified_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + name: "Critical findings due in 7 days" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: due_date_rules + schema: + $ref: "#/components/schemas/DueDateRuleResponse" + description: Successfully updated the due date 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 due date 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/mute_rules: + get: + description: Get all mute rules for the current organization. + operationId: ListSecurityFindingsAutomationMuteRules + 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: + expire_at: 4070908800000 + reason: risk_accepted + reason_description: "Accepted for dev environments only" + 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: "Mute accepted risks in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev team:platform @severity:low" + id: "00000000-0000-0000-0000-000000000000" + type: mute_rules + links: + first: "/api/v2/security/findings/automation/mute_rules?page[size]=1000&page[number]=0" + last: "/api/v2/security/findings/automation/mute_rules?page[size]=1000&page[number]=0" + meta: + page: + total_filtered_count: 1 + schema: + $ref: "#/components/schemas/MuteRulesResponse" + description: Successfully retrieved the list of mute rules + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get all mute 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 mute rule for the current organization. + operationId: CreateSecurityFindingsAutomationMuteRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + expire_at: 4070908800000 + reason: risk_accepted + reason_description: "Accepted for dev environments only" + enabled: true + name: "Mute accepted risks in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev team:platform @severity:low" + type: mute_rules + schema: + $ref: "#/components/schemas/MuteRuleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + expire_at: 4070908800000 + reason: risk_accepted + reason_description: "Accepted for dev environments only" + 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: "Mute accepted risks in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev team:platform @severity:low" + id: "00000000-0000-0000-0000-000000000000" + type: mute_rules + schema: + $ref: "#/components/schemas/MuteRuleResponse" + description: Successfully created the mute 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 mute 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/mute_rules/reorder: + post: + description: Reorder the list of mute rules for the current organization. + operationId: ReorderSecurityFindingsAutomationMuteRules + requestBody: + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: mute_rules + - id: "11111111-1111-1111-1111-111111111111" + type: mute_rules + schema: + $ref: "#/components/schemas/MuteRuleReorderRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: mute_rules + - id: "11111111-1111-1111-1111-111111111111" + type: mute_rules + schema: + $ref: "#/components/schemas/MuteRuleReorderRequest" + description: Successfully reordered the mute 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 mute 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/mute_rules/{rule_id}: + delete: + description: Delete an existing mute rule by ID. + operationId: DeleteSecurityFindingsAutomationMuteRule + parameters: + - description: The ID of the mute 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 mute 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 mute rule by ID. + operationId: GetSecurityFindingsAutomationMuteRule + parameters: + - description: The ID of the mute 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: + expire_at: 4070908800000 + reason: risk_accepted + reason_description: "Accepted for dev environments only" + 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: "Mute accepted risks in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev team:platform @severity:low" + id: "00000000-0000-0000-0000-000000000000" + type: mute_rules + schema: + $ref: "#/components/schemas/MuteRuleResponse" + description: Successfully retrieved the mute rule + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a mute 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 mute rule by ID. + operationId: UpdateSecurityFindingsAutomationMuteRule + parameters: + - description: The ID of the mute 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: + reason: risk_accepted + enabled: false + name: "Mute accepted risks in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + type: mute_rules + schema: + $ref: "#/components/schemas/MuteRuleUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + reason: risk_accepted + 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: "Mute accepted risks in dev" + rule: + finding_types: + - misconfiguration + query: "env:dev" + id: "00000000-0000-0000-0000-000000000000" + type: mute_rules + schema: + $ref: "#/components/schemas/MuteRuleResponse" + description: Successfully updated the mute 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 mute 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. + operationId: ListSecurityFindingsAutomationTicketCreationRules + 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: + max_tickets_per_day: 100 + project_id: "11111111-1111-1111-1111-111111111111" + target: jira + 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: "Auto-create Jira tickets for critical findings" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: ticket_creation_rules + links: + first: "/api/v2/security/findings/automation/ticket_creation_rules?page[size]=1000&page[number]=0" + last: "/api/v2/security/findings/automation/ticket_creation_rules?page[size]=1000&page[number]=0" + meta: + page: + total_filtered_count: 1 + schema: + $ref: "#/components/schemas/TicketCreationRulesResponse" + description: Successfully retrieved the list of ticket creation rules + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get all ticket creation 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 ticket creation rule for the current organization. + operationId: CreateSecurityFindingsAutomationTicketCreationRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + max_tickets_per_day: 100 + project_id: "11111111-1111-1111-1111-111111111111" + target: jira + enabled: true + name: "Auto-create Jira tickets for critical findings" + rule: + finding_types: + - misconfiguration + query: "env:prod" + type: ticket_creation_rules + schema: + $ref: "#/components/schemas/TicketCreationRuleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + max_tickets_per_day: 100 + project_id: "11111111-1111-1111-1111-111111111111" + target: jira + 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: "Auto-create Jira tickets for critical findings" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: ticket_creation_rules + schema: + $ref: "#/components/schemas/TicketCreationRuleResponse" + description: Successfully created the ticket creation 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 ticket creation 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/reorder: + post: + description: Reorder the list of ticket creation rules for the current organization. + operationId: ReorderSecurityFindingsAutomationTicketCreationRules + requestBody: + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: ticket_creation_rules + - id: "11111111-1111-1111-1111-111111111111" + type: ticket_creation_rules + schema: + $ref: "#/components/schemas/TicketCreationRuleReorderRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - id: "00000000-0000-0000-0000-000000000000" + type: ticket_creation_rules + - id: "11111111-1111-1111-1111-111111111111" + type: ticket_creation_rules + schema: + $ref: "#/components/schemas/TicketCreationRuleReorderRequest" + description: Successfully reordered the ticket creation 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 ticket creation 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/ticket_creation_rules/{rule_id}: + delete: + description: Delete an existing ticket creation rule by ID. + operationId: DeleteSecurityFindingsAutomationTicketCreationRule + parameters: + - description: The ID of the ticket creation 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 ticket creation 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 ticket creation rule by ID. + operationId: GetSecurityFindingsAutomationTicketCreationRule + parameters: + - description: The ID of the ticket creation 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: + max_tickets_per_day: 100 + project_id: "11111111-1111-1111-1111-111111111111" + target: jira + 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: "Auto-create Jira tickets for critical findings" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: ticket_creation_rules + schema: + $ref: "#/components/schemas/TicketCreationRuleResponse" + description: Successfully retrieved the ticket creation rule + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a ticket creation 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 ticket creation rule by ID. + operationId: UpdateSecurityFindingsAutomationTicketCreationRule + parameters: + - description: The ID of the ticket creation 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: + max_tickets_per_day: 50 + project_id: "11111111-1111-1111-1111-111111111111" + target: jira + enabled: true + name: "Auto-create Jira tickets for critical findings" + rule: + finding_types: + - misconfiguration + query: "env:prod" + type: ticket_creation_rules + schema: + $ref: "#/components/schemas/TicketCreationRuleUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: + max_tickets_per_day: 50 + project_id: "11111111-1111-1111-1111-111111111111" + target: jira + created_at: 1722439510282 + created_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + enabled: true + modified_at: 1722439510999 + modified_by: + id: "00000000-0000-0000-0000-000000000000" + name: "Jane Doe" + type: user + name: "Auto-create Jira tickets for critical findings" + rule: + finding_types: + - misconfiguration + query: "env:prod" + id: "00000000-0000-0000-0000-000000000000" + type: ticket_creation_rules + schema: + $ref: "#/components/schemas/TicketCreationRuleResponse" + description: Successfully updated the ticket creation 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 ticket creation 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/cases: delete: description: >- diff --git a/examples/v2_security-monitoring_CreateSecurityFindingsAutomationDueDateRule.rs b/examples/v2_security-monitoring_CreateSecurityFindingsAutomationDueDateRule.rs new file mode 100644 index 000000000..a7fd1ced7 --- /dev/null +++ b/examples/v2_security-monitoring_CreateSecurityFindingsAutomationDueDateRule.rs @@ -0,0 +1,42 @@ +// Create a due date rule returns "Successfully created the due date rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::AutomationRuleScope; +use datadog_api_client::datadogV2::model::DueDateFrom; +use datadog_api_client::datadogV2::model::DueDatePerSeverityItem; +use datadog_api_client::datadogV2::model::DueDateRuleAction; +use datadog_api_client::datadogV2::model::DueDateRuleAttributesCreate; +use datadog_api_client::datadogV2::model::DueDateRuleCreateRequest; +use datadog_api_client::datadogV2::model::DueDateRuleDataCreate; +use datadog_api_client::datadogV2::model::DueDateRuleType; +use datadog_api_client::datadogV2::model::DueDateSeverity; +use datadog_api_client::datadogV2::model::SecurityFindingType; + +#[tokio::main] +async fn main() { + let body = DueDateRuleCreateRequest::new(DueDateRuleDataCreate::new( + DueDateRuleAttributesCreate::new( + DueDateRuleAction::new( + vec![DueDatePerSeverityItem::new(7, DueDateSeverity::CRITICAL)], + DueDateFrom::FIRST_SEEN, + ), + "Example-Security-Monitoring".to_string(), + AutomationRuleScope::new(vec![SecurityFindingType::MISCONFIGURATION]) + .query("env:staging".to_string()), + ) + .enabled(true), + DueDateRuleType::DUE_DATE_RULES, + )); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.CreateSecurityFindingsAutomationDueDateRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .create_security_findings_automation_due_date_rule(body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_CreateSecurityFindingsAutomationMuteRule.rs b/examples/v2_security-monitoring_CreateSecurityFindingsAutomationMuteRule.rs new file mode 100644 index 000000000..f9098267c --- /dev/null +++ b/examples/v2_security-monitoring_CreateSecurityFindingsAutomationMuteRule.rs @@ -0,0 +1,37 @@ +// Create a mute rule returns "Successfully created the mute rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::AutomationRuleScope; +use datadog_api_client::datadogV2::model::MuteReason; +use datadog_api_client::datadogV2::model::MuteRuleAction; +use datadog_api_client::datadogV2::model::MuteRuleAttributesCreate; +use datadog_api_client::datadogV2::model::MuteRuleCreateRequest; +use datadog_api_client::datadogV2::model::MuteRuleDataCreate; +use datadog_api_client::datadogV2::model::MuteRuleType; +use datadog_api_client::datadogV2::model::SecurityFindingType; + +#[tokio::main] +async fn main() { + let body = MuteRuleCreateRequest::new(MuteRuleDataCreate::new( + MuteRuleAttributesCreate::new( + MuteRuleAction::new(MuteReason::RISK_ACCEPTED), + "Example-Security-Monitoring".to_string(), + AutomationRuleScope::new(vec![SecurityFindingType::MISCONFIGURATION]) + .query("env:staging".to_string()), + ) + .enabled(true), + MuteRuleType::MUTE_RULES, + )); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.CreateSecurityFindingsAutomationMuteRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .create_security_findings_automation_mute_rule(body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_CreateSecurityFindingsAutomationTicketCreationRule.rs b/examples/v2_security-monitoring_CreateSecurityFindingsAutomationTicketCreationRule.rs new file mode 100644 index 000000000..b6c52e4eb --- /dev/null +++ b/examples/v2_security-monitoring_CreateSecurityFindingsAutomationTicketCreationRule.rs @@ -0,0 +1,45 @@ +// Create a ticket creation rule returns "Successfully created the ticket creation +// rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::AutomationRuleScope; +use datadog_api_client::datadogV2::model::SecurityFindingType; +use datadog_api_client::datadogV2::model::TicketCreationRuleAction; +use datadog_api_client::datadogV2::model::TicketCreationRuleAttributesCreate; +use datadog_api_client::datadogV2::model::TicketCreationRuleCreateRequest; +use datadog_api_client::datadogV2::model::TicketCreationRuleDataCreate; +use datadog_api_client::datadogV2::model::TicketCreationRuleType; +use datadog_api_client::datadogV2::model::TicketCreationTarget; +use uuid::Uuid; + +#[tokio::main] +async fn main() { + let body = TicketCreationRuleCreateRequest::new(TicketCreationRuleDataCreate::new( + TicketCreationRuleAttributesCreate::new( + TicketCreationRuleAction::new( + 10, + Uuid::parse_str("11111111-1111-1111-1111-111111111111").expect("invalid UUID"), + TicketCreationTarget::JIRA, + ), + "Example-Security-Monitoring".to_string(), + AutomationRuleScope::new(vec![SecurityFindingType::MISCONFIGURATION]) + .query("env:staging".to_string()), + ) + .enabled(true), + TicketCreationRuleType::TICKET_CREATION_RULES, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled( + "v2.CreateSecurityFindingsAutomationTicketCreationRule", + true, + ); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .create_security_findings_automation_ticket_creation_rule(body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationDueDateRule.rs b/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationDueDateRule.rs new file mode 100644 index 000000000..30f48b976 --- /dev/null +++ b/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationDueDateRule.rs @@ -0,0 +1,23 @@ +// Delete a due date rule returns "Rule successfully deleted." response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + // there is a valid "valid_due_date_rule" in the system + let valid_due_date_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_DUE_DATE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.DeleteSecurityFindingsAutomationDueDateRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .delete_security_findings_automation_due_date_rule(valid_due_date_rule_data_id.clone()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationMuteRule.rs b/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationMuteRule.rs new file mode 100644 index 000000000..867d04050 --- /dev/null +++ b/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationMuteRule.rs @@ -0,0 +1,23 @@ +// Delete a mute rule returns "Rule successfully deleted." response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + // there is a valid "valid_mute_rule" in the system + let valid_mute_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_MUTE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.DeleteSecurityFindingsAutomationMuteRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .delete_security_findings_automation_mute_rule(valid_mute_rule_data_id.clone()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationTicketCreationRule.rs b/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationTicketCreationRule.rs new file mode 100644 index 000000000..4274d2f2f --- /dev/null +++ b/examples/v2_security-monitoring_DeleteSecurityFindingsAutomationTicketCreationRule.rs @@ -0,0 +1,27 @@ +// Delete a ticket creation rule returns "Rule successfully deleted." response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + // there is a valid "valid_ticket_creation_rule" in the system + let valid_ticket_creation_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_TICKET_CREATION_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled( + "v2.DeleteSecurityFindingsAutomationTicketCreationRule", + true, + ); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .delete_security_findings_automation_ticket_creation_rule( + valid_ticket_creation_rule_data_id.clone(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_GetSecurityFindingsAutomationDueDateRule.rs b/examples/v2_security-monitoring_GetSecurityFindingsAutomationDueDateRule.rs new file mode 100644 index 000000000..fccd94e8e --- /dev/null +++ b/examples/v2_security-monitoring_GetSecurityFindingsAutomationDueDateRule.rs @@ -0,0 +1,23 @@ +// Get a due date rule returns "Successfully retrieved the due date rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + // there is a valid "valid_due_date_rule" in the system + let valid_due_date_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_DUE_DATE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.GetSecurityFindingsAutomationDueDateRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .get_security_findings_automation_due_date_rule(valid_due_date_rule_data_id.clone()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_GetSecurityFindingsAutomationMuteRule.rs b/examples/v2_security-monitoring_GetSecurityFindingsAutomationMuteRule.rs new file mode 100644 index 000000000..3eae8ddfc --- /dev/null +++ b/examples/v2_security-monitoring_GetSecurityFindingsAutomationMuteRule.rs @@ -0,0 +1,22 @@ +// Get a mute rule returns "Successfully retrieved the mute rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + // there is a valid "valid_mute_rule" in the system + let valid_mute_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_MUTE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetSecurityFindingsAutomationMuteRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .get_security_findings_automation_mute_rule(valid_mute_rule_data_id.clone()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_GetSecurityFindingsAutomationTicketCreationRule.rs b/examples/v2_security-monitoring_GetSecurityFindingsAutomationTicketCreationRule.rs new file mode 100644 index 000000000..b4569ebc4 --- /dev/null +++ b/examples/v2_security-monitoring_GetSecurityFindingsAutomationTicketCreationRule.rs @@ -0,0 +1,26 @@ +// Get a ticket creation rule returns "Successfully retrieved the ticket creation +// rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + // there is a valid "valid_ticket_creation_rule" in the system + let valid_ticket_creation_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_TICKET_CREATION_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.GetSecurityFindingsAutomationTicketCreationRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .get_security_findings_automation_ticket_creation_rule( + valid_ticket_creation_rule_data_id.clone(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_ListSecurityFindingsAutomationDueDateRules.rs b/examples/v2_security-monitoring_ListSecurityFindingsAutomationDueDateRules.rs new file mode 100644 index 000000000..e972c9de6 --- /dev/null +++ b/examples/v2_security-monitoring_ListSecurityFindingsAutomationDueDateRules.rs @@ -0,0 +1,23 @@ +// Get all due date rules returns "Successfully retrieved the list of due date +// rules" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::ListSecurityFindingsAutomationDueDateRulesOptionalParams; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.ListSecurityFindingsAutomationDueDateRules", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .list_security_findings_automation_due_date_rules( + ListSecurityFindingsAutomationDueDateRulesOptionalParams::default(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_ListSecurityFindingsAutomationMuteRules.rs b/examples/v2_security-monitoring_ListSecurityFindingsAutomationMuteRules.rs new file mode 100644 index 000000000..3becb077e --- /dev/null +++ b/examples/v2_security-monitoring_ListSecurityFindingsAutomationMuteRules.rs @@ -0,0 +1,23 @@ +// Get all mute rules returns "Successfully retrieved the list of mute rules" +// response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::ListSecurityFindingsAutomationMuteRulesOptionalParams; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.ListSecurityFindingsAutomationMuteRules", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .list_security_findings_automation_mute_rules( + ListSecurityFindingsAutomationMuteRulesOptionalParams::default(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_ListSecurityFindingsAutomationTicketCreationRules.rs b/examples/v2_security-monitoring_ListSecurityFindingsAutomationTicketCreationRules.rs new file mode 100644 index 000000000..3881be207 --- /dev/null +++ b/examples/v2_security-monitoring_ListSecurityFindingsAutomationTicketCreationRules.rs @@ -0,0 +1,25 @@ +// Get all ticket creation rules returns "Successfully retrieved the list of +// ticket creation rules" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::ListSecurityFindingsAutomationTicketCreationRulesOptionalParams; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled( + "v2.ListSecurityFindingsAutomationTicketCreationRules", + true, + ); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .list_security_findings_automation_ticket_creation_rules( + ListSecurityFindingsAutomationTicketCreationRulesOptionalParams::default(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationDueDateRules.rs b/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationDueDateRules.rs new file mode 100644 index 000000000..0485764d4 --- /dev/null +++ b/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationDueDateRules.rs @@ -0,0 +1,31 @@ +// Reorder due date rules returns "Successfully reordered the due date rules" +// response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::DueDateRuleReorderItem; +use datadog_api_client::datadogV2::model::DueDateRuleReorderRequest; +use datadog_api_client::datadogV2::model::DueDateRuleType; + +#[tokio::main] +async fn main() { + // there is a valid "valid_due_date_rule" in the system + let valid_due_date_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_DUE_DATE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let body = DueDateRuleReorderRequest::new(vec![DueDateRuleReorderItem::new( + valid_due_date_rule_data_id.clone(), + DueDateRuleType::DUE_DATE_RULES, + )]); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.ReorderSecurityFindingsAutomationDueDateRules", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .reorder_security_findings_automation_due_date_rules(body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationMuteRules.rs b/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationMuteRules.rs new file mode 100644 index 000000000..9b62acc7a --- /dev/null +++ b/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationMuteRules.rs @@ -0,0 +1,30 @@ +// Reorder mute rules returns "Successfully reordered the mute rules" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::MuteRuleReorderItem; +use datadog_api_client::datadogV2::model::MuteRuleReorderRequest; +use datadog_api_client::datadogV2::model::MuteRuleType; + +#[tokio::main] +async fn main() { + // there is a valid "valid_mute_rule" in the system + let valid_mute_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_MUTE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let body = MuteRuleReorderRequest::new(vec![MuteRuleReorderItem::new( + valid_mute_rule_data_id.clone(), + MuteRuleType::MUTE_RULES, + )]); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.ReorderSecurityFindingsAutomationMuteRules", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .reorder_security_findings_automation_mute_rules(body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationTicketCreationRules.rs b/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationTicketCreationRules.rs new file mode 100644 index 000000000..0480048ef --- /dev/null +++ b/examples/v2_security-monitoring_ReorderSecurityFindingsAutomationTicketCreationRules.rs @@ -0,0 +1,33 @@ +// Reorder ticket creation rules returns "Successfully reordered the ticket +// creation rules" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::TicketCreationRuleReorderItem; +use datadog_api_client::datadogV2::model::TicketCreationRuleReorderRequest; +use datadog_api_client::datadogV2::model::TicketCreationRuleType; + +#[tokio::main] +async fn main() { + // there is a valid "valid_ticket_creation_rule" in the system + let valid_ticket_creation_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_TICKET_CREATION_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let body = TicketCreationRuleReorderRequest::new(vec![TicketCreationRuleReorderItem::new( + valid_ticket_creation_rule_data_id.clone(), + TicketCreationRuleType::TICKET_CREATION_RULES, + )]); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled( + "v2.ReorderSecurityFindingsAutomationTicketCreationRules", + true, + ); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .reorder_security_findings_automation_ticket_creation_rules(body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationDueDateRule.rs b/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationDueDateRule.rs new file mode 100644 index 000000000..97ce5aa10 --- /dev/null +++ b/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationDueDateRule.rs @@ -0,0 +1,49 @@ +// Update a due date rule returns "Successfully updated the due date rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::AutomationRuleScope; +use datadog_api_client::datadogV2::model::DueDateFrom; +use datadog_api_client::datadogV2::model::DueDatePerSeverityItem; +use datadog_api_client::datadogV2::model::DueDateRuleAction; +use datadog_api_client::datadogV2::model::DueDateRuleAttributesCreate; +use datadog_api_client::datadogV2::model::DueDateRuleDataCreate; +use datadog_api_client::datadogV2::model::DueDateRuleType; +use datadog_api_client::datadogV2::model::DueDateRuleUpdateRequest; +use datadog_api_client::datadogV2::model::DueDateSeverity; +use datadog_api_client::datadogV2::model::SecurityFindingType; + +#[tokio::main] +async fn main() { + // there is a valid "valid_due_date_rule" in the system + let valid_due_date_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_DUE_DATE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let body = DueDateRuleUpdateRequest::new(DueDateRuleDataCreate::new( + DueDateRuleAttributesCreate::new( + DueDateRuleAction::new( + vec![DueDatePerSeverityItem::new(14, DueDateSeverity::CRITICAL)], + DueDateFrom::FIRST_SEEN, + ), + "Example-Security-Monitoring".to_string(), + AutomationRuleScope::new(vec![SecurityFindingType::MISCONFIGURATION]) + .query("env:staging".to_string()), + ) + .enabled(false), + DueDateRuleType::DUE_DATE_RULES, + )); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.UpdateSecurityFindingsAutomationDueDateRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .update_security_findings_automation_due_date_rule( + valid_due_date_rule_data_id.clone(), + body, + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationMuteRule.rs b/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationMuteRule.rs new file mode 100644 index 000000000..adc37aeb1 --- /dev/null +++ b/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationMuteRule.rs @@ -0,0 +1,41 @@ +// Update a mute rule returns "Successfully updated the mute rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::AutomationRuleScope; +use datadog_api_client::datadogV2::model::MuteReason; +use datadog_api_client::datadogV2::model::MuteRuleAction; +use datadog_api_client::datadogV2::model::MuteRuleAttributesCreate; +use datadog_api_client::datadogV2::model::MuteRuleDataCreate; +use datadog_api_client::datadogV2::model::MuteRuleType; +use datadog_api_client::datadogV2::model::MuteRuleUpdateRequest; +use datadog_api_client::datadogV2::model::SecurityFindingType; + +#[tokio::main] +async fn main() { + // there is a valid "valid_mute_rule" in the system + let valid_mute_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_MUTE_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let body = MuteRuleUpdateRequest::new(MuteRuleDataCreate::new( + MuteRuleAttributesCreate::new( + MuteRuleAction::new(MuteReason::FALSE_POSITIVE), + "Example-Security-Monitoring".to_string(), + AutomationRuleScope::new(vec![SecurityFindingType::MISCONFIGURATION]) + .query("env:staging".to_string()), + ) + .enabled(false), + MuteRuleType::MUTE_RULES, + )); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.UpdateSecurityFindingsAutomationMuteRule", true); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .update_security_findings_automation_mute_rule(valid_mute_rule_data_id.clone(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationTicketCreationRule.rs b/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationTicketCreationRule.rs new file mode 100644 index 000000000..179e5ad89 --- /dev/null +++ b/examples/v2_security-monitoring_UpdateSecurityFindingsAutomationTicketCreationRule.rs @@ -0,0 +1,52 @@ +// Update a ticket creation rule returns "Successfully updated the ticket creation +// rule" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI; +use datadog_api_client::datadogV2::model::AutomationRuleScope; +use datadog_api_client::datadogV2::model::SecurityFindingType; +use datadog_api_client::datadogV2::model::TicketCreationRuleAction; +use datadog_api_client::datadogV2::model::TicketCreationRuleAttributesCreate; +use datadog_api_client::datadogV2::model::TicketCreationRuleDataCreate; +use datadog_api_client::datadogV2::model::TicketCreationRuleType; +use datadog_api_client::datadogV2::model::TicketCreationRuleUpdateRequest; +use datadog_api_client::datadogV2::model::TicketCreationTarget; +use uuid::Uuid; + +#[tokio::main] +async fn main() { + // there is a valid "valid_ticket_creation_rule" in the system + let valid_ticket_creation_rule_data_id = + uuid::Uuid::parse_str(&std::env::var("VALID_TICKET_CREATION_RULE_DATA_ID").unwrap()) + .expect("Invalid UUID"); + let body = TicketCreationRuleUpdateRequest::new(TicketCreationRuleDataCreate::new( + TicketCreationRuleAttributesCreate::new( + TicketCreationRuleAction::new( + 5, + Uuid::parse_str("11111111-1111-1111-1111-111111111111").expect("invalid UUID"), + TicketCreationTarget::JIRA, + ), + "Example-Security-Monitoring".to_string(), + AutomationRuleScope::new(vec![SecurityFindingType::MISCONFIGURATION]) + .query("env:staging".to_string()), + ) + .enabled(false), + TicketCreationRuleType::TICKET_CREATION_RULES, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled( + "v2.UpdateSecurityFindingsAutomationTicketCreationRule", + true, + ); + let api = SecurityMonitoringAPI::with_config(configuration); + let resp = api + .update_security_findings_automation_ticket_creation_rule( + valid_ticket_creation_rule_data_id.clone(), + body, + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 684a48d7b..17c8af305 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -315,6 +315,18 @@ impl Default for Configuration { "v2.create_sample_log_generation_subscription".to_owned(), false, ), + ( + "v2.create_security_findings_automation_due_date_rule".to_owned(), + false, + ), + ( + "v2.create_security_findings_automation_mute_rule".to_owned(), + false, + ), + ( + "v2.create_security_findings_automation_ticket_creation_rule".to_owned(), + false, + ), ("v2.create_security_monitoring_dataset".to_owned(), false), ( "v2.create_security_monitoring_integration_config".to_owned(), @@ -332,6 +344,18 @@ impl Default for Configuration { "v2.delete_sample_log_generation_subscription".to_owned(), false, ), + ( + "v2.delete_security_findings_automation_due_date_rule".to_owned(), + false, + ), + ( + "v2.delete_security_findings_automation_mute_rule".to_owned(), + false, + ), + ( + "v2.delete_security_findings_automation_ticket_creation_rule".to_owned(), + false, + ), ("v2.delete_security_monitoring_dataset".to_owned(), false), ( "v2.delete_security_monitoring_integration_config".to_owned(), @@ -348,6 +372,18 @@ impl Default for Configuration { ("v2.get_indicator_of_compromise".to_owned(), false), ("v2.get_rule_version_history".to_owned(), false), ("v2.get_secrets_rules".to_owned(), false), + ( + "v2.get_security_findings_automation_due_date_rule".to_owned(), + false, + ), + ( + "v2.get_security_findings_automation_mute_rule".to_owned(), + false, + ), + ( + "v2.get_security_findings_automation_ticket_creation_rule".to_owned(), + false, + ), ("v2.get_security_monitoring_dataset".to_owned(), false), ( "v2.get_security_monitoring_dataset_by_version".to_owned(), @@ -381,6 +417,18 @@ impl Default for Configuration { false, ), ("v2.list_scanned_assets_metadata".to_owned(), false), + ( + "v2.list_security_findings_automation_due_date_rules".to_owned(), + false, + ), + ( + "v2.list_security_findings_automation_mute_rules".to_owned(), + false, + ), + ( + "v2.list_security_findings_automation_ticket_creation_rules".to_owned(), + false, + ), ("v2.list_security_monitoring_datasets".to_owned(), false), ("v2.list_security_monitoring_histsignals".to_owned(), false), ( @@ -390,6 +438,18 @@ impl Default for Configuration { ("v2.list_static_analysis_codegen_rulesets".to_owned(), false), ("v2.list_vulnerabilities".to_owned(), false), ("v2.list_vulnerable_assets".to_owned(), false), + ( + "v2.reorder_security_findings_automation_due_date_rules".to_owned(), + false, + ), + ( + "v2.reorder_security_findings_automation_mute_rules".to_owned(), + false, + ), + ( + "v2.reorder_security_findings_automation_ticket_creation_rules".to_owned(), + false, + ), ("v2.restore_security_monitoring_rule".to_owned(), false), ("v2.run_historical_job".to_owned(), false), ( @@ -397,6 +457,18 @@ impl Default for Configuration { false, ), ("v2.update_findings_assignee".to_owned(), false), + ( + "v2.update_security_findings_automation_due_date_rule".to_owned(), + false, + ), + ( + "v2.update_security_findings_automation_mute_rule".to_owned(), + false, + ), + ( + "v2.update_security_findings_automation_ticket_creation_rule".to_owned(), + false, + ), ("v2.update_security_monitoring_dataset".to_owned(), false), ( "v2.update_security_monitoring_integration_config".to_owned(), diff --git a/src/datadogV2/api/api_security_monitoring.rs b/src/datadogV2/api/api_security_monitoring.rs index 94b33fa23..446ce4251 100644 --- a/src/datadogV2/api/api_security_monitoring.rs +++ b/src/datadogV2/api/api_security_monitoring.rs @@ -793,6 +793,75 @@ impl ListSecurityFindingsOptionalParams { } } +/// ListSecurityFindingsAutomationDueDateRulesOptionalParams is a struct for passing parameters to the method [`SecurityMonitoringAPI::list_security_findings_automation_due_date_rules`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListSecurityFindingsAutomationDueDateRulesOptionalParams { + /// The number of rules per page. Maximum is 1000. + pub page_size: Option, + /// The page number to return. + pub page_number: Option, +} + +impl ListSecurityFindingsAutomationDueDateRulesOptionalParams { + /// The number of rules per page. Maximum is 1000. + pub fn page_size(mut self, value: i64) -> Self { + self.page_size = Some(value); + self + } + /// The page number to return. + pub fn page_number(mut self, value: i64) -> Self { + self.page_number = Some(value); + self + } +} + +/// ListSecurityFindingsAutomationMuteRulesOptionalParams is a struct for passing parameters to the method [`SecurityMonitoringAPI::list_security_findings_automation_mute_rules`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListSecurityFindingsAutomationMuteRulesOptionalParams { + /// The number of rules per page. Maximum is 1000. + pub page_size: Option, + /// The page number to return. + pub page_number: Option, +} + +impl ListSecurityFindingsAutomationMuteRulesOptionalParams { + /// The number of rules per page. Maximum is 1000. + pub fn page_size(mut self, value: i64) -> Self { + self.page_size = Some(value); + self + } + /// The page number to return. + pub fn page_number(mut self, value: i64) -> Self { + self.page_number = Some(value); + self + } +} + +/// ListSecurityFindingsAutomationTicketCreationRulesOptionalParams is a struct for passing parameters to the method [`SecurityMonitoringAPI::list_security_findings_automation_ticket_creation_rules`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListSecurityFindingsAutomationTicketCreationRulesOptionalParams { + /// The number of rules per page. Maximum is 1000. + pub page_size: Option, + /// The page number to return. + pub page_number: Option, +} + +impl ListSecurityFindingsAutomationTicketCreationRulesOptionalParams { + /// The number of rules per page. Maximum is 1000. + pub fn page_size(mut self, value: i64) -> Self { + self.page_size = Some(value); + self + } + /// The page number to return. + pub fn page_number(mut self, value: i64) -> Self { + self.page_number = Some(value); + self + } +} + /// ListSecurityMonitoringDatasetsOptionalParams is a struct for passing parameters to the method [`SecurityMonitoringAPI::list_security_monitoring_datasets`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -1709,6 +1778,33 @@ pub enum CreateSecurityFilterError { UnknownValue(serde_json::Value), } +/// CreateSecurityFindingsAutomationDueDateRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::create_security_findings_automation_due_date_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateSecurityFindingsAutomationDueDateRuleError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// CreateSecurityFindingsAutomationMuteRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::create_security_findings_automation_mute_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateSecurityFindingsAutomationMuteRuleError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// CreateSecurityFindingsAutomationTicketCreationRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::create_security_findings_automation_ticket_creation_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateSecurityFindingsAutomationTicketCreationRuleError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// CreateSecurityMonitoringCriticalAssetError is a struct for typed errors of method [`SecurityMonitoringAPI::create_security_monitoring_critical_asset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1833,6 +1929,30 @@ pub enum DeleteSecurityFilterError { UnknownValue(serde_json::Value), } +/// DeleteSecurityFindingsAutomationDueDateRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::delete_security_findings_automation_due_date_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteSecurityFindingsAutomationDueDateRuleError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteSecurityFindingsAutomationMuteRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::delete_security_findings_automation_mute_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteSecurityFindingsAutomationMuteRuleError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteSecurityFindingsAutomationTicketCreationRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::delete_security_findings_automation_ticket_creation_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteSecurityFindingsAutomationTicketCreationRuleError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// DeleteSecurityMonitoringCriticalAssetError is a struct for typed errors of method [`SecurityMonitoringAPI::delete_security_monitoring_critical_asset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -2045,6 +2165,30 @@ pub enum GetSecurityFilterError { UnknownValue(serde_json::Value), } +/// GetSecurityFindingsAutomationDueDateRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::get_security_findings_automation_due_date_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSecurityFindingsAutomationDueDateRuleError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetSecurityFindingsAutomationMuteRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::get_security_findings_automation_mute_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSecurityFindingsAutomationMuteRuleError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetSecurityFindingsAutomationTicketCreationRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::get_security_findings_automation_ticket_creation_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSecurityFindingsAutomationTicketCreationRuleError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// GetSecurityMonitoringCriticalAssetError is a struct for typed errors of method [`SecurityMonitoringAPI::get_security_monitoring_critical_asset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -2326,6 +2470,30 @@ pub enum ListSecurityFindingsError { UnknownValue(serde_json::Value), } +/// ListSecurityFindingsAutomationDueDateRulesError is a struct for typed errors of method [`SecurityMonitoringAPI::list_security_findings_automation_due_date_rules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListSecurityFindingsAutomationDueDateRulesError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListSecurityFindingsAutomationMuteRulesError is a struct for typed errors of method [`SecurityMonitoringAPI::list_security_findings_automation_mute_rules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListSecurityFindingsAutomationMuteRulesError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListSecurityFindingsAutomationTicketCreationRulesError is a struct for typed errors of method [`SecurityMonitoringAPI::list_security_findings_automation_ticket_creation_rules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListSecurityFindingsAutomationTicketCreationRulesError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ListSecurityMonitoringCriticalAssetsError is a struct for typed errors of method [`SecurityMonitoringAPI::list_security_monitoring_critical_assets`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -2437,6 +2605,33 @@ pub enum PatchVulnerabilityNotificationRuleError { UnknownValue(serde_json::Value), } +/// ReorderSecurityFindingsAutomationDueDateRulesError is a struct for typed errors of method [`SecurityMonitoringAPI::reorder_security_findings_automation_due_date_rules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ReorderSecurityFindingsAutomationDueDateRulesError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ReorderSecurityFindingsAutomationMuteRulesError is a struct for typed errors of method [`SecurityMonitoringAPI::reorder_security_findings_automation_mute_rules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ReorderSecurityFindingsAutomationMuteRulesError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ReorderSecurityFindingsAutomationTicketCreationRulesError is a struct for typed errors of method [`SecurityMonitoringAPI::reorder_security_findings_automation_ticket_creation_rules`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ReorderSecurityFindingsAutomationTicketCreationRulesError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// RestoreSecurityMonitoringRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::restore_security_monitoring_rule`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -2534,6 +2729,33 @@ pub enum UpdateSecurityFilterError { UnknownValue(serde_json::Value), } +/// UpdateSecurityFindingsAutomationDueDateRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::update_security_findings_automation_due_date_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateSecurityFindingsAutomationDueDateRuleError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// UpdateSecurityFindingsAutomationMuteRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::update_security_findings_automation_mute_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateSecurityFindingsAutomationMuteRuleError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// UpdateSecurityFindingsAutomationTicketCreationRuleError is a struct for typed errors of method [`SecurityMonitoringAPI::update_security_findings_automation_ticket_creation_rule`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateSecurityFindingsAutomationTicketCreationRuleError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// UpdateSecurityMonitoringCriticalAssetError is a struct for typed errors of method [`SecurityMonitoringAPI::update_security_monitoring_critical_asset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -6420,16 +6642,16 @@ impl SecurityMonitoringAPI { } } - /// Create a new critical asset. - pub async fn create_security_monitoring_critical_asset( + /// Create a new due date rule for the current organization. + pub async fn create_security_findings_automation_due_date_rule( &self, - body: crate::datadogV2::model::SecurityMonitoringCriticalAssetCreateRequest, + body: crate::datadogV2::model::DueDateRuleCreateRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, - datadog::Error, + crate::datadogV2::model::DueDateRuleResponse, + datadog::Error, > { match self - .create_security_monitoring_critical_asset_with_http_info(body) + .create_security_findings_automation_due_date_rule_with_http_info(body) .await { Ok(response_content) => { @@ -6445,21 +6667,29 @@ impl SecurityMonitoringAPI { } } - /// Create a new critical asset. - pub async fn create_security_monitoring_critical_asset_with_http_info( + /// Create a new due date rule for the current organization. + pub async fn create_security_findings_automation_due_date_rule_with_http_info( &self, - body: crate::datadogV2::model::SecurityMonitoringCriticalAssetCreateRequest, + body: crate::datadogV2::model::DueDateRuleCreateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_security_monitoring_critical_asset"; + let operation_id = "v2.create_security_findings_automation_due_date_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_security_findings_automation_due_date_rule' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/critical_assets", + "{}/api/v2/security/findings/automation/due_date_rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -6554,10 +6784,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -6568,7 +6797,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6579,17 +6808,16 @@ impl SecurityMonitoringAPI { } } - /// Create a new Cloud SIEM dataset. A dataset bundles a data source, a set of - /// indexes, and a search query that can be referenced from detection rules. - pub async fn create_security_monitoring_dataset( + /// Create a new mute rule for the current organization. + pub async fn create_security_findings_automation_mute_rule( &self, - body: crate::datadogV2::model::SecurityMonitoringDatasetCreateRequest, + body: crate::datadogV2::model::MuteRuleCreateRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringDatasetCreateResponse, - datadog::Error, + crate::datadogV2::model::MuteRuleResponse, + datadog::Error, > { match self - .create_security_monitoring_dataset_with_http_info(body) + .create_security_findings_automation_mute_rule_with_http_info(body) .await { Ok(response_content) => { @@ -6605,22 +6833,22 @@ impl SecurityMonitoringAPI { } } - /// Create a new Cloud SIEM dataset. A dataset bundles a data source, a set of - /// indexes, and a search query that can be referenced from detection rules. - pub async fn create_security_monitoring_dataset_with_http_info( + /// Create a new mute rule for the current organization. + pub async fn create_security_findings_automation_mute_rule_with_http_info( &self, - body: crate::datadogV2::model::SecurityMonitoringDatasetCreateRequest, + body: crate::datadogV2::model::MuteRuleCreateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_security_monitoring_dataset"; + let operation_id = "v2.create_security_findings_automation_mute_rule"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_security_monitoring_dataset' is not enabled".to_string(), + msg: "Operation 'v2.create_security_findings_automation_mute_rule' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -6628,7 +6856,7 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/datasets", + "{}/api/v2/security/findings/automation/mute_rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -6723,9 +6951,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringDatasetCreateResponse, - >(&local_content) + match serde_json::from_str::(&local_content) { Ok(e) => { return Ok(datadog::ResponseContent { @@ -6737,7 +6963,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6748,18 +6974,16 @@ impl SecurityMonitoringAPI { } } - /// Create a new entity context sync configuration so Cloud SIEM can ingest entities from an external - /// source. The credentials provided in `secrets` are validated against the source before the configuration - /// is stored and never returned in subsequent responses. - pub async fn create_security_monitoring_integration_config( + /// Create a new ticket creation rule for the current organization. + pub async fn create_security_findings_automation_ticket_creation_rule( &self, - body: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCreateRequest, + body: crate::datadogV2::model::TicketCreationRuleCreateRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, - datadog::Error, + crate::datadogV2::model::TicketCreationRuleResponse, + datadog::Error, > { match self - .create_security_monitoring_integration_config_with_http_info(body) + .create_security_findings_automation_ticket_creation_rule_with_http_info(body) .await { Ok(response_content) => { @@ -6775,26 +6999,21 @@ impl SecurityMonitoringAPI { } } - /// Create a new entity context sync configuration so Cloud SIEM can ingest entities from an external - /// source. The credentials provided in `secrets` are validated against the source before the configuration - /// is stored and never returned in subsequent responses. - pub async fn create_security_monitoring_integration_config_with_http_info( + /// Create a new ticket creation rule for the current organization. + pub async fn create_security_findings_automation_ticket_creation_rule_with_http_info( &self, - body: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCreateRequest, + body: crate::datadogV2::model::TicketCreationRuleCreateRequest, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_security_monitoring_integration_config"; + let operation_id = "v2.create_security_findings_automation_ticket_creation_rule"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_security_monitoring_integration_config' is not enabled" - .to_string(), + msg: "Operation 'v2.create_security_findings_automation_ticket_creation_rule' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -6802,7 +7021,7 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/integration_config", + "{}/api/v2/security/findings/automation/ticket_creation_rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -6897,10 +7116,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -6911,7 +7129,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6922,16 +7140,16 @@ impl SecurityMonitoringAPI { } } - /// Create a detection rule. - pub async fn create_security_monitoring_rule( + /// Create a new critical asset. + pub async fn create_security_monitoring_critical_asset( &self, - body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, + body: crate::datadogV2::model::SecurityMonitoringCriticalAssetCreateRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringRuleResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, + datadog::Error, > { match self - .create_security_monitoring_rule_with_http_info(body) + .create_security_monitoring_critical_asset_with_http_info(body) .await { Ok(response_content) => { @@ -6947,21 +7165,21 @@ impl SecurityMonitoringAPI { } } - /// Create a detection rule. - pub async fn create_security_monitoring_rule_with_http_info( - &self, - body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, + /// Create a new critical asset. + pub async fn create_security_monitoring_critical_asset_with_http_info( + &self, + body: crate::datadogV2::model::SecurityMonitoringCriticalAssetCreateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_security_monitoring_rule"; + let operation_id = "v2.create_security_monitoring_critical_asset"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules", + "{}/api/v2/security_monitoring/configuration/critical_assets", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -7056,9 +7274,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -7069,7 +7288,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7080,16 +7299,17 @@ impl SecurityMonitoringAPI { } } - /// Create a new suppression rule. - pub async fn create_security_monitoring_suppression( + /// Create a new Cloud SIEM dataset. A dataset bundles a data source, a set of + /// indexes, and a search query that can be referenced from detection rules. + pub async fn create_security_monitoring_dataset( &self, - body: crate::datadogV2::model::SecurityMonitoringSuppressionCreateRequest, + body: crate::datadogV2::model::SecurityMonitoringDatasetCreateRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSuppressionResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringDatasetCreateResponse, + datadog::Error, > { match self - .create_security_monitoring_suppression_with_http_info(body) + .create_security_monitoring_dataset_with_http_info(body) .await { Ok(response_content) => { @@ -7105,21 +7325,30 @@ impl SecurityMonitoringAPI { } } - /// Create a new suppression rule. - pub async fn create_security_monitoring_suppression_with_http_info( + /// Create a new Cloud SIEM dataset. A dataset bundles a data source, a set of + /// indexes, and a search query that can be referenced from detection rules. + pub async fn create_security_monitoring_dataset_with_http_info( &self, - body: crate::datadogV2::model::SecurityMonitoringSuppressionCreateRequest, + body: crate::datadogV2::model::SecurityMonitoringDatasetCreateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_security_monitoring_suppression"; + let operation_id = "v2.create_security_monitoring_dataset"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_security_monitoring_dataset' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/suppressions", + "{}/api/v2/security_monitoring/datasets", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -7215,7 +7444,7 @@ impl SecurityMonitoringAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSuppressionResponse, + crate::datadogV2::model::SecurityMonitoringDatasetCreateResponse, >(&local_content) { Ok(e) => { @@ -7228,7 +7457,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7239,16 +7468,20 @@ impl SecurityMonitoringAPI { } } - /// Create ServiceNow tickets for security findings. - /// This operation creates a case in Datadog and a ServiceNow ticket linked to that case for bidirectional sync between Datadog and ServiceNow. You can create up to 50 ServiceNow tickets per request and associate up to 50 security findings per ServiceNow ticket. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the newly created ServiceNow ticket. - pub async fn create_service_now_tickets( + /// Create a new entity context sync configuration so Cloud SIEM can ingest entities from an external + /// source. The credentials provided in `secrets` are validated against the source before the configuration + /// is stored and never returned in subsequent responses. + pub async fn create_security_monitoring_integration_config( &self, - body: crate::datadogV2::model::CreateServiceNowTicketRequestArray, + body: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCreateRequest, ) -> Result< - crate::datadogV2::model::FindingCaseResponseArray, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, + datadog::Error, > { - match self.create_service_now_tickets_with_http_info(body).await { + match self + .create_security_monitoring_integration_config_with_http_info(body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -7262,22 +7495,26 @@ impl SecurityMonitoringAPI { } } - /// Create ServiceNow tickets for security findings. - /// This operation creates a case in Datadog and a ServiceNow ticket linked to that case for bidirectional sync between Datadog and ServiceNow. You can create up to 50 ServiceNow tickets per request and associate up to 50 security findings per ServiceNow ticket. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the newly created ServiceNow ticket. - pub async fn create_service_now_tickets_with_http_info( + /// Create a new entity context sync configuration so Cloud SIEM can ingest entities from an external + /// source. The credentials provided in `secrets` are validated against the source before the configuration + /// is stored and never returned in subsequent responses. + pub async fn create_security_monitoring_integration_config_with_http_info( &self, - body: crate::datadogV2::model::CreateServiceNowTicketRequestArray, + body: crate::datadogV2::model::SecurityMonitoringIntegrationConfigCreateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_service_now_tickets"; + let operation_id = "v2.create_security_monitoring_integration_config"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_service_now_tickets' is not enabled".to_string(), + msg: "Operation 'v2.create_security_monitoring_integration_config' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -7285,7 +7522,7 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/findings/servicenow_tickets", + "{}/api/v2/security_monitoring/configuration/integration_config", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -7380,9 +7617,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -7393,7 +7631,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7404,16 +7642,16 @@ impl SecurityMonitoringAPI { } } - /// Create a new notification rule for security signals and return the created rule. - pub async fn create_signal_notification_rule( + /// Create a detection rule. + pub async fn create_security_monitoring_rule( &self, - body: crate::datadogV2::model::CreateNotificationRuleParameters, + body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, ) -> Result< - crate::datadogV2::model::NotificationRuleResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringRuleResponse, + datadog::Error, > { match self - .create_signal_notification_rule_with_http_info(body) + .create_security_monitoring_rule_with_http_info(body) .await { Ok(response_content) => { @@ -7429,21 +7667,21 @@ impl SecurityMonitoringAPI { } } - /// Create a new notification rule for security signals and return the created rule. - pub async fn create_signal_notification_rule_with_http_info( + /// Create a detection rule. + pub async fn create_security_monitoring_rule_with_http_info( &self, - body: crate::datadogV2::model::CreateNotificationRuleParameters, + body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_signal_notification_rule"; + let operation_id = "v2.create_security_monitoring_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/signals/notification_rules", + "{}/api/v2/security_monitoring/rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -7538,7 +7776,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -7551,7 +7789,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7562,13 +7800,18 @@ impl SecurityMonitoringAPI { } } - /// Parse source code into an abstract syntax tree (AST) for the specified language. - pub async fn create_static_analysis_ast( + /// Create a new suppression rule. + pub async fn create_security_monitoring_suppression( &self, - body: crate::datadogV2::model::GetAstRequest, - ) -> Result> - { - match self.create_static_analysis_ast_with_http_info(body).await { + body: crate::datadogV2::model::SecurityMonitoringSuppressionCreateRequest, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringSuppressionResponse, + datadog::Error, + > { + match self + .create_security_monitoring_suppression_with_http_info(body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -7582,29 +7825,21 @@ impl SecurityMonitoringAPI { } } - /// Parse source code into an abstract syntax tree (AST) for the specified language. - pub async fn create_static_analysis_ast_with_http_info( + /// Create a new suppression rule. + pub async fn create_security_monitoring_suppression_with_http_info( &self, - body: crate::datadogV2::model::GetAstRequest, + body: crate::datadogV2::model::SecurityMonitoringSuppressionCreateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_static_analysis_ast"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_static_analysis_ast' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.create_security_monitoring_suppression"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/static-analysis-server/get-ast", + "{}/api/v2/security_monitoring/configuration/suppressions", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -7699,7 +7934,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSuppressionResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -7710,7 +7948,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7721,18 +7959,16 @@ impl SecurityMonitoringAPI { } } - /// Run static analysis rules against a source code file and return violations found. - pub async fn create_static_analysis_server_analysis( + /// Create ServiceNow tickets for security findings. + /// This operation creates a case in Datadog and a ServiceNow ticket linked to that case for bidirectional sync between Datadog and ServiceNow. You can create up to 50 ServiceNow tickets per request and associate up to 50 security findings per ServiceNow ticket. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the newly created ServiceNow ticket. + pub async fn create_service_now_tickets( &self, - body: crate::datadogV2::model::AnalysisRequest, + body: crate::datadogV2::model::CreateServiceNowTicketRequestArray, ) -> Result< - crate::datadogV2::model::AnalysisResponse, - datadog::Error, + crate::datadogV2::model::FindingCaseResponseArray, + datadog::Error, > { - match self - .create_static_analysis_server_analysis_with_http_info(body) - .await - { + match self.create_service_now_tickets_with_http_info(body).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -7746,22 +7982,22 @@ impl SecurityMonitoringAPI { } } - /// Run static analysis rules against a source code file and return violations found. - pub async fn create_static_analysis_server_analysis_with_http_info( + /// Create ServiceNow tickets for security findings. + /// This operation creates a case in Datadog and a ServiceNow ticket linked to that case for bidirectional sync between Datadog and ServiceNow. You can create up to 50 ServiceNow tickets per request and associate up to 50 security findings per ServiceNow ticket. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the newly created ServiceNow ticket. + pub async fn create_service_now_tickets_with_http_info( &self, - body: crate::datadogV2::model::AnalysisRequest, + body: crate::datadogV2::model::CreateServiceNowTicketRequestArray, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_static_analysis_server_analysis"; + let operation_id = "v2.create_service_now_tickets"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_static_analysis_server_analysis' is not enabled" - .to_string(), + msg: "Operation 'v2.create_service_now_tickets' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -7769,7 +8005,7 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/static-analysis-server/analyze", + "{}/api/v2/security/findings/servicenow_tickets", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -7864,8 +8100,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -7876,7 +8113,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7887,16 +8124,16 @@ impl SecurityMonitoringAPI { } } - /// Create a new notification rule for security vulnerabilities and return the created rule. - pub async fn create_vulnerability_notification_rule( + /// Create a new notification rule for security signals and return the created rule. + pub async fn create_signal_notification_rule( &self, body: crate::datadogV2::model::CreateNotificationRuleParameters, ) -> Result< crate::datadogV2::model::NotificationRuleResponse, - datadog::Error, + datadog::Error, > { match self - .create_vulnerability_notification_rule_with_http_info(body) + .create_signal_notification_rule_with_http_info(body) .await { Ok(response_content) => { @@ -7912,21 +8149,21 @@ impl SecurityMonitoringAPI { } } - /// Create a new notification rule for security vulnerabilities and return the created rule. - pub async fn create_vulnerability_notification_rule_with_http_info( + /// Create a new notification rule for security signals and return the created rule. + pub async fn create_signal_notification_rule_with_http_info( &self, body: crate::datadogV2::model::CreateNotificationRuleParameters, ) -> Result< datadog::ResponseContent, - datadog::Error, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_vulnerability_notification_rule"; + let operation_id = "v2.create_signal_notification_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/vulnerabilities/notification_rules", + "{}/api/v2/security/signals/notification_rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -8034,7 +8271,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8045,34 +8282,41 @@ impl SecurityMonitoringAPI { } } - /// Deactivate a Cloud SIEM content pack. This operation removes the content pack's - /// configuration from log filters or security filters and updates the content pack activation state. - pub async fn deactivate_content_pack( + /// Parse source code into an abstract syntax tree (AST) for the specified language. + pub async fn create_static_analysis_ast( &self, - content_pack_id: String, - ) -> Result<(), datadog::Error> { - match self - .deactivate_content_pack_with_http_info(content_pack_id) - .await - { - Ok(_) => Ok(()), + body: crate::datadogV2::model::GetAstRequest, + ) -> Result> + { + match self.create_static_analysis_ast_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Deactivate a Cloud SIEM content pack. This operation removes the content pack's - /// configuration from log filters or security filters and updates the content pack activation state. - pub async fn deactivate_content_pack_with_http_info( + /// Parse source code into an abstract syntax tree (AST) for the specified language. + pub async fn create_static_analysis_ast_with_http_info( &self, - content_pack_id: String, - ) -> Result, datadog::Error> { + body: crate::datadogV2::model::GetAstRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.deactivate_content_pack"; + let operation_id = "v2.create_static_analysis_ast"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.deactivate_content_pack' is not enabled".to_string(), + msg: "Operation 'v2.create_static_analysis_ast' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8080,16 +8324,16 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/content_packs/{content_pack_id}/deactivate", - local_configuration.get_operation_host(operation_id), - content_pack_id = datadog::urlencode(content_pack_id) + "{}/api/v2/static-analysis/static-analysis-server/get-ast", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -8119,6 +8363,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -8129,13 +8419,18 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8146,17 +8441,16 @@ impl SecurityMonitoringAPI { } } - /// Delete a custom framework. - pub async fn delete_custom_framework( + /// Run static analysis rules against a source code file and return violations found. + pub async fn create_static_analysis_server_analysis( &self, - handle: String, - version: String, + body: crate::datadogV2::model::AnalysisRequest, ) -> Result< - crate::datadogV2::model::DeleteCustomFrameworkResponse, - datadog::Error, + crate::datadogV2::model::AnalysisResponse, + datadog::Error, > { match self - .delete_custom_framework_with_http_info(handle, version) + .create_static_analysis_server_analysis_with_http_info(body) .await { Ok(response_content) => { @@ -8172,31 +8466,38 @@ impl SecurityMonitoringAPI { } } - /// Delete a custom framework. - pub async fn delete_custom_framework_with_http_info( + /// Run static analysis rules against a source code file and return violations found. + pub async fn create_static_analysis_server_analysis_with_http_info( &self, - handle: String, - version: String, + body: crate::datadogV2::model::AnalysisRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.delete_custom_framework"; + let operation_id = "v2.create_static_analysis_server_analysis"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_static_analysis_server_analysis' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/cloud_security_management/custom_frameworks/{handle}/{version}", - local_configuration.get_operation_host(operation_id), - handle = datadog::urlencode(handle), - version = datadog::urlencode(version) + "{}/api/v2/static-analysis/static-analysis-server/analyze", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -8227,6 +8528,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -8237,9 +8584,8 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -8250,7 +8596,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8261,46 +8607,55 @@ impl SecurityMonitoringAPI { } } - /// Delete an existing job. - pub async fn delete_historical_job( + /// Create a new notification rule for security vulnerabilities and return the created rule. + pub async fn create_vulnerability_notification_rule( &self, - job_id: String, - ) -> Result<(), datadog::Error> { - match self.delete_historical_job_with_http_info(job_id).await { - Ok(_) => Ok(()), + body: crate::datadogV2::model::CreateNotificationRuleParameters, + ) -> Result< + crate::datadogV2::model::NotificationRuleResponse, + datadog::Error, + > { + match self + .create_vulnerability_notification_rule_with_http_info(body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Delete an existing job. - pub async fn delete_historical_job_with_http_info( + /// Create a new notification rule for security vulnerabilities and return the created rule. + pub async fn create_vulnerability_notification_rule_with_http_info( &self, - job_id: String, - ) -> Result, datadog::Error> { + body: crate::datadogV2::model::CreateNotificationRuleParameters, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_historical_job"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_historical_job' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.create_vulnerability_notification_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/jobs/{job_id}", - local_configuration.get_operation_host(operation_id), - job_id = datadog::urlencode(job_id) + "{}/api/v2/security/vulnerabilities/notification_rules", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -8330,6 +8685,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -8340,13 +8741,20 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8357,57 +8765,34 @@ impl SecurityMonitoringAPI { } } - /// Unsubscribe from sample log generation for a Cloud SIEM content pack. - /// After unsubscribing, no more sample logs are generated for the requested content pack. - /// - /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an - /// eligible pricing model. Non-trial orgs receive `403 Forbidden`, the feature flag may also reject - /// requests with `400 Bad Request`, and legacy pricing tiers receive a response with `status: not_available`. - pub async fn delete_sample_log_generation_subscription( + /// Deactivate a Cloud SIEM content pack. This operation removes the content pack's + /// configuration from log filters or security filters and updates the content pack activation state. + pub async fn deactivate_content_pack( &self, content_pack_id: String, - ) -> Result< - crate::datadogV2::model::SampleLogGenerationSubscriptionResponse, - datadog::Error, - > { + ) -> Result<(), datadog::Error> { match self - .delete_sample_log_generation_subscription_with_http_info(content_pack_id) + .deactivate_content_pack_with_http_info(content_pack_id) .await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Unsubscribe from sample log generation for a Cloud SIEM content pack. - /// After unsubscribing, no more sample logs are generated for the requested content pack. - /// - /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an - /// eligible pricing model. Non-trial orgs receive `403 Forbidden`, the feature flag may also reject - /// requests with `400 Bad Request`, and legacy pricing tiers receive a response with `status: not_available`. - pub async fn delete_sample_log_generation_subscription_with_http_info( + /// Deactivate a Cloud SIEM content pack. This operation removes the content pack's + /// configuration from log filters or security filters and updates the content pack activation state. + pub async fn deactivate_content_pack_with_http_info( &self, content_pack_id: String, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.delete_sample_log_generation_subscription"; + let operation_id = "v2.deactivate_content_pack"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_sample_log_generation_subscription' is not enabled" - .to_string(), + msg: "Operation 'v2.deactivate_content_pack' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8415,16 +8800,16 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/sample_log_generation/subscriptions/{content_pack_id}", + "{}/api/v2/security_monitoring/content_packs/{content_pack_id}/deactivate", local_configuration.get_operation_host(operation_id), content_pack_id = datadog::urlencode(content_pack_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -8464,21 +8849,13 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SampleLogGenerationSubscriptionResponse, - >(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8489,41 +8866,58 @@ impl SecurityMonitoringAPI { } } - /// Delete a specific security filter. - pub async fn delete_security_filter( + /// Delete a custom framework. + pub async fn delete_custom_framework( &self, - security_filter_id: String, - ) -> Result<(), datadog::Error> { + handle: String, + version: String, + ) -> Result< + crate::datadogV2::model::DeleteCustomFrameworkResponse, + datadog::Error, + > { match self - .delete_security_filter_with_http_info(security_filter_id) + .delete_custom_framework_with_http_info(handle, version) .await { - Ok(_) => Ok(()), + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Delete a specific security filter. - pub async fn delete_security_filter_with_http_info( + /// Delete a custom framework. + pub async fn delete_custom_framework_with_http_info( &self, - security_filter_id: String, - ) -> Result, datadog::Error> { + handle: String, + version: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_security_filter"; + let operation_id = "v2.delete_custom_framework"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}", + "{}/api/v2/cloud_security_management/custom_frameworks/{handle}/{version}", local_configuration.get_operation_host(operation_id), - security_filter_id = datadog::urlencode(security_filter_id) + handle = datadog::urlencode(handle), + version = datadog::urlencode(version) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -8563,13 +8957,20 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8580,37 +8981,39 @@ impl SecurityMonitoringAPI { } } - /// Delete a specific critical asset. - pub async fn delete_security_monitoring_critical_asset( + /// Delete an existing job. + pub async fn delete_historical_job( &self, - critical_asset_id: String, - ) -> Result<(), datadog::Error> { - match self - .delete_security_monitoring_critical_asset_with_http_info(critical_asset_id) - .await - { + job_id: String, + ) -> Result<(), datadog::Error> { + match self.delete_historical_job_with_http_info(job_id).await { Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Delete a specific critical asset. - pub async fn delete_security_monitoring_critical_asset_with_http_info( + /// Delete an existing job. + pub async fn delete_historical_job_with_http_info( &self, - critical_asset_id: String, - ) -> Result< - datadog::ResponseContent<()>, - datadog::Error, - > { + job_id: String, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.delete_security_monitoring_critical_asset"; + let operation_id = "v2.delete_historical_job"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_historical_job' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/critical_assets/{critical_asset_id}", + "{}/api/v2/siem-historical-detections/jobs/{job_id}", local_configuration.get_operation_host(operation_id), - critical_asset_id = datadog::urlencode(critical_asset_id) + job_id = datadog::urlencode(job_id) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); @@ -8663,7 +9066,7 @@ impl SecurityMonitoringAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8674,35 +9077,57 @@ impl SecurityMonitoringAPI { } } - /// Delete a Cloud SIEM dataset. Out-of-the-box datasets cannot be deleted and - /// deleting a dataset that is referenced by a detection rule is rejected. - pub async fn delete_security_monitoring_dataset( + /// Unsubscribe from sample log generation for a Cloud SIEM content pack. + /// After unsubscribing, no more sample logs are generated for the requested content pack. + /// + /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an + /// eligible pricing model. Non-trial orgs receive `403 Forbidden`, the feature flag may also reject + /// requests with `400 Bad Request`, and legacy pricing tiers receive a response with `status: not_available`. + pub async fn delete_sample_log_generation_subscription( &self, - dataset_id: String, - ) -> Result<(), datadog::Error> { + content_pack_id: String, + ) -> Result< + crate::datadogV2::model::SampleLogGenerationSubscriptionResponse, + datadog::Error, + > { match self - .delete_security_monitoring_dataset_with_http_info(dataset_id) + .delete_sample_log_generation_subscription_with_http_info(content_pack_id) .await { - Ok(_) => Ok(()), + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Delete a Cloud SIEM dataset. Out-of-the-box datasets cannot be deleted and - /// deleting a dataset that is referenced by a detection rule is rejected. - pub async fn delete_security_monitoring_dataset_with_http_info( + /// Unsubscribe from sample log generation for a Cloud SIEM content pack. + /// After unsubscribing, no more sample logs are generated for the requested content pack. + /// + /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an + /// eligible pricing model. Non-trial orgs receive `403 Forbidden`, the feature flag may also reject + /// requests with `400 Bad Request`, and legacy pricing tiers receive a response with `status: not_available`. + pub async fn delete_sample_log_generation_subscription_with_http_info( &self, - dataset_id: String, - ) -> Result, datadog::Error> - { + content_pack_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_security_monitoring_dataset"; + let operation_id = "v2.delete_sample_log_generation_subscription"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_security_monitoring_dataset' is not enabled".to_string(), + msg: "Operation 'v2.delete_sample_log_generation_subscription' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8710,16 +9135,16 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/datasets/{dataset_id}", + "{}/api/v2/security_monitoring/sample_log_generation/subscriptions/{content_pack_id}", local_configuration.get_operation_host(operation_id), - dataset_id = datadog::urlencode(dataset_id) + content_pack_id = datadog::urlencode(content_pack_id) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -8759,13 +9184,21 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::< + crate::datadogV2::model::SampleLogGenerationSubscriptionResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8776,14 +9209,13 @@ impl SecurityMonitoringAPI { } } - /// Delete an entity context sync configuration. Cloud SIEM stops ingesting entities from this source, - /// and the credentials stored for the configuration are removed from the secrets store. - pub async fn delete_security_monitoring_integration_config( + /// Delete a specific security filter. + pub async fn delete_security_filter( &self, - integration_config_id: String, - ) -> Result<(), datadog::Error> { + security_filter_id: String, + ) -> Result<(), datadog::Error> { match self - .delete_security_monitoring_integration_config_with_http_info(integration_config_id) + .delete_security_filter_with_http_info(security_filter_id) .await { Ok(_) => Ok(()), @@ -8791,34 +9223,21 @@ impl SecurityMonitoringAPI { } } - /// Delete an entity context sync configuration. Cloud SIEM stops ingesting entities from this source, - /// and the credentials stored for the configuration are removed from the secrets store. - pub async fn delete_security_monitoring_integration_config_with_http_info( + /// Delete a specific security filter. + pub async fn delete_security_filter_with_http_info( &self, - integration_config_id: String, - ) -> Result< - datadog::ResponseContent<()>, - datadog::Error, - > { + security_filter_id: String, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.delete_security_monitoring_integration_config"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_security_monitoring_integration_config' is not enabled" - .to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.delete_security_filter"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/integration_config/{integration_config_id}", - local_configuration.get_operation_host(operation_id), integration_config_id= - datadog::urlencode(integration_config_id) - ); + "{}/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}", + local_configuration.get_operation_host(operation_id), + security_filter_id = datadog::urlencode(security_filter_id) + ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); @@ -8870,7 +9289,7 @@ impl SecurityMonitoringAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8881,13 +9300,13 @@ impl SecurityMonitoringAPI { } } - /// Delete an existing rule. Default rules cannot be deleted. - pub async fn delete_security_monitoring_rule( + /// Delete an existing due date rule by ID. + pub async fn delete_security_findings_automation_due_date_rule( &self, - rule_id: String, - ) -> Result<(), datadog::Error> { + rule_id: uuid::Uuid, + ) -> Result<(), datadog::Error> { match self - .delete_security_monitoring_rule_with_http_info(rule_id) + .delete_security_findings_automation_due_date_rule_with_http_info(rule_id) .await { Ok(_) => Ok(()), @@ -8895,21 +9314,31 @@ impl SecurityMonitoringAPI { } } - /// Delete an existing rule. Default rules cannot be deleted. - pub async fn delete_security_monitoring_rule_with_http_info( + /// Delete an existing due date rule by ID. + pub async fn delete_security_findings_automation_due_date_rule_with_http_info( &self, - rule_id: String, - ) -> Result, datadog::Error> - { + rule_id: uuid::Uuid, + ) -> Result< + datadog::ResponseContent<()>, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_security_monitoring_rule"; + let operation_id = "v2.delete_security_findings_automation_due_date_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_security_findings_automation_due_date_rule' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules/{rule_id}", + "{}/api/v2/security/findings/automation/due_date_rules/{rule_id}", local_configuration.get_operation_host(operation_id), - rule_id = datadog::urlencode(rule_id) + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); @@ -8962,7 +9391,7 @@ impl SecurityMonitoringAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8973,13 +9402,13 @@ impl SecurityMonitoringAPI { } } - /// Delete a specific suppression rule. - pub async fn delete_security_monitoring_suppression( + /// Delete an existing mute rule by ID. + pub async fn delete_security_findings_automation_mute_rule( &self, - suppression_id: String, - ) -> Result<(), datadog::Error> { + rule_id: uuid::Uuid, + ) -> Result<(), datadog::Error> { match self - .delete_security_monitoring_suppression_with_http_info(suppression_id) + .delete_security_findings_automation_mute_rule_with_http_info(rule_id) .await { Ok(_) => Ok(()), @@ -8987,23 +9416,32 @@ impl SecurityMonitoringAPI { } } - /// Delete a specific suppression rule. - pub async fn delete_security_monitoring_suppression_with_http_info( + /// Delete an existing mute rule by ID. + pub async fn delete_security_findings_automation_mute_rule_with_http_info( &self, - suppression_id: String, + rule_id: uuid::Uuid, ) -> Result< datadog::ResponseContent<()>, - datadog::Error, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.delete_security_monitoring_suppression"; + let operation_id = "v2.delete_security_findings_automation_mute_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_security_findings_automation_mute_rule' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/suppressions/{suppression_id}", + "{}/api/v2/security/findings/automation/mute_rules/{rule_id}", local_configuration.get_operation_host(operation_id), - suppression_id = datadog::urlencode(suppression_id) + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); @@ -9056,7 +9494,7 @@ impl SecurityMonitoringAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9067,13 +9505,13 @@ impl SecurityMonitoringAPI { } } - /// Delete a notification rule for security signals. - pub async fn delete_signal_notification_rule( + /// Delete an existing ticket creation rule by ID. + pub async fn delete_security_findings_automation_ticket_creation_rule( &self, - id: String, - ) -> Result<(), datadog::Error> { + rule_id: uuid::Uuid, + ) -> Result<(), datadog::Error> { match self - .delete_signal_notification_rule_with_http_info(id) + .delete_security_findings_automation_ticket_creation_rule_with_http_info(rule_id) .await { Ok(_) => Ok(()), @@ -9081,21 +9519,31 @@ impl SecurityMonitoringAPI { } } - /// Delete a notification rule for security signals. - pub async fn delete_signal_notification_rule_with_http_info( + /// Delete an existing ticket creation rule by ID. + pub async fn delete_security_findings_automation_ticket_creation_rule_with_http_info( &self, - id: String, - ) -> Result, datadog::Error> - { + rule_id: uuid::Uuid, + ) -> Result< + datadog::ResponseContent<()>, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_signal_notification_rule"; + let operation_id = "v2.delete_security_findings_automation_ticket_creation_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_security_findings_automation_ticket_creation_rule' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/signals/notification_rules/{id}", + "{}/api/v2/security/findings/automation/ticket_creation_rules/{rule_id}", local_configuration.get_operation_host(operation_id), - id = datadog::urlencode(id) + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); @@ -9148,7 +9596,7 @@ impl SecurityMonitoringAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9159,13 +9607,13 @@ impl SecurityMonitoringAPI { } } - /// Delete a notification rule for security vulnerabilities. - pub async fn delete_vulnerability_notification_rule( + /// Delete a specific critical asset. + pub async fn delete_security_monitoring_critical_asset( &self, - id: String, - ) -> Result<(), datadog::Error> { + critical_asset_id: String, + ) -> Result<(), datadog::Error> { match self - .delete_vulnerability_notification_rule_with_http_info(id) + .delete_security_monitoring_critical_asset_with_http_info(critical_asset_id) .await { Ok(_) => Ok(()), @@ -9173,23 +9621,23 @@ impl SecurityMonitoringAPI { } } - /// Delete a notification rule for security vulnerabilities. - pub async fn delete_vulnerability_notification_rule_with_http_info( + /// Delete a specific critical asset. + pub async fn delete_security_monitoring_critical_asset_with_http_info( &self, - id: String, + critical_asset_id: String, ) -> Result< datadog::ResponseContent<()>, - datadog::Error, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.delete_vulnerability_notification_rule"; + let operation_id = "v2.delete_security_monitoring_critical_asset"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/vulnerabilities/notification_rules/{id}", + "{}/api/v2/security_monitoring/configuration/critical_assets/{critical_asset_id}", local_configuration.get_operation_host(operation_id), - id = datadog::urlencode(id) + critical_asset_id = datadog::urlencode(critical_asset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); @@ -9242,7 +9690,7 @@ impl SecurityMonitoringAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9253,39 +9701,51 @@ impl SecurityMonitoringAPI { } } - /// Detach security findings from their case. - /// This operation dissociates security findings from their associated cases without deleting the cases themselves. You can detach security findings from multiple different cases in a single request, with a limit of 50 security findings per request. Security findings that are not currently attached to any case will be ignored. - pub async fn detach_case( + /// Delete a Cloud SIEM dataset. Out-of-the-box datasets cannot be deleted and + /// deleting a dataset that is referenced by a detection rule is rejected. + pub async fn delete_security_monitoring_dataset( &self, - body: crate::datadogV2::model::DetachCaseRequest, - ) -> Result<(), datadog::Error> { - match self.detach_case_with_http_info(body).await { + dataset_id: String, + ) -> Result<(), datadog::Error> { + match self + .delete_security_monitoring_dataset_with_http_info(dataset_id) + .await + { Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Detach security findings from their case. - /// This operation dissociates security findings from their associated cases without deleting the cases themselves. You can detach security findings from multiple different cases in a single request, with a limit of 50 security findings per request. Security findings that are not currently attached to any case will be ignored. - pub async fn detach_case_with_http_info( + /// Delete a Cloud SIEM dataset. Out-of-the-box datasets cannot be deleted and + /// deleting a dataset that is referenced by a detection rule is rejected. + pub async fn delete_security_monitoring_dataset_with_http_info( &self, - body: crate::datadogV2::model::DetachCaseRequest, - ) -> Result, datadog::Error> { + dataset_id: String, + ) -> Result, datadog::Error> + { let local_configuration = &self.config; - let operation_id = "v2.detach_case"; + let operation_id = "v2.delete_security_monitoring_dataset"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_security_monitoring_dataset' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/findings/cases", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security_monitoring/datasets/{dataset_id}", + local_configuration.get_operation_host(operation_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent @@ -9316,52 +9776,6 @@ impl SecurityMonitoringAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -9378,7 +9792,8 @@ impl SecurityMonitoringAPI { entity: None, }) } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_entity: Option = + serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, content: local_content, @@ -9388,60 +9803,55 @@ impl SecurityMonitoringAPI { } } - /// Update the triage state or assignee of a security signal. - pub async fn edit_security_monitoring_signal( + /// Delete an entity context sync configuration. Cloud SIEM stops ingesting entities from this source, + /// and the credentials stored for the configuration are removed from the secrets store. + pub async fn delete_security_monitoring_integration_config( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalUpdateRequest, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - datadog::Error, - > { + integration_config_id: String, + ) -> Result<(), datadog::Error> { match self - .edit_security_monitoring_signal_with_http_info(signal_id, body) + .delete_security_monitoring_integration_config_with_http_info(integration_config_id) .await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Update the triage state or assignee of a security signal. - pub async fn edit_security_monitoring_signal_with_http_info( + /// Delete an entity context sync configuration. Cloud SIEM stops ingesting entities from this source, + /// and the credentials stored for the configuration are removed from the secrets store. + pub async fn delete_security_monitoring_integration_config_with_http_info( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalUpdateRequest, + integration_config_id: String, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >, - datadog::Error, + datadog::ResponseContent<()>, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.edit_security_monitoring_signal"; + let operation_id = "v2.delete_security_monitoring_integration_config"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_security_monitoring_integration_config' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}/update", - local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) - ); + "{}/api/v2/security_monitoring/configuration/integration_config/{integration_config_id}", + local_configuration.get_operation_host(operation_id), integration_config_id= + datadog::urlencode(integration_config_id) + ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -9471,52 +9881,6 @@ impl SecurityMonitoringAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -9527,21 +9891,13 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9552,60 +9908,42 @@ impl SecurityMonitoringAPI { } } - /// Modify the triage assignee of a security signal. - pub async fn edit_security_monitoring_signal_assignee( + /// Delete an existing rule. Default rules cannot be deleted. + pub async fn delete_security_monitoring_rule( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalAssigneeUpdateRequest, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - datadog::Error, - > { + rule_id: String, + ) -> Result<(), datadog::Error> { match self - .edit_security_monitoring_signal_assignee_with_http_info(signal_id, body) + .delete_security_monitoring_rule_with_http_info(rule_id) .await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Modify the triage assignee of a security signal. - pub async fn edit_security_monitoring_signal_assignee_with_http_info( + /// Delete an existing rule. Default rules cannot be deleted. + pub async fn delete_security_monitoring_rule_with_http_info( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalAssigneeUpdateRequest, - ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >, - datadog::Error, - > { + rule_id: String, + ) -> Result, datadog::Error> + { let local_configuration = &self.config; - let operation_id = "v2.edit_security_monitoring_signal_assignee"; + let operation_id = "v2.delete_security_monitoring_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}/assignee", + "{}/api/v2/security_monitoring/rules/{rule_id}", local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) + rule_id = datadog::urlencode(rule_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -9635,52 +9973,6 @@ impl SecurityMonitoringAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -9691,21 +9983,13 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9716,60 +10000,44 @@ impl SecurityMonitoringAPI { } } - /// Change the related incidents for a security signal. - pub async fn edit_security_monitoring_signal_incidents( + /// Delete a specific suppression rule. + pub async fn delete_security_monitoring_suppression( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalIncidentsUpdateRequest, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - datadog::Error, - > { + suppression_id: String, + ) -> Result<(), datadog::Error> { match self - .edit_security_monitoring_signal_incidents_with_http_info(signal_id, body) + .delete_security_monitoring_suppression_with_http_info(suppression_id) .await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Change the related incidents for a security signal. - pub async fn edit_security_monitoring_signal_incidents_with_http_info( + /// Delete a specific suppression rule. + pub async fn delete_security_monitoring_suppression_with_http_info( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalIncidentsUpdateRequest, + suppression_id: String, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >, - datadog::Error, + datadog::ResponseContent<()>, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.edit_security_monitoring_signal_incidents"; + let operation_id = "v2.delete_security_monitoring_suppression"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}/incidents", + "{}/api/v2/security_monitoring/configuration/suppressions/{suppression_id}", local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) + suppression_id = datadog::urlencode(suppression_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -9799,52 +10067,6 @@ impl SecurityMonitoringAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -9855,21 +10077,13 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9880,60 +10094,42 @@ impl SecurityMonitoringAPI { } } - /// Change the triage state of a security signal. - pub async fn edit_security_monitoring_signal_state( + /// Delete a notification rule for security signals. + pub async fn delete_signal_notification_rule( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalStateUpdateRequest, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - datadog::Error, - > { + id: String, + ) -> Result<(), datadog::Error> { match self - .edit_security_monitoring_signal_state_with_http_info(signal_id, body) + .delete_signal_notification_rule_with_http_info(id) .await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Change the triage state of a security signal. - pub async fn edit_security_monitoring_signal_state_with_http_info( + /// Delete a notification rule for security signals. + pub async fn delete_signal_notification_rule_with_http_info( &self, - signal_id: String, - body: crate::datadogV2::model::SecurityMonitoringSignalStateUpdateRequest, - ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >, - datadog::Error, - > { + id: String, + ) -> Result, datadog::Error> + { let local_configuration = &self.config; - let operation_id = "v2.edit_security_monitoring_signal_state"; + let operation_id = "v2.delete_signal_notification_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}/state", + "{}/api/v2/security/signals/notification_rules/{id}", local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) + id = datadog::urlencode(id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -9963,52 +10159,6 @@ impl SecurityMonitoringAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -10019,21 +10169,13 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, - >(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -10044,76 +10186,44 @@ impl SecurityMonitoringAPI { } } - /// Export a security monitoring resource to a Terraform configuration. - /// The `resource_type` path parameter specifies the type of resource to export - /// and must be one of `suppressions` or `critical_assets`. - pub async fn export_security_monitoring_terraform_resource( + /// Delete a notification rule for security vulnerabilities. + pub async fn delete_vulnerability_notification_rule( &self, - resource_type: crate::datadogV2::model::SecurityMonitoringTerraformResourceType, - resource_id: String, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringTerraformExportResponse, - datadog::Error, - > { + id: String, + ) -> Result<(), datadog::Error> { match self - .export_security_monitoring_terraform_resource_with_http_info( - resource_type, - resource_id, - ) + .delete_vulnerability_notification_rule_with_http_info(id) .await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Export a security monitoring resource to a Terraform configuration. - /// The `resource_type` path parameter specifies the type of resource to export - /// and must be one of `suppressions` or `critical_assets`. - pub async fn export_security_monitoring_terraform_resource_with_http_info( + /// Delete a notification rule for security vulnerabilities. + pub async fn delete_vulnerability_notification_rule_with_http_info( &self, - resource_type: crate::datadogV2::model::SecurityMonitoringTerraformResourceType, - resource_id: String, + id: String, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringTerraformExportResponse, - >, - datadog::Error, + datadog::ResponseContent<()>, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.export_security_monitoring_terraform_resource"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.export_security_monitoring_terraform_resource' is not enabled" - .to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.delete_vulnerability_notification_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/terraform/{resource_type}/{resource_id}", + "{}/api/v2/security/vulnerabilities/notification_rules/{id}", local_configuration.get_operation_host(operation_id), - resource_type = datadog::urlencode(resource_type.to_string()), - resource_id = datadog::urlencode(resource_id) + id = datadog::urlencode(id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -10153,21 +10263,13 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringTerraformExportResponse, - >(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -10178,61 +10280,40 @@ impl SecurityMonitoringAPI { } } - /// Get the activation state, integration status, and log collection status - /// for all Cloud SIEM content packs. - pub async fn get_content_packs_states( + /// Detach security findings from their case. + /// This operation dissociates security findings from their associated cases without deleting the cases themselves. You can detach security findings from multiple different cases in a single request, with a limit of 50 security findings per request. Security findings that are not currently attached to any case will be ignored. + pub async fn detach_case( &self, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringContentPackStatesResponse, - datadog::Error, - > { - match self.get_content_packs_states_with_http_info().await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + body: crate::datadogV2::model::DetachCaseRequest, + ) -> Result<(), datadog::Error> { + match self.detach_case_with_http_info(body).await { + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Get the activation state, integration status, and log collection status - /// for all Cloud SIEM content packs. - pub async fn get_content_packs_states_with_http_info( + /// Detach security findings from their case. + /// This operation dissociates security findings from their associated cases without deleting the cases themselves. You can detach security findings from multiple different cases in a single request, with a limit of 50 security findings per request. Security findings that are not currently attached to any case will be ignored. + pub async fn detach_case_with_http_info( &self, - ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringContentPackStatesResponse, - >, - datadog::Error, - > { + body: crate::datadogV2::model::DetachCaseRequest, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.get_content_packs_states"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_content_packs_states' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.detach_case"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/content_packs/states", + "{}/api/v2/security/findings/cases", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -10262,6 +10343,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -10272,22 +10399,13 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringContentPackStatesResponse, - >(&local_content) - { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, content: local_content, @@ -10297,16 +10415,17 @@ impl SecurityMonitoringAPI { } } - /// Get the list of critical assets that affect a specific existing rule by the rule's ID. - pub async fn get_critical_assets_affecting_rule( + /// Update the triage state or assignee of a security signal. + pub async fn edit_security_monitoring_signal( &self, - rule_id: String, + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalUpdateRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + datadog::Error, > { match self - .get_critical_assets_affecting_rule_with_http_info(rule_id) + .edit_security_monitoring_signal_with_http_info(signal_id, body) .await { Ok(response_content) => { @@ -10322,29 +10441,33 @@ impl SecurityMonitoringAPI { } } - /// Get the list of critical assets that affect a specific existing rule by the rule's ID. - pub async fn get_critical_assets_affecting_rule_with_http_info( + /// Update the triage state or assignee of a security signal. + pub async fn edit_security_monitoring_signal_with_http_info( &self, - rule_id: String, + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_critical_assets_affecting_rule"; + let operation_id = "v2.edit_security_monitoring_signal"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/critical_assets/rules/{rule_id}", + "{}/api/v2/security_monitoring/signals/{signal_id}/update", local_configuration.get_operation_host(operation_id), - rule_id = datadog::urlencode(rule_id) + signal_id = datadog::urlencode(signal_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -10375,18 +10498,64 @@ impl SecurityMonitoringAPI { ); }; - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, >(&local_content) { Ok(e) => { @@ -10399,7 +10568,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -10410,17 +10579,17 @@ impl SecurityMonitoringAPI { } } - /// Get a custom framework. - pub async fn get_custom_framework( + /// Modify the triage assignee of a security signal. + pub async fn edit_security_monitoring_signal_assignee( &self, - handle: String, - version: String, + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalAssigneeUpdateRequest, ) -> Result< - crate::datadogV2::model::GetCustomFrameworkResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + datadog::Error, > { match self - .get_custom_framework_with_http_info(handle, version) + .edit_security_monitoring_signal_assignee_with_http_info(signal_id, body) .await { Ok(response_content) => { @@ -10436,31 +10605,33 @@ impl SecurityMonitoringAPI { } } - /// Get a custom framework. - pub async fn get_custom_framework_with_http_info( + /// Modify the triage assignee of a security signal. + pub async fn edit_security_monitoring_signal_assignee_with_http_info( &self, - handle: String, - version: String, + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalAssigneeUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_custom_framework"; + let operation_id = "v2.edit_security_monitoring_signal_assignee"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/cloud_security_management/custom_frameworks/{handle}/{version}", + "{}/api/v2/security_monitoring/signals/{signal_id}/assignee", local_configuration.get_operation_host(operation_id), - handle = datadog::urlencode(handle), - version = datadog::urlencode(version) + signal_id = datadog::urlencode(signal_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -10491,6 +10662,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -10501,9 +10718,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -10514,7 +10732,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -10525,16 +10743,19 @@ impl SecurityMonitoringAPI { } } - /// Search the Cloud SIEM entity context store for entities that match a query, and return the historical - /// revisions of each entity in the requested time range. The endpoint can either return revisions across an - /// interval (`from` / `to`) or the snapshot of each entity at a single point in time (`as_of`); the two modes - /// are mutually exclusive. - pub async fn get_entity_context( + /// Change the related incidents for a security signal. + pub async fn edit_security_monitoring_signal_incidents( &self, - params: GetEntityContextOptionalParams, - ) -> Result> - { - match self.get_entity_context_with_http_info(params).await { + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalIncidentsUpdateRequest, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + datadog::Error, + > { + match self + .edit_security_monitoring_signal_incidents_with_http_info(signal_id, body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -10548,71 +10769,33 @@ impl SecurityMonitoringAPI { } } - /// Search the Cloud SIEM entity context store for entities that match a query, and return the historical - /// revisions of each entity in the requested time range. The endpoint can either return revisions across an - /// interval (`from` / `to`) or the snapshot of each entity at a single point in time (`as_of`); the two modes - /// are mutually exclusive. - pub async fn get_entity_context_with_http_info( + /// Change the related incidents for a security signal. + pub async fn edit_security_monitoring_signal_incidents_with_http_info( &self, - params: GetEntityContextOptionalParams, + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalIncidentsUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_entity_context"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_entity_context' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let query = params.query; - let from = params.from; - let to = params.to; - let as_of = params.as_of; - let limit = params.limit; - let page_token = params.page_token; + let operation_id = "v2.edit_security_monitoring_signal_incidents"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/entity_context", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security_monitoring/signals/{signal_id}/incidents", + local_configuration.get_operation_host(operation_id), + signal_id = datadog::urlencode(signal_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = query { - local_req_builder = - local_req_builder.query(&[("query", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = from { - local_req_builder = - local_req_builder.query(&[("from", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = to { - local_req_builder = local_req_builder.query(&[("to", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = as_of { - local_req_builder = - local_req_builder.query(&[("as_of", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = limit { - local_req_builder = - local_req_builder.query(&[("limit", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_token { - local_req_builder = - local_req_builder.query(&[("page_token", &local_query_param.to_string())]); - }; + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -10643,30 +10826,77 @@ impl SecurityMonitoringAPI { ); }; - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), }) } Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -10677,13 +10907,19 @@ impl SecurityMonitoringAPI { } } - /// Returns a single finding with message and resource configuration. - pub async fn get_finding( + /// Change the triage state of a security signal. + pub async fn edit_security_monitoring_signal_state( &self, - finding_id: String, - params: GetFindingOptionalParams, - ) -> Result> { - match self.get_finding_with_http_info(finding_id, params).await { + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalStateUpdateRequest, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + datadog::Error, + > { + match self + .edit_security_monitoring_signal_state_with_http_info(signal_id, body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -10697,46 +10933,33 @@ impl SecurityMonitoringAPI { } } - /// Returns a single finding with message and resource configuration. - pub async fn get_finding_with_http_info( + /// Change the triage state of a security signal. + pub async fn edit_security_monitoring_signal_state_with_http_info( &self, - finding_id: String, - params: GetFindingOptionalParams, + signal_id: String, + body: crate::datadogV2::model::SecurityMonitoringSignalStateUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_finding"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_finding' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let snapshot_timestamp = params.snapshot_timestamp; + let operation_id = "v2.edit_security_monitoring_signal_state"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/posture_management/findings/{finding_id}", + "{}/api/v2/security_monitoring/signals/{signal_id}/state", local_configuration.get_operation_host(operation_id), - finding_id = datadog::urlencode(finding_id) + signal_id = datadog::urlencode(signal_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = snapshot_timestamp { - local_req_builder = - local_req_builder.query(&[("snapshot_timestamp", &local_query_param.to_string())]); - }; + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -10767,6 +10990,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -10777,9 +11046,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalTriageUpdateResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -10790,7 +11060,8 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_entity: Option = + serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, content: local_content, @@ -10800,13 +11071,24 @@ impl SecurityMonitoringAPI { } } - /// Get a job's details. - pub async fn get_historical_job( + /// Export a security monitoring resource to a Terraform configuration. + /// The `resource_type` path parameter specifies the type of resource to export + /// and must be one of `suppressions` or `critical_assets`. + pub async fn export_security_monitoring_terraform_resource( &self, - job_id: String, - ) -> Result> - { - match self.get_historical_job_with_http_info(job_id).await { + resource_type: crate::datadogV2::model::SecurityMonitoringTerraformResourceType, + resource_id: String, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringTerraformExportResponse, + datadog::Error, + > { + match self + .export_security_monitoring_terraform_resource_with_http_info( + resource_type, + resource_id, + ) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -10820,21 +11102,27 @@ impl SecurityMonitoringAPI { } } - /// Get a job's details. - pub async fn get_historical_job_with_http_info( + /// Export a security monitoring resource to a Terraform configuration. + /// The `resource_type` path parameter specifies the type of resource to export + /// and must be one of `suppressions` or `critical_assets`. + pub async fn export_security_monitoring_terraform_resource_with_http_info( &self, - job_id: String, + resource_type: crate::datadogV2::model::SecurityMonitoringTerraformResourceType, + resource_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringTerraformExportResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_historical_job"; + let operation_id = "v2.export_security_monitoring_terraform_resource"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_historical_job' is not enabled".to_string(), + msg: "Operation 'v2.export_security_monitoring_terraform_resource' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -10842,9 +11130,10 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/jobs/{job_id}", + "{}/api/v2/security_monitoring/terraform/{resource_type}/{resource_id}", local_configuration.get_operation_host(operation_id), - job_id = datadog::urlencode(job_id) + resource_type = datadog::urlencode(resource_type.to_string()), + resource_id = datadog::urlencode(resource_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -10891,9 +11180,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringTerraformExportResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -10904,7 +11194,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -10915,19 +11205,15 @@ impl SecurityMonitoringAPI { } } - /// Get detailed information about a specific indicator of compromise (IoC). - pub async fn get_indicator_of_compromise( + /// Get the activation state, integration status, and log collection status + /// for all Cloud SIEM content packs. + pub async fn get_content_packs_states( &self, - indicator: String, - params: GetIndicatorOfCompromiseOptionalParams, ) -> Result< - crate::datadogV2::model::GetIoCIndicatorResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringContentPackStatesResponse, + datadog::Error, > { - match self - .get_indicator_of_compromise_with_http_info(indicator, params) - .await - { + match self.get_content_packs_states_with_http_info().await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -10941,59 +11227,36 @@ impl SecurityMonitoringAPI { } } - /// Get detailed information about a specific indicator of compromise (IoC). - pub async fn get_indicator_of_compromise_with_http_info( - &self, - indicator: String, - params: GetIndicatorOfCompromiseOptionalParams, + /// Get the activation state, integration status, and log collection status + /// for all Cloud SIEM content packs. + pub async fn get_content_packs_states_with_http_info( + &self, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringContentPackStatesResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_indicator_of_compromise"; + let operation_id = "v2.get_content_packs_states"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_indicator_of_compromise' is not enabled".to_string(), + msg: "Operation 'v2.get_content_packs_states' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let ocsf = params.ocsf; - let include_triage_history = params.include_triage_history; - let triage_history_limit = params.triage_history_limit; - let triage_history_offset = params.triage_history_offset; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/siem/ioc-explorer/indicator", + "{}/api/v2/security_monitoring/content_packs/states", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = local_req_builder.query(&[("indicator", &indicator.to_string())]); - if let Some(ref local_query_param) = ocsf { - local_req_builder = - local_req_builder.query(&[("ocsf", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = include_triage_history { - local_req_builder = local_req_builder - .query(&[("include_triage_history", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = triage_history_limit { - local_req_builder = local_req_builder - .query(&[("triage_history_limit", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = triage_history_offset { - local_req_builder = local_req_builder - .query(&[("triage_history_offset", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -11036,9 +11299,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringContentPackStatesResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -11049,7 +11313,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -11060,16 +11324,16 @@ impl SecurityMonitoringAPI { } } - /// Get the list of investigation log queries available for a given security signal. - pub async fn get_investigation_log_queries_matching_signal( + /// Get the list of critical assets that affect a specific existing rule by the rule's ID. + pub async fn get_critical_assets_affecting_rule( &self, - signal_id: String, + rule_id: String, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, + datadog::Error, > { match self - .get_investigation_log_queries_matching_signal_with_http_info(signal_id) + .get_critical_assets_affecting_rule_with_http_info(rule_id) .await { Ok(response_content) => { @@ -11085,25 +11349,23 @@ impl SecurityMonitoringAPI { } } - /// Get the list of investigation log queries available for a given security signal. - pub async fn get_investigation_log_queries_matching_signal_with_http_info( + /// Get the list of critical assets that affect a specific existing rule by the rule's ID. + pub async fn get_critical_assets_affecting_rule_with_http_info( &self, - signal_id: String, + rule_id: String, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_investigation_log_queries_matching_signal"; + let operation_id = "v2.get_critical_assets_affecting_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}/investigation_queries", + "{}/api/v2/security_monitoring/configuration/critical_assets/rules/{rule_id}", local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) + rule_id = datadog::urlencode(rule_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -11151,7 +11413,7 @@ impl SecurityMonitoringAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, + crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, >(&local_content) { Ok(e) => { @@ -11164,7 +11426,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -11175,16 +11437,17 @@ impl SecurityMonitoringAPI { } } - /// List resource filters. - pub async fn get_resource_evaluation_filters( + /// Get a custom framework. + pub async fn get_custom_framework( &self, - params: GetResourceEvaluationFiltersOptionalParams, + handle: String, + version: String, ) -> Result< - crate::datadogV2::model::GetResourceEvaluationFiltersResponse, - datadog::Error, + crate::datadogV2::model::GetCustomFrameworkResponse, + datadog::Error, > { match self - .get_resource_evaluation_filters_with_http_info(params) + .get_custom_framework_with_http_info(handle, version) .await { Ok(response_content) => { @@ -11200,44 +11463,29 @@ impl SecurityMonitoringAPI { } } - /// List resource filters. - pub async fn get_resource_evaluation_filters_with_http_info( + /// Get a custom framework. + pub async fn get_custom_framework_with_http_info( &self, - params: GetResourceEvaluationFiltersOptionalParams, + handle: String, + version: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_resource_evaluation_filters"; - - // unbox and build optional parameters - let cloud_provider = params.cloud_provider; - let account_id = params.account_id; - let skip_cache = params.skip_cache; + let operation_id = "v2.get_custom_framework"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/cloud_security_management/resource_filters", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/cloud_security_management/custom_frameworks/{handle}/{version}", + local_configuration.get_operation_host(operation_id), + handle = datadog::urlencode(handle), + version = datadog::urlencode(version) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = cloud_provider { - local_req_builder = - local_req_builder.query(&[("cloud_provider", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = account_id { - local_req_builder = - local_req_builder.query(&[("account_id", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = skip_cache { - local_req_builder = - local_req_builder.query(&[("skip_cache", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -11280,10 +11528,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::GetResourceEvaluationFiltersResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -11294,7 +11541,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -11305,19 +11552,16 @@ impl SecurityMonitoringAPI { } } - /// Get a rule's version history. - pub async fn get_rule_version_history( + /// Search the Cloud SIEM entity context store for entities that match a query, and return the historical + /// revisions of each entity in the requested time range. The endpoint can either return revisions across an + /// interval (`from` / `to`) or the snapshot of each entity at a single point in time (`as_of`); the two modes + /// are mutually exclusive. + pub async fn get_entity_context( &self, - rule_id: String, - params: GetRuleVersionHistoryOptionalParams, - ) -> Result< - crate::datadogV2::model::GetRuleVersionHistoryResponse, - datadog::Error, - > { - match self - .get_rule_version_history_with_http_info(rule_id, params) - .await - { + params: GetEntityContextOptionalParams, + ) -> Result> + { + match self.get_entity_context_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -11331,47 +11575,67 @@ impl SecurityMonitoringAPI { } } - /// Get a rule's version history. - pub async fn get_rule_version_history_with_http_info( + /// Search the Cloud SIEM entity context store for entities that match a query, and return the historical + /// revisions of each entity in the requested time range. The endpoint can either return revisions across an + /// interval (`from` / `to`) or the snapshot of each entity at a single point in time (`as_of`); the two modes + /// are mutually exclusive. + pub async fn get_entity_context_with_http_info( &self, - rule_id: String, - params: GetRuleVersionHistoryOptionalParams, + params: GetEntityContextOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_rule_version_history"; + let operation_id = "v2.get_entity_context"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_rule_version_history' is not enabled".to_string(), + msg: "Operation 'v2.get_entity_context' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let page_size = params.page_size; - let page_number = params.page_number; + let query = params.query; + let from = params.from; + let to = params.to; + let as_of = params.as_of; + let limit = params.limit; + let page_token = params.page_token; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules/{rule_id}/version_history", - local_configuration.get_operation_host(operation_id), - rule_id = datadog::urlencode(rule_id) + "{}/api/v2/security_monitoring/entity_context", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_size { + if let Some(ref local_query_param) = query { local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + local_req_builder.query(&[("query", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_number { + if let Some(ref local_query_param) = from { local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + local_req_builder.query(&[("from", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = to { + local_req_builder = local_req_builder.query(&[("to", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = as_of { + local_req_builder = + local_req_builder.query(&[("as_of", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = limit { + local_req_builder = + local_req_builder.query(&[("limit", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_token { + local_req_builder = + local_req_builder.query(&[("page_token", &local_query_param.to_string())]); }; // build headers @@ -11416,7 +11680,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -11429,7 +11693,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -11440,17 +11704,13 @@ impl SecurityMonitoringAPI { } } - /// Get a single SBOM related to an asset by its type and name. - pub async fn get_sbom( + /// Returns a single finding with message and resource configuration. + pub async fn get_finding( &self, - asset_type: crate::datadogV2::model::AssetType, - filter_asset_name: String, - params: GetSBOMOptionalParams, - ) -> Result> { - match self - .get_sbom_with_http_info(asset_type, filter_asset_name, params) - .await - { + finding_id: String, + params: GetFindingOptionalParams, + ) -> Result> { + match self.get_finding_with_http_info(finding_id, params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -11464,42 +11724,42 @@ impl SecurityMonitoringAPI { } } - /// Get a single SBOM related to an asset by its type and name. - pub async fn get_sbom_with_http_info( + /// Returns a single finding with message and resource configuration. + pub async fn get_finding_with_http_info( &self, - asset_type: crate::datadogV2::model::AssetType, - filter_asset_name: String, - params: GetSBOMOptionalParams, + finding_id: String, + params: GetFindingOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_sbom"; - - // unbox and build optional parameters - let filter_repo_digest = params.filter_repo_digest; - let ext_format = params.ext_format; + let operation_id = "v2.get_finding"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_finding' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let snapshot_timestamp = params.snapshot_timestamp; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/sboms/{asset_type}", + "{}/api/v2/posture_management/findings/{finding_id}", local_configuration.get_operation_host(operation_id), - asset_type = datadog::urlencode(asset_type.to_string()) + finding_id = datadog::urlencode(finding_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = - local_req_builder.query(&[("filter[asset_name]", &filter_asset_name.to_string())]); - if let Some(ref local_query_param) = filter_repo_digest { - local_req_builder = - local_req_builder.query(&[("filter[repo_digest]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = ext_format { + if let Some(ref local_query_param) = snapshot_timestamp { local_req_builder = - local_req_builder.query(&[("ext:format", &local_query_param.to_string())]); + local_req_builder.query(&[("snapshot_timestamp", &local_query_param.to_string())]); }; // build headers @@ -11544,7 +11804,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -11555,7 +11817,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, content: local_content, @@ -11565,12 +11827,13 @@ impl SecurityMonitoringAPI { } } - /// Returns a list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID. - pub async fn get_secrets_rules( + /// Get a job's details. + pub async fn get_historical_job( &self, - ) -> Result> + job_id: String, + ) -> Result> { - match self.get_secrets_rules_with_http_info().await { + match self.get_historical_job_with_http_info(job_id).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -11584,20 +11847,21 @@ impl SecurityMonitoringAPI { } } - /// Returns a list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID. - pub async fn get_secrets_rules_with_http_info( + /// Get a job's details. + pub async fn get_historical_job_with_http_info( &self, + job_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_secrets_rules"; + let operation_id = "v2.get_historical_job"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_secrets_rules' is not enabled".to_string(), + msg: "Operation 'v2.get_historical_job' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -11605,8 +11869,9 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/secrets/rules", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/siem-historical-detections/jobs/{job_id}", + local_configuration.get_operation_host(operation_id), + job_id = datadog::urlencode(job_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -11653,7 +11918,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -11664,7 +11931,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -11675,19 +11942,17 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific security filter. - /// - /// See the [security filter guide]() - /// for more examples. - pub async fn get_security_filter( + /// Get detailed information about a specific indicator of compromise (IoC). + pub async fn get_indicator_of_compromise( &self, - security_filter_id: String, + indicator: String, + params: GetIndicatorOfCompromiseOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityFilterResponse, - datadog::Error, + crate::datadogV2::model::GetIoCIndicatorResponse, + datadog::Error, > { match self - .get_security_filter_with_http_info(security_filter_id) + .get_indicator_of_compromise_with_http_info(indicator, params) .await { Ok(response_content) => { @@ -11703,30 +11968,59 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific security filter. - /// - /// See the [security filter guide]() - /// for more examples. - pub async fn get_security_filter_with_http_info( + /// Get detailed information about a specific indicator of compromise (IoC). + pub async fn get_indicator_of_compromise_with_http_info( &self, - security_filter_id: String, + indicator: String, + params: GetIndicatorOfCompromiseOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_filter"; + let operation_id = "v2.get_indicator_of_compromise"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_indicator_of_compromise' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let ocsf = params.ocsf; + let include_triage_history = params.include_triage_history; + let triage_history_limit = params.triage_history_limit; + let triage_history_offset = params.triage_history_offset; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}", - local_configuration.get_operation_host(operation_id), - security_filter_id = datadog::urlencode(security_filter_id) + "{}/api/v2/security/siem/ioc-explorer/indicator", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + local_req_builder = local_req_builder.query(&[("indicator", &indicator.to_string())]); + if let Some(ref local_query_param) = ocsf { + local_req_builder = + local_req_builder.query(&[("ocsf", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = include_triage_history { + local_req_builder = local_req_builder + .query(&[("include_triage_history", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = triage_history_limit { + local_req_builder = local_req_builder + .query(&[("triage_history_limit", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = triage_history_offset { + local_req_builder = local_req_builder + .query(&[("triage_history_offset", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -11769,7 +12063,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -11782,7 +12076,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -11793,16 +12087,16 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific critical asset. - pub async fn get_security_monitoring_critical_asset( + /// Get the list of investigation log queries available for a given security signal. + pub async fn get_investigation_log_queries_matching_signal( &self, - critical_asset_id: String, + signal_id: String, ) -> Result< - crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, + datadog::Error, > { match self - .get_security_monitoring_critical_asset_with_http_info(critical_asset_id) + .get_investigation_log_queries_matching_signal_with_http_info(signal_id) .await { Ok(response_content) => { @@ -11818,23 +12112,25 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific critical asset. - pub async fn get_security_monitoring_critical_asset_with_http_info( + /// Get the list of investigation log queries available for a given security signal. + pub async fn get_investigation_log_queries_matching_signal_with_http_info( &self, - critical_asset_id: String, + signal_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_critical_asset"; + let operation_id = "v2.get_investigation_log_queries_matching_signal"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/critical_assets/{critical_asset_id}", + "{}/api/v2/security_monitoring/signals/{signal_id}/investigation_queries", local_configuration.get_operation_host(operation_id), - critical_asset_id = datadog::urlencode(critical_asset_id) + signal_id = datadog::urlencode(signal_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -11882,7 +12178,7 @@ impl SecurityMonitoringAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, + crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, >(&local_content) { Ok(e) => { @@ -11895,7 +12191,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -11906,16 +12202,16 @@ impl SecurityMonitoringAPI { } } - /// Get the current version of a Cloud SIEM dataset by ID. - pub async fn get_security_monitoring_dataset( + /// List resource filters. + pub async fn get_resource_evaluation_filters( &self, - dataset_id: String, + params: GetResourceEvaluationFiltersOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringDatasetResponse, - datadog::Error, + crate::datadogV2::model::GetResourceEvaluationFiltersResponse, + datadog::Error, > { match self - .get_security_monitoring_dataset_with_http_info(dataset_id) + .get_resource_evaluation_filters_with_http_info(params) .await { Ok(response_content) => { @@ -11931,35 +12227,44 @@ impl SecurityMonitoringAPI { } } - /// Get the current version of a Cloud SIEM dataset by ID. - pub async fn get_security_monitoring_dataset_with_http_info( + /// List resource filters. + pub async fn get_resource_evaluation_filters_with_http_info( &self, - dataset_id: String, + params: GetResourceEvaluationFiltersOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_dataset"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_security_monitoring_dataset' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.get_resource_evaluation_filters"; + + // unbox and build optional parameters + let cloud_provider = params.cloud_provider; + let account_id = params.account_id; + let skip_cache = params.skip_cache; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/datasets/{dataset_id}", - local_configuration.get_operation_host(operation_id), - dataset_id = datadog::urlencode(dataset_id) + "{}/api/v2/cloud_security_management/resource_filters", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = cloud_provider { + local_req_builder = + local_req_builder.query(&[("cloud_provider", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = account_id { + local_req_builder = + local_req_builder.query(&[("account_id", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = skip_cache { + local_req_builder = + local_req_builder.query(&[("skip_cache", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -12002,9 +12307,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::GetResourceEvaluationFiltersResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -12015,7 +12321,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -12026,17 +12332,17 @@ impl SecurityMonitoringAPI { } } - /// Retrieve a specific historical version of a Cloud SIEM dataset. - pub async fn get_security_monitoring_dataset_by_version( + /// Get a rule's version history. + pub async fn get_rule_version_history( &self, - dataset_id: String, - version: i64, + rule_id: String, + params: GetRuleVersionHistoryOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringDatasetResponse, - datadog::Error, + crate::datadogV2::model::GetRuleVersionHistoryResponse, + datadog::Error, > { match self - .get_security_monitoring_dataset_by_version_with_http_info(dataset_id, version) + .get_rule_version_history_with_http_info(rule_id, params) .await { Ok(response_content) => { @@ -12052,38 +12358,49 @@ impl SecurityMonitoringAPI { } } - /// Retrieve a specific historical version of a Cloud SIEM dataset. - pub async fn get_security_monitoring_dataset_by_version_with_http_info( + /// Get a rule's version history. + pub async fn get_rule_version_history_with_http_info( &self, - dataset_id: String, - version: i64, + rule_id: String, + params: GetRuleVersionHistoryOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_dataset_by_version"; + let operation_id = "v2.get_rule_version_history"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_security_monitoring_dataset_by_version' is not enabled" - .to_string(), + msg: "Operation 'v2.get_rule_version_history' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/datasets/{dataset_id}/version/{version}", + "{}/api/v2/security_monitoring/rules/{rule_id}/version_history", local_configuration.get_operation_host(operation_id), - dataset_id = datadog::urlencode(dataset_id), - version = version + rule_id = datadog::urlencode(rule_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -12126,7 +12443,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -12139,7 +12456,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -12150,17 +12467,15 @@ impl SecurityMonitoringAPI { } } - /// Retrieve the version history of a Cloud SIEM dataset, including the changes made at each version. - pub async fn get_security_monitoring_dataset_version_history( + /// Get a single SBOM related to an asset by its type and name. + pub async fn get_sbom( &self, - dataset_id: String, - params: GetSecurityMonitoringDatasetVersionHistoryOptionalParams, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringDatasetVersionHistoryResponse, - datadog::Error, - > { + asset_type: crate::datadogV2::model::AssetType, + filter_asset_name: String, + params: GetSBOMOptionalParams, + ) -> Result> { match self - .get_security_monitoring_dataset_version_history_with_http_info(dataset_id, params) + .get_sbom_with_http_info(asset_type, filter_asset_name, params) .await { Ok(response_content) => { @@ -12176,51 +12491,42 @@ impl SecurityMonitoringAPI { } } - /// Retrieve the version history of a Cloud SIEM dataset, including the changes made at each version. - pub async fn get_security_monitoring_dataset_version_history_with_http_info( + /// Get a single SBOM related to an asset by its type and name. + pub async fn get_sbom_with_http_info( &self, - dataset_id: String, - params: GetSecurityMonitoringDatasetVersionHistoryOptionalParams, + asset_type: crate::datadogV2::model::AssetType, + filter_asset_name: String, + params: GetSBOMOptionalParams, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringDatasetVersionHistoryResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_dataset_version_history"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: - "Operation 'v2.get_security_monitoring_dataset_version_history' is not enabled" - .to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.get_sbom"; // unbox and build optional parameters - let page_size = params.page_size; - let page_number = params.page_number; + let filter_repo_digest = params.filter_repo_digest; + let ext_format = params.ext_format; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/datasets/{dataset_id}/version_history", + "{}/api/v2/security/sboms/{asset_type}", local_configuration.get_operation_host(operation_id), - dataset_id = datadog::urlencode(dataset_id) + asset_type = datadog::urlencode(asset_type.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("filter[asset_name]", &filter_asset_name.to_string())]); + if let Some(ref local_query_param) = filter_repo_digest { local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[repo_digest]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_number { + if let Some(ref local_query_param) = ext_format { local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + local_req_builder.query(&[("ext:format", &local_query_param.to_string())]); }; // build headers @@ -12265,10 +12571,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringDatasetVersionHistoryResponse, - >(&local_content) - { + match serde_json::from_str::(&local_content) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -12279,8 +12582,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, content: local_content, @@ -12290,18 +12592,12 @@ impl SecurityMonitoringAPI { } } - /// Get a hist signal's details. - pub async fn get_security_monitoring_histsignal( + /// Returns a list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID. + pub async fn get_secrets_rules( &self, - histsignal_id: String, - ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalResponse, - datadog::Error, - > { - match self - .get_security_monitoring_histsignal_with_http_info(histsignal_id) - .await - { + ) -> Result> + { + match self.get_secrets_rules_with_http_info().await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -12315,21 +12611,20 @@ impl SecurityMonitoringAPI { } } - /// Get a hist signal's details. - pub async fn get_security_monitoring_histsignal_with_http_info( + /// Returns a list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID. + pub async fn get_secrets_rules_with_http_info( &self, - histsignal_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_histsignal"; + let operation_id = "v2.get_secrets_rules"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_security_monitoring_histsignal' is not enabled".to_string(), + msg: "Operation 'v2.get_secrets_rules' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -12337,9 +12632,8 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/histsignals/{histsignal_id}", - local_configuration.get_operation_host(operation_id), - histsignal_id = datadog::urlencode(histsignal_id) + "{}/api/v2/static-analysis/secrets/rules", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -12386,9 +12680,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::(&local_content) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -12399,7 +12691,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -12410,17 +12702,19 @@ impl SecurityMonitoringAPI { } } - /// Get a job's hist signals. - pub async fn get_security_monitoring_histsignals_by_job_id( + /// Get the details of a specific security filter. + /// + /// See the [security filter guide]() + /// for more examples. + pub async fn get_security_filter( &self, - job_id: String, - params: GetSecurityMonitoringHistsignalsByJobIdOptionalParams, + security_filter_id: String, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - datadog::Error, + crate::datadogV2::model::SecurityFilterResponse, + datadog::Error, > { match self - .get_security_monitoring_histsignals_by_job_id_with_http_info(job_id, params) + .get_security_filter_with_http_info(security_filter_id) .await { Ok(response_content) => { @@ -12436,74 +12730,30 @@ impl SecurityMonitoringAPI { } } - /// Get a job's hist signals. - pub async fn get_security_monitoring_histsignals_by_job_id_with_http_info( + /// Get the details of a specific security filter. + /// + /// See the [security filter guide]() + /// for more examples. + pub async fn get_security_filter_with_http_info( &self, - job_id: String, - params: GetSecurityMonitoringHistsignalsByJobIdOptionalParams, + security_filter_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_histsignals_by_job_id"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_security_monitoring_histsignals_by_job_id' is not enabled" - .to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let filter_query = params.filter_query; - let filter_from = params.filter_from; - let filter_to = params.filter_to; - let sort = params.sort; - let page_cursor = params.page_cursor; - let page_limit = params.page_limit; + let operation_id = "v2.get_security_filter"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/jobs/{job_id}/histsignals", + "{}/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}", local_configuration.get_operation_host(operation_id), - job_id = datadog::urlencode(job_id) + security_filter_id = datadog::urlencode(security_filter_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = filter_query { - local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_from { - local_req_builder = local_req_builder.query(&[( - "filter[from]", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - if let Some(ref local_query_param) = filter_to { - local_req_builder = local_req_builder.query(&[( - "filter[to]", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - if let Some(ref local_query_param) = sort { - local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -12546,10 +12796,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -12560,7 +12809,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -12571,16 +12820,16 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific entity context sync configuration. - pub async fn get_security_monitoring_integration_config( + /// Get the details of a due date rule by ID. + pub async fn get_security_findings_automation_due_date_rule( &self, - integration_config_id: String, + rule_id: uuid::Uuid, ) -> Result< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, - datadog::Error, + crate::datadogV2::model::DueDateRuleResponse, + datadog::Error, > { match self - .get_security_monitoring_integration_config_with_http_info(integration_config_id) + .get_security_findings_automation_due_date_rule_with_http_info(rule_id) .await { Ok(response_content) => { @@ -12596,23 +12845,21 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific entity context sync configuration. - pub async fn get_security_monitoring_integration_config_with_http_info( + /// Get the details of a due date rule by ID. + pub async fn get_security_findings_automation_due_date_rule_with_http_info( &self, - integration_config_id: String, + rule_id: uuid::Uuid, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_integration_config"; + let operation_id = "v2.get_security_findings_automation_due_date_rule"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_security_monitoring_integration_config' is not enabled" + msg: "Operation 'v2.get_security_findings_automation_due_date_rule' is not enabled" .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); @@ -12621,10 +12868,10 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/integration_config/{integration_config_id}", - local_configuration.get_operation_host(operation_id), integration_config_id= - datadog::urlencode(integration_config_id) - ); + "{}/api/v2/security/findings/automation/due_date_rules/{rule_id}", + local_configuration.get_operation_host(operation_id), + rule_id = datadog::urlencode(rule_id.to_string()) + ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -12670,10 +12917,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -12684,7 +12930,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -12695,16 +12941,16 @@ impl SecurityMonitoringAPI { } } - /// Get a rule's details. - pub async fn get_security_monitoring_rule( + /// Get the details of a mute rule by ID. + pub async fn get_security_findings_automation_mute_rule( &self, - rule_id: String, + rule_id: uuid::Uuid, ) -> Result< - crate::datadogV2::model::SecurityMonitoringRuleResponse, - datadog::Error, + crate::datadogV2::model::MuteRuleResponse, + datadog::Error, > { match self - .get_security_monitoring_rule_with_http_info(rule_id) + .get_security_findings_automation_mute_rule_with_http_info(rule_id) .await { Ok(response_content) => { @@ -12720,23 +12966,32 @@ impl SecurityMonitoringAPI { } } - /// Get a rule's details. - pub async fn get_security_monitoring_rule_with_http_info( + /// Get the details of a mute rule by ID. + pub async fn get_security_findings_automation_mute_rule_with_http_info( &self, - rule_id: String, + rule_id: uuid::Uuid, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_rule"; + let operation_id = "v2.get_security_findings_automation_mute_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_security_findings_automation_mute_rule' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules/{rule_id}", + "{}/api/v2/security/findings/automation/mute_rules/{rule_id}", local_configuration.get_operation_host(operation_id), - rule_id = datadog::urlencode(rule_id) + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -12783,9 +13038,8 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -12796,7 +13050,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -12807,16 +13061,16 @@ impl SecurityMonitoringAPI { } } - /// Get a signal's details. - pub async fn get_security_monitoring_signal( + /// Get the details of a ticket creation rule by ID. + pub async fn get_security_findings_automation_ticket_creation_rule( &self, - signal_id: String, + rule_id: uuid::Uuid, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalResponse, - datadog::Error, + crate::datadogV2::model::TicketCreationRuleResponse, + datadog::Error, > { match self - .get_security_monitoring_signal_with_http_info(signal_id) + .get_security_findings_automation_ticket_creation_rule_with_http_info(rule_id) .await { Ok(response_content) => { @@ -12832,23 +13086,31 @@ impl SecurityMonitoringAPI { } } - /// Get a signal's details. - pub async fn get_security_monitoring_signal_with_http_info( + /// Get the details of a ticket creation rule by ID. + pub async fn get_security_findings_automation_ticket_creation_rule_with_http_info( &self, - signal_id: String, + rule_id: uuid::Uuid, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_signal"; + let operation_id = "v2.get_security_findings_automation_ticket_creation_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_security_findings_automation_ticket_creation_rule' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}", + "{}/api/v2/security/findings/automation/ticket_creation_rules/{rule_id}", local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -12895,7 +13157,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -12908,7 +13170,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -12919,16 +13181,16 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific suppression rule. - pub async fn get_security_monitoring_suppression( + /// Get the details of a specific critical asset. + pub async fn get_security_monitoring_critical_asset( &self, - suppression_id: String, + critical_asset_id: String, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSuppressionResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, + datadog::Error, > { match self - .get_security_monitoring_suppression_with_http_info(suppression_id) + .get_security_monitoring_critical_asset_with_http_info(critical_asset_id) .await { Ok(response_content) => { @@ -12944,23 +13206,23 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a specific suppression rule. - pub async fn get_security_monitoring_suppression_with_http_info( + /// Get the details of a specific critical asset. + pub async fn get_security_monitoring_critical_asset_with_http_info( &self, - suppression_id: String, + critical_asset_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_security_monitoring_suppression"; + let operation_id = "v2.get_security_monitoring_critical_asset"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/suppressions/{suppression_id}", + "{}/api/v2/security_monitoring/configuration/critical_assets/{critical_asset_id}", local_configuration.get_operation_host(operation_id), - suppression_id = datadog::urlencode(suppression_id) + critical_asset_id = datadog::urlencode(critical_asset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -13008,7 +13270,7 @@ impl SecurityMonitoringAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSuppressionResponse, + crate::datadogV2::model::SecurityMonitoringCriticalAssetResponse, >(&local_content) { Ok(e) => { @@ -13021,7 +13283,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13032,17 +13294,16 @@ impl SecurityMonitoringAPI { } } - /// Get the list of entities related to a security signal, captured at the signal's timestamp. - pub async fn get_signal_entities( + /// Get the current version of a Cloud SIEM dataset by ID. + pub async fn get_security_monitoring_dataset( &self, - signal_id: String, - params: GetSignalEntitiesOptionalParams, + dataset_id: String, ) -> Result< - crate::datadogV2::model::SignalEntitiesResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringDatasetResponse, + datadog::Error, > { match self - .get_signal_entities_with_http_info(signal_id, params) + .get_security_monitoring_dataset_with_http_info(dataset_id) .await { Ok(response_content) => { @@ -13058,44 +13319,35 @@ impl SecurityMonitoringAPI { } } - /// Get the list of entities related to a security signal, captured at the signal's timestamp. - pub async fn get_signal_entities_with_http_info( + /// Get the current version of a Cloud SIEM dataset by ID. + pub async fn get_security_monitoring_dataset_with_http_info( &self, - signal_id: String, - params: GetSignalEntitiesOptionalParams, + dataset_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_signal_entities"; + let operation_id = "v2.get_security_monitoring_dataset"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_signal_entities' is not enabled".to_string(), + msg: "Operation 'v2.get_security_monitoring_dataset' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let limit = params.limit; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}/entities", + "{}/api/v2/security_monitoring/datasets/{dataset_id}", local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = limit { - local_req_builder = - local_req_builder.query(&[("limit", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -13138,7 +13390,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -13151,7 +13403,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13162,15 +13414,19 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a notification rule for security signals. - pub async fn get_signal_notification_rule( + /// Retrieve a specific historical version of a Cloud SIEM dataset. + pub async fn get_security_monitoring_dataset_by_version( &self, - id: String, + dataset_id: String, + version: i64, ) -> Result< - crate::datadogV2::model::NotificationRuleResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringDatasetResponse, + datadog::Error, > { - match self.get_signal_notification_rule_with_http_info(id).await { + match self + .get_security_monitoring_dataset_by_version_with_http_info(dataset_id, version) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -13184,23 +13440,34 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a notification rule for security signals. - pub async fn get_signal_notification_rule_with_http_info( + /// Retrieve a specific historical version of a Cloud SIEM dataset. + pub async fn get_security_monitoring_dataset_by_version_with_http_info( &self, - id: String, + dataset_id: String, + version: i64, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_signal_notification_rule"; + let operation_id = "v2.get_security_monitoring_dataset_by_version"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_security_monitoring_dataset_by_version' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/signals/notification_rules/{id}", + "{}/api/v2/security_monitoring/datasets/{dataset_id}/version/{version}", local_configuration.get_operation_host(operation_id), - id = datadog::urlencode(id) + dataset_id = datadog::urlencode(dataset_id), + version = version ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -13247,7 +13514,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -13260,7 +13527,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13271,14 +13538,19 @@ impl SecurityMonitoringAPI { } } - /// Returns the list of notification rules for security signals. - pub async fn get_signal_notification_rules( + /// Retrieve the version history of a Cloud SIEM dataset, including the changes made at each version. + pub async fn get_security_monitoring_dataset_version_history( &self, + dataset_id: String, + params: GetSecurityMonitoringDatasetVersionHistoryOptionalParams, ) -> Result< - crate::datadogV2::model::NotificationRulesListResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringDatasetVersionHistoryResponse, + datadog::Error, > { - match self.get_signal_notification_rules_with_http_info().await { + match self + .get_security_monitoring_dataset_version_history_with_http_info(dataset_id, params) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -13292,25 +13564,53 @@ impl SecurityMonitoringAPI { } } - /// Returns the list of notification rules for security signals. - pub async fn get_signal_notification_rules_with_http_info( + /// Retrieve the version history of a Cloud SIEM dataset, including the changes made at each version. + pub async fn get_security_monitoring_dataset_version_history_with_http_info( &self, + dataset_id: String, + params: GetSecurityMonitoringDatasetVersionHistoryOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringDatasetVersionHistoryResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_signal_notification_rules"; + let operation_id = "v2.get_security_monitoring_dataset_version_history"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: + "Operation 'v2.get_security_monitoring_dataset_version_history' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/signals/notification_rules", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security_monitoring/datasets/{dataset_id}/version_history", + local_configuration.get_operation_host(operation_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -13353,9 +13653,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringDatasetVersionHistoryResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -13366,7 +13667,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13377,20 +13678,16 @@ impl SecurityMonitoringAPI { } } - /// Get a single entity from the Cloud SIEM entity context store by its identifier, returning the historical - /// revisions of the entity in the requested time range. The endpoint can either return revisions across an - /// interval (`from` / `to`) or the snapshot of the entity at a single point in time (`as_of`); the two modes - /// are mutually exclusive. - pub async fn get_single_entity_context( + /// Get a hist signal's details. + pub async fn get_security_monitoring_histsignal( &self, - id: String, - params: GetSingleEntityContextOptionalParams, + histsignal_id: String, ) -> Result< - crate::datadogV2::model::SingleEntityContextResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSignalResponse, + datadog::Error, > { match self - .get_single_entity_context_with_http_info(id, params) + .get_security_monitoring_histsignal_with_http_info(histsignal_id) .await { Ok(response_content) => { @@ -13406,56 +13703,35 @@ impl SecurityMonitoringAPI { } } - /// Get a single entity from the Cloud SIEM entity context store by its identifier, returning the historical - /// revisions of the entity in the requested time range. The endpoint can either return revisions across an - /// interval (`from` / `to`) or the snapshot of the entity at a single point in time (`as_of`); the two modes - /// are mutually exclusive. - pub async fn get_single_entity_context_with_http_info( + /// Get a hist signal's details. + pub async fn get_security_monitoring_histsignal_with_http_info( &self, - id: String, - params: GetSingleEntityContextOptionalParams, + histsignal_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_single_entity_context"; + let operation_id = "v2.get_security_monitoring_histsignal"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_single_entity_context' is not enabled".to_string(), + msg: "Operation 'v2.get_security_monitoring_histsignal' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let from = params.from; - let to = params.to; - let as_of = params.as_of; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/entity_context/{id}", + "{}/api/v2/siem-historical-detections/histsignals/{histsignal_id}", local_configuration.get_operation_host(operation_id), - id = datadog::urlencode(id) + histsignal_id = datadog::urlencode(histsignal_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = from { - local_req_builder = - local_req_builder.query(&[("from", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = to { - local_req_builder = local_req_builder.query(&[("to", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = as_of { - local_req_builder = - local_req_builder.query(&[("as_of", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -13498,7 +13774,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -13511,7 +13787,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13522,16 +13798,17 @@ impl SecurityMonitoringAPI { } } - /// Get the default SAST ruleset names for a given programming language. - pub async fn get_static_analysis_default_rulesets( + /// Get a job's hist signals. + pub async fn get_security_monitoring_histsignals_by_job_id( &self, - language: String, + job_id: String, + params: GetSecurityMonitoringHistsignalsByJobIdOptionalParams, ) -> Result< - crate::datadogV2::model::DefaultRulesetsPerLanguageResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + datadog::Error, > { match self - .get_static_analysis_default_rulesets_with_http_info(language) + .get_security_monitoring_histsignals_by_job_id_with_http_info(job_id, params) .await { Ok(response_content) => { @@ -13547,36 +13824,74 @@ impl SecurityMonitoringAPI { } } - /// Get the default SAST ruleset names for a given programming language. - pub async fn get_static_analysis_default_rulesets_with_http_info( + /// Get a job's hist signals. + pub async fn get_security_monitoring_histsignals_by_job_id_with_http_info( &self, - language: String, + job_id: String, + params: GetSecurityMonitoringHistsignalsByJobIdOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_static_analysis_default_rulesets"; + let operation_id = "v2.get_security_monitoring_histsignals_by_job_id"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_static_analysis_default_rulesets' is not enabled" + msg: "Operation 'v2.get_security_monitoring_histsignals_by_job_id' is not enabled" .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let filter_query = params.filter_query; + let filter_from = params.filter_from; + let filter_to = params.filter_to; + let sort = params.sort; + let page_cursor = params.page_cursor; + let page_limit = params.page_limit; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/default-rulesets/{language}", + "{}/api/v2/siem-historical-detections/jobs/{job_id}/histsignals", local_configuration.get_operation_host(operation_id), - language = datadog::urlencode(language) + job_id = datadog::urlencode(job_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = filter_query { + local_req_builder = + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_from { + local_req_builder = local_req_builder.query(&[( + "filter[from]", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); + }; + if let Some(ref local_query_param) = filter_to { + local_req_builder = local_req_builder.query(&[( + "filter[to]", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); + }; + if let Some(ref local_query_param) = sort { + local_req_builder = + local_req_builder.query(&[("sort", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_cursor { + local_req_builder = + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -13619,9 +13934,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -13632,7 +13948,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13643,16 +13959,16 @@ impl SecurityMonitoringAPI { } } - /// Retrieve tree-sitter node type definitions for a given programming language. - pub async fn get_static_analysis_node_types( + /// Get the details of a specific entity context sync configuration. + pub async fn get_security_monitoring_integration_config( &self, - language: String, + integration_config_id: String, ) -> Result< - crate::datadogV2::model::NodeTypesResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, + datadog::Error, > { match self - .get_static_analysis_node_types_with_http_info(language) + .get_security_monitoring_integration_config_with_http_info(integration_config_id) .await { Ok(response_content) => { @@ -13668,21 +13984,24 @@ impl SecurityMonitoringAPI { } } - /// Retrieve tree-sitter node type definitions for a given programming language. - pub async fn get_static_analysis_node_types_with_http_info( + /// Get the details of a specific entity context sync configuration. + pub async fn get_security_monitoring_integration_config_with_http_info( &self, - language: String, + integration_config_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_static_analysis_node_types"; + let operation_id = "v2.get_security_monitoring_integration_config"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_static_analysis_node_types' is not enabled".to_string(), + msg: "Operation 'v2.get_security_monitoring_integration_config' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -13690,10 +14009,10 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/static-analysis-server/node-types/{language}", - local_configuration.get_operation_host(operation_id), - language = datadog::urlencode(language) - ); + "{}/api/v2/security_monitoring/configuration/integration_config/{integration_config_id}", + local_configuration.get_operation_host(operation_id), integration_config_id= + datadog::urlencode(integration_config_id) + ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -13739,7 +14058,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigResponse, + >(&local_content) { Ok(e) => { return Ok(datadog::ResponseContent { @@ -13751,7 +14072,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13762,17 +14083,16 @@ impl SecurityMonitoringAPI { } } - /// Get a SAST ruleset by name, including all its rules. - pub async fn get_static_analysis_ruleset( + /// Get a rule's details. + pub async fn get_security_monitoring_rule( &self, - ruleset_name: String, - params: GetStaticAnalysisRulesetOptionalParams, + rule_id: String, ) -> Result< - crate::datadogV2::model::SastRulesetResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringRuleResponse, + datadog::Error, > { match self - .get_static_analysis_ruleset_with_http_info(ruleset_name, params) + .get_security_monitoring_rule_with_http_info(rule_id) .await { Ok(response_content) => { @@ -13788,49 +14108,27 @@ impl SecurityMonitoringAPI { } } - /// Get a SAST ruleset by name, including all its rules. - pub async fn get_static_analysis_ruleset_with_http_info( + /// Get a rule's details. + pub async fn get_security_monitoring_rule_with_http_info( &self, - ruleset_name: String, - params: GetStaticAnalysisRulesetOptionalParams, + rule_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_static_analysis_ruleset"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_static_analysis_ruleset' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let include_tests = params.include_tests; - let include_testing_rules = params.include_testing_rules; + let operation_id = "v2.get_security_monitoring_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/rulesets/{ruleset_name}", + "{}/api/v2/security_monitoring/rules/{rule_id}", local_configuration.get_operation_host(operation_id), - ruleset_name = datadog::urlencode(ruleset_name) + rule_id = datadog::urlencode(rule_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = include_tests { - local_req_builder = - local_req_builder.query(&[("include_tests", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = include_testing_rules { - local_req_builder = local_req_builder - .query(&[("include_testing_rules", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -13873,7 +14171,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -13886,7 +14184,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -13897,13 +14195,16 @@ impl SecurityMonitoringAPI { } } - /// Download the WebAssembly binary for a tree-sitter grammar by file name. - pub async fn get_static_analysis_tree_sitter_wasm( + /// Get a signal's details. + pub async fn get_security_monitoring_signal( &self, - file: String, - ) -> Result, datadog::Error> { + signal_id: String, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringSignalResponse, + datadog::Error, + > { match self - .get_static_analysis_tree_sitter_wasm_with_http_info(file) + .get_security_monitoring_signal_with_http_info(signal_id) .await { Ok(response_content) => { @@ -13919,32 +14220,23 @@ impl SecurityMonitoringAPI { } } - /// Download the WebAssembly binary for a tree-sitter grammar by file name. - pub async fn get_static_analysis_tree_sitter_wasm_with_http_info( + /// Get a signal's details. + pub async fn get_security_monitoring_signal_with_http_info( &self, - file: String, + signal_id: String, ) -> Result< - datadog::ResponseContent>, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_static_analysis_tree_sitter_wasm"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_static_analysis_tree_sitter_wasm' is not enabled" - .to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.get_security_monitoring_signal"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/static-analysis-server/tree-sitter-wasm/{file}", + "{}/api/v2/security_monitoring/signals/{signal_id}", local_configuration.get_operation_host(operation_id), - file = datadog::urlencode(file) + signal_id = datadog::urlencode(signal_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -13991,13 +14283,20 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content.clone(), - entity: Some(local_content.into_bytes()), - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14008,16 +14307,16 @@ impl SecurityMonitoringAPI { } } - /// Get the list of suggested actions for a given security signal. - pub async fn get_suggested_actions_matching_signal( + /// Get the details of a specific suppression rule. + pub async fn get_security_monitoring_suppression( &self, - signal_id: String, + suppression_id: String, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSuppressionResponse, + datadog::Error, > { match self - .get_suggested_actions_matching_signal_with_http_info(signal_id) + .get_security_monitoring_suppression_with_http_info(suppression_id) .await { Ok(response_content) => { @@ -14033,25 +14332,23 @@ impl SecurityMonitoringAPI { } } - /// Get the list of suggested actions for a given security signal. - pub async fn get_suggested_actions_matching_signal_with_http_info( + /// Get the details of a specific suppression rule. + pub async fn get_security_monitoring_suppression_with_http_info( &self, - signal_id: String, + suppression_id: String, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_suggested_actions_matching_signal"; + let operation_id = "v2.get_security_monitoring_suppression"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/{signal_id}/suggested_actions", + "{}/api/v2/security_monitoring/configuration/suppressions/{suppression_id}", local_configuration.get_operation_host(operation_id), - signal_id = datadog::urlencode(signal_id) + suppression_id = datadog::urlencode(suppression_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -14099,7 +14396,7 @@ impl SecurityMonitoringAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, + crate::datadogV2::model::SecurityMonitoringSuppressionResponse, >(&local_content) { Ok(e) => { @@ -14112,7 +14409,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14123,17 +14420,17 @@ impl SecurityMonitoringAPI { } } - /// Get a suppression's version history. - pub async fn get_suppression_version_history( + /// Get the list of entities related to a security signal, captured at the signal's timestamp. + pub async fn get_signal_entities( &self, - suppression_id: String, - params: GetSuppressionVersionHistoryOptionalParams, + signal_id: String, + params: GetSignalEntitiesOptionalParams, ) -> Result< - crate::datadogV2::model::GetSuppressionVersionHistoryResponse, - datadog::Error, + crate::datadogV2::model::SignalEntitiesResponse, + datadog::Error, > { match self - .get_suppression_version_history_with_http_info(suppression_id, params) + .get_signal_entities_with_http_info(signal_id, params) .await { Ok(response_content) => { @@ -14149,39 +14446,42 @@ impl SecurityMonitoringAPI { } } - /// Get a suppression's version history. - pub async fn get_suppression_version_history_with_http_info( + /// Get the list of entities related to a security signal, captured at the signal's timestamp. + pub async fn get_signal_entities_with_http_info( &self, - suppression_id: String, - params: GetSuppressionVersionHistoryOptionalParams, + signal_id: String, + params: GetSignalEntitiesOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_suppression_version_history"; + let operation_id = "v2.get_signal_entities"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_signal_entities' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } // unbox and build optional parameters - let page_size = params.page_size; - let page_number = params.page_number; + let limit = params.limit; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history", - local_configuration.get_operation_host(operation_id), suppression_id= - datadog::urlencode(suppression_id) - ); + "{}/api/v2/security_monitoring/signals/{signal_id}/entities", + local_configuration.get_operation_host(operation_id), + signal_id = datadog::urlencode(signal_id) + ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_size { - local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_number { + if let Some(ref local_query_param) = limit { local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + local_req_builder.query(&[("limit", &local_query_param.to_string())]); }; // build headers @@ -14226,10 +14526,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::GetSuppressionVersionHistoryResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -14240,7 +14539,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14251,18 +14550,15 @@ impl SecurityMonitoringAPI { } } - /// Get the list of suppressions that would affect a rule. - pub async fn get_suppressions_affecting_future_rule( + /// Get the details of a notification rule for security signals. + pub async fn get_signal_notification_rule( &self, - body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, + id: String, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, - datadog::Error, + crate::datadogV2::model::NotificationRuleResponse, + datadog::Error, > { - match self - .get_suppressions_affecting_future_rule_with_http_info(body) - .await - { + match self.get_signal_notification_rule_with_http_info(id).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -14276,29 +14572,29 @@ impl SecurityMonitoringAPI { } } - /// Get the list of suppressions that would affect a rule. - pub async fn get_suppressions_affecting_future_rule_with_http_info( + /// Get the details of a notification rule for security signals. + pub async fn get_signal_notification_rule_with_http_info( &self, - body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, + id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_suppressions_affecting_future_rule"; + let operation_id = "v2.get_signal_notification_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/suppressions/rules", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security/signals/notification_rules/{id}", + local_configuration.get_operation_host(operation_id), + id = datadog::urlencode(id) ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -14329,52 +14625,6 @@ impl SecurityMonitoringAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -14385,10 +14635,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -14399,7 +14648,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14410,18 +14659,14 @@ impl SecurityMonitoringAPI { } } - /// Get the list of suppressions that affect a specific existing rule by its ID. - pub async fn get_suppressions_affecting_rule( + /// Returns the list of notification rules for security signals. + pub async fn get_signal_notification_rules( &self, - rule_id: String, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, - datadog::Error, + crate::datadogV2::model::NotificationRulesListResponse, + datadog::Error, > { - match self - .get_suppressions_affecting_rule_with_http_info(rule_id) - .await - { + match self.get_signal_notification_rules_with_http_info().await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -14435,23 +14680,21 @@ impl SecurityMonitoringAPI { } } - /// Get the list of suppressions that affect a specific existing rule by its ID. - pub async fn get_suppressions_affecting_rule_with_http_info( + /// Returns the list of notification rules for security signals. + pub async fn get_signal_notification_rules_with_http_info( &self, - rule_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_suppressions_affecting_rule"; + let operation_id = "v2.get_signal_notification_rules"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/suppressions/rules/{rule_id}", - local_configuration.get_operation_host(operation_id), - rule_id = datadog::urlencode(rule_id) + "{}/api/v2/security/signals/notification_rules", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -14498,10 +14741,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -14512,7 +14754,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14523,16 +14765,20 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a notification rule for security vulnerabilities. - pub async fn get_vulnerability_notification_rule( - &self, - id: String, + /// Get a single entity from the Cloud SIEM entity context store by its identifier, returning the historical + /// revisions of the entity in the requested time range. The endpoint can either return revisions across an + /// interval (`from` / `to`) or the snapshot of the entity at a single point in time (`as_of`); the two modes + /// are mutually exclusive. + pub async fn get_single_entity_context( + &self, + id: String, + params: GetSingleEntityContextOptionalParams, ) -> Result< - crate::datadogV2::model::NotificationRuleResponse, - datadog::Error, + crate::datadogV2::model::SingleEntityContextResponse, + datadog::Error, > { match self - .get_vulnerability_notification_rule_with_http_info(id) + .get_single_entity_context_with_http_info(id, params) .await { Ok(response_content) => { @@ -14548,27 +14794,56 @@ impl SecurityMonitoringAPI { } } - /// Get the details of a notification rule for security vulnerabilities. - pub async fn get_vulnerability_notification_rule_with_http_info( + /// Get a single entity from the Cloud SIEM entity context store by its identifier, returning the historical + /// revisions of the entity in the requested time range. The endpoint can either return revisions across an + /// interval (`from` / `to`) or the snapshot of the entity at a single point in time (`as_of`); the two modes + /// are mutually exclusive. + pub async fn get_single_entity_context_with_http_info( &self, id: String, + params: GetSingleEntityContextOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_vulnerability_notification_rule"; + let operation_id = "v2.get_single_entity_context"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_single_entity_context' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let from = params.from; + let to = params.to; + let as_of = params.as_of; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/vulnerabilities/notification_rules/{id}", + "{}/api/v2/security_monitoring/entity_context/{id}", local_configuration.get_operation_host(operation_id), id = datadog::urlencode(id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = from { + local_req_builder = + local_req_builder.query(&[("from", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = to { + local_req_builder = local_req_builder.query(&[("to", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = as_of { + local_req_builder = + local_req_builder.query(&[("as_of", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -14611,7 +14886,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -14624,7 +14899,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14635,15 +14910,16 @@ impl SecurityMonitoringAPI { } } - /// Returns the list of notification rules for security vulnerabilities. - pub async fn get_vulnerability_notification_rules( + /// Get the default SAST ruleset names for a given programming language. + pub async fn get_static_analysis_default_rulesets( &self, + language: String, ) -> Result< - crate::datadogV2::model::NotificationRulesListResponse, - datadog::Error, + crate::datadogV2::model::DefaultRulesetsPerLanguageResponse, + datadog::Error, > { match self - .get_vulnerability_notification_rules_with_http_info() + .get_static_analysis_default_rulesets_with_http_info(language) .await { Ok(response_content) => { @@ -14659,21 +14935,32 @@ impl SecurityMonitoringAPI { } } - /// Returns the list of notification rules for security vulnerabilities. - pub async fn get_vulnerability_notification_rules_with_http_info( + /// Get the default SAST ruleset names for a given programming language. + pub async fn get_static_analysis_default_rulesets_with_http_info( &self, + language: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_vulnerability_notification_rules"; + let operation_id = "v2.get_static_analysis_default_rulesets"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_static_analysis_default_rulesets' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/vulnerabilities/notification_rules", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/static-analysis/default-rulesets/{language}", + local_configuration.get_operation_host(operation_id), + language = datadog::urlencode(language) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -14720,7 +15007,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -14733,7 +15020,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14744,27 +15031,18 @@ impl SecurityMonitoringAPI { } } - /// Get a list of assets SBOMs for an organization. - /// - /// ### Pagination - /// - /// Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint. - /// - /// ### Filtering - /// - /// Please review the [Filtering section](#filtering) for the "List Vulnerabilities" endpoint. - /// - /// ### Metadata - /// - /// Please review the [Metadata section](#metadata) for the "List Vulnerabilities" endpoint. - pub async fn list_assets_sbo_ms( + /// Retrieve tree-sitter node type definitions for a given programming language. + pub async fn get_static_analysis_node_types( &self, - params: ListAssetsSBOMsOptionalParams, + language: String, ) -> Result< - crate::datadogV2::model::ListAssetsSBOMsResponse, - datadog::Error, + crate::datadogV2::model::NodeTypesResponse, + datadog::Error, > { - match self.list_assets_sbo_ms_with_http_info(params).await { + match self + .get_static_analysis_node_types_with_http_info(language) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -14778,81 +15056,35 @@ impl SecurityMonitoringAPI { } } - /// Get a list of assets SBOMs for an organization. - /// - /// ### Pagination - /// - /// Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint. - /// - /// ### Filtering - /// - /// Please review the [Filtering section](#filtering) for the "List Vulnerabilities" endpoint. - /// - /// ### Metadata - /// - /// Please review the [Metadata section](#metadata) for the "List Vulnerabilities" endpoint. - pub async fn list_assets_sbo_ms_with_http_info( + /// Retrieve tree-sitter node type definitions for a given programming language. + pub async fn get_static_analysis_node_types_with_http_info( &self, - params: ListAssetsSBOMsOptionalParams, + language: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_assets_sbo_ms"; - - // unbox and build optional parameters - let page_token = params.page_token; - let page_number = params.page_number; - let filter_asset_type = params.filter_asset_type; - let filter_asset_name = params.filter_asset_name; - let filter_package_name = params.filter_package_name; - let filter_package_version = params.filter_package_version; - let filter_license_name = params.filter_license_name; - let filter_license_type = params.filter_license_type; + let operation_id = "v2.get_static_analysis_node_types"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_static_analysis_node_types' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/sboms", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/static-analysis/static-analysis-server/node-types/{language}", + local_configuration.get_operation_host(operation_id), + language = datadog::urlencode(language) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_token { - local_req_builder = - local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_number { - local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_asset_type { - local_req_builder = - local_req_builder.query(&[("filter[asset_type]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_asset_name { - local_req_builder = - local_req_builder.query(&[("filter[asset_name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_package_name { - local_req_builder = local_req_builder - .query(&[("filter[package_name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_package_version { - local_req_builder = local_req_builder - .query(&[("filter[package_version]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_license_name { - local_req_builder = local_req_builder - .query(&[("filter[license_name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_license_type { - local_req_builder = local_req_builder - .query(&[("filter[license_type]", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -14895,9 +15127,8 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -14908,7 +15139,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -14919,56 +15150,19 @@ impl SecurityMonitoringAPI { } } - /// Get a list of findings. These include both misconfigurations and identity risks. - /// - /// **Note**: To filter and return only identity risks, add the following query parameter: `?filter[tags]=dd_rule_type:ciem` - /// - /// ### Filtering - /// - /// Filters can be applied by appending query parameters to the URL. - /// - /// - Using a single filter: `?filter[attribute_key]=attribute_value` - /// - Chaining filters: `?filter[attribute_key]=attribute_value&filter[attribute_key]=attribute_value...` - /// - Filtering on tags: `?filter[tags]=tag_key:tag_value&filter[tags]=tag_key_2:tag_value_2` - /// - /// Here, `attribute_key` can be any of the filter keys described further below. - /// - /// Query parameters of type `integer` support comparison operators (`>`, `>=`, `<`, `<=`). This is particularly useful when filtering by `evaluation_changed_at` or `resource_discovery_timestamp`. For example: `?filter[evaluation_changed_at]=>20123123121`. - /// - /// You can also use the negation operator on strings. For example, use `filter[resource_type]=-aws*` to filter for any non-AWS resources. - /// - /// The operator must come after the equal sign. For example, to filter with the `>=` operator, add the operator after the equal sign: `filter[evaluation_changed_at]=>=1678809373257`. - /// - /// Query parameters must be only among the documented ones and with values of correct types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`) are not allowed. - /// - /// ### Additional extension fields - /// - /// Additional extension fields are available for some findings. - /// - /// The data is available when you include the query parameter `?detailed_findings=true` in the request. - /// - /// The following fields are available for findings: - /// - `external_id`: The resource external ID related to the finding. - /// - `description`: The description and remediation steps for the finding. - /// - `datadog_link`: The Datadog relative link for the finding. - /// - `ip_addresses`: The list of private IP addresses for the resource related to the finding. - /// - /// ### Response - /// - /// The response includes an array of finding objects, pagination metadata, and a count of items that match the query. - /// - /// Each finding object contains the following: - /// - /// - The finding ID that can be used in a `GetFinding` request to retrieve the full finding details. - /// - Core attributes, including status, evaluation, high-level resource details, muted state, and rule details. - /// - `evaluation_changed_at` and `resource_discovery_date` time stamps. - /// - An array of associated tags. - pub async fn list_findings( + /// Get a SAST ruleset by name, including all its rules. + pub async fn get_static_analysis_ruleset( &self, - params: ListFindingsOptionalParams, - ) -> Result> - { - match self.list_findings_with_http_info(params).await { + ruleset_name: String, + params: GetStaticAnalysisRulesetOptionalParams, + ) -> Result< + crate::datadogV2::model::SastRulesetResponse, + datadog::Error, + > { + match self + .get_static_analysis_ruleset_with_http_info(ruleset_name, params) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -14982,191 +15176,47 @@ impl SecurityMonitoringAPI { } } - pub fn list_findings_with_pagination( - &self, - mut params: ListFindingsOptionalParams, - ) -> impl Stream< - Item = Result>, - > + '_ { - try_stream! { - let mut page_size: i64 = 100; - if params.page_limit.is_none() { - params.page_limit = Some(page_size); - } else { - page_size = params.page_limit.unwrap().clone(); - } - loop { - let resp = self.list_findings(params.clone()).await?; - - let r = resp.data; - let count = r.len(); - for team in r { - yield team; - } - if count == 0 { - break; - } - let Some(page) = resp.meta.page else { break }; - let Some(cursor) = page.cursor else { break }; - - params.page_cursor = Some(cursor); - } - } - } - - /// Get a list of findings. These include both misconfigurations and identity risks. - /// - /// **Note**: To filter and return only identity risks, add the following query parameter: `?filter[tags]=dd_rule_type:ciem` - /// - /// ### Filtering - /// - /// Filters can be applied by appending query parameters to the URL. - /// - /// - Using a single filter: `?filter[attribute_key]=attribute_value` - /// - Chaining filters: `?filter[attribute_key]=attribute_value&filter[attribute_key]=attribute_value...` - /// - Filtering on tags: `?filter[tags]=tag_key:tag_value&filter[tags]=tag_key_2:tag_value_2` - /// - /// Here, `attribute_key` can be any of the filter keys described further below. - /// - /// Query parameters of type `integer` support comparison operators (`>`, `>=`, `<`, `<=`). This is particularly useful when filtering by `evaluation_changed_at` or `resource_discovery_timestamp`. For example: `?filter[evaluation_changed_at]=>20123123121`. - /// - /// You can also use the negation operator on strings. For example, use `filter[resource_type]=-aws*` to filter for any non-AWS resources. - /// - /// The operator must come after the equal sign. For example, to filter with the `>=` operator, add the operator after the equal sign: `filter[evaluation_changed_at]=>=1678809373257`. - /// - /// Query parameters must be only among the documented ones and with values of correct types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`) are not allowed. - /// - /// ### Additional extension fields - /// - /// Additional extension fields are available for some findings. - /// - /// The data is available when you include the query parameter `?detailed_findings=true` in the request. - /// - /// The following fields are available for findings: - /// - `external_id`: The resource external ID related to the finding. - /// - `description`: The description and remediation steps for the finding. - /// - `datadog_link`: The Datadog relative link for the finding. - /// - `ip_addresses`: The list of private IP addresses for the resource related to the finding. - /// - /// ### Response - /// - /// The response includes an array of finding objects, pagination metadata, and a count of items that match the query. - /// - /// Each finding object contains the following: - /// - /// - The finding ID that can be used in a `GetFinding` request to retrieve the full finding details. - /// - Core attributes, including status, evaluation, high-level resource details, muted state, and rule details. - /// - `evaluation_changed_at` and `resource_discovery_date` time stamps. - /// - An array of associated tags. - pub async fn list_findings_with_http_info( + /// Get a SAST ruleset by name, including all its rules. + pub async fn get_static_analysis_ruleset_with_http_info( &self, - params: ListFindingsOptionalParams, + ruleset_name: String, + params: GetStaticAnalysisRulesetOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_findings"; + let operation_id = "v2.get_static_analysis_ruleset"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_findings' is not enabled".to_string(), + msg: "Operation 'v2.get_static_analysis_ruleset' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let page_limit = params.page_limit; - let snapshot_timestamp = params.snapshot_timestamp; - let page_cursor = params.page_cursor; - let filter_tags = params.filter_tags; - let filter_evaluation_changed_at = params.filter_evaluation_changed_at; - let filter_muted = params.filter_muted; - let filter_rule_id = params.filter_rule_id; - let filter_rule_name = params.filter_rule_name; - let filter_resource_type = params.filter_resource_type; - let filter_resource_id = params.filter_resource_id; - let filter_discovery_timestamp = params.filter_discovery_timestamp; - let filter_evaluation = params.filter_evaluation; - let filter_status = params.filter_status; - let filter_vulnerability_type = params.filter_vulnerability_type; - let detailed_findings = params.detailed_findings; + let include_tests = params.include_tests; + let include_testing_rules = params.include_testing_rules; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/posture_management/findings", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/static-analysis/rulesets/{ruleset_name}", + local_configuration.get_operation_host(operation_id), + ruleset_name = datadog::urlencode(ruleset_name) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = snapshot_timestamp { - local_req_builder = - local_req_builder.query(&[("snapshot_timestamp", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_tags { - local_req_builder = - local_req_builder.query(&[("filter[tags]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_evaluation_changed_at { - local_req_builder = local_req_builder.query(&[( - "filter[evaluation_changed_at]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_muted { - local_req_builder = - local_req_builder.query(&[("filter[muted]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_rule_id { - local_req_builder = - local_req_builder.query(&[("filter[rule_id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_rule_name { + if let Some(ref local_query_param) = include_tests { local_req_builder = - local_req_builder.query(&[("filter[rule_name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_resource_type { - local_req_builder = local_req_builder - .query(&[("filter[resource_type]", &local_query_param.to_string())]); + local_req_builder.query(&[("include_tests", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_resource_id { + if let Some(ref local_query_param) = include_testing_rules { local_req_builder = local_req_builder - .query(&[("filter[@resource_id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_discovery_timestamp { - local_req_builder = local_req_builder.query(&[( - "filter[discovery_timestamp]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_evaluation { - local_req_builder = - local_req_builder.query(&[("filter[evaluation]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_status { - local_req_builder = - local_req_builder.query(&[("filter[status]", &local_query_param.to_string())]); - }; - if let Some(ref local) = filter_vulnerability_type { - for param in local { - local_req_builder = - local_req_builder.query(&[("filter[vulnerability_type]", ¶m.to_string())]); - } - }; - if let Some(ref local_query_param) = detailed_findings { - local_req_builder = - local_req_builder.query(&[("detailed_findings", &local_query_param.to_string())]); + .query(&[("include_testing_rules", &local_query_param.to_string())]); }; // build headers @@ -15211,7 +15261,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -15224,7 +15274,8 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = serde_json::from_str(&local_content).ok(); + let local_entity: Option = + serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, content: local_content, @@ -15234,15 +15285,15 @@ impl SecurityMonitoringAPI { } } - /// List historical jobs. - pub async fn list_historical_jobs( + /// Download the WebAssembly binary for a tree-sitter grammar by file name. + pub async fn get_static_analysis_tree_sitter_wasm( &self, - params: ListHistoricalJobsOptionalParams, - ) -> Result< - crate::datadogV2::model::ListHistoricalJobsResponse, - datadog::Error, - > { - match self.list_historical_jobs_with_http_info(params).await { + file: String, + ) -> Result, datadog::Error> { + match self + .get_static_analysis_tree_sitter_wasm_with_http_info(file) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -15256,57 +15307,143 @@ impl SecurityMonitoringAPI { } } - /// List historical jobs. - pub async fn list_historical_jobs_with_http_info( + /// Download the WebAssembly binary for a tree-sitter grammar by file name. + pub async fn get_static_analysis_tree_sitter_wasm_with_http_info( &self, - params: ListHistoricalJobsOptionalParams, + file: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent>, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_historical_jobs"; + let operation_id = "v2.get_static_analysis_tree_sitter_wasm"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_historical_jobs' is not enabled".to_string(), + msg: "Operation 'v2.get_static_analysis_tree_sitter_wasm' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let page_size = params.page_size; - let page_number = params.page_number; - let sort = params.sort; - let filter_query = params.filter_query; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/jobs", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/static-analysis/static-analysis-server/tree-sitter-wasm/{file}", + local_configuration.get_operation_host(operation_id), + file = datadog::urlencode(file) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_size { - local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_number { - local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = sort { - local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_query { - local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); }; + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content.clone(), + entity: Some(local_content.into_bytes()), + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get the list of suggested actions for a given security signal. + pub async fn get_suggested_actions_matching_signal( + &self, + signal_id: String, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, + datadog::Error, + > { + match self + .get_suggested_actions_matching_signal_with_http_info(signal_id) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get the list of suggested actions for a given security signal. + pub async fn get_suggested_actions_matching_signal_with_http_info( + &self, + signal_id: String, + ) -> Result< + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, + >, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_suggested_actions_matching_signal"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security_monitoring/signals/{signal_id}/suggested_actions", + local_configuration.get_operation_host(operation_id), + signal_id = datadog::urlencode(signal_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -15349,9 +15486,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalSuggestedActionsResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -15362,7 +15500,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -15373,16 +15511,17 @@ impl SecurityMonitoringAPI { } } - /// Get a list of indicators of compromise (IoCs) matching the specified filters. - pub async fn list_indicators_of_compromise( + /// Get a suppression's version history. + pub async fn get_suppression_version_history( &self, - params: ListIndicatorsOfCompromiseOptionalParams, + suppression_id: String, + params: GetSuppressionVersionHistoryOptionalParams, ) -> Result< - crate::datadogV2::model::IoCExplorerListResponse, - datadog::Error, + crate::datadogV2::model::GetSuppressionVersionHistoryResponse, + datadog::Error, > { match self - .list_indicators_of_compromise_with_http_info(params) + .get_suppression_version_history_with_http_info(suppression_id, params) .await { Ok(response_content) => { @@ -15398,75 +15537,39 @@ impl SecurityMonitoringAPI { } } - /// Get a list of indicators of compromise (IoCs) matching the specified filters. - pub async fn list_indicators_of_compromise_with_http_info( + /// Get a suppression's version history. + pub async fn get_suppression_version_history_with_http_info( &self, - params: ListIndicatorsOfCompromiseOptionalParams, + suppression_id: String, + params: GetSuppressionVersionHistoryOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_indicators_of_compromise"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_indicators_of_compromise' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.get_suppression_version_history"; // unbox and build optional parameters - let limit = params.limit; - let offset = params.offset; - let query = params.query; - let sort_column = params.sort_column; - let sort_order = params.sort_order; - let ocsf = params.ocsf; - let worked_by = params.worked_by; - let triage_state = params.triage_state; + let page_size = params.page_size; + let page_number = params.page_number; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/siem/ioc-explorer", - local_configuration.get_operation_host(operation_id) - ); + "{}/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history", + local_configuration.get_operation_host(operation_id), suppression_id= + datadog::urlencode(suppression_id) + ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = limit { - local_req_builder = - local_req_builder.query(&[("limit", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = offset { - local_req_builder = - local_req_builder.query(&[("offset", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = query { - local_req_builder = - local_req_builder.query(&[("query", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = sort_column { - local_req_builder = - local_req_builder.query(&[("sort[column]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = sort_order { - local_req_builder = - local_req_builder.query(&[("sort[order]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = ocsf { - local_req_builder = - local_req_builder.query(&[("ocsf", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = worked_by { + if let Some(ref local_query_param) = page_size { local_req_builder = - local_req_builder.query(&[("worked_by", &local_query_param.to_string())]); + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = triage_state { + if let Some(ref local_query_param) = page_number { local_req_builder = - local_req_builder.query(&[("triage_state", &local_query_param.to_string())]); + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); }; // build headers @@ -15511,9 +15614,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::GetSuppressionVersionHistoryResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -15524,7 +15628,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -15535,15 +15639,18 @@ impl SecurityMonitoringAPI { } } - /// Get rules for multiple rulesets in batch. - pub async fn list_multiple_rulesets( + /// Get the list of suppressions that would affect a rule. + pub async fn get_suppressions_affecting_future_rule( &self, - body: crate::datadogV2::model::GetMultipleRulesetsRequest, + body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, ) -> Result< - crate::datadogV2::model::GetMultipleRulesetsResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, + datadog::Error, > { - match self.list_multiple_rulesets_with_http_info(body).await { + match self + .get_suppressions_affecting_future_rule_with_http_info(body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -15557,29 +15664,21 @@ impl SecurityMonitoringAPI { } } - /// Get rules for multiple rulesets in batch. - pub async fn list_multiple_rulesets_with_http_info( + /// Get the list of suppressions that would affect a rule. + pub async fn get_suppressions_affecting_future_rule_with_http_info( &self, - body: crate::datadogV2::model::GetMultipleRulesetsRequest, + body: crate::datadogV2::model::SecurityMonitoringRuleCreatePayload, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_multiple_rulesets"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_multiple_rulesets' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.get_suppressions_affecting_future_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/rulesets", + "{}/api/v2/security_monitoring/configuration/suppressions/rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -15674,9 +15773,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -15687,7 +15787,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -15698,22 +15798,16 @@ impl SecurityMonitoringAPI { } } - /// Get the sample log generation subscriptions for the organization. - /// Sample log generation injects representative example logs for a given Cloud SIEM content pack into the Logs platform, - /// which can be used to test detection rules without onboarding the underlying integration first. - /// - /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an eligible - /// pricing model. Other organizations receive a `403 Forbidden` (non-trial orgs) or a `400 Bad Request` - /// (feature disabled), and legacy pricing tiers receive a response with `status: not_available`. - pub async fn list_sample_log_generation_subscriptions( + /// Get the list of suppressions that affect a specific existing rule by its ID. + pub async fn get_suppressions_affecting_rule( &self, - params: ListSampleLogGenerationSubscriptionsOptionalParams, + rule_id: String, ) -> Result< - crate::datadogV2::model::SampleLogGenerationSubscriptionsResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, + datadog::Error, > { match self - .list_sample_log_generation_subscriptions_with_http_info(params) + .get_suppressions_affecting_rule_with_http_info(rule_id) .await { Ok(response_content) => { @@ -15729,63 +15823,27 @@ impl SecurityMonitoringAPI { } } - /// Get the sample log generation subscriptions for the organization. - /// Sample log generation injects representative example logs for a given Cloud SIEM content pack into the Logs platform, - /// which can be used to test detection rules without onboarding the underlying integration first. - /// - /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an eligible - /// pricing model. Other organizations receive a `403 Forbidden` (non-trial orgs) or a `400 Bad Request` - /// (feature disabled), and legacy pricing tiers receive a response with `status: not_available`. - pub async fn list_sample_log_generation_subscriptions_with_http_info( + /// Get the list of suppressions that affect a specific existing rule by its ID. + pub async fn get_suppressions_affecting_rule_with_http_info( &self, - params: ListSampleLogGenerationSubscriptionsOptionalParams, + rule_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_sample_log_generation_subscriptions"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_sample_log_generation_subscriptions' is not enabled" - .to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let status = params.status; - let start_timestamp = params.start_timestamp; - let end_timestamp = params.end_timestamp; + let operation_id = "v2.get_suppressions_affecting_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/sample_log_generation/subscriptions", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security_monitoring/configuration/suppressions/rules/{rule_id}", + local_configuration.get_operation_host(operation_id), + rule_id = datadog::urlencode(rule_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = status { - local_req_builder = - local_req_builder.query(&[("status", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = start_timestamp { - local_req_builder = local_req_builder.query(&[( - "start_timestamp", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - if let Some(ref local_query_param) = end_timestamp { - local_req_builder = local_req_builder.query(&[( - "end_timestamp", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -15829,7 +15887,7 @@ impl SecurityMonitoringAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SampleLogGenerationSubscriptionsResponse, + crate::datadogV2::model::SecurityMonitoringSuppressionsResponse, >(&local_content) { Ok(e) => { @@ -15842,7 +15900,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -15853,59 +15911,16 @@ impl SecurityMonitoringAPI { } } - /// Get a list of security scanned assets metadata for an organization. - /// - /// ### Pagination - /// - /// For the "List Vulnerabilities" endpoint, see the [Pagination section](#pagination). - /// - /// ### Filtering - /// - /// For the "List Vulnerabilities" endpoint, see the [Filtering section](#filtering). - /// - /// ### Metadata - /// - /// For the "List Vulnerabilities" endpoint, see the [Metadata section](#metadata). - /// - /// ### Related endpoints - /// - /// This endpoint returns additional metadata for cloud resources that is not available from the standard resource endpoints. To access a richer dataset, call this endpoint together with the relevant resource endpoint(s) and merge (join) their results using the resource identifier. - /// - /// **Hosts** - /// - /// To enrich host data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: - /// - /// | ENDPOINT | JOIN KEY | TYPE | - /// | --- | --- | --- | - /// | [/api/v1/hosts]() | host_list.host_name | string | - /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | - /// - /// **Host Images** - /// - /// To enrich host image data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: - /// - /// | ENDPOINT | JOIN KEY | TYPE | - /// | --- | --- | --- | - /// | [/api/v1/hosts]() | host_list.tags_by_source["Amazon Web Services"]["image"] | string | - /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | - /// - /// **Container Images** - /// - /// To enrich container image data, join the response from the [Container Images]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: - /// - /// | ENDPOINT | JOIN KEY | TYPE | - /// | --- | --- | --- | - /// | [/api/v2/container_images]() | `data.attributes.name`@`data.attributes.repo_digest` | string | - /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | - pub async fn list_scanned_assets_metadata( + /// Get the details of a notification rule for security vulnerabilities. + pub async fn get_vulnerability_notification_rule( &self, - params: ListScannedAssetsMetadataOptionalParams, + id: String, ) -> Result< - crate::datadogV2::model::ScannedAssetsMetadata, - datadog::Error, + crate::datadogV2::model::NotificationRuleResponse, + datadog::Error, > { match self - .list_scanned_assets_metadata_with_http_info(params) + .get_vulnerability_notification_rule_with_http_info(id) .await { Ok(response_content) => { @@ -15921,112 +15936,27 @@ impl SecurityMonitoringAPI { } } - /// Get a list of security scanned assets metadata for an organization. - /// - /// ### Pagination - /// - /// For the "List Vulnerabilities" endpoint, see the [Pagination section](#pagination). - /// - /// ### Filtering - /// - /// For the "List Vulnerabilities" endpoint, see the [Filtering section](#filtering). - /// - /// ### Metadata - /// - /// For the "List Vulnerabilities" endpoint, see the [Metadata section](#metadata). - /// - /// ### Related endpoints - /// - /// This endpoint returns additional metadata for cloud resources that is not available from the standard resource endpoints. To access a richer dataset, call this endpoint together with the relevant resource endpoint(s) and merge (join) their results using the resource identifier. - /// - /// **Hosts** - /// - /// To enrich host data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: - /// - /// | ENDPOINT | JOIN KEY | TYPE | - /// | --- | --- | --- | - /// | [/api/v1/hosts]() | host_list.host_name | string | - /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | - /// - /// **Host Images** - /// - /// To enrich host image data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: - /// - /// | ENDPOINT | JOIN KEY | TYPE | - /// | --- | --- | --- | - /// | [/api/v1/hosts]() | host_list.tags_by_source["Amazon Web Services"]["image"] | string | - /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | - /// - /// **Container Images** - /// - /// To enrich container image data, join the response from the [Container Images]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: - /// - /// | ENDPOINT | JOIN KEY | TYPE | - /// | --- | --- | --- | - /// | [/api/v2/container_images]() | `data.attributes.name`@`data.attributes.repo_digest` | string | - /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | - pub async fn list_scanned_assets_metadata_with_http_info( + /// Get the details of a notification rule for security vulnerabilities. + pub async fn get_vulnerability_notification_rule_with_http_info( &self, - params: ListScannedAssetsMetadataOptionalParams, + id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_scanned_assets_metadata"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_scanned_assets_metadata' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let page_token = params.page_token; - let page_number = params.page_number; - let filter_asset_type = params.filter_asset_type; - let filter_asset_name = params.filter_asset_name; - let filter_last_success_origin = params.filter_last_success_origin; - let filter_last_success_env = params.filter_last_success_env; + let operation_id = "v2.get_vulnerability_notification_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/scanned-assets-metadata", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security/vulnerabilities/notification_rules/{id}", + local_configuration.get_operation_host(operation_id), + id = datadog::urlencode(id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_token { - local_req_builder = - local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_number { - local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_asset_type { - local_req_builder = - local_req_builder.query(&[("filter[asset.type]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_asset_name { - local_req_builder = - local_req_builder.query(&[("filter[asset.name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_last_success_origin { - local_req_builder = local_req_builder.query(&[( - "filter[last_success.origin]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_last_success_env { - local_req_builder = local_req_builder - .query(&[("filter[last_success.env]", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -16069,7 +15999,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -16082,7 +16012,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -16093,16 +16023,17 @@ impl SecurityMonitoringAPI { } } - /// Get the configured security filters at each historical version of the configuration. - /// Each entry in the response represents the set of all security filters at a given version, - /// ordered from the most recent version to the oldest. - pub async fn list_security_filter_versions( + /// Returns the list of notification rules for security vulnerabilities. + pub async fn get_vulnerability_notification_rules( &self, ) -> Result< - crate::datadogV2::model::SecurityFilterVersionsResponse, - datadog::Error, + crate::datadogV2::model::NotificationRulesListResponse, + datadog::Error, > { - match self.list_security_filter_versions_with_http_info().await { + match self + .get_vulnerability_notification_rules_with_http_info() + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -16116,22 +16047,20 @@ impl SecurityMonitoringAPI { } } - /// Get the configured security filters at each historical version of the configuration. - /// Each entry in the response represents the set of all security filters at a given version, - /// ordered from the most recent version to the oldest. - pub async fn list_security_filter_versions_with_http_info( - &self, + /// Returns the list of notification rules for security vulnerabilities. + pub async fn get_vulnerability_notification_rules_with_http_info( + &self, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_filter_versions"; + let operation_id = "v2.get_vulnerability_notification_rules"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/security_filters/versions", + "{}/api/v2/security/vulnerabilities/notification_rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -16179,7 +16108,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -16192,7 +16121,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -16203,14 +16132,27 @@ impl SecurityMonitoringAPI { } } - /// Get the list of configured security filters with their definitions. - pub async fn list_security_filters( + /// Get a list of assets SBOMs for an organization. + /// + /// ### Pagination + /// + /// Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint. + /// + /// ### Filtering + /// + /// Please review the [Filtering section](#filtering) for the "List Vulnerabilities" endpoint. + /// + /// ### Metadata + /// + /// Please review the [Metadata section](#metadata) for the "List Vulnerabilities" endpoint. + pub async fn list_assets_sbo_ms( &self, + params: ListAssetsSBOMsOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityFiltersResponse, - datadog::Error, + crate::datadogV2::model::ListAssetsSBOMsResponse, + datadog::Error, > { - match self.list_security_filters_with_http_info().await { + match self.list_assets_sbo_ms_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -16224,25 +16166,81 @@ impl SecurityMonitoringAPI { } } - /// Get the list of configured security filters with their definitions. - pub async fn list_security_filters_with_http_info( + /// Get a list of assets SBOMs for an organization. + /// + /// ### Pagination + /// + /// Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint. + /// + /// ### Filtering + /// + /// Please review the [Filtering section](#filtering) for the "List Vulnerabilities" endpoint. + /// + /// ### Metadata + /// + /// Please review the [Metadata section](#metadata) for the "List Vulnerabilities" endpoint. + pub async fn list_assets_sbo_ms_with_http_info( &self, + params: ListAssetsSBOMsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_filters"; + let operation_id = "v2.list_assets_sbo_ms"; + + // unbox and build optional parameters + let page_token = params.page_token; + let page_number = params.page_number; + let filter_asset_type = params.filter_asset_type; + let filter_asset_name = params.filter_asset_name; + let filter_package_name = params.filter_package_name; + let filter_package_version = params.filter_package_version; + let filter_license_name = params.filter_license_name; + let filter_license_type = params.filter_license_type; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/security_filters", + "{}/api/v2/security/sboms", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = page_token { + local_req_builder = + local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_type { + local_req_builder = + local_req_builder.query(&[("filter[asset_type]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_name { + local_req_builder = + local_req_builder.query(&[("filter[asset_name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_package_name { + local_req_builder = local_req_builder + .query(&[("filter[package_name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_package_version { + local_req_builder = local_req_builder + .query(&[("filter[package_version]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_license_name { + local_req_builder = local_req_builder + .query(&[("filter[license_name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_license_type { + local_req_builder = local_req_builder + .query(&[("filter[license_type]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -16285,7 +16283,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -16298,7 +16296,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -16309,21 +16307,56 @@ impl SecurityMonitoringAPI { } } - /// Get a list of security findings that match a search query. [See the schema for security findings](). + /// Get a list of findings. These include both misconfigurations and identity risks. /// - /// ### Query Syntax + /// **Note**: To filter and return only identity risks, add the following query parameter: `?filter[tags]=dd_rule_type:ciem` /// - /// This endpoint uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. + /// ### Filtering /// - /// Example: `@severity:(critical OR high) @status:open team:platform` - pub async fn list_security_findings( + /// Filters can be applied by appending query parameters to the URL. + /// + /// - Using a single filter: `?filter[attribute_key]=attribute_value` + /// - Chaining filters: `?filter[attribute_key]=attribute_value&filter[attribute_key]=attribute_value...` + /// - Filtering on tags: `?filter[tags]=tag_key:tag_value&filter[tags]=tag_key_2:tag_value_2` + /// + /// Here, `attribute_key` can be any of the filter keys described further below. + /// + /// Query parameters of type `integer` support comparison operators (`>`, `>=`, `<`, `<=`). This is particularly useful when filtering by `evaluation_changed_at` or `resource_discovery_timestamp`. For example: `?filter[evaluation_changed_at]=>20123123121`. + /// + /// You can also use the negation operator on strings. For example, use `filter[resource_type]=-aws*` to filter for any non-AWS resources. + /// + /// The operator must come after the equal sign. For example, to filter with the `>=` operator, add the operator after the equal sign: `filter[evaluation_changed_at]=>=1678809373257`. + /// + /// Query parameters must be only among the documented ones and with values of correct types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`) are not allowed. + /// + /// ### Additional extension fields + /// + /// Additional extension fields are available for some findings. + /// + /// The data is available when you include the query parameter `?detailed_findings=true` in the request. + /// + /// The following fields are available for findings: + /// - `external_id`: The resource external ID related to the finding. + /// - `description`: The description and remediation steps for the finding. + /// - `datadog_link`: The Datadog relative link for the finding. + /// - `ip_addresses`: The list of private IP addresses for the resource related to the finding. + /// + /// ### Response + /// + /// The response includes an array of finding objects, pagination metadata, and a count of items that match the query. + /// + /// Each finding object contains the following: + /// + /// - The finding ID that can be used in a `GetFinding` request to retrieve the full finding details. + /// - Core attributes, including status, evaluation, high-level resource details, muted state, and rule details. + /// - `evaluation_changed_at` and `resource_discovery_date` time stamps. + /// - An array of associated tags. + pub async fn list_findings( &self, - params: ListSecurityFindingsOptionalParams, - ) -> Result< - crate::datadogV2::model::ListSecurityFindingsResponse, - datadog::Error, - > { - match self.list_security_findings_with_http_info(params).await { + params: ListFindingsOptionalParams, + ) -> Result> + { + match self.list_findings_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -16337,27 +16370,23 @@ impl SecurityMonitoringAPI { } } - pub fn list_security_findings_with_pagination( + pub fn list_findings_with_pagination( &self, - mut params: ListSecurityFindingsOptionalParams, + mut params: ListFindingsOptionalParams, ) -> impl Stream< - Item = Result< - crate::datadogV2::model::SecurityFindingsData, - datadog::Error, - >, + Item = Result>, > + '_ { try_stream! { - let mut page_size: i64 = 10; + let mut page_size: i64 = 100; if params.page_limit.is_none() { params.page_limit = Some(page_size); } else { page_size = params.page_limit.unwrap().clone(); } loop { - let resp = self.list_security_findings(params.clone()).await?; - let Some(data) = resp.data else { break }; + let resp = self.list_findings(params.clone()).await?; - let r = data; + let r = resp.data; let count = r.len(); for team in r { yield team; @@ -16365,62 +16394,167 @@ impl SecurityMonitoringAPI { if count == 0 { break; } - let Some(meta) = resp.meta else { break }; - let Some(page) = meta.page else { break }; - let Some(after) = page.after else { break }; + let Some(page) = resp.meta.page else { break }; + let Some(cursor) = page.cursor else { break }; - params.page_cursor = Some(after); + params.page_cursor = Some(cursor); } } } - /// Get a list of security findings that match a search query. [See the schema for security findings](). + /// Get a list of findings. These include both misconfigurations and identity risks. /// - /// ### Query Syntax + /// **Note**: To filter and return only identity risks, add the following query parameter: `?filter[tags]=dd_rule_type:ciem` /// - /// This endpoint uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. + /// ### Filtering /// - /// Example: `@severity:(critical OR high) @status:open team:platform` - pub async fn list_security_findings_with_http_info( + /// Filters can be applied by appending query parameters to the URL. + /// + /// - Using a single filter: `?filter[attribute_key]=attribute_value` + /// - Chaining filters: `?filter[attribute_key]=attribute_value&filter[attribute_key]=attribute_value...` + /// - Filtering on tags: `?filter[tags]=tag_key:tag_value&filter[tags]=tag_key_2:tag_value_2` + /// + /// Here, `attribute_key` can be any of the filter keys described further below. + /// + /// Query parameters of type `integer` support comparison operators (`>`, `>=`, `<`, `<=`). This is particularly useful when filtering by `evaluation_changed_at` or `resource_discovery_timestamp`. For example: `?filter[evaluation_changed_at]=>20123123121`. + /// + /// You can also use the negation operator on strings. For example, use `filter[resource_type]=-aws*` to filter for any non-AWS resources. + /// + /// The operator must come after the equal sign. For example, to filter with the `>=` operator, add the operator after the equal sign: `filter[evaluation_changed_at]=>=1678809373257`. + /// + /// Query parameters must be only among the documented ones and with values of correct types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`) are not allowed. + /// + /// ### Additional extension fields + /// + /// Additional extension fields are available for some findings. + /// + /// The data is available when you include the query parameter `?detailed_findings=true` in the request. + /// + /// The following fields are available for findings: + /// - `external_id`: The resource external ID related to the finding. + /// - `description`: The description and remediation steps for the finding. + /// - `datadog_link`: The Datadog relative link for the finding. + /// - `ip_addresses`: The list of private IP addresses for the resource related to the finding. + /// + /// ### Response + /// + /// The response includes an array of finding objects, pagination metadata, and a count of items that match the query. + /// + /// Each finding object contains the following: + /// + /// - The finding ID that can be used in a `GetFinding` request to retrieve the full finding details. + /// - Core attributes, including status, evaluation, high-level resource details, muted state, and rule details. + /// - `evaluation_changed_at` and `resource_discovery_date` time stamps. + /// - An array of associated tags. + pub async fn list_findings_with_http_info( &self, - params: ListSecurityFindingsOptionalParams, + params: ListFindingsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_findings"; + let operation_id = "v2.list_findings"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_findings' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } // unbox and build optional parameters - let filter_query = params.filter_query; - let page_cursor = params.page_cursor; let page_limit = params.page_limit; - let sort = params.sort; + let snapshot_timestamp = params.snapshot_timestamp; + let page_cursor = params.page_cursor; + let filter_tags = params.filter_tags; + let filter_evaluation_changed_at = params.filter_evaluation_changed_at; + let filter_muted = params.filter_muted; + let filter_rule_id = params.filter_rule_id; + let filter_rule_name = params.filter_rule_name; + let filter_resource_type = params.filter_resource_type; + let filter_resource_id = params.filter_resource_id; + let filter_discovery_timestamp = params.filter_discovery_timestamp; + let filter_evaluation = params.filter_evaluation; + let filter_status = params.filter_status; + let filter_vulnerability_type = params.filter_vulnerability_type; + let detailed_findings = params.detailed_findings; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/findings", + "{}/api/v2/posture_management/findings", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = filter_query { + if let Some(ref local_query_param) = page_limit { local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = snapshot_timestamp { + local_req_builder = + local_req_builder.query(&[("snapshot_timestamp", &local_query_param.to_string())]); }; if let Some(ref local_query_param) = page_cursor { local_req_builder = local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_limit { + if let Some(ref local_query_param) = filter_tags { local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[tags]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = sort { + if let Some(ref local_query_param) = filter_evaluation_changed_at { + local_req_builder = local_req_builder.query(&[( + "filter[evaluation_changed_at]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_muted { local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[muted]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_rule_id { + local_req_builder = + local_req_builder.query(&[("filter[rule_id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_rule_name { + local_req_builder = + local_req_builder.query(&[("filter[rule_name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_resource_type { + local_req_builder = local_req_builder + .query(&[("filter[resource_type]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_resource_id { + local_req_builder = local_req_builder + .query(&[("filter[@resource_id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_discovery_timestamp { + local_req_builder = local_req_builder.query(&[( + "filter[discovery_timestamp]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_evaluation { + local_req_builder = + local_req_builder.query(&[("filter[evaluation]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_status { + local_req_builder = + local_req_builder.query(&[("filter[status]", &local_query_param.to_string())]); + }; + if let Some(ref local) = filter_vulnerability_type { + for param in local { + local_req_builder = + local_req_builder.query(&[("filter[vulnerability_type]", ¶m.to_string())]); + } + }; + if let Some(ref local_query_param) = detailed_findings { + local_req_builder = + local_req_builder.query(&[("detailed_findings", &local_query_param.to_string())]); }; // build headers @@ -16465,7 +16599,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -16478,8 +16612,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, content: local_content, @@ -16489,17 +16622,15 @@ impl SecurityMonitoringAPI { } } - /// Get the list of all critical assets. - pub async fn list_security_monitoring_critical_assets( + /// List historical jobs. + pub async fn list_historical_jobs( &self, + params: ListHistoricalJobsOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, - datadog::Error, + crate::datadogV2::model::ListHistoricalJobsResponse, + datadog::Error, > { - match self - .list_security_monitoring_critical_assets_with_http_info() - .await - { + match self.list_historical_jobs_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -16513,25 +16644,57 @@ impl SecurityMonitoringAPI { } } - /// Get the list of all critical assets. - pub async fn list_security_monitoring_critical_assets_with_http_info( + /// List historical jobs. + pub async fn list_historical_jobs_with_http_info( &self, + params: ListHistoricalJobsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_monitoring_critical_assets"; + let operation_id = "v2.list_historical_jobs"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_historical_jobs' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let sort = params.sort; + let filter_query = params.filter_query; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/critical_assets", + "{}/api/v2/siem-historical-detections/jobs", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = sort { + local_req_builder = + local_req_builder.query(&[("sort", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_query { + local_req_builder = + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -16574,10 +16737,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -16588,7 +16750,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -16599,17 +16761,16 @@ impl SecurityMonitoringAPI { } } - /// List all Cloud SIEM datasets available to the organization, including both - /// customer-defined datasets and Datadog out-of-the-box datasets. - pub async fn list_security_monitoring_datasets( + /// Get a list of indicators of compromise (IoCs) matching the specified filters. + pub async fn list_indicators_of_compromise( &self, - params: ListSecurityMonitoringDatasetsOptionalParams, + params: ListIndicatorsOfCompromiseOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringDatasetsListResponse, - datadog::Error, + crate::datadogV2::model::IoCExplorerListResponse, + datadog::Error, > { match self - .list_security_monitoring_datasets_with_http_info(params) + .list_indicators_of_compromise_with_http_info(params) .await { Ok(response_content) => { @@ -16625,56 +16786,75 @@ impl SecurityMonitoringAPI { } } - /// List all Cloud SIEM datasets available to the organization, including both - /// customer-defined datasets and Datadog out-of-the-box datasets. - pub async fn list_security_monitoring_datasets_with_http_info( + /// Get a list of indicators of compromise (IoCs) matching the specified filters. + pub async fn list_indicators_of_compromise_with_http_info( &self, - params: ListSecurityMonitoringDatasetsOptionalParams, + params: ListIndicatorsOfCompromiseOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_monitoring_datasets"; + let operation_id = "v2.list_indicators_of_compromise"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_security_monitoring_datasets' is not enabled".to_string(), + msg: "Operation 'v2.list_indicators_of_compromise' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let page_size = params.page_size; - let page_number = params.page_number; - let sort = params.sort; - let filter_query = params.filter_query; + let limit = params.limit; + let offset = params.offset; + let query = params.query; + let sort_column = params.sort_column; + let sort_order = params.sort_order; + let ocsf = params.ocsf; + let worked_by = params.worked_by; + let triage_state = params.triage_state; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/datasets", + "{}/api/v2/security/siem/ioc-explorer", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_size { + if let Some(ref local_query_param) = limit { local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + local_req_builder.query(&[("limit", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_number { + if let Some(ref local_query_param) = offset { local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + local_req_builder.query(&[("offset", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = sort { + if let Some(ref local_query_param) = query { local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); + local_req_builder.query(&[("query", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_query { + if let Some(ref local_query_param) = sort_column { local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + local_req_builder.query(&[("sort[column]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = sort_order { + local_req_builder = + local_req_builder.query(&[("sort[order]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = ocsf { + local_req_builder = + local_req_builder.query(&[("ocsf", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = worked_by { + local_req_builder = + local_req_builder.query(&[("worked_by", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = triage_state { + local_req_builder = + local_req_builder.query(&[("triage_state", &local_query_param.to_string())]); }; // build headers @@ -16719,10 +16899,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringDatasetsListResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -16733,7 +16912,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -16744,18 +16923,15 @@ impl SecurityMonitoringAPI { } } - /// List hist signals. - pub async fn list_security_monitoring_histsignals( + /// Get rules for multiple rulesets in batch. + pub async fn list_multiple_rulesets( &self, - params: ListSecurityMonitoringHistsignalsOptionalParams, + body: crate::datadogV2::model::GetMultipleRulesetsRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - datadog::Error, + crate::datadogV2::model::GetMultipleRulesetsResponse, + datadog::Error, > { - match self - .list_security_monitoring_histsignals_with_http_info(params) - .await - { + match self.list_multiple_rulesets_with_http_info(body).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -16769,74 +16945,37 @@ impl SecurityMonitoringAPI { } } - /// List hist signals. - pub async fn list_security_monitoring_histsignals_with_http_info( + /// Get rules for multiple rulesets in batch. + pub async fn list_multiple_rulesets_with_http_info( &self, - params: ListSecurityMonitoringHistsignalsOptionalParams, + body: crate::datadogV2::model::GetMultipleRulesetsRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_monitoring_histsignals"; + let operation_id = "v2.list_multiple_rulesets"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_security_monitoring_histsignals' is not enabled" - .to_string(), + msg: "Operation 'v2.list_multiple_rulesets' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let filter_query = params.filter_query; - let filter_from = params.filter_from; - let filter_to = params.filter_to; - let sort = params.sort; - let page_cursor = params.page_cursor; - let page_limit = params.page_limit; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/histsignals", + "{}/api/v2/static-analysis/rulesets", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = filter_query { - local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_from { - local_req_builder = local_req_builder.query(&[( - "filter[from]", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - if let Some(ref local_query_param) = filter_to { - local_req_builder = local_req_builder.query(&[( - "filter[to]", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - if let Some(ref local_query_param) = sort { - local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -16867,6 +17006,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -16877,10 +17062,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -16891,7 +17075,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -16902,18 +17086,22 @@ impl SecurityMonitoringAPI { } } - /// List the entity context sync configurations for Cloud SIEM. Each configuration connects Cloud SIEM - /// to an external source that provides entities (for example, users from an identity provider) for use - /// in signals and the entity explorer. - pub async fn list_security_monitoring_integration_configs( + /// Get the sample log generation subscriptions for the organization. + /// Sample log generation injects representative example logs for a given Cloud SIEM content pack into the Logs platform, + /// which can be used to test detection rules without onboarding the underlying integration first. + /// + /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an eligible + /// pricing model. Other organizations receive a `403 Forbidden` (non-trial orgs) or a `400 Bad Request` + /// (feature disabled), and legacy pricing tiers receive a response with `status: not_available`. + pub async fn list_sample_log_generation_subscriptions( &self, - params: ListSecurityMonitoringIntegrationConfigsOptionalParams, + params: ListSampleLogGenerationSubscriptionsOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigsResponse, - datadog::Error, + crate::datadogV2::model::SampleLogGenerationSubscriptionsResponse, + datadog::Error, > { match self - .list_security_monitoring_integration_configs_with_http_info(params) + .list_sample_log_generation_subscriptions_with_http_info(params) .await { Ok(response_content) => { @@ -16929,45 +17117,61 @@ impl SecurityMonitoringAPI { } } - /// List the entity context sync configurations for Cloud SIEM. Each configuration connects Cloud SIEM - /// to an external source that provides entities (for example, users from an identity provider) for use - /// in signals and the entity explorer. - pub async fn list_security_monitoring_integration_configs_with_http_info( + /// Get the sample log generation subscriptions for the organization. + /// Sample log generation injects representative example logs for a given Cloud SIEM content pack into the Logs platform, + /// which can be used to test detection rules without onboarding the underlying integration first. + /// + /// **Availability**: this endpoint is restricted to Cloud SIEM trial organizations on an eligible + /// pricing model. Other organizations receive a `403 Forbidden` (non-trial orgs) or a `400 Bad Request` + /// (feature disabled), and legacy pricing tiers receive a response with `status: not_available`. + pub async fn list_sample_log_generation_subscriptions_with_http_info( &self, - params: ListSecurityMonitoringIntegrationConfigsOptionalParams, + params: ListSampleLogGenerationSubscriptionsOptionalParams, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigsResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_monitoring_integration_configs"; + let operation_id = "v2.list_sample_log_generation_subscriptions"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_security_monitoring_integration_configs' is not enabled" + msg: "Operation 'v2.list_sample_log_generation_subscriptions' is not enabled" .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let filter_integration_type = params.filter_integration_type; + let status = params.status; + let start_timestamp = params.start_timestamp; + let end_timestamp = params.end_timestamp; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/integration_config", + "{}/api/v2/security_monitoring/sample_log_generation/subscriptions", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = filter_integration_type { - local_req_builder = local_req_builder - .query(&[("filter[integration_type]", &local_query_param.to_string())]); + if let Some(ref local_query_param) = status { + local_req_builder = + local_req_builder.query(&[("status", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = start_timestamp { + local_req_builder = local_req_builder.query(&[( + "start_timestamp", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); + }; + if let Some(ref local_query_param) = end_timestamp { + local_req_builder = local_req_builder.query(&[( + "end_timestamp", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); }; // build headers @@ -17013,7 +17217,7 @@ impl SecurityMonitoringAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringIntegrationConfigsResponse, + crate::datadogV2::model::SampleLogGenerationSubscriptionsResponse, >(&local_content) { Ok(e) => { @@ -17026,7 +17230,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -17037,16 +17241,59 @@ impl SecurityMonitoringAPI { } } - /// List rules. - pub async fn list_security_monitoring_rules( + /// Get a list of security scanned assets metadata for an organization. + /// + /// ### Pagination + /// + /// For the "List Vulnerabilities" endpoint, see the [Pagination section](#pagination). + /// + /// ### Filtering + /// + /// For the "List Vulnerabilities" endpoint, see the [Filtering section](#filtering). + /// + /// ### Metadata + /// + /// For the "List Vulnerabilities" endpoint, see the [Metadata section](#metadata). + /// + /// ### Related endpoints + /// + /// This endpoint returns additional metadata for cloud resources that is not available from the standard resource endpoints. To access a richer dataset, call this endpoint together with the relevant resource endpoint(s) and merge (join) their results using the resource identifier. + /// + /// **Hosts** + /// + /// To enrich host data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: + /// + /// | ENDPOINT | JOIN KEY | TYPE | + /// | --- | --- | --- | + /// | [/api/v1/hosts]() | host_list.host_name | string | + /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + /// + /// **Host Images** + /// + /// To enrich host image data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: + /// + /// | ENDPOINT | JOIN KEY | TYPE | + /// | --- | --- | --- | + /// | [/api/v1/hosts]() | host_list.tags_by_source["Amazon Web Services"]["image"] | string | + /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + /// + /// **Container Images** + /// + /// To enrich container image data, join the response from the [Container Images]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: + /// + /// | ENDPOINT | JOIN KEY | TYPE | + /// | --- | --- | --- | + /// | [/api/v2/container_images]() | `data.attributes.name`@`data.attributes.repo_digest` | string | + /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + pub async fn list_scanned_assets_metadata( &self, - params: ListSecurityMonitoringRulesOptionalParams, + params: ListScannedAssetsMetadataOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringListRulesResponse, - datadog::Error, + crate::datadogV2::model::ScannedAssetsMetadata, + datadog::Error, > { match self - .list_security_monitoring_rules_with_http_info(params) + .list_scanned_assets_metadata_with_http_info(params) .await { Ok(response_content) => { @@ -17062,47 +17309,110 @@ impl SecurityMonitoringAPI { } } - /// List rules. - pub async fn list_security_monitoring_rules_with_http_info( - &self, - params: ListSecurityMonitoringRulesOptionalParams, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.list_security_monitoring_rules"; - - // unbox and build optional parameters - let page_size = params.page_size; - let page_number = params.page_number; - let query = params.query; - let sort = params.sort; - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + /// Get a list of security scanned assets metadata for an organization. + /// + /// ### Pagination + /// + /// For the "List Vulnerabilities" endpoint, see the [Pagination section](#pagination). + /// + /// ### Filtering + /// + /// For the "List Vulnerabilities" endpoint, see the [Filtering section](#filtering). + /// + /// ### Metadata + /// + /// For the "List Vulnerabilities" endpoint, see the [Metadata section](#metadata). + /// + /// ### Related endpoints + /// + /// This endpoint returns additional metadata for cloud resources that is not available from the standard resource endpoints. To access a richer dataset, call this endpoint together with the relevant resource endpoint(s) and merge (join) their results using the resource identifier. + /// + /// **Hosts** + /// + /// To enrich host data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: + /// + /// | ENDPOINT | JOIN KEY | TYPE | + /// | --- | --- | --- | + /// | [/api/v1/hosts]() | host_list.host_name | string | + /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + /// + /// **Host Images** + /// + /// To enrich host image data, join the response from the [Hosts]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: + /// + /// | ENDPOINT | JOIN KEY | TYPE | + /// | --- | --- | --- | + /// | [/api/v1/hosts]() | host_list.tags_by_source["Amazon Web Services"]["image"] | string | + /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + /// + /// **Container Images** + /// + /// To enrich container image data, join the response from the [Container Images]() endpoint with the response from the scanned-assets-metadata endpoint on the following key fields: + /// + /// | ENDPOINT | JOIN KEY | TYPE | + /// | --- | --- | --- | + /// | [/api/v2/container_images]() | `data.attributes.name`@`data.attributes.repo_digest` | string | + /// | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + pub async fn list_scanned_assets_metadata_with_http_info( + &self, + params: ListScannedAssetsMetadataOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_scanned_assets_metadata"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_scanned_assets_metadata' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } - if let Some(ref local_query_param) = page_size { + // unbox and build optional parameters + let page_token = params.page_token; + let page_number = params.page_number; + let filter_asset_type = params.filter_asset_type; + let filter_asset_name = params.filter_asset_name; + let filter_last_success_origin = params.filter_last_success_origin; + let filter_last_success_env = params.filter_last_success_env; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/scanned-assets-metadata", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_token { local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); }; if let Some(ref local_query_param) = page_number { local_req_builder = local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = query { + if let Some(ref local_query_param) = filter_asset_type { local_req_builder = - local_req_builder.query(&[("query", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[asset.type]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = sort { + if let Some(ref local_query_param) = filter_asset_name { local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[asset.name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_last_success_origin { + local_req_builder = local_req_builder.query(&[( + "filter[last_success.origin]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_last_success_env { + local_req_builder = local_req_builder + .query(&[("filter[last_success.env]", &local_query_param.to_string())]); }; // build headers @@ -17147,7 +17457,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -17160,7 +17470,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -17171,20 +17481,16 @@ impl SecurityMonitoringAPI { } } - /// The list endpoint returns security signals that match a search query. - /// Both this endpoint and the POST endpoint can be used interchangeably when listing - /// security signals. - pub async fn list_security_monitoring_signals( + /// Get the configured security filters at each historical version of the configuration. + /// Each entry in the response represents the set of all security filters at a given version, + /// ordered from the most recent version to the oldest. + pub async fn list_security_filter_versions( &self, - params: ListSecurityMonitoringSignalsOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - datadog::Error, + crate::datadogV2::model::SecurityFilterVersionsResponse, + datadog::Error, > { - match self - .list_security_monitoring_signals_with_http_info(params) - .await - { + match self.list_security_filter_versions_with_http_info().await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -17198,102 +17504,27 @@ impl SecurityMonitoringAPI { } } - pub fn list_security_monitoring_signals_with_pagination( - &self, - mut params: ListSecurityMonitoringSignalsOptionalParams, - ) -> impl Stream< - Item = Result< - crate::datadogV2::model::SecurityMonitoringSignal, - datadog::Error, - >, - > + '_ { - try_stream! { - let mut page_size: i32 = 10; - if params.page_limit.is_none() { - params.page_limit = Some(page_size); - } else { - page_size = params.page_limit.unwrap().clone(); - } - loop { - let resp = self.list_security_monitoring_signals(params.clone()).await?; - let Some(data) = resp.data else { break }; - - let r = data; - let count = r.len(); - for team in r { - yield team; - } - if count == 0 { - break; - } - let Some(meta) = resp.meta else { break }; - let Some(page) = meta.page else { break }; - let Some(after) = page.after else { break }; - - params.page_cursor = Some(after); - } - } - } - - /// The list endpoint returns security signals that match a search query. - /// Both this endpoint and the POST endpoint can be used interchangeably when listing - /// security signals. - pub async fn list_security_monitoring_signals_with_http_info( + /// Get the configured security filters at each historical version of the configuration. + /// Each entry in the response represents the set of all security filters at a given version, + /// ordered from the most recent version to the oldest. + pub async fn list_security_filter_versions_with_http_info( &self, - params: ListSecurityMonitoringSignalsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_monitoring_signals"; - - // unbox and build optional parameters - let filter_query = params.filter_query; - let filter_from = params.filter_from; - let filter_to = params.filter_to; - let sort = params.sort; - let page_cursor = params.page_cursor; - let page_limit = params.page_limit; + let operation_id = "v2.list_security_filter_versions"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals", + "{}/api/v2/security_monitoring/configuration/security_filters/versions", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = filter_query { - local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_from { - local_req_builder = local_req_builder.query(&[( - "filter[from]", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - if let Some(ref local_query_param) = filter_to { - local_req_builder = local_req_builder.query(&[( - "filter[to]", - &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), - )]); - }; - if let Some(ref local_query_param) = sort { - local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -17336,10 +17567,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -17350,7 +17580,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -17361,18 +17591,14 @@ impl SecurityMonitoringAPI { } } - /// Get the list of all suppression rules. - pub async fn list_security_monitoring_suppressions( + /// Get the list of configured security filters with their definitions. + pub async fn list_security_filters( &self, - params: ListSecurityMonitoringSuppressionsOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringPaginatedSuppressionsResponse, - datadog::Error, + crate::datadogV2::model::SecurityFiltersResponse, + datadog::Error, > { - match self - .list_security_monitoring_suppressions_with_http_info(params) - .await - { + match self.list_security_filters_with_http_info().await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -17386,49 +17612,203 @@ impl SecurityMonitoringAPI { } } - /// Get the list of all suppression rules. - pub async fn list_security_monitoring_suppressions_with_http_info( + /// Get the list of configured security filters with their definitions. + pub async fn list_security_filters_with_http_info( &self, - params: ListSecurityMonitoringSuppressionsOptionalParams, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::SecurityMonitoringPaginatedSuppressionsResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_security_monitoring_suppressions"; - - // unbox and build optional parameters - let query = params.query; - let sort = params.sort; - let page_size = params.page_size; - let page_number = params.page_number; + let operation_id = "v2.list_security_filters"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/suppressions", + "{}/api/v2/security_monitoring/configuration/security_filters", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = query { + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get a list of security findings that match a search query. [See the schema for security findings](). + /// + /// ### Query Syntax + /// + /// This endpoint uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. + /// + /// Example: `@severity:(critical OR high) @status:open team:platform` + pub async fn list_security_findings( + &self, + params: ListSecurityFindingsOptionalParams, + ) -> Result< + crate::datadogV2::model::ListSecurityFindingsResponse, + datadog::Error, + > { + match self.list_security_findings_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + pub fn list_security_findings_with_pagination( + &self, + mut params: ListSecurityFindingsOptionalParams, + ) -> impl Stream< + Item = Result< + crate::datadogV2::model::SecurityFindingsData, + datadog::Error, + >, + > + '_ { + try_stream! { + let mut page_size: i64 = 10; + if params.page_limit.is_none() { + params.page_limit = Some(page_size); + } else { + page_size = params.page_limit.unwrap().clone(); + } + loop { + let resp = self.list_security_findings(params.clone()).await?; + let Some(data) = resp.data else { break }; + + let r = data; + let count = r.len(); + for team in r { + yield team; + } + if count == 0 { + break; + } + let Some(meta) = resp.meta else { break }; + let Some(page) = meta.page else { break }; + let Some(after) = page.after else { break }; + + params.page_cursor = Some(after); + } + } + } + + /// Get a list of security findings that match a search query. [See the schema for security findings](). + /// + /// ### Query Syntax + /// + /// This endpoint uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. + /// + /// Example: `@severity:(critical OR high) @status:open team:platform` + pub async fn list_security_findings_with_http_info( + &self, + params: ListSecurityFindingsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_findings"; + + // unbox and build optional parameters + let filter_query = params.filter_query; + let page_cursor = params.page_cursor; + let page_limit = params.page_limit; + let sort = params.sort; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/findings", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = filter_query { local_req_builder = - local_req_builder.query(&[("query", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = sort { + if let Some(ref local_query_param) = page_cursor { local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_size { + if let Some(ref local_query_param) = page_limit { local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_number { + if let Some(ref local_query_param) = sort { local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + local_req_builder.query(&[("sort", &local_query_param.to_string())]); }; // build headers @@ -17473,10 +17853,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringPaginatedSuppressionsResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -17487,7 +17866,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -17498,15 +17877,16 @@ impl SecurityMonitoringAPI { } } - /// Get the rulesets relevant for code generation for the authenticated user. - pub async fn list_static_analysis_codegen_rulesets( + /// Get all due date rules for the current organization. + pub async fn list_security_findings_automation_due_date_rules( &self, + params: ListSecurityFindingsAutomationDueDateRulesOptionalParams, ) -> Result< - crate::datadogV2::model::SastRulesetsResponse, - datadog::Error, + crate::datadogV2::model::DueDateRulesResponse, + datadog::Error, > { match self - .list_static_analysis_codegen_rulesets_with_http_info() + .list_security_findings_automation_due_date_rules_with_http_info(params) .await { Ok(response_content) => { @@ -17522,34 +17902,49 @@ impl SecurityMonitoringAPI { } } - /// Get the rulesets relevant for code generation for the authenticated user. - pub async fn list_static_analysis_codegen_rulesets_with_http_info( + /// Get all due date rules for the current organization. + pub async fn list_security_findings_automation_due_date_rules_with_http_info( &self, + params: ListSecurityFindingsAutomationDueDateRulesOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_static_analysis_codegen_rulesets"; + let operation_id = "v2.list_security_findings_automation_due_date_rules"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_static_analysis_codegen_rulesets' is not enabled" - .to_string(), + msg: + "Operation 'v2.list_security_findings_automation_due_date_rules' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/static-analysis/codegen/rulesets", + "{}/api/v2/security/findings/automation/due_date_rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -17592,7 +17987,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -17605,7 +18000,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -17616,103 +18011,18 @@ impl SecurityMonitoringAPI { } } - /// Get a list of vulnerabilities. - /// - /// ### Pagination - /// - /// Pagination is enabled by default in both `vulnerabilities` and `assets`. The size of the page varies depending on the endpoint and cannot be modified. To automate the request of the next page, you can use the links section in the response. - /// - /// This endpoint will return paginated responses. The pages are stored in the links section of the response: - /// - /// ```JSON - /// { - /// "data": [...], - /// "meta": {...}, - /// "links": { - /// "self": " - /// "first": " - /// "last": " - /// "next": " - /// } - /// } - /// ``` - /// - /// - /// - `links.previous` is empty if the first page is requested. - /// - `links.next` is empty if the last page is requested. - /// - /// #### Token - /// - /// Vulnerabilities can be created, updated or deleted at any point in time. - /// - /// Upon the first request, a token is created to ensure consistency across subsequent paginated requests. - /// - /// A token is valid only for 24 hours. - /// - /// #### First request - /// - /// We consider a request to be the first request when there is no `page[token]` parameter. - /// - /// The response of this first request contains the newly created token in the `links` section. - /// - /// This token can then be used in the subsequent paginated requests. - /// - /// *Note: The first request may take longer to complete than subsequent requests.* - /// - /// #### Subsequent requests - /// - /// Any request containing valid `page[token]` and `page[number]` parameters will be considered a subsequent request. - /// - /// If the `token` is invalid, a `404` response will be returned. - /// - /// If the page `number` is invalid, a `400` response will be returned. - /// - /// The returned `token` is valid for all requests in the pagination sequence. To send paginated requests in parallel, reuse the same `token` and change only the `page[number]` parameter. - /// - /// ### Filtering - /// - /// The request can include some filter parameters to filter the data to be retrieved. The format of the filter parameters follows the [JSON:API format](): `filter[$prop_name]`, where `prop_name` is the property name in the entity being filtered by. - /// - /// All filters can include multiple values, where data will be filtered with an OR clause: `filter[title]=Title1,Title2` will filter all vulnerabilities where title is equal to `Title1` OR `Title2`. - /// - /// String filters are case sensitive. - /// - /// Boolean filters accept `true` or `false` as values. - /// - /// Number filters must include an operator as a second filter input: `filter[$prop_name][$operator]`. For example, for the vulnerabilities endpoint: `filter[cvss.base.score][lte]=8`. - /// - /// Available operators are: `eq` (==), `lt` (<), `lte` (<=), `gt` (>) and `gte` (>=). - /// - /// ### Metadata - /// - /// Following [JSON:API format](), object including non-standard meta-information. - /// - /// This endpoint includes the meta member in the response. For more details on each of the properties included in this section, check the endpoints response tables. - /// - /// ```JSON - /// { - /// "data": [...], - /// "meta": { - /// "total": 1500, - /// "count": 18732, - /// "token": "some_token" - /// }, - /// "links": {...} - /// } - /// ``` - /// ### Extensions - /// - /// Requests may include extensions to modify the behavior of the requested endpoint. The filter parameters follow the [JSON:API format]() format: `ext:$extension_name`, where `extension_name` is the name of the modifier that is being applied. - /// - /// Extensions can only include one value: `ext:modifier=value`. - pub async fn list_vulnerabilities( + /// Get all mute rules for the current organization. + pub async fn list_security_findings_automation_mute_rules( &self, - params: ListVulnerabilitiesOptionalParams, + params: ListSecurityFindingsAutomationMuteRulesOptionalParams, ) -> Result< - crate::datadogV2::model::ListVulnerabilitiesResponse, - datadog::Error, + crate::datadogV2::model::MuteRulesResponse, + datadog::Error, > { - match self.list_vulnerabilities_with_http_info(params).await { + match self + .list_security_findings_automation_mute_rules_with_http_info(params) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -17726,387 +18036,2875 @@ impl SecurityMonitoringAPI { } } - /// Get a list of vulnerabilities. - /// - /// ### Pagination - /// - /// Pagination is enabled by default in both `vulnerabilities` and `assets`. The size of the page varies depending on the endpoint and cannot be modified. To automate the request of the next page, you can use the links section in the response. - /// - /// This endpoint will return paginated responses. The pages are stored in the links section of the response: - /// - /// ```JSON - /// { - /// "data": [...], - /// "meta": {...}, - /// "links": { - /// "self": " - /// "first": " - /// "last": " - /// "next": " - /// } - /// } - /// ``` - /// - /// - /// - `links.previous` is empty if the first page is requested. - /// - `links.next` is empty if the last page is requested. - /// - /// #### Token - /// - /// Vulnerabilities can be created, updated or deleted at any point in time. - /// - /// Upon the first request, a token is created to ensure consistency across subsequent paginated requests. - /// - /// A token is valid only for 24 hours. - /// - /// #### First request - /// - /// We consider a request to be the first request when there is no `page[token]` parameter. - /// - /// The response of this first request contains the newly created token in the `links` section. - /// - /// This token can then be used in the subsequent paginated requests. - /// - /// *Note: The first request may take longer to complete than subsequent requests.* - /// - /// #### Subsequent requests - /// - /// Any request containing valid `page[token]` and `page[number]` parameters will be considered a subsequent request. - /// - /// If the `token` is invalid, a `404` response will be returned. - /// - /// If the page `number` is invalid, a `400` response will be returned. - /// - /// The returned `token` is valid for all requests in the pagination sequence. To send paginated requests in parallel, reuse the same `token` and change only the `page[number]` parameter. - /// - /// ### Filtering - /// - /// The request can include some filter parameters to filter the data to be retrieved. The format of the filter parameters follows the [JSON:API format](): `filter[$prop_name]`, where `prop_name` is the property name in the entity being filtered by. - /// - /// All filters can include multiple values, where data will be filtered with an OR clause: `filter[title]=Title1,Title2` will filter all vulnerabilities where title is equal to `Title1` OR `Title2`. - /// - /// String filters are case sensitive. - /// - /// Boolean filters accept `true` or `false` as values. - /// - /// Number filters must include an operator as a second filter input: `filter[$prop_name][$operator]`. For example, for the vulnerabilities endpoint: `filter[cvss.base.score][lte]=8`. - /// - /// Available operators are: `eq` (==), `lt` (<), `lte` (<=), `gt` (>) and `gte` (>=). - /// - /// ### Metadata - /// - /// Following [JSON:API format](), object including non-standard meta-information. - /// - /// This endpoint includes the meta member in the response. For more details on each of the properties included in this section, check the endpoints response tables. - /// - /// ```JSON - /// { - /// "data": [...], - /// "meta": { - /// "total": 1500, - /// "count": 18732, - /// "token": "some_token" - /// }, - /// "links": {...} - /// } - /// ``` - /// ### Extensions - /// - /// Requests may include extensions to modify the behavior of the requested endpoint. The filter parameters follow the [JSON:API format]() format: `ext:$extension_name`, where `extension_name` is the name of the modifier that is being applied. - /// - /// Extensions can only include one value: `ext:modifier=value`. - pub async fn list_vulnerabilities_with_http_info( + /// Get all mute rules for the current organization. + pub async fn list_security_findings_automation_mute_rules_with_http_info( &self, - params: ListVulnerabilitiesOptionalParams, + params: ListSecurityFindingsAutomationMuteRulesOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_vulnerabilities"; + let operation_id = "v2.list_security_findings_automation_mute_rules"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_vulnerabilities' is not enabled".to_string(), + msg: "Operation 'v2.list_security_findings_automation_mute_rules' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let page_token = params.page_token; + let page_size = params.page_size; let page_number = params.page_number; - let filter_type = params.filter_type; - let filter_cvss_base_score_op = params.filter_cvss_base_score_op; - let filter_cvss_base_severity = params.filter_cvss_base_severity; - let filter_cvss_base_vector = params.filter_cvss_base_vector; - let filter_cvss_datadog_score_op = params.filter_cvss_datadog_score_op; - let filter_cvss_datadog_severity = params.filter_cvss_datadog_severity; - let filter_cvss_datadog_vector = params.filter_cvss_datadog_vector; - let filter_status = params.filter_status; - let filter_tool = params.filter_tool; - let filter_library_name = params.filter_library_name; - let filter_library_version = params.filter_library_version; - let filter_advisory_id = params.filter_advisory_id; - let filter_risks_exploitation_probability = params.filter_risks_exploitation_probability; - let filter_risks_poc_exploit_available = params.filter_risks_poc_exploit_available; - let filter_risks_exploit_available = params.filter_risks_exploit_available; - let filter_risks_epss_score_op = params.filter_risks_epss_score_op; - let filter_risks_epss_severity = params.filter_risks_epss_severity; - let filter_language = params.filter_language; - let filter_ecosystem = params.filter_ecosystem; - let filter_code_location_location = params.filter_code_location_location; - let filter_code_location_file_path = params.filter_code_location_file_path; - let filter_code_location_method = params.filter_code_location_method; - let filter_fix_available = params.filter_fix_available; - let filter_repo_digests = params.filter_repo_digests; - let filter_origin = params.filter_origin; - let filter_running_kernel = params.filter_running_kernel; - let filter_asset_name = params.filter_asset_name; - let filter_asset_type = params.filter_asset_type; - let filter_asset_version_first = params.filter_asset_version_first; - let filter_asset_version_last = params.filter_asset_version_last; - let filter_asset_repository_url = params.filter_asset_repository_url; - let filter_asset_risks_in_production = params.filter_asset_risks_in_production; - let filter_asset_risks_under_attack = params.filter_asset_risks_under_attack; - let filter_asset_risks_is_publicly_accessible = - params.filter_asset_risks_is_publicly_accessible; - let filter_asset_risks_has_privileged_access = - params.filter_asset_risks_has_privileged_access; - let filter_asset_risks_has_access_to_sensitive_data = - params.filter_asset_risks_has_access_to_sensitive_data; - let filter_asset_environments = params.filter_asset_environments; - let filter_asset_teams = params.filter_asset_teams; - let filter_asset_arch = params.filter_asset_arch; - let filter_asset_operating_system_name = params.filter_asset_operating_system_name; - let filter_asset_operating_system_version = params.filter_asset_operating_system_version; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/vulnerabilities", + "{}/api/v2/security/findings/automation/mute_rules", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_token { + if let Some(ref local_query_param) = page_size { local_req_builder = - local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); }; if let Some(ref local_query_param) = page_number { local_req_builder = local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_type { - local_req_builder = - local_req_builder.query(&[("filter[type]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_cvss_base_score_op { - local_req_builder = local_req_builder.query(&[( - "filter[cvss.base.score][`$op`]", - &local_query_param.to_string(), - )]); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } }; - if let Some(ref local_query_param) = filter_cvss_base_severity { - local_req_builder = local_req_builder - .query(&[("filter[cvss.base.severity]", &local_query_param.to_string())]); + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); }; - if let Some(ref local_query_param) = filter_cvss_base_vector { - local_req_builder = local_req_builder - .query(&[("filter[cvss.base.vector]", &local_query_param.to_string())]); + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); }; - if let Some(ref local_query_param) = filter_cvss_datadog_score_op { - local_req_builder = local_req_builder.query(&[( - "filter[cvss.datadog.score][`$op`]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_cvss_datadog_severity { - local_req_builder = local_req_builder.query(&[( - "filter[cvss.datadog.severity]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_cvss_datadog_vector { - local_req_builder = local_req_builder.query(&[( - "filter[cvss.datadog.vector]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_status { + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get all ticket creation rules for the current organization. + pub async fn list_security_findings_automation_ticket_creation_rules( + &self, + params: ListSecurityFindingsAutomationTicketCreationRulesOptionalParams, + ) -> Result< + crate::datadogV2::model::TicketCreationRulesResponse, + datadog::Error, + > { + match self + .list_security_findings_automation_ticket_creation_rules_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get all ticket creation rules for the current organization. + pub async fn list_security_findings_automation_ticket_creation_rules_with_http_info( + &self, + params: ListSecurityFindingsAutomationTicketCreationRulesOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_findings_automation_ticket_creation_rules"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_security_findings_automation_ticket_creation_rules' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/findings/automation/ticket_creation_rules", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_size { local_req_builder = - local_req_builder.query(&[("filter[status]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_tool { + if let Some(ref local_query_param) = page_number { local_req_builder = - local_req_builder.query(&[("filter[tool]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_library_name { - local_req_builder = local_req_builder - .query(&[("filter[library.name]", &local_query_param.to_string())]); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } }; - if let Some(ref local_query_param) = filter_library_version { - local_req_builder = local_req_builder - .query(&[("filter[library.version]", &local_query_param.to_string())]); + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); }; - if let Some(ref local_query_param) = filter_advisory_id { - local_req_builder = - local_req_builder.query(&[("filter[advisory.id]", &local_query_param.to_string())]); + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); }; - if let Some(ref local_query_param) = filter_risks_exploitation_probability { - local_req_builder = local_req_builder.query(&[( - "filter[risks.exploitation_probability]", - &local_query_param.to_string(), - )]); + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get the list of all critical assets. + pub async fn list_security_monitoring_critical_assets( + &self, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, + datadog::Error, + > { + match self + .list_security_monitoring_critical_assets_with_http_info() + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get the list of all critical assets. + pub async fn list_security_monitoring_critical_assets_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_monitoring_critical_assets"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security_monitoring/configuration/critical_assets", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } }; - if let Some(ref local_query_param) = filter_risks_poc_exploit_available { - local_req_builder = local_req_builder.query(&[( - "filter[risks.poc_exploit_available]", - &local_query_param.to_string(), - )]); + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); }; - if let Some(ref local_query_param) = filter_risks_exploit_available { - local_req_builder = local_req_builder.query(&[( - "filter[risks.exploit_available]", - &local_query_param.to_string(), - )]); + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); }; - if let Some(ref local_query_param) = filter_risks_epss_score_op { - local_req_builder = local_req_builder.query(&[( - "filter[risks.epss.score][`$op`]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_risks_epss_severity { - local_req_builder = local_req_builder.query(&[( - "filter[risks.epss.severity]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_language { - local_req_builder = - local_req_builder.query(&[("filter[language]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_ecosystem { - local_req_builder = - local_req_builder.query(&[("filter[ecosystem]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_code_location_location { - local_req_builder = local_req_builder.query(&[( - "filter[code_location.location]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_code_location_file_path { - local_req_builder = local_req_builder.query(&[( - "filter[code_location.file_path]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_code_location_method { - local_req_builder = local_req_builder.query(&[( - "filter[code_location.method]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_fix_available { - local_req_builder = local_req_builder - .query(&[("filter[fix_available]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_repo_digests { - local_req_builder = local_req_builder - .query(&[("filter[repo_digests]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_origin { + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringCriticalAssetsResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List all Cloud SIEM datasets available to the organization, including both + /// customer-defined datasets and Datadog out-of-the-box datasets. + pub async fn list_security_monitoring_datasets( + &self, + params: ListSecurityMonitoringDatasetsOptionalParams, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringDatasetsListResponse, + datadog::Error, + > { + match self + .list_security_monitoring_datasets_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List all Cloud SIEM datasets available to the organization, including both + /// customer-defined datasets and Datadog out-of-the-box datasets. + pub async fn list_security_monitoring_datasets_with_http_info( + &self, + params: ListSecurityMonitoringDatasetsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_monitoring_datasets"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_security_monitoring_datasets' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let sort = params.sort; + let filter_query = params.filter_query; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security_monitoring/datasets", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_size { local_req_builder = - local_req_builder.query(&[("filter[origin]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_running_kernel { - local_req_builder = local_req_builder - .query(&[("filter[running_kernel]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_asset_name { + if let Some(ref local_query_param) = page_number { local_req_builder = - local_req_builder.query(&[("filter[asset.name]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_asset_type { + if let Some(ref local_query_param) = sort { local_req_builder = - local_req_builder.query(&[("filter[asset.type]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_asset_version_first { - local_req_builder = local_req_builder.query(&[( - "filter[asset.version.first]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_asset_version_last { - local_req_builder = local_req_builder - .query(&[("filter[asset.version.last]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_asset_repository_url { - local_req_builder = local_req_builder.query(&[( - "filter[asset.repository_url]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_asset_risks_in_production { - local_req_builder = local_req_builder.query(&[( - "filter[asset.risks.in_production]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_asset_risks_under_attack { - local_req_builder = local_req_builder.query(&[( - "filter[asset.risks.under_attack]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_asset_risks_is_publicly_accessible { - local_req_builder = local_req_builder.query(&[( - "filter[asset.risks.is_publicly_accessible]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_asset_risks_has_privileged_access { - local_req_builder = local_req_builder.query(&[( - "filter[asset.risks.has_privileged_access]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_asset_risks_has_access_to_sensitive_data { - local_req_builder = local_req_builder.query(&[( - "filter[asset.risks.has_access_to_sensitive_data]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_asset_environments { - local_req_builder = local_req_builder - .query(&[("filter[asset.environments]", &local_query_param.to_string())]); + local_req_builder.query(&[("sort", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_asset_teams { + if let Some(ref local_query_param) = filter_query { local_req_builder = - local_req_builder.query(&[("filter[asset.teams]", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = filter_asset_arch { - local_req_builder = - local_req_builder.query(&[("filter[asset.arch]", &local_query_param.to_string())]); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } }; - if let Some(ref local_query_param) = filter_asset_operating_system_name { - local_req_builder = local_req_builder.query(&[( - "filter[asset.operating_system.name]", - &local_query_param.to_string(), - )]); + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); }; - if let Some(ref local_query_param) = filter_asset_operating_system_version { - local_req_builder = local_req_builder.query(&[( - "filter[asset.operating_system.version]", - &local_query_param.to_string(), - )]); + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); }; + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringDatasetsListResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List hist signals. + pub async fn list_security_monitoring_histsignals( + &self, + params: ListSecurityMonitoringHistsignalsOptionalParams, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + datadog::Error, + > { + match self + .list_security_monitoring_histsignals_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List hist signals. + pub async fn list_security_monitoring_histsignals_with_http_info( + &self, + params: ListSecurityMonitoringHistsignalsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_monitoring_histsignals"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_security_monitoring_histsignals' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let filter_query = params.filter_query; + let filter_from = params.filter_from; + let filter_to = params.filter_to; + let sort = params.sort; + let page_cursor = params.page_cursor; + let page_limit = params.page_limit; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/siem-historical-detections/histsignals", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = filter_query { + local_req_builder = + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_from { + local_req_builder = local_req_builder.query(&[( + "filter[from]", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); + }; + if let Some(ref local_query_param) = filter_to { + local_req_builder = local_req_builder.query(&[( + "filter[to]", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); + }; + if let Some(ref local_query_param) = sort { + local_req_builder = + local_req_builder.query(&[("sort", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_cursor { + local_req_builder = + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List the entity context sync configurations for Cloud SIEM. Each configuration connects Cloud SIEM + /// to an external source that provides entities (for example, users from an identity provider) for use + /// in signals and the entity explorer. + pub async fn list_security_monitoring_integration_configs( + &self, + params: ListSecurityMonitoringIntegrationConfigsOptionalParams, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigsResponse, + datadog::Error, + > { + match self + .list_security_monitoring_integration_configs_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List the entity context sync configurations for Cloud SIEM. Each configuration connects Cloud SIEM + /// to an external source that provides entities (for example, users from an identity provider) for use + /// in signals and the entity explorer. + pub async fn list_security_monitoring_integration_configs_with_http_info( + &self, + params: ListSecurityMonitoringIntegrationConfigsOptionalParams, + ) -> Result< + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigsResponse, + >, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_monitoring_integration_configs"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_security_monitoring_integration_configs' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let filter_integration_type = params.filter_integration_type; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security_monitoring/configuration/integration_config", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = filter_integration_type { + local_req_builder = local_req_builder + .query(&[("filter[integration_type]", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringIntegrationConfigsResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List rules. + pub async fn list_security_monitoring_rules( + &self, + params: ListSecurityMonitoringRulesOptionalParams, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringListRulesResponse, + datadog::Error, + > { + match self + .list_security_monitoring_rules_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List rules. + pub async fn list_security_monitoring_rules_with_http_info( + &self, + params: ListSecurityMonitoringRulesOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_monitoring_rules"; + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let query = params.query; + let sort = params.sort; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security_monitoring/rules", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = query { + local_req_builder = + local_req_builder.query(&[("query", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = sort { + local_req_builder = + local_req_builder.query(&[("sort", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// The list endpoint returns security signals that match a search query. + /// Both this endpoint and the POST endpoint can be used interchangeably when listing + /// security signals. + pub async fn list_security_monitoring_signals( + &self, + params: ListSecurityMonitoringSignalsOptionalParams, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + datadog::Error, + > { + match self + .list_security_monitoring_signals_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + pub fn list_security_monitoring_signals_with_pagination( + &self, + mut params: ListSecurityMonitoringSignalsOptionalParams, + ) -> impl Stream< + Item = Result< + crate::datadogV2::model::SecurityMonitoringSignal, + datadog::Error, + >, + > + '_ { + try_stream! { + let mut page_size: i32 = 10; + if params.page_limit.is_none() { + params.page_limit = Some(page_size); + } else { + page_size = params.page_limit.unwrap().clone(); + } + loop { + let resp = self.list_security_monitoring_signals(params.clone()).await?; + let Some(data) = resp.data else { break }; + + let r = data; + let count = r.len(); + for team in r { + yield team; + } + if count == 0 { + break; + } + let Some(meta) = resp.meta else { break }; + let Some(page) = meta.page else { break }; + let Some(after) = page.after else { break }; + + params.page_cursor = Some(after); + } + } + } + + /// The list endpoint returns security signals that match a search query. + /// Both this endpoint and the POST endpoint can be used interchangeably when listing + /// security signals. + pub async fn list_security_monitoring_signals_with_http_info( + &self, + params: ListSecurityMonitoringSignalsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_monitoring_signals"; + + // unbox and build optional parameters + let filter_query = params.filter_query; + let filter_from = params.filter_from; + let filter_to = params.filter_to; + let sort = params.sort; + let page_cursor = params.page_cursor; + let page_limit = params.page_limit; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security_monitoring/signals", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = filter_query { + local_req_builder = + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_from { + local_req_builder = local_req_builder.query(&[( + "filter[from]", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); + }; + if let Some(ref local_query_param) = filter_to { + local_req_builder = local_req_builder.query(&[( + "filter[to]", + &local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + )]); + }; + if let Some(ref local_query_param) = sort { + local_req_builder = + local_req_builder.query(&[("sort", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_cursor { + local_req_builder = + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get the list of all suppression rules. + pub async fn list_security_monitoring_suppressions( + &self, + params: ListSecurityMonitoringSuppressionsOptionalParams, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringPaginatedSuppressionsResponse, + datadog::Error, + > { + match self + .list_security_monitoring_suppressions_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get the list of all suppression rules. + pub async fn list_security_monitoring_suppressions_with_http_info( + &self, + params: ListSecurityMonitoringSuppressionsOptionalParams, + ) -> Result< + datadog::ResponseContent< + crate::datadogV2::model::SecurityMonitoringPaginatedSuppressionsResponse, + >, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_security_monitoring_suppressions"; + + // unbox and build optional parameters + let query = params.query; + let sort = params.sort; + let page_size = params.page_size; + let page_number = params.page_number; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security_monitoring/configuration/suppressions", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = query { + local_req_builder = + local_req_builder.query(&[("query", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = sort { + local_req_builder = + local_req_builder.query(&[("sort", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringPaginatedSuppressionsResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get the rulesets relevant for code generation for the authenticated user. + pub async fn list_static_analysis_codegen_rulesets( + &self, + ) -> Result< + crate::datadogV2::model::SastRulesetsResponse, + datadog::Error, + > { + match self + .list_static_analysis_codegen_rulesets_with_http_info() + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get the rulesets relevant for code generation for the authenticated user. + pub async fn list_static_analysis_codegen_rulesets_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_static_analysis_codegen_rulesets"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_static_analysis_codegen_rulesets' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/static-analysis/codegen/rulesets", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get a list of vulnerabilities. + /// + /// ### Pagination + /// + /// Pagination is enabled by default in both `vulnerabilities` and `assets`. The size of the page varies depending on the endpoint and cannot be modified. To automate the request of the next page, you can use the links section in the response. + /// + /// This endpoint will return paginated responses. The pages are stored in the links section of the response: + /// + /// ```JSON + /// { + /// "data": [...], + /// "meta": {...}, + /// "links": { + /// "self": " + /// "first": " + /// "last": " + /// "next": " + /// } + /// } + /// ``` + /// + /// + /// - `links.previous` is empty if the first page is requested. + /// - `links.next` is empty if the last page is requested. + /// + /// #### Token + /// + /// Vulnerabilities can be created, updated or deleted at any point in time. + /// + /// Upon the first request, a token is created to ensure consistency across subsequent paginated requests. + /// + /// A token is valid only for 24 hours. + /// + /// #### First request + /// + /// We consider a request to be the first request when there is no `page[token]` parameter. + /// + /// The response of this first request contains the newly created token in the `links` section. + /// + /// This token can then be used in the subsequent paginated requests. + /// + /// *Note: The first request may take longer to complete than subsequent requests.* + /// + /// #### Subsequent requests + /// + /// Any request containing valid `page[token]` and `page[number]` parameters will be considered a subsequent request. + /// + /// If the `token` is invalid, a `404` response will be returned. + /// + /// If the page `number` is invalid, a `400` response will be returned. + /// + /// The returned `token` is valid for all requests in the pagination sequence. To send paginated requests in parallel, reuse the same `token` and change only the `page[number]` parameter. + /// + /// ### Filtering + /// + /// The request can include some filter parameters to filter the data to be retrieved. The format of the filter parameters follows the [JSON:API format](): `filter[$prop_name]`, where `prop_name` is the property name in the entity being filtered by. + /// + /// All filters can include multiple values, where data will be filtered with an OR clause: `filter[title]=Title1,Title2` will filter all vulnerabilities where title is equal to `Title1` OR `Title2`. + /// + /// String filters are case sensitive. + /// + /// Boolean filters accept `true` or `false` as values. + /// + /// Number filters must include an operator as a second filter input: `filter[$prop_name][$operator]`. For example, for the vulnerabilities endpoint: `filter[cvss.base.score][lte]=8`. + /// + /// Available operators are: `eq` (==), `lt` (<), `lte` (<=), `gt` (>) and `gte` (>=). + /// + /// ### Metadata + /// + /// Following [JSON:API format](), object including non-standard meta-information. + /// + /// This endpoint includes the meta member in the response. For more details on each of the properties included in this section, check the endpoints response tables. + /// + /// ```JSON + /// { + /// "data": [...], + /// "meta": { + /// "total": 1500, + /// "count": 18732, + /// "token": "some_token" + /// }, + /// "links": {...} + /// } + /// ``` + /// ### Extensions + /// + /// Requests may include extensions to modify the behavior of the requested endpoint. The filter parameters follow the [JSON:API format]() format: `ext:$extension_name`, where `extension_name` is the name of the modifier that is being applied. + /// + /// Extensions can only include one value: `ext:modifier=value`. + pub async fn list_vulnerabilities( + &self, + params: ListVulnerabilitiesOptionalParams, + ) -> Result< + crate::datadogV2::model::ListVulnerabilitiesResponse, + datadog::Error, + > { + match self.list_vulnerabilities_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get a list of vulnerabilities. + /// + /// ### Pagination + /// + /// Pagination is enabled by default in both `vulnerabilities` and `assets`. The size of the page varies depending on the endpoint and cannot be modified. To automate the request of the next page, you can use the links section in the response. + /// + /// This endpoint will return paginated responses. The pages are stored in the links section of the response: + /// + /// ```JSON + /// { + /// "data": [...], + /// "meta": {...}, + /// "links": { + /// "self": " + /// "first": " + /// "last": " + /// "next": " + /// } + /// } + /// ``` + /// + /// + /// - `links.previous` is empty if the first page is requested. + /// - `links.next` is empty if the last page is requested. + /// + /// #### Token + /// + /// Vulnerabilities can be created, updated or deleted at any point in time. + /// + /// Upon the first request, a token is created to ensure consistency across subsequent paginated requests. + /// + /// A token is valid only for 24 hours. + /// + /// #### First request + /// + /// We consider a request to be the first request when there is no `page[token]` parameter. + /// + /// The response of this first request contains the newly created token in the `links` section. + /// + /// This token can then be used in the subsequent paginated requests. + /// + /// *Note: The first request may take longer to complete than subsequent requests.* + /// + /// #### Subsequent requests + /// + /// Any request containing valid `page[token]` and `page[number]` parameters will be considered a subsequent request. + /// + /// If the `token` is invalid, a `404` response will be returned. + /// + /// If the page `number` is invalid, a `400` response will be returned. + /// + /// The returned `token` is valid for all requests in the pagination sequence. To send paginated requests in parallel, reuse the same `token` and change only the `page[number]` parameter. + /// + /// ### Filtering + /// + /// The request can include some filter parameters to filter the data to be retrieved. The format of the filter parameters follows the [JSON:API format](): `filter[$prop_name]`, where `prop_name` is the property name in the entity being filtered by. + /// + /// All filters can include multiple values, where data will be filtered with an OR clause: `filter[title]=Title1,Title2` will filter all vulnerabilities where title is equal to `Title1` OR `Title2`. + /// + /// String filters are case sensitive. + /// + /// Boolean filters accept `true` or `false` as values. + /// + /// Number filters must include an operator as a second filter input: `filter[$prop_name][$operator]`. For example, for the vulnerabilities endpoint: `filter[cvss.base.score][lte]=8`. + /// + /// Available operators are: `eq` (==), `lt` (<), `lte` (<=), `gt` (>) and `gte` (>=). + /// + /// ### Metadata + /// + /// Following [JSON:API format](), object including non-standard meta-information. + /// + /// This endpoint includes the meta member in the response. For more details on each of the properties included in this section, check the endpoints response tables. + /// + /// ```JSON + /// { + /// "data": [...], + /// "meta": { + /// "total": 1500, + /// "count": 18732, + /// "token": "some_token" + /// }, + /// "links": {...} + /// } + /// ``` + /// ### Extensions + /// + /// Requests may include extensions to modify the behavior of the requested endpoint. The filter parameters follow the [JSON:API format]() format: `ext:$extension_name`, where `extension_name` is the name of the modifier that is being applied. + /// + /// Extensions can only include one value: `ext:modifier=value`. + pub async fn list_vulnerabilities_with_http_info( + &self, + params: ListVulnerabilitiesOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_vulnerabilities"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_vulnerabilities' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_token = params.page_token; + let page_number = params.page_number; + let filter_type = params.filter_type; + let filter_cvss_base_score_op = params.filter_cvss_base_score_op; + let filter_cvss_base_severity = params.filter_cvss_base_severity; + let filter_cvss_base_vector = params.filter_cvss_base_vector; + let filter_cvss_datadog_score_op = params.filter_cvss_datadog_score_op; + let filter_cvss_datadog_severity = params.filter_cvss_datadog_severity; + let filter_cvss_datadog_vector = params.filter_cvss_datadog_vector; + let filter_status = params.filter_status; + let filter_tool = params.filter_tool; + let filter_library_name = params.filter_library_name; + let filter_library_version = params.filter_library_version; + let filter_advisory_id = params.filter_advisory_id; + let filter_risks_exploitation_probability = params.filter_risks_exploitation_probability; + let filter_risks_poc_exploit_available = params.filter_risks_poc_exploit_available; + let filter_risks_exploit_available = params.filter_risks_exploit_available; + let filter_risks_epss_score_op = params.filter_risks_epss_score_op; + let filter_risks_epss_severity = params.filter_risks_epss_severity; + let filter_language = params.filter_language; + let filter_ecosystem = params.filter_ecosystem; + let filter_code_location_location = params.filter_code_location_location; + let filter_code_location_file_path = params.filter_code_location_file_path; + let filter_code_location_method = params.filter_code_location_method; + let filter_fix_available = params.filter_fix_available; + let filter_repo_digests = params.filter_repo_digests; + let filter_origin = params.filter_origin; + let filter_running_kernel = params.filter_running_kernel; + let filter_asset_name = params.filter_asset_name; + let filter_asset_type = params.filter_asset_type; + let filter_asset_version_first = params.filter_asset_version_first; + let filter_asset_version_last = params.filter_asset_version_last; + let filter_asset_repository_url = params.filter_asset_repository_url; + let filter_asset_risks_in_production = params.filter_asset_risks_in_production; + let filter_asset_risks_under_attack = params.filter_asset_risks_under_attack; + let filter_asset_risks_is_publicly_accessible = + params.filter_asset_risks_is_publicly_accessible; + let filter_asset_risks_has_privileged_access = + params.filter_asset_risks_has_privileged_access; + let filter_asset_risks_has_access_to_sensitive_data = + params.filter_asset_risks_has_access_to_sensitive_data; + let filter_asset_environments = params.filter_asset_environments; + let filter_asset_teams = params.filter_asset_teams; + let filter_asset_arch = params.filter_asset_arch; + let filter_asset_operating_system_name = params.filter_asset_operating_system_name; + let filter_asset_operating_system_version = params.filter_asset_operating_system_version; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/vulnerabilities", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_token { + local_req_builder = + local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_type { + local_req_builder = + local_req_builder.query(&[("filter[type]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_cvss_base_score_op { + local_req_builder = local_req_builder.query(&[( + "filter[cvss.base.score][`$op`]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_cvss_base_severity { + local_req_builder = local_req_builder + .query(&[("filter[cvss.base.severity]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_cvss_base_vector { + local_req_builder = local_req_builder + .query(&[("filter[cvss.base.vector]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_cvss_datadog_score_op { + local_req_builder = local_req_builder.query(&[( + "filter[cvss.datadog.score][`$op`]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_cvss_datadog_severity { + local_req_builder = local_req_builder.query(&[( + "filter[cvss.datadog.severity]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_cvss_datadog_vector { + local_req_builder = local_req_builder.query(&[( + "filter[cvss.datadog.vector]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_status { + local_req_builder = + local_req_builder.query(&[("filter[status]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_tool { + local_req_builder = + local_req_builder.query(&[("filter[tool]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_library_name { + local_req_builder = local_req_builder + .query(&[("filter[library.name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_library_version { + local_req_builder = local_req_builder + .query(&[("filter[library.version]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_advisory_id { + local_req_builder = + local_req_builder.query(&[("filter[advisory.id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_risks_exploitation_probability { + local_req_builder = local_req_builder.query(&[( + "filter[risks.exploitation_probability]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_risks_poc_exploit_available { + local_req_builder = local_req_builder.query(&[( + "filter[risks.poc_exploit_available]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_risks_exploit_available { + local_req_builder = local_req_builder.query(&[( + "filter[risks.exploit_available]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_risks_epss_score_op { + local_req_builder = local_req_builder.query(&[( + "filter[risks.epss.score][`$op`]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_risks_epss_severity { + local_req_builder = local_req_builder.query(&[( + "filter[risks.epss.severity]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_language { + local_req_builder = + local_req_builder.query(&[("filter[language]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_ecosystem { + local_req_builder = + local_req_builder.query(&[("filter[ecosystem]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_code_location_location { + local_req_builder = local_req_builder.query(&[( + "filter[code_location.location]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_code_location_file_path { + local_req_builder = local_req_builder.query(&[( + "filter[code_location.file_path]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_code_location_method { + local_req_builder = local_req_builder.query(&[( + "filter[code_location.method]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_fix_available { + local_req_builder = local_req_builder + .query(&[("filter[fix_available]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_repo_digests { + local_req_builder = local_req_builder + .query(&[("filter[repo_digests]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_origin { + local_req_builder = + local_req_builder.query(&[("filter[origin]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_running_kernel { + local_req_builder = local_req_builder + .query(&[("filter[running_kernel]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_name { + local_req_builder = + local_req_builder.query(&[("filter[asset.name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_type { + local_req_builder = + local_req_builder.query(&[("filter[asset.type]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_version_first { + local_req_builder = local_req_builder.query(&[( + "filter[asset.version.first]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_version_last { + local_req_builder = local_req_builder + .query(&[("filter[asset.version.last]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_repository_url { + local_req_builder = local_req_builder.query(&[( + "filter[asset.repository_url]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_risks_in_production { + local_req_builder = local_req_builder.query(&[( + "filter[asset.risks.in_production]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_risks_under_attack { + local_req_builder = local_req_builder.query(&[( + "filter[asset.risks.under_attack]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_risks_is_publicly_accessible { + local_req_builder = local_req_builder.query(&[( + "filter[asset.risks.is_publicly_accessible]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_risks_has_privileged_access { + local_req_builder = local_req_builder.query(&[( + "filter[asset.risks.has_privileged_access]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_risks_has_access_to_sensitive_data { + local_req_builder = local_req_builder.query(&[( + "filter[asset.risks.has_access_to_sensitive_data]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_environments { + local_req_builder = local_req_builder + .query(&[("filter[asset.environments]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_teams { + local_req_builder = + local_req_builder.query(&[("filter[asset.teams]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_arch { + local_req_builder = + local_req_builder.query(&[("filter[asset.arch]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_asset_operating_system_name { + local_req_builder = local_req_builder.query(&[( + "filter[asset.operating_system.name]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_asset_operating_system_version { + local_req_builder = local_req_builder.query(&[( + "filter[asset.operating_system.version]", + &local_query_param.to_string(), + )]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Get a list of vulnerable assets. + /// + /// ### Pagination + /// + /// Please review the [Pagination section for the "List Vulnerabilities"](#pagination) endpoint. + /// + /// ### Filtering + /// + /// Please review the [Filtering section for the "List Vulnerabilities"](#filtering) endpoint. + /// + /// ### Metadata + /// + /// Please review the [Metadata section for the "List Vulnerabilities"](#metadata) endpoint. + pub async fn list_vulnerable_assets( + &self, + params: ListVulnerableAssetsOptionalParams, + ) -> Result< + crate::datadogV2::model::ListVulnerableAssetsResponse, + datadog::Error, + > { + match self.list_vulnerable_assets_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Get a list of vulnerable assets. + /// + /// ### Pagination + /// + /// Please review the [Pagination section for the "List Vulnerabilities"](#pagination) endpoint. + /// + /// ### Filtering + /// + /// Please review the [Filtering section for the "List Vulnerabilities"](#filtering) endpoint. + /// + /// ### Metadata + /// + /// Please review the [Metadata section for the "List Vulnerabilities"](#metadata) endpoint. + pub async fn list_vulnerable_assets_with_http_info( + &self, + params: ListVulnerableAssetsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_vulnerable_assets"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_vulnerable_assets' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_token = params.page_token; + let page_number = params.page_number; + let filter_name = params.filter_name; + let filter_type = params.filter_type; + let filter_version_first = params.filter_version_first; + let filter_version_last = params.filter_version_last; + let filter_repository_url = params.filter_repository_url; + let filter_risks_in_production = params.filter_risks_in_production; + let filter_risks_under_attack = params.filter_risks_under_attack; + let filter_risks_is_publicly_accessible = params.filter_risks_is_publicly_accessible; + let filter_risks_has_privileged_access = params.filter_risks_has_privileged_access; + let filter_risks_has_access_to_sensitive_data = + params.filter_risks_has_access_to_sensitive_data; + let filter_environments = params.filter_environments; + let filter_teams = params.filter_teams; + let filter_arch = params.filter_arch; + let filter_operating_system_name = params.filter_operating_system_name; + let filter_operating_system_version = params.filter_operating_system_version; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/vulnerable-assets", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_token { + local_req_builder = + local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_name { + local_req_builder = + local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_type { + local_req_builder = + local_req_builder.query(&[("filter[type]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_version_first { + local_req_builder = local_req_builder + .query(&[("filter[version.first]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_version_last { + local_req_builder = local_req_builder + .query(&[("filter[version.last]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_repository_url { + local_req_builder = local_req_builder + .query(&[("filter[repository_url]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_risks_in_production { + local_req_builder = local_req_builder.query(&[( + "filter[risks.in_production]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_risks_under_attack { + local_req_builder = local_req_builder + .query(&[("filter[risks.under_attack]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_risks_is_publicly_accessible { + local_req_builder = local_req_builder.query(&[( + "filter[risks.is_publicly_accessible]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_risks_has_privileged_access { + local_req_builder = local_req_builder.query(&[( + "filter[risks.has_privileged_access]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_risks_has_access_to_sensitive_data { + local_req_builder = local_req_builder.query(&[( + "filter[risks.has_access_to_sensitive_data]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_environments { + local_req_builder = local_req_builder + .query(&[("filter[environments]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_teams { + local_req_builder = + local_req_builder.query(&[("filter[teams]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_arch { + local_req_builder = + local_req_builder.query(&[("filter[arch]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_operating_system_name { + local_req_builder = local_req_builder.query(&[( + "filter[operating_system.name]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_operating_system_version { + local_req_builder = local_req_builder.query(&[( + "filter[operating_system.version]", + &local_query_param.to_string(), + )]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Mute or unmute security findings. + /// You can mute or unmute up to 100 security findings per request. The request body must include `is_muted` and `reason` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: + /// - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `OTHER`, `NO_FIX`, `DUPLICATE`, `RISK_ACCEPTED`. + /// - To unmute a finding: `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, `OTHER`. + pub async fn mute_security_findings( + &self, + body: crate::datadogV2::model::MuteFindingsRequest, + ) -> Result< + crate::datadogV2::model::MuteFindingsResponse, + datadog::Error, + > { + match self.mute_security_findings_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Mute or unmute security findings. + /// You can mute or unmute up to 100 security findings per request. The request body must include `is_muted` and `reason` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: + /// - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `OTHER`, `NO_FIX`, `DUPLICATE`, `RISK_ACCEPTED`. + /// - To unmute a finding: `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, `OTHER`. + pub async fn mute_security_findings_with_http_info( + &self, + body: crate::datadogV2::model::MuteFindingsRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.mute_security_findings"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/findings/mute", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. + pub async fn patch_signal_notification_rule( + &self, + id: String, + body: crate::datadogV2::model::PatchNotificationRuleParameters, + ) -> Result< + crate::datadogV2::model::NotificationRuleResponse, + datadog::Error, + > { + match self + .patch_signal_notification_rule_with_http_info(id, body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. + pub async fn patch_signal_notification_rule_with_http_info( + &self, + id: String, + body: crate::datadogV2::model::PatchNotificationRuleParameters, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.patch_signal_notification_rule"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/signals/notification_rules/{id}", + local_configuration.get_operation_host(operation_id), + id = datadog::urlencode(id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. + pub async fn patch_vulnerability_notification_rule( + &self, + id: String, + body: crate::datadogV2::model::PatchNotificationRuleParameters, + ) -> Result< + crate::datadogV2::model::NotificationRuleResponse, + datadog::Error, + > { + match self + .patch_vulnerability_notification_rule_with_http_info(id, body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. + pub async fn patch_vulnerability_notification_rule_with_http_info( + &self, + id: String, + body: crate::datadogV2::model::PatchNotificationRuleParameters, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.patch_vulnerability_notification_rule"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/vulnerabilities/notification_rules/{id}", + local_configuration.get_operation_host(operation_id), + id = datadog::urlencode(id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Reorder the list of due date rules for the current organization. + pub async fn reorder_security_findings_automation_due_date_rules( + &self, + body: crate::datadogV2::model::DueDateRuleReorderRequest, + ) -> Result< + crate::datadogV2::model::DueDateRuleReorderRequest, + datadog::Error, + > { + match self + .reorder_security_findings_automation_due_date_rules_with_http_info(body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Reorder the list of due date rules for the current organization. + pub async fn reorder_security_findings_automation_due_date_rules_with_http_info( + &self, + body: crate::datadogV2::model::DueDateRuleReorderRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.reorder_security_findings_automation_due_date_rules"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.reorder_security_findings_automation_due_date_rules' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/findings/automation/due_date_rules/reorder", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Reorder the list of mute rules for the current organization. + pub async fn reorder_security_findings_automation_mute_rules( + &self, + body: crate::datadogV2::model::MuteRuleReorderRequest, + ) -> Result< + crate::datadogV2::model::MuteRuleReorderRequest, + datadog::Error, + > { + match self + .reorder_security_findings_automation_mute_rules_with_http_info(body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Reorder the list of mute rules for the current organization. + pub async fn reorder_security_findings_automation_mute_rules_with_http_info( + &self, + body: crate::datadogV2::model::MuteRuleReorderRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.reorder_security_findings_automation_mute_rules"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: + "Operation 'v2.reorder_security_findings_automation_mute_rules' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/findings/automation/mute_rules/reorder", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -18137,6 +20935,52 @@ impl SecurityMonitoringAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -18147,7 +20991,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -18160,7 +21004,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -18171,27 +21015,18 @@ impl SecurityMonitoringAPI { } } - /// Get a list of vulnerable assets. - /// - /// ### Pagination - /// - /// Please review the [Pagination section for the "List Vulnerabilities"](#pagination) endpoint. - /// - /// ### Filtering - /// - /// Please review the [Filtering section for the "List Vulnerabilities"](#filtering) endpoint. - /// - /// ### Metadata - /// - /// Please review the [Metadata section for the "List Vulnerabilities"](#metadata) endpoint. - pub async fn list_vulnerable_assets( + /// Reorder the list of ticket creation rules for the current organization. + pub async fn reorder_security_findings_automation_ticket_creation_rules( &self, - params: ListVulnerableAssetsOptionalParams, + body: crate::datadogV2::model::TicketCreationRuleReorderRequest, ) -> Result< - crate::datadogV2::model::ListVulnerableAssetsResponse, - datadog::Error, + crate::datadogV2::model::TicketCreationRuleReorderRequest, + datadog::Error, > { - match self.list_vulnerable_assets_with_http_info(params).await { + match self + .reorder_security_findings_automation_ticket_creation_rules_with_http_info(body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -18205,146 +21040,207 @@ impl SecurityMonitoringAPI { } } - /// Get a list of vulnerable assets. - /// - /// ### Pagination - /// - /// Please review the [Pagination section for the "List Vulnerabilities"](#pagination) endpoint. - /// - /// ### Filtering - /// - /// Please review the [Filtering section for the "List Vulnerabilities"](#filtering) endpoint. - /// - /// ### Metadata - /// - /// Please review the [Metadata section for the "List Vulnerabilities"](#metadata) endpoint. - pub async fn list_vulnerable_assets_with_http_info( + /// Reorder the list of ticket creation rules for the current organization. + pub async fn reorder_security_findings_automation_ticket_creation_rules_with_http_info( + &self, + body: crate::datadogV2::model::TicketCreationRuleReorderRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.reorder_security_findings_automation_ticket_creation_rules"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.reorder_security_findings_automation_ticket_creation_rules' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/security/findings/automation/ticket_creation_rules/reorder", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Restores a custom detection rule to a previously saved historical version. + /// Only custom rules can be restored. Default and partner rules return 400. + /// The restore creates a new version entry; it does not overwrite history. + pub async fn restore_security_monitoring_rule( + &self, + rule_id: String, + version: i64, + ) -> Result< + crate::datadogV2::model::SecurityMonitoringRuleResponse, + datadog::Error, + > { + match self + .restore_security_monitoring_rule_with_http_info(rule_id, version) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Restores a custom detection rule to a previously saved historical version. + /// Only custom rules can be restored. Default and partner rules return 400. + /// The restore creates a new version entry; it does not overwrite history. + pub async fn restore_security_monitoring_rule_with_http_info( &self, - params: ListVulnerableAssetsOptionalParams, + rule_id: String, + version: i64, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_vulnerable_assets"; + let operation_id = "v2.restore_security_monitoring_rule"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_vulnerable_assets' is not enabled".to_string(), + msg: "Operation 'v2.restore_security_monitoring_rule' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let page_token = params.page_token; - let page_number = params.page_number; - let filter_name = params.filter_name; - let filter_type = params.filter_type; - let filter_version_first = params.filter_version_first; - let filter_version_last = params.filter_version_last; - let filter_repository_url = params.filter_repository_url; - let filter_risks_in_production = params.filter_risks_in_production; - let filter_risks_under_attack = params.filter_risks_under_attack; - let filter_risks_is_publicly_accessible = params.filter_risks_is_publicly_accessible; - let filter_risks_has_privileged_access = params.filter_risks_has_privileged_access; - let filter_risks_has_access_to_sensitive_data = - params.filter_risks_has_access_to_sensitive_data; - let filter_environments = params.filter_environments; - let filter_teams = params.filter_teams; - let filter_arch = params.filter_arch; - let filter_operating_system_name = params.filter_operating_system_name; - let filter_operating_system_version = params.filter_operating_system_version; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/vulnerable-assets", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security_monitoring/rules/{rule_id}/restore/{version}", + local_configuration.get_operation_host(operation_id), + rule_id = datadog::urlencode(rule_id), + version = version ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = page_token { - local_req_builder = - local_req_builder.query(&[("page[token]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_number { - local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_name { - local_req_builder = - local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_type { - local_req_builder = - local_req_builder.query(&[("filter[type]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_version_first { - local_req_builder = local_req_builder - .query(&[("filter[version.first]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_version_last { - local_req_builder = local_req_builder - .query(&[("filter[version.last]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_repository_url { - local_req_builder = local_req_builder - .query(&[("filter[repository_url]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_risks_in_production { - local_req_builder = local_req_builder.query(&[( - "filter[risks.in_production]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_risks_under_attack { - local_req_builder = local_req_builder - .query(&[("filter[risks.under_attack]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_risks_is_publicly_accessible { - local_req_builder = local_req_builder.query(&[( - "filter[risks.is_publicly_accessible]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_risks_has_privileged_access { - local_req_builder = local_req_builder.query(&[( - "filter[risks.has_privileged_access]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_risks_has_access_to_sensitive_data { - local_req_builder = local_req_builder.query(&[( - "filter[risks.has_access_to_sensitive_data]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_environments { - local_req_builder = local_req_builder - .query(&[("filter[environments]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_teams { - local_req_builder = - local_req_builder.query(&[("filter[teams]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_arch { - local_req_builder = - local_req_builder.query(&[("filter[arch]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_operating_system_name { - local_req_builder = local_req_builder.query(&[( - "filter[operating_system.name]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_operating_system_version { - local_req_builder = local_req_builder.query(&[( - "filter[operating_system.version]", - &local_query_param.to_string(), - )]); - }; + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -18388,7 +21284,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -18401,7 +21297,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -18412,18 +21308,13 @@ impl SecurityMonitoringAPI { } } - /// Mute or unmute security findings. - /// You can mute or unmute up to 100 security findings per request. The request body must include `is_muted` and `reason` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: - /// - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `OTHER`, `NO_FIX`, `DUPLICATE`, `RISK_ACCEPTED`. - /// - To unmute a finding: `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, `OTHER`. - pub async fn mute_security_findings( + /// Run a historical job. + pub async fn run_historical_job( &self, - body: crate::datadogV2::model::MuteFindingsRequest, - ) -> Result< - crate::datadogV2::model::MuteFindingsResponse, - datadog::Error, - > { - match self.mute_security_findings_with_http_info(body).await { + body: crate::datadogV2::model::RunHistoricalJobRequest, + ) -> Result> + { + match self.run_historical_job_with_http_info(body).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -18437,28 +21328,33 @@ impl SecurityMonitoringAPI { } } - /// Mute or unmute security findings. - /// You can mute or unmute up to 100 security findings per request. The request body must include `is_muted` and `reason` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: - /// - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `OTHER`, `NO_FIX`, `DUPLICATE`, `RISK_ACCEPTED`. - /// - To unmute a finding: `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, `OTHER`. - pub async fn mute_security_findings_with_http_info( + /// Run a historical job. + pub async fn run_historical_job_with_http_info( &self, - body: crate::datadogV2::model::MuteFindingsRequest, + body: crate::datadogV2::model::RunHistoricalJobRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.mute_security_findings"; + let operation_id = "v2.run_historical_job"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.run_historical_job' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/findings/mute", + "{}/api/v2/siem-historical-detections/jobs", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -18549,9 +21445,8 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -18562,7 +21457,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -18573,19 +21468,21 @@ impl SecurityMonitoringAPI { } } - /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. - pub async fn patch_signal_notification_rule( + /// Get a list of security findings that match a search query. [See the schema for security findings](). + /// + /// ### Query Syntax + /// + /// The API uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. + /// + /// Example: `@severity:(critical OR high) @status:open team:platform` + pub async fn search_security_findings( &self, - id: String, - body: crate::datadogV2::model::PatchNotificationRuleParameters, + body: crate::datadogV2::model::SecurityFindingsSearchRequest, ) -> Result< - crate::datadogV2::model::NotificationRuleResponse, - datadog::Error, + crate::datadogV2::model::ListSecurityFindingsResponse, + datadog::Error, > { - match self - .patch_signal_notification_rule_with_http_info(id, body) - .await - { + match self.search_security_findings_with_http_info(body).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -18595,31 +21492,81 @@ impl SecurityMonitoringAPI { ))) } } - Err(err) => Err(err), + Err(err) => Err(err), + } + } + + pub fn search_security_findings_with_pagination( + &self, + mut body: crate::datadogV2::model::SecurityFindingsSearchRequest, + ) -> impl Stream< + Item = Result< + crate::datadogV2::model::SecurityFindingsData, + datadog::Error, + >, + > + '_ { + try_stream! { + let mut page_size: i64 = 10; + if body.data.is_none() { + body.data = Some(crate::datadogV2::model::SecurityFindingsSearchRequestData::new()); + } + if body.data.as_ref().unwrap().attributes.is_none() { + body.data.as_mut().unwrap().attributes = Some(crate::datadogV2::model::SecurityFindingsSearchRequestDataAttributes::new()); + } + if body.data.as_ref().unwrap().attributes.as_ref().unwrap().page.is_none() { + body.data.as_mut().unwrap().attributes.as_mut().unwrap().page = Some(crate::datadogV2::model::SecurityFindingsSearchRequestPage::new()); + } + if body.data.as_ref().unwrap().attributes.as_ref().unwrap().page.as_ref().unwrap().limit.is_none() { + body.data.as_mut().unwrap().attributes.as_mut().unwrap().page.as_mut().unwrap().limit = Some(page_size); + } else { + page_size = body.data.as_ref().unwrap().attributes.as_ref().unwrap().page.as_ref().unwrap().limit.unwrap().clone(); + } + loop { + let resp = self.search_security_findings( body.clone(),).await?; + let Some(data) = resp.data else { break }; + + let r = data; + let count = r.len(); + for team in r { + yield team; + } + if count == 0 { + break; + } + let Some(meta) = resp.meta else { break }; + let Some(page) = meta.page else { break }; + let Some(after) = page.after else { break }; + + body.data.as_mut().unwrap().attributes.as_mut().unwrap().page.as_mut().unwrap().cursor = Some(after); + } } } - /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. - pub async fn patch_signal_notification_rule_with_http_info( + /// Get a list of security findings that match a search query. [See the schema for security findings](). + /// + /// ### Query Syntax + /// + /// The API uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. + /// + /// Example: `@severity:(critical OR high) @status:open team:platform` + pub async fn search_security_findings_with_http_info( &self, - id: String, - body: crate::datadogV2::model::PatchNotificationRuleParameters, + body: crate::datadogV2::model::SecurityFindingsSearchRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.patch_signal_notification_rule"; + let operation_id = "v2.search_security_findings"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/signals/notification_rules/{id}", - local_configuration.get_operation_host(operation_id), - id = datadog::urlencode(id) + "{}/api/v2/security/findings/search", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -18710,7 +21657,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -18723,7 +21670,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -18734,17 +21681,16 @@ impl SecurityMonitoringAPI { } } - /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. - pub async fn patch_vulnerability_notification_rule( + /// Search hist signals. + pub async fn search_security_monitoring_histsignals( &self, - id: String, - body: crate::datadogV2::model::PatchNotificationRuleParameters, + params: SearchSecurityMonitoringHistsignalsOptionalParams, ) -> Result< - crate::datadogV2::model::NotificationRuleResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + datadog::Error, > { match self - .patch_vulnerability_notification_rule_with_http_info(id, body) + .search_security_monitoring_histsignals_with_http_info(params) .await { Ok(response_content) => { @@ -18760,27 +21706,37 @@ impl SecurityMonitoringAPI { } } - /// Partially update the notification rule. All fields are optional; if a field is not provided, it is not updated. - pub async fn patch_vulnerability_notification_rule_with_http_info( + /// Search hist signals. + pub async fn search_security_monitoring_histsignals_with_http_info( &self, - id: String, - body: crate::datadogV2::model::PatchNotificationRuleParameters, + params: SearchSecurityMonitoringHistsignalsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.patch_vulnerability_notification_rule"; + let operation_id = "v2.search_security_monitoring_histsignals"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.search_security_monitoring_histsignals' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let body = params.body; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/vulnerabilities/notification_rules/{id}", - local_configuration.get_operation_host(operation_id), - id = datadog::urlencode(id) + "{}/api/v2/siem-historical-detections/histsignals/search", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -18871,9 +21827,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -18884,7 +21841,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -18895,19 +21852,18 @@ impl SecurityMonitoringAPI { } } - /// Restores a custom detection rule to a previously saved historical version. - /// Only custom rules can be restored. Default and partner rules return 400. - /// The restore creates a new version entry; it does not overwrite history. - pub async fn restore_security_monitoring_rule( + /// Returns security signals that match a search query. + /// Both this endpoint and the GET endpoint can be used interchangeably for listing + /// security signals. + pub async fn search_security_monitoring_signals( &self, - rule_id: String, - version: i64, + params: SearchSecurityMonitoringSignalsOptionalParams, ) -> Result< - crate::datadogV2::model::SecurityMonitoringRuleResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + datadog::Error, > { match self - .restore_security_monitoring_rule_with_http_info(rule_id, version) + .search_security_monitoring_signals_with_http_info(params) .await { Ok(response_content) => { @@ -18923,148 +21879,69 @@ impl SecurityMonitoringAPI { } } - /// Restores a custom detection rule to a previously saved historical version. - /// Only custom rules can be restored. Default and partner rules return 400. - /// The restore creates a new version entry; it does not overwrite history. - pub async fn restore_security_monitoring_rule_with_http_info( + pub fn search_security_monitoring_signals_with_pagination( &self, - rule_id: String, - version: i64, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.restore_security_monitoring_rule"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.restore_security_monitoring_rule' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules/{rule_id}/restore/{version}", - local_configuration.get_operation_host(operation_id), - rule_id = datadog::urlencode(rule_id), - version = version - ); - let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) + mut params: SearchSecurityMonitoringSignalsOptionalParams, + ) -> impl Stream< + Item = Result< + crate::datadogV2::model::SecurityMonitoringSignal, + datadog::Error, + >, + > + '_ { + try_stream! { + let mut page_size: i32 = 10; + if params.body.is_none() { + params.body = Some(crate::datadogV2::model::SecurityMonitoringSignalListRequest::new()); } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); + if params.body.as_ref().unwrap().page.is_none() { + params.body.as_mut().unwrap().page = Some(crate::datadogV2::model::SecurityMonitoringSignalListRequestPage::new()); + } + if params.body.as_ref().unwrap().page.as_ref().unwrap().limit.is_none() { + params.body.as_mut().unwrap().page.as_mut().unwrap().limit = Some(page_size); + } else { + page_size = params.body.as_ref().unwrap().page.as_ref().unwrap().limit.unwrap().clone(); + } + loop { + let resp = self.search_security_monitoring_signals(params.clone()).await?; + let Some(data) = resp.data else { break }; - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) + let r = data; + let count = r.len(); + for team in r { + yield team; } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Run a historical job. - pub async fn run_historical_job( - &self, - body: crate::datadogV2::model::RunHistoricalJobRequest, - ) -> Result> - { - match self.run_historical_job_with_http_info(body).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) + if count == 0 { + break; } + let Some(meta) = resp.meta else { break }; + let Some(page) = meta.page else { break }; + let Some(after) = page.after else { break }; + + params.body.as_mut().unwrap().page.as_mut().unwrap().cursor = Some(after); } - Err(err) => Err(err), } } - /// Run a historical job. - pub async fn run_historical_job_with_http_info( + /// Returns security signals that match a search query. + /// Both this endpoint and the GET endpoint can be used interchangeably for listing + /// security signals. + pub async fn search_security_monitoring_signals_with_http_info( &self, - body: crate::datadogV2::model::RunHistoricalJobRequest, + params: SearchSecurityMonitoringSignalsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.run_historical_job"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.run_historical_job' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } + let operation_id = "v2.search_security_monitoring_signals"; + + // unbox and build optional parameters + let body = params.body; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/jobs", + "{}/api/v2/security_monitoring/signals/search", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -19159,7 +22036,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) + match serde_json::from_str::< + crate::datadogV2::model::SecurityMonitoringSignalsListResponse, + >(&local_content) { Ok(e) => { return Ok(datadog::ResponseContent { @@ -19171,7 +22050,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -19182,21 +22061,18 @@ impl SecurityMonitoringAPI { } } - /// Get a list of security findings that match a search query. [See the schema for security findings](). - /// - /// ### Query Syntax - /// - /// The API uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. - /// - /// Example: `@severity:(critical OR high) @status:open team:platform` - pub async fn search_security_findings( + /// Send a notification preview to test that a notification rule's targets are properly configured. + pub async fn send_security_monitoring_notification_preview( &self, - body: crate::datadogV2::model::SecurityFindingsSearchRequest, + body: crate::datadogV2::model::CreateNotificationRuleParameters, ) -> Result< - crate::datadogV2::model::ListSecurityFindingsResponse, - datadog::Error, + crate::datadogV2::model::NotificationRulePreviewResponse, + datadog::Error, > { - match self.search_security_findings_with_http_info(body).await { + match self + .send_security_monitoring_notification_preview_with_http_info(body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -19210,75 +22086,22 @@ impl SecurityMonitoringAPI { } } - pub fn search_security_findings_with_pagination( - &self, - mut body: crate::datadogV2::model::SecurityFindingsSearchRequest, - ) -> impl Stream< - Item = Result< - crate::datadogV2::model::SecurityFindingsData, - datadog::Error, - >, - > + '_ { - try_stream! { - let mut page_size: i64 = 10; - if body.data.is_none() { - body.data = Some(crate::datadogV2::model::SecurityFindingsSearchRequestData::new()); - } - if body.data.as_ref().unwrap().attributes.is_none() { - body.data.as_mut().unwrap().attributes = Some(crate::datadogV2::model::SecurityFindingsSearchRequestDataAttributes::new()); - } - if body.data.as_ref().unwrap().attributes.as_ref().unwrap().page.is_none() { - body.data.as_mut().unwrap().attributes.as_mut().unwrap().page = Some(crate::datadogV2::model::SecurityFindingsSearchRequestPage::new()); - } - if body.data.as_ref().unwrap().attributes.as_ref().unwrap().page.as_ref().unwrap().limit.is_none() { - body.data.as_mut().unwrap().attributes.as_mut().unwrap().page.as_mut().unwrap().limit = Some(page_size); - } else { - page_size = body.data.as_ref().unwrap().attributes.as_ref().unwrap().page.as_ref().unwrap().limit.unwrap().clone(); - } - loop { - let resp = self.search_security_findings( body.clone(),).await?; - let Some(data) = resp.data else { break }; - - let r = data; - let count = r.len(); - for team in r { - yield team; - } - if count == 0 { - break; - } - let Some(meta) = resp.meta else { break }; - let Some(page) = meta.page else { break }; - let Some(after) = page.after else { break }; - - body.data.as_mut().unwrap().attributes.as_mut().unwrap().page.as_mut().unwrap().cursor = Some(after); - } - } - } - - /// Get a list of security findings that match a search query. [See the schema for security findings](). - /// - /// ### Query Syntax - /// - /// The API uses the logs query syntax. Findings attributes (living in the attributes.attributes. namespace) are prefixed by @ when queried. Tags are queried without a prefix. - /// - /// Example: `@severity:(critical OR high) @status:open team:platform` - pub async fn search_security_findings_with_http_info( + /// Send a notification preview to test that a notification rule's targets are properly configured. + pub async fn send_security_monitoring_notification_preview_with_http_info( &self, - body: crate::datadogV2::model::SecurityFindingsSearchRequest, + body: crate::datadogV2::model::CreateNotificationRuleParameters, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.search_security_findings"; + let operation_id = "v2.send_security_monitoring_notification_preview"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/findings/search", - local_configuration.get_operation_host(operation_id) - ); + "{}/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview", + local_configuration.get_operation_host(operation_id)); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -19371,7 +22194,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -19384,7 +22207,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -19395,16 +22218,17 @@ impl SecurityMonitoringAPI { } } - /// Search hist signals. - pub async fn search_security_monitoring_histsignals( + /// Test an existing rule. + pub async fn test_existing_security_monitoring_rule( &self, - params: SearchSecurityMonitoringHistsignalsOptionalParams, + rule_id: String, + body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringRuleTestResponse, + datadog::Error, > { match self - .search_security_monitoring_histsignals_with_http_info(params) + .test_existing_security_monitoring_rule_with_http_info(rule_id, body) .await { Ok(response_content) => { @@ -19420,34 +22244,24 @@ impl SecurityMonitoringAPI { } } - /// Search hist signals. - pub async fn search_security_monitoring_histsignals_with_http_info( + /// Test an existing rule. + pub async fn test_existing_security_monitoring_rule_with_http_info( &self, - params: SearchSecurityMonitoringHistsignalsOptionalParams, + rule_id: String, + body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.search_security_monitoring_histsignals"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.search_security_monitoring_histsignals' is not enabled" - .to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let body = params.body; + let operation_id = "v2.test_existing_security_monitoring_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/siem-historical-detections/histsignals/search", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security_monitoring/rules/{rule_id}/test", + local_configuration.get_operation_host(operation_id), + rule_id = datadog::urlencode(rule_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -19541,10 +22355,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -19555,7 +22368,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -19566,18 +22379,16 @@ impl SecurityMonitoringAPI { } } - /// Returns security signals that match a search query. - /// Both this endpoint and the GET endpoint can be used interchangeably for listing - /// security signals. - pub async fn search_security_monitoring_signals( + /// Test a rule. + pub async fn test_security_monitoring_rule( &self, - params: SearchSecurityMonitoringSignalsOptionalParams, + body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - datadog::Error, + crate::datadogV2::model::SecurityMonitoringRuleTestResponse, + datadog::Error, > { match self - .search_security_monitoring_signals_with_http_info(params) + .test_security_monitoring_rule_with_http_info(body) .await { Ok(response_content) => { @@ -19593,69 +22404,21 @@ impl SecurityMonitoringAPI { } } - pub fn search_security_monitoring_signals_with_pagination( - &self, - mut params: SearchSecurityMonitoringSignalsOptionalParams, - ) -> impl Stream< - Item = Result< - crate::datadogV2::model::SecurityMonitoringSignal, - datadog::Error, - >, - > + '_ { - try_stream! { - let mut page_size: i32 = 10; - if params.body.is_none() { - params.body = Some(crate::datadogV2::model::SecurityMonitoringSignalListRequest::new()); - } - if params.body.as_ref().unwrap().page.is_none() { - params.body.as_mut().unwrap().page = Some(crate::datadogV2::model::SecurityMonitoringSignalListRequestPage::new()); - } - if params.body.as_ref().unwrap().page.as_ref().unwrap().limit.is_none() { - params.body.as_mut().unwrap().page.as_mut().unwrap().limit = Some(page_size); - } else { - page_size = params.body.as_ref().unwrap().page.as_ref().unwrap().limit.unwrap().clone(); - } - loop { - let resp = self.search_security_monitoring_signals(params.clone()).await?; - let Some(data) = resp.data else { break }; - - let r = data; - let count = r.len(); - for team in r { - yield team; - } - if count == 0 { - break; - } - let Some(meta) = resp.meta else { break }; - let Some(page) = meta.page else { break }; - let Some(after) = page.after else { break }; - - params.body.as_mut().unwrap().page.as_mut().unwrap().cursor = Some(after); - } - } - } - - /// Returns security signals that match a search query. - /// Both this endpoint and the GET endpoint can be used interchangeably for listing - /// security signals. - pub async fn search_security_monitoring_signals_with_http_info( + /// Test a rule. + pub async fn test_security_monitoring_rule_with_http_info( &self, - params: SearchSecurityMonitoringSignalsOptionalParams, + body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.search_security_monitoring_signals"; - - // unbox and build optional parameters - let body = params.body; + let operation_id = "v2.test_security_monitoring_rule"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/signals/search", + "{}/api/v2/security_monitoring/rules/test", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -19750,10 +22513,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::SecurityMonitoringSignalsListResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -19764,7 +22526,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -19775,16 +22537,18 @@ impl SecurityMonitoringAPI { } } - /// Send a notification preview to test that a notification rule's targets are properly configured. - pub async fn send_security_monitoring_notification_preview( + /// Update a custom framework. + pub async fn update_custom_framework( &self, - body: crate::datadogV2::model::CreateNotificationRuleParameters, + handle: String, + version: String, + body: crate::datadogV2::model::UpdateCustomFrameworkRequest, ) -> Result< - crate::datadogV2::model::NotificationRulePreviewResponse, - datadog::Error, + crate::datadogV2::model::UpdateCustomFrameworkResponse, + datadog::Error, > { match self - .send_security_monitoring_notification_preview_with_http_info(body) + .update_custom_framework_with_http_info(handle, version, body) .await { Ok(response_content) => { @@ -19800,24 +22564,29 @@ impl SecurityMonitoringAPI { } } - /// Send a notification preview to test that a notification rule's targets are properly configured. - pub async fn send_security_monitoring_notification_preview_with_http_info( + /// Update a custom framework. + pub async fn update_custom_framework_with_http_info( &self, - body: crate::datadogV2::model::CreateNotificationRuleParameters, + handle: String, + version: String, + body: crate::datadogV2::model::UpdateCustomFrameworkRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.send_security_monitoring_notification_preview"; + let operation_id = "v2.update_custom_framework"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview", - local_configuration.get_operation_host(operation_id)); + "{}/api/v2/cloud_security_management/custom_frameworks/{handle}/{version}", + local_configuration.get_operation_host(operation_id), + handle = datadog::urlencode(handle), + version = datadog::urlencode(version) + ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -19908,7 +22677,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -19921,7 +22690,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -19932,19 +22701,16 @@ impl SecurityMonitoringAPI { } } - /// Test an existing rule. - pub async fn test_existing_security_monitoring_rule( + /// Assign or unassign security findings. + /// You can assign up to 100 security findings per request. Set `assignee_id` to the unique identifier of the Datadog user you want to assign the findings to. Omit `assignee_id` (or set it to `null`) to unassign the findings. Per-finding warnings and failures are returned in the response `meta` object. + pub async fn update_findings_assignee( &self, - rule_id: String, - body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, + body: crate::datadogV2::model::AssigneeRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringRuleTestResponse, - datadog::Error, + crate::datadogV2::model::AssigneeResponse, + datadog::Error, > { - match self - .test_existing_security_monitoring_rule_with_http_info(rule_id, body) - .await - { + match self.update_findings_assignee_with_http_info(body).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -19958,27 +22724,34 @@ impl SecurityMonitoringAPI { } } - /// Test an existing rule. - pub async fn test_existing_security_monitoring_rule_with_http_info( + /// Assign or unassign security findings. + /// You can assign up to 100 security findings per request. Set `assignee_id` to the unique identifier of the Datadog user you want to assign the findings to. Omit `assignee_id` (or set it to `null`) to unassign the findings. Per-finding warnings and failures are returned in the response `meta` object. + pub async fn update_findings_assignee_with_http_info( &self, - rule_id: String, - body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, + body: crate::datadogV2::model::AssigneeRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.test_existing_security_monitoring_rule"; + let operation_id = "v2.update_findings_assignee"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_findings_assignee' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules/{rule_id}/test", - local_configuration.get_operation_host(operation_id), - rule_id = datadog::urlencode(rule_id) + "{}/api/v2/security/findings/assignee", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -20069,9 +22842,8 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -20082,7 +22854,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -20093,16 +22865,16 @@ impl SecurityMonitoringAPI { } } - /// Test a rule. - pub async fn test_security_monitoring_rule( + /// Update resource filters. + pub async fn update_resource_evaluation_filters( &self, - body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, + body: crate::datadogV2::model::UpdateResourceEvaluationFiltersRequest, ) -> Result< - crate::datadogV2::model::SecurityMonitoringRuleTestResponse, - datadog::Error, + crate::datadogV2::model::UpdateResourceEvaluationFiltersResponse, + datadog::Error, > { match self - .test_security_monitoring_rule_with_http_info(body) + .update_resource_evaluation_filters_with_http_info(body) .await { Ok(response_content) => { @@ -20118,25 +22890,25 @@ impl SecurityMonitoringAPI { } } - /// Test a rule. - pub async fn test_security_monitoring_rule_with_http_info( + /// Update resource filters. + pub async fn update_resource_evaluation_filters_with_http_info( &self, - body: crate::datadogV2::model::SecurityMonitoringRuleTestRequest, + body: crate::datadogV2::model::UpdateResourceEvaluationFiltersRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.test_security_monitoring_rule"; + let operation_id = "v2.update_resource_evaluation_filters"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/rules/test", + "{}/api/v2/cloud_security_management/resource_filters", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -20227,9 +22999,10 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::UpdateResourceEvaluationFiltersResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -20240,7 +23013,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -20251,18 +23024,18 @@ impl SecurityMonitoringAPI { } } - /// Update a custom framework. - pub async fn update_custom_framework( + /// Update a specific security filter. + /// Returns the security filter object when the request is successful. + pub async fn update_security_filter( &self, - handle: String, - version: String, - body: crate::datadogV2::model::UpdateCustomFrameworkRequest, + security_filter_id: String, + body: crate::datadogV2::model::SecurityFilterUpdateRequest, ) -> Result< - crate::datadogV2::model::UpdateCustomFrameworkResponse, - datadog::Error, + crate::datadogV2::model::SecurityFilterResponse, + datadog::Error, > { match self - .update_custom_framework_with_http_info(handle, version, body) + .update_security_filter_with_http_info(security_filter_id, body) .await { Ok(response_content) => { @@ -20278,29 +23051,28 @@ impl SecurityMonitoringAPI { } } - /// Update a custom framework. - pub async fn update_custom_framework_with_http_info( + /// Update a specific security filter. + /// Returns the security filter object when the request is successful. + pub async fn update_security_filter_with_http_info( &self, - handle: String, - version: String, - body: crate::datadogV2::model::UpdateCustomFrameworkRequest, + security_filter_id: String, + body: crate::datadogV2::model::SecurityFilterUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_custom_framework"; + let operation_id = "v2.update_security_filter"; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/cloud_security_management/custom_frameworks/{handle}/{version}", + "{}/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}", local_configuration.get_operation_host(operation_id), - handle = datadog::urlencode(handle), - version = datadog::urlencode(version) + security_filter_id = datadog::urlencode(security_filter_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -20391,7 +23163,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -20404,7 +23176,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -20415,16 +23187,19 @@ impl SecurityMonitoringAPI { } } - /// Assign or unassign security findings. - /// You can assign up to 100 security findings per request. Set `assignee_id` to the unique identifier of the Datadog user you want to assign the findings to. Omit `assignee_id` (or set it to `null`) to unassign the findings. Per-finding warnings and failures are returned in the response `meta` object. - pub async fn update_findings_assignee( + /// Update an existing due date rule by ID. + pub async fn update_security_findings_automation_due_date_rule( &self, - body: crate::datadogV2::model::AssigneeRequest, + rule_id: uuid::Uuid, + body: crate::datadogV2::model::DueDateRuleUpdateRequest, ) -> Result< - crate::datadogV2::model::AssigneeResponse, - datadog::Error, + crate::datadogV2::model::DueDateRuleResponse, + datadog::Error, > { - match self.update_findings_assignee_with_http_info(body).await { + match self + .update_security_findings_automation_due_date_rule_with_http_info(rule_id, body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -20438,22 +23213,22 @@ impl SecurityMonitoringAPI { } } - /// Assign or unassign security findings. - /// You can assign up to 100 security findings per request. Set `assignee_id` to the unique identifier of the Datadog user you want to assign the findings to. Omit `assignee_id` (or set it to `null`) to unassign the findings. Per-finding warnings and failures are returned in the response `meta` object. - pub async fn update_findings_assignee_with_http_info( + /// Update an existing due date rule by ID. + pub async fn update_security_findings_automation_due_date_rule_with_http_info( &self, - body: crate::datadogV2::model::AssigneeRequest, + rule_id: uuid::Uuid, + body: crate::datadogV2::model::DueDateRuleUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_findings_assignee"; + let operation_id = "v2.update_security_findings_automation_due_date_rule"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_findings_assignee' is not enabled".to_string(), + msg: "Operation 'v2.update_security_findings_automation_due_date_rule' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -20461,11 +23236,12 @@ impl SecurityMonitoringAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security/findings/assignee", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security/findings/automation/due_date_rules/{rule_id}", + local_configuration.get_operation_host(operation_id), + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -20556,8 +23332,9 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -20568,7 +23345,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -20579,16 +23356,17 @@ impl SecurityMonitoringAPI { } } - /// Update resource filters. - pub async fn update_resource_evaluation_filters( + /// Update an existing mute rule by ID. + pub async fn update_security_findings_automation_mute_rule( &self, - body: crate::datadogV2::model::UpdateResourceEvaluationFiltersRequest, + rule_id: uuid::Uuid, + body: crate::datadogV2::model::MuteRuleUpdateRequest, ) -> Result< - crate::datadogV2::model::UpdateResourceEvaluationFiltersResponse, - datadog::Error, + crate::datadogV2::model::MuteRuleResponse, + datadog::Error, > { match self - .update_resource_evaluation_filters_with_http_info(body) + .update_security_findings_automation_mute_rule_with_http_info(rule_id, body) .await { Ok(response_content) => { @@ -20604,22 +23382,33 @@ impl SecurityMonitoringAPI { } } - /// Update resource filters. - pub async fn update_resource_evaluation_filters_with_http_info( + /// Update an existing mute rule by ID. + pub async fn update_security_findings_automation_mute_rule_with_http_info( &self, - body: crate::datadogV2::model::UpdateResourceEvaluationFiltersRequest, + rule_id: uuid::Uuid, + body: crate::datadogV2::model::MuteRuleUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_resource_evaluation_filters"; + let operation_id = "v2.update_security_findings_automation_mute_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_security_findings_automation_mute_rule' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/cloud_security_management/resource_filters", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/security/findings/automation/mute_rules/{rule_id}", + local_configuration.get_operation_host(operation_id), + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); @@ -20713,9 +23502,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::UpdateResourceEvaluationFiltersResponse, - >(&local_content) + match serde_json::from_str::(&local_content) { Ok(e) => { return Ok(datadog::ResponseContent { @@ -20727,7 +23514,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -20738,18 +23525,17 @@ impl SecurityMonitoringAPI { } } - /// Update a specific security filter. - /// Returns the security filter object when the request is successful. - pub async fn update_security_filter( + /// Update an existing ticket creation rule by ID. + pub async fn update_security_findings_automation_ticket_creation_rule( &self, - security_filter_id: String, - body: crate::datadogV2::model::SecurityFilterUpdateRequest, + rule_id: uuid::Uuid, + body: crate::datadogV2::model::TicketCreationRuleUpdateRequest, ) -> Result< - crate::datadogV2::model::SecurityFilterResponse, - datadog::Error, + crate::datadogV2::model::TicketCreationRuleResponse, + datadog::Error, > { match self - .update_security_filter_with_http_info(security_filter_id, body) + .update_security_findings_automation_ticket_creation_rule_with_http_info(rule_id, body) .await { Ok(response_content) => { @@ -20765,28 +23551,35 @@ impl SecurityMonitoringAPI { } } - /// Update a specific security filter. - /// Returns the security filter object when the request is successful. - pub async fn update_security_filter_with_http_info( + /// Update an existing ticket creation rule by ID. + pub async fn update_security_findings_automation_ticket_creation_rule_with_http_info( &self, - security_filter_id: String, - body: crate::datadogV2::model::SecurityFilterUpdateRequest, + rule_id: uuid::Uuid, + body: crate::datadogV2::model::TicketCreationRuleUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_security_filter"; + let operation_id = "v2.update_security_findings_automation_ticket_creation_rule"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_security_findings_automation_ticket_creation_rule' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}", + "{}/api/v2/security/findings/automation/ticket_creation_rules/{rule_id}", local_configuration.get_operation_host(operation_id), - security_filter_id = datadog::urlencode(security_filter_id) + rule_id = datadog::urlencode(rule_id.to_string()) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -20877,7 +23670,7 @@ impl SecurityMonitoringAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -20890,7 +23683,7 @@ impl SecurityMonitoringAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 7665fe017..ed662d551 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -9814,6 +9814,106 @@ pub mod model_assignee_response_meta; pub use self::model_assignee_response_meta::AssigneeResponseMeta; pub mod model_assignment_result; pub use self::model_assignment_result::AssignmentResult; +pub mod model_due_date_rules_response; +pub use self::model_due_date_rules_response::DueDateRulesResponse; +pub mod model_due_date_rule_data_response; +pub use self::model_due_date_rule_data_response::DueDateRuleDataResponse; +pub mod model_due_date_rule_attributes_response; +pub use self::model_due_date_rule_attributes_response::DueDateRuleAttributesResponse; +pub mod model_due_date_rule_action; +pub use self::model_due_date_rule_action::DueDateRuleAction; +pub mod model_due_date_per_severity_item; +pub use self::model_due_date_per_severity_item::DueDatePerSeverityItem; +pub mod model_due_date_severity; +pub use self::model_due_date_severity::DueDateSeverity; +pub mod model_due_date_from; +pub use self::model_due_date_from::DueDateFrom; +pub mod model_automation_rule_created_by; +pub use self::model_automation_rule_created_by::AutomationRuleCreatedBy; +pub mod model_automation_rule_actor_type; +pub use self::model_automation_rule_actor_type::AutomationRuleActorType; +pub mod model_automation_rule_modified_by; +pub use self::model_automation_rule_modified_by::AutomationRuleModifiedBy; +pub mod model_automation_rule_scope; +pub use self::model_automation_rule_scope::AutomationRuleScope; +pub mod model_security_finding_type; +pub use self::model_security_finding_type::SecurityFindingType; +pub mod model_due_date_rule_type; +pub use self::model_due_date_rule_type::DueDateRuleType; +pub mod model_security_automation_rules_links; +pub use self::model_security_automation_rules_links::SecurityAutomationRulesLinks; +pub mod model_security_automation_rules_meta; +pub use self::model_security_automation_rules_meta::SecurityAutomationRulesMeta; +pub mod model_security_automation_rules_page_info; +pub use self::model_security_automation_rules_page_info::SecurityAutomationRulesPageInfo; +pub mod model_due_date_rule_create_request; +pub use self::model_due_date_rule_create_request::DueDateRuleCreateRequest; +pub mod model_due_date_rule_data_create; +pub use self::model_due_date_rule_data_create::DueDateRuleDataCreate; +pub mod model_due_date_rule_attributes_create; +pub use self::model_due_date_rule_attributes_create::DueDateRuleAttributesCreate; +pub mod model_due_date_rule_response; +pub use self::model_due_date_rule_response::DueDateRuleResponse; +pub mod model_due_date_rule_reorder_request; +pub use self::model_due_date_rule_reorder_request::DueDateRuleReorderRequest; +pub mod model_due_date_rule_reorder_item; +pub use self::model_due_date_rule_reorder_item::DueDateRuleReorderItem; +pub mod model_due_date_rule_update_request; +pub use self::model_due_date_rule_update_request::DueDateRuleUpdateRequest; +pub mod model_mute_rules_response; +pub use self::model_mute_rules_response::MuteRulesResponse; +pub mod model_mute_rule_data_response; +pub use self::model_mute_rule_data_response::MuteRuleDataResponse; +pub mod model_mute_rule_attributes_response; +pub use self::model_mute_rule_attributes_response::MuteRuleAttributesResponse; +pub mod model_mute_rule_action; +pub use self::model_mute_rule_action::MuteRuleAction; +pub mod model_mute_reason; +pub use self::model_mute_reason::MuteReason; +pub mod model_mute_rule_type; +pub use self::model_mute_rule_type::MuteRuleType; +pub mod model_mute_rule_create_request; +pub use self::model_mute_rule_create_request::MuteRuleCreateRequest; +pub mod model_mute_rule_data_create; +pub use self::model_mute_rule_data_create::MuteRuleDataCreate; +pub mod model_mute_rule_attributes_create; +pub use self::model_mute_rule_attributes_create::MuteRuleAttributesCreate; +pub mod model_mute_rule_response; +pub use self::model_mute_rule_response::MuteRuleResponse; +pub mod model_mute_rule_reorder_request; +pub use self::model_mute_rule_reorder_request::MuteRuleReorderRequest; +pub mod model_mute_rule_reorder_item; +pub use self::model_mute_rule_reorder_item::MuteRuleReorderItem; +pub mod model_mute_rule_update_request; +pub use self::model_mute_rule_update_request::MuteRuleUpdateRequest; +pub mod model_ticket_creation_rules_response; +pub use self::model_ticket_creation_rules_response::TicketCreationRulesResponse; +pub mod model_ticket_creation_rule_data_response; +pub use self::model_ticket_creation_rule_data_response::TicketCreationRuleDataResponse; +pub mod model_ticket_creation_rule_attributes_response; +pub use self::model_ticket_creation_rule_attributes_response::TicketCreationRuleAttributesResponse; +pub mod model_ticket_creation_rule_action_response; +pub use self::model_ticket_creation_rule_action_response::TicketCreationRuleActionResponse; +pub mod model_ticket_creation_target; +pub use self::model_ticket_creation_target::TicketCreationTarget; +pub mod model_ticket_creation_rule_type; +pub use self::model_ticket_creation_rule_type::TicketCreationRuleType; +pub mod model_ticket_creation_rule_create_request; +pub use self::model_ticket_creation_rule_create_request::TicketCreationRuleCreateRequest; +pub mod model_ticket_creation_rule_data_create; +pub use self::model_ticket_creation_rule_data_create::TicketCreationRuleDataCreate; +pub mod model_ticket_creation_rule_attributes_create; +pub use self::model_ticket_creation_rule_attributes_create::TicketCreationRuleAttributesCreate; +pub mod model_ticket_creation_rule_action; +pub use self::model_ticket_creation_rule_action::TicketCreationRuleAction; +pub mod model_ticket_creation_rule_response; +pub use self::model_ticket_creation_rule_response::TicketCreationRuleResponse; +pub mod model_ticket_creation_rule_reorder_request; +pub use self::model_ticket_creation_rule_reorder_request::TicketCreationRuleReorderRequest; +pub mod model_ticket_creation_rule_reorder_item; +pub use self::model_ticket_creation_rule_reorder_item::TicketCreationRuleReorderItem; +pub mod model_ticket_creation_rule_update_request; +pub use self::model_ticket_creation_rule_update_request::TicketCreationRuleUpdateRequest; pub mod model_detach_case_request; pub use self::model_detach_case_request::DetachCaseRequest; pub mod model_detach_case_request_data; diff --git a/src/datadogV2/model/model_automation_rule_actor_type.rs b/src/datadogV2/model/model_automation_rule_actor_type.rs new file mode 100644 index 000000000..7014eb394 --- /dev/null +++ b/src/datadogV2/model/model_automation_rule_actor_type.rs @@ -0,0 +1,51 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AutomationRuleActorType { + USER, + SYSTEM, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AutomationRuleActorType { + fn to_string(&self) -> String { + match self { + Self::USER => String::from("user"), + Self::SYSTEM => String::from("system"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AutomationRuleActorType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AutomationRuleActorType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "user" => Self::USER, + "system" => Self::SYSTEM, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_automation_rule_created_by.rs b/src/datadogV2/model/model_automation_rule_created_by.rs new file mode 100644 index 000000000..6ea359b3c --- /dev/null +++ b/src/datadogV2/model/model_automation_rule_created_by.rs @@ -0,0 +1,124 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The user or Datadog system who created the rule. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AutomationRuleCreatedBy { + /// The actor's identifier (a user UUID or a system identifier). + #[serde(rename = "id")] + pub id: String, + /// The name of the actor. + #[serde(rename = "name")] + pub name: String, + /// Whether the actor is a user or the Datadog system. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AutomationRuleActorType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AutomationRuleCreatedBy { + pub fn new( + id: String, + name: String, + type_: crate::datadogV2::model::AutomationRuleActorType, + ) -> AutomationRuleCreatedBy { + AutomationRuleCreatedBy { + id, + name, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AutomationRuleCreatedBy { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AutomationRuleCreatedByVisitor; + impl<'a> Visitor<'a> for AutomationRuleCreatedByVisitor { + type Value = AutomationRuleCreatedBy; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut name: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AutomationRuleActorType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AutomationRuleCreatedBy { + id, + name, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AutomationRuleCreatedByVisitor) + } +} diff --git a/src/datadogV2/model/model_automation_rule_modified_by.rs b/src/datadogV2/model/model_automation_rule_modified_by.rs new file mode 100644 index 000000000..ff49dfee6 --- /dev/null +++ b/src/datadogV2/model/model_automation_rule_modified_by.rs @@ -0,0 +1,124 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The user or Datadog system who last modified the rule. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AutomationRuleModifiedBy { + /// The actor's identifier (a user UUID or a system identifier). + #[serde(rename = "id")] + pub id: String, + /// The name of the actor. + #[serde(rename = "name")] + pub name: String, + /// Whether the actor is a user or the Datadog system. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AutomationRuleActorType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AutomationRuleModifiedBy { + pub fn new( + id: String, + name: String, + type_: crate::datadogV2::model::AutomationRuleActorType, + ) -> AutomationRuleModifiedBy { + AutomationRuleModifiedBy { + id, + name, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AutomationRuleModifiedBy { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AutomationRuleModifiedByVisitor; + impl<'a> Visitor<'a> for AutomationRuleModifiedByVisitor { + type Value = AutomationRuleModifiedBy; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut name: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AutomationRuleActorType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AutomationRuleModifiedBy { + id, + name, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AutomationRuleModifiedByVisitor) + } +} diff --git a/src/datadogV2/model/model_automation_rule_scope.rs b/src/datadogV2/model/model_automation_rule_scope.rs new file mode 100644 index 000000000..5d2405626 --- /dev/null +++ b/src/datadogV2/model/model_automation_rule_scope.rs @@ -0,0 +1,114 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Defines the scope of findings to which the automation rule applies. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AutomationRuleScope { + /// The list of security finding types that the automation rule applies to. + #[serde(rename = "finding_types")] + pub finding_types: Vec, + /// A search query to further filter the findings matched by this rule. The `@workflow.*` namespace and `@status` fields are not permitted. For a reference of available fields, see the [Security Findings schema documentation](). + #[serde(rename = "query")] + pub query: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AutomationRuleScope { + pub fn new( + finding_types: Vec, + ) -> AutomationRuleScope { + AutomationRuleScope { + finding_types, + query: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn query(mut self, value: String) -> Self { + self.query = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AutomationRuleScope { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AutomationRuleScopeVisitor; + impl<'a> Visitor<'a> for AutomationRuleScopeVisitor { + type Value = AutomationRuleScope; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut finding_types: Option> = + None; + let mut query: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "finding_types" => { + finding_types = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "query" => { + if v.is_null() { + continue; + } + query = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let finding_types = + finding_types.ok_or_else(|| M::Error::missing_field("finding_types"))?; + + let content = AutomationRuleScope { + finding_types, + query, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AutomationRuleScopeVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_from.rs b/src/datadogV2/model/model_due_date_from.rs new file mode 100644 index 000000000..af72b6825 --- /dev/null +++ b/src/datadogV2/model/model_due_date_from.rs @@ -0,0 +1,51 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DueDateFrom { + FIRST_SEEN, + FIX_AVAILABLE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DueDateFrom { + fn to_string(&self) -> String { + match self { + Self::FIRST_SEEN => String::from("first_seen"), + Self::FIX_AVAILABLE => String::from("fix_available"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DueDateFrom { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DueDateFrom { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "first_seen" => Self::FIRST_SEEN, + "fix_available" => Self::FIX_AVAILABLE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_due_date_per_severity_item.rs b/src/datadogV2/model/model_due_date_per_severity_item.rs new file mode 100644 index 000000000..6f621d166 --- /dev/null +++ b/src/datadogV2/model/model_due_date_per_severity_item.rs @@ -0,0 +1,117 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A mapping of a severity level to the number of days until a finding is due. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDatePerSeverityItem { + /// The number of days from the reference point until the finding is due. + #[serde(rename = "due_in_days")] + pub due_in_days: i64, + /// A severity level used to configure due date thresholds. + #[serde(rename = "severity")] + pub severity: crate::datadogV2::model::DueDateSeverity, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDatePerSeverityItem { + pub fn new( + due_in_days: i64, + severity: crate::datadogV2::model::DueDateSeverity, + ) -> DueDatePerSeverityItem { + DueDatePerSeverityItem { + due_in_days, + severity, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDatePerSeverityItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDatePerSeverityItemVisitor; + impl<'a> Visitor<'a> for DueDatePerSeverityItemVisitor { + type Value = DueDatePerSeverityItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut due_in_days: Option = None; + let mut severity: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "due_in_days" => { + due_in_days = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "severity" => { + severity = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _severity) = severity { + match _severity { + crate::datadogV2::model::DueDateSeverity::UnparsedObject( + _severity, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let due_in_days = + due_in_days.ok_or_else(|| M::Error::missing_field("due_in_days"))?; + let severity = severity.ok_or_else(|| M::Error::missing_field("severity"))?; + + let content = DueDatePerSeverityItem { + due_in_days, + severity, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDatePerSeverityItemVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_action.rs b/src/datadogV2/model/model_due_date_rule_action.rs new file mode 100644 index 000000000..9eea5f4b8 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_action.rs @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The action to take when the due date rule matches a finding. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleAction { + /// A list of severity-to-due-date mappings. Each severity may appear at most once. + #[serde(rename = "due_days_per_severity")] + pub due_days_per_severity: Vec, + /// The reference point from which the due date is calculated. When `fix_available` is selected but not applicable to the finding type, `first_seen` is used instead. + #[serde(rename = "due_from")] + pub due_from: crate::datadogV2::model::DueDateFrom, + /// An optional description providing more context for the due date assignment. + #[serde(rename = "reason_description")] + pub reason_description: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleAction { + pub fn new( + due_days_per_severity: Vec, + due_from: crate::datadogV2::model::DueDateFrom, + ) -> DueDateRuleAction { + DueDateRuleAction { + due_days_per_severity, + due_from, + reason_description: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn reason_description(mut self, value: String) -> Self { + self.reason_description = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleAction { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleActionVisitor; + impl<'a> Visitor<'a> for DueDateRuleActionVisitor { + type Value = DueDateRuleAction; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut due_days_per_severity: Option< + Vec, + > = None; + let mut due_from: Option = None; + let mut reason_description: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "due_days_per_severity" => { + due_days_per_severity = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "due_from" => { + due_from = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _due_from) = due_from { + match _due_from { + crate::datadogV2::model::DueDateFrom::UnparsedObject( + _due_from, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "reason_description" => { + if v.is_null() { + continue; + } + reason_description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let due_days_per_severity = due_days_per_severity + .ok_or_else(|| M::Error::missing_field("due_days_per_severity"))?; + let due_from = due_from.ok_or_else(|| M::Error::missing_field("due_from"))?; + + let content = DueDateRuleAction { + due_days_per_severity, + due_from, + reason_description, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleActionVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_attributes_create.rs b/src/datadogV2/model/model_due_date_rule_attributes_create.rs new file mode 100644 index 000000000..5a4933378 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_attributes_create.rs @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for creating or updating a due date rule. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleAttributesCreate { + /// The action to take when the due date rule matches a finding. + #[serde(rename = "action")] + pub action: crate::datadogV2::model::DueDateRuleAction, + /// Whether the due date rule is enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The name of the due date rule. + #[serde(rename = "name")] + pub name: String, + /// Defines the scope of findings to which the automation rule applies. + #[serde(rename = "rule")] + pub rule: crate::datadogV2::model::AutomationRuleScope, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleAttributesCreate { + pub fn new( + action: crate::datadogV2::model::DueDateRuleAction, + name: String, + rule: crate::datadogV2::model::AutomationRuleScope, + ) -> DueDateRuleAttributesCreate { + DueDateRuleAttributesCreate { + action, + enabled: None, + name, + rule, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleAttributesCreate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleAttributesCreateVisitor; + impl<'a> Visitor<'a> for DueDateRuleAttributesCreateVisitor { + type Value = DueDateRuleAttributesCreate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut action: Option = None; + let mut enabled: Option = None; + let mut name: Option = None; + let mut rule: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "action" => { + action = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rule" => { + rule = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let action = action.ok_or_else(|| M::Error::missing_field("action"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let rule = rule.ok_or_else(|| M::Error::missing_field("rule"))?; + + let content = DueDateRuleAttributesCreate { + action, + enabled, + name, + rule, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleAttributesCreateVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_attributes_response.rs b/src/datadogV2/model/model_due_date_rule_attributes_response.rs new file mode 100644 index 000000000..9669f483d --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_attributes_response.rs @@ -0,0 +1,176 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of a due date rule returned by the API. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleAttributesResponse { + /// The action to take when the due date rule matches a finding. + #[serde(rename = "action")] + pub action: crate::datadogV2::model::DueDateRuleAction, + /// The Unix timestamp in milliseconds when the rule was created. + #[serde(rename = "created_at")] + pub created_at: i64, + /// The user or Datadog system who created the rule. + #[serde(rename = "created_by")] + pub created_by: crate::datadogV2::model::AutomationRuleCreatedBy, + /// Whether the due date rule is enabled. + #[serde(rename = "enabled")] + pub enabled: bool, + /// The Unix timestamp in milliseconds when the rule was last modified. + #[serde(rename = "modified_at")] + pub modified_at: i64, + /// The user or Datadog system who last modified the rule. + #[serde(rename = "modified_by")] + pub modified_by: crate::datadogV2::model::AutomationRuleModifiedBy, + /// The name of the due date rule. + #[serde(rename = "name")] + pub name: String, + /// Defines the scope of findings to which the automation rule applies. + #[serde(rename = "rule")] + pub rule: crate::datadogV2::model::AutomationRuleScope, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleAttributesResponse { + pub fn new( + action: crate::datadogV2::model::DueDateRuleAction, + created_at: i64, + created_by: crate::datadogV2::model::AutomationRuleCreatedBy, + enabled: bool, + modified_at: i64, + modified_by: crate::datadogV2::model::AutomationRuleModifiedBy, + name: String, + rule: crate::datadogV2::model::AutomationRuleScope, + ) -> DueDateRuleAttributesResponse { + DueDateRuleAttributesResponse { + action, + created_at, + created_by, + enabled, + modified_at, + modified_by, + name, + rule, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleAttributesResponseVisitor; + impl<'a> Visitor<'a> for DueDateRuleAttributesResponseVisitor { + type Value = DueDateRuleAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut action: Option = None; + let mut created_at: Option = None; + let mut created_by: Option = None; + let mut enabled: Option = None; + let mut modified_at: Option = None; + let mut modified_by: Option = + None; + let mut name: Option = None; + let mut rule: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "action" => { + action = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_by" => { + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_by" => { + modified_by = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rule" => { + rule = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let action = action.ok_or_else(|| M::Error::missing_field("action"))?; + let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?; + let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?; + let enabled = enabled.ok_or_else(|| M::Error::missing_field("enabled"))?; + let modified_at = + modified_at.ok_or_else(|| M::Error::missing_field("modified_at"))?; + let modified_by = + modified_by.ok_or_else(|| M::Error::missing_field("modified_by"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let rule = rule.ok_or_else(|| M::Error::missing_field("rule"))?; + + let content = DueDateRuleAttributesResponse { + action, + created_at, + created_by, + enabled, + modified_at, + modified_by, + name, + rule, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_create_request.rs b/src/datadogV2/model/model_due_date_rule_create_request.rs new file mode 100644 index 000000000..c78d9e4a2 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_create_request.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of a due date rule create request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleCreateRequest { + /// The data object for a due date rule create or update request. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::DueDateRuleDataCreate, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleCreateRequest { + pub fn new(data: crate::datadogV2::model::DueDateRuleDataCreate) -> DueDateRuleCreateRequest { + DueDateRuleCreateRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleCreateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleCreateRequestVisitor; + impl<'a> Visitor<'a> for DueDateRuleCreateRequestVisitor { + type Value = DueDateRuleCreateRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = DueDateRuleCreateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleCreateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_data_create.rs b/src/datadogV2/model/model_due_date_rule_data_create.rs new file mode 100644 index 000000000..96e0a85a2 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_data_create.rs @@ -0,0 +1,116 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for a due date rule create or update request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleDataCreate { + /// Attributes for creating or updating a due date rule. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::DueDateRuleAttributesCreate, + /// The JSON:API type for due date rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DueDateRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleDataCreate { + pub fn new( + attributes: crate::datadogV2::model::DueDateRuleAttributesCreate, + type_: crate::datadogV2::model::DueDateRuleType, + ) -> DueDateRuleDataCreate { + DueDateRuleDataCreate { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleDataCreate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleDataCreateVisitor; + impl<'a> Visitor<'a> for DueDateRuleDataCreateVisitor { + type Value = DueDateRuleDataCreate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DueDateRuleType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DueDateRuleDataCreate { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleDataCreateVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_data_response.rs b/src/datadogV2/model/model_due_date_rule_data_response.rs new file mode 100644 index 000000000..51b96bdaa --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_data_response.rs @@ -0,0 +1,127 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for a due date rule returned by the API. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleDataResponse { + /// Attributes of a due date rule returned by the API. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::DueDateRuleAttributesResponse, + /// The ID of the due date rule. + #[serde(rename = "id")] + pub id: uuid::Uuid, + /// The JSON:API type for due date rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DueDateRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleDataResponse { + pub fn new( + attributes: crate::datadogV2::model::DueDateRuleAttributesResponse, + id: uuid::Uuid, + type_: crate::datadogV2::model::DueDateRuleType, + ) -> DueDateRuleDataResponse { + DueDateRuleDataResponse { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleDataResponseVisitor; + impl<'a> Visitor<'a> for DueDateRuleDataResponseVisitor { + type Value = DueDateRuleDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DueDateRuleType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DueDateRuleDataResponse { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_reorder_item.rs b/src/datadogV2/model/model_due_date_rule_reorder_item.rs new file mode 100644 index 000000000..cc9501d63 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_reorder_item.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A reference to a due date rule used for reordering. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleReorderItem { + /// The ID of the automation rule. + #[serde(rename = "id")] + pub id: uuid::Uuid, + /// The JSON:API type for due date rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::DueDateRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleReorderItem { + pub fn new( + id: uuid::Uuid, + type_: crate::datadogV2::model::DueDateRuleType, + ) -> DueDateRuleReorderItem { + DueDateRuleReorderItem { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleReorderItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleReorderItemVisitor; + impl<'a> Visitor<'a> for DueDateRuleReorderItemVisitor { + type Value = DueDateRuleReorderItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::DueDateRuleType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DueDateRuleReorderItem { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleReorderItemVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_reorder_request.rs b/src/datadogV2/model/model_due_date_rule_reorder_request.rs new file mode 100644 index 000000000..d65c45610 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_reorder_request.rs @@ -0,0 +1,94 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of the due date rule reorder request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleReorderRequest { + /// The ordered list of all due date rules; every rule must be included. + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleReorderRequest { + pub fn new( + data: Vec, + ) -> DueDateRuleReorderRequest { + DueDateRuleReorderRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleReorderRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleReorderRequestVisitor; + impl<'a> Visitor<'a> for DueDateRuleReorderRequestVisitor { + type Value = DueDateRuleReorderRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = DueDateRuleReorderRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleReorderRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_response.rs b/src/datadogV2/model/model_due_date_rule_response.rs new file mode 100644 index 000000000..113b8a729 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_response.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A single due date rule response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleResponse { + /// The data object for a due date rule returned by the API. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::DueDateRuleDataResponse, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleResponse { + pub fn new(data: crate::datadogV2::model::DueDateRuleDataResponse) -> DueDateRuleResponse { + DueDateRuleResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleResponseVisitor; + impl<'a> Visitor<'a> for DueDateRuleResponseVisitor { + type Value = DueDateRuleResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = DueDateRuleResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_type.rs b/src/datadogV2/model/model_due_date_rule_type.rs new file mode 100644 index 000000000..10047f3ca --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DueDateRuleType { + DUE_DATE_RULES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DueDateRuleType { + fn to_string(&self) -> String { + match self { + Self::DUE_DATE_RULES => String::from("due_date_rules"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DueDateRuleType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DueDateRuleType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "due_date_rules" => Self::DUE_DATE_RULES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_due_date_rule_update_request.rs b/src/datadogV2/model/model_due_date_rule_update_request.rs new file mode 100644 index 000000000..78a0a4515 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rule_update_request.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of a due date rule update request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRuleUpdateRequest { + /// The data object for a due date rule create or update request. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::DueDateRuleDataCreate, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRuleUpdateRequest { + pub fn new(data: crate::datadogV2::model::DueDateRuleDataCreate) -> DueDateRuleUpdateRequest { + DueDateRuleUpdateRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRuleUpdateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRuleUpdateRequestVisitor; + impl<'a> Visitor<'a> for DueDateRuleUpdateRequestVisitor { + type Value = DueDateRuleUpdateRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = DueDateRuleUpdateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRuleUpdateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_rules_response.rs b/src/datadogV2/model/model_due_date_rules_response.rs new file mode 100644 index 000000000..e242e5709 --- /dev/null +++ b/src/datadogV2/model/model_due_date_rules_response.rs @@ -0,0 +1,116 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A list of due date rules with pagination metadata. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DueDateRulesResponse { + /// A list of due date rule data objects. + #[serde(rename = "data")] + pub data: Vec, + /// Pagination links for the list of automation rules. + #[serde(rename = "links")] + pub links: crate::datadogV2::model::SecurityAutomationRulesLinks, + /// Metadata for the list of automation rules. + #[serde(rename = "meta")] + pub meta: crate::datadogV2::model::SecurityAutomationRulesMeta, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DueDateRulesResponse { + pub fn new( + data: Vec, + links: crate::datadogV2::model::SecurityAutomationRulesLinks, + meta: crate::datadogV2::model::SecurityAutomationRulesMeta, + ) -> DueDateRulesResponse { + DueDateRulesResponse { + data, + links, + meta, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DueDateRulesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DueDateRulesResponseVisitor; + impl<'a> Visitor<'a> for DueDateRulesResponseVisitor { + type Value = DueDateRulesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = None; + let mut links: Option = None; + let mut meta: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "links" => { + links = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + let links = links.ok_or_else(|| M::Error::missing_field("links"))?; + let meta = meta.ok_or_else(|| M::Error::missing_field("meta"))?; + + let content = DueDateRulesResponse { + data, + links, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DueDateRulesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_due_date_severity.rs b/src/datadogV2/model/model_due_date_severity.rs new file mode 100644 index 000000000..62c628e33 --- /dev/null +++ b/src/datadogV2/model/model_due_date_severity.rs @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DueDateSeverity { + CRITICAL, + HIGH, + MEDIUM, + LOW, + INFO, + NONE, + UNKNOWN, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for DueDateSeverity { + fn to_string(&self) -> String { + match self { + Self::CRITICAL => String::from("critical"), + Self::HIGH => String::from("high"), + Self::MEDIUM => String::from("medium"), + Self::LOW => String::from("low"), + Self::INFO => String::from("info"), + Self::NONE => String::from("none"), + Self::UNKNOWN => String::from("unknown"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for DueDateSeverity { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for DueDateSeverity { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "critical" => Self::CRITICAL, + "high" => Self::HIGH, + "medium" => Self::MEDIUM, + "low" => Self::LOW, + "info" => Self::INFO, + "none" => Self::NONE, + "unknown" => Self::UNKNOWN, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_mute_reason.rs b/src/datadogV2/model/model_mute_reason.rs new file mode 100644 index 000000000..1df9bf03d --- /dev/null +++ b/src/datadogV2/model/model_mute_reason.rs @@ -0,0 +1,63 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum MuteReason { + DUPLICATE, + FALSE_POSITIVE, + NO_FIX, + OTHER, + PENDING_FIX, + RISK_ACCEPTED, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for MuteReason { + fn to_string(&self) -> String { + match self { + Self::DUPLICATE => String::from("duplicate"), + Self::FALSE_POSITIVE => String::from("false_positive"), + Self::NO_FIX => String::from("no_fix"), + Self::OTHER => String::from("other"), + Self::PENDING_FIX => String::from("pending_fix"), + Self::RISK_ACCEPTED => String::from("risk_accepted"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for MuteReason { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for MuteReason { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "duplicate" => Self::DUPLICATE, + "false_positive" => Self::FALSE_POSITIVE, + "no_fix" => Self::NO_FIX, + "other" => Self::OTHER, + "pending_fix" => Self::PENDING_FIX, + "risk_accepted" => Self::RISK_ACCEPTED, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_mute_rule_action.rs b/src/datadogV2/model/model_mute_rule_action.rs new file mode 100644 index 000000000..284fff929 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_action.rs @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The action to take when the mute rule matches a finding. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleAction { + /// The Unix timestamp in milliseconds at which the mute expires. If omitted, the mute does not expire. + #[serde(rename = "expire_at")] + pub expire_at: Option, + /// The reason for muting a security finding. + #[serde(rename = "reason")] + pub reason: crate::datadogV2::model::MuteReason, + /// An optional description providing more context for the mute reason. + #[serde(rename = "reason_description")] + pub reason_description: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleAction { + pub fn new(reason: crate::datadogV2::model::MuteReason) -> MuteRuleAction { + MuteRuleAction { + expire_at: None, + reason, + reason_description: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn expire_at(mut self, value: i64) -> Self { + self.expire_at = Some(value); + self + } + + pub fn reason_description(mut self, value: String) -> Self { + self.reason_description = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleAction { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleActionVisitor; + impl<'a> Visitor<'a> for MuteRuleActionVisitor { + type Value = MuteRuleAction; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut expire_at: Option = None; + let mut reason: Option = None; + let mut reason_description: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "expire_at" => { + if v.is_null() { + continue; + } + expire_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "reason" => { + reason = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _reason) = reason { + match _reason { + crate::datadogV2::model::MuteReason::UnparsedObject( + _reason, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "reason_description" => { + if v.is_null() { + continue; + } + reason_description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let reason = reason.ok_or_else(|| M::Error::missing_field("reason"))?; + + let content = MuteRuleAction { + expire_at, + reason, + reason_description, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleActionVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_attributes_create.rs b/src/datadogV2/model/model_mute_rule_attributes_create.rs new file mode 100644 index 000000000..8bdd58747 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_attributes_create.rs @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for creating or updating a mute rule. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleAttributesCreate { + /// The action to take when the mute rule matches a finding. + #[serde(rename = "action")] + pub action: crate::datadogV2::model::MuteRuleAction, + /// Whether the mute rule is enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The name of the mute rule. + #[serde(rename = "name")] + pub name: String, + /// Defines the scope of findings to which the automation rule applies. + #[serde(rename = "rule")] + pub rule: crate::datadogV2::model::AutomationRuleScope, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleAttributesCreate { + pub fn new( + action: crate::datadogV2::model::MuteRuleAction, + name: String, + rule: crate::datadogV2::model::AutomationRuleScope, + ) -> MuteRuleAttributesCreate { + MuteRuleAttributesCreate { + action, + enabled: None, + name, + rule, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleAttributesCreate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleAttributesCreateVisitor; + impl<'a> Visitor<'a> for MuteRuleAttributesCreateVisitor { + type Value = MuteRuleAttributesCreate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut action: Option = None; + let mut enabled: Option = None; + let mut name: Option = None; + let mut rule: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "action" => { + action = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rule" => { + rule = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let action = action.ok_or_else(|| M::Error::missing_field("action"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let rule = rule.ok_or_else(|| M::Error::missing_field("rule"))?; + + let content = MuteRuleAttributesCreate { + action, + enabled, + name, + rule, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleAttributesCreateVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_attributes_response.rs b/src/datadogV2/model/model_mute_rule_attributes_response.rs new file mode 100644 index 000000000..77c6958d9 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_attributes_response.rs @@ -0,0 +1,176 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of a mute rule returned by the API. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleAttributesResponse { + /// The action to take when the mute rule matches a finding. + #[serde(rename = "action")] + pub action: crate::datadogV2::model::MuteRuleAction, + /// The Unix timestamp in milliseconds when the rule was created. + #[serde(rename = "created_at")] + pub created_at: i64, + /// The user or Datadog system who created the rule. + #[serde(rename = "created_by")] + pub created_by: crate::datadogV2::model::AutomationRuleCreatedBy, + /// Whether the mute rule is enabled. + #[serde(rename = "enabled")] + pub enabled: bool, + /// The Unix timestamp in milliseconds when the rule was last modified. + #[serde(rename = "modified_at")] + pub modified_at: i64, + /// The user or Datadog system who last modified the rule. + #[serde(rename = "modified_by")] + pub modified_by: crate::datadogV2::model::AutomationRuleModifiedBy, + /// The name of the mute rule. + #[serde(rename = "name")] + pub name: String, + /// Defines the scope of findings to which the automation rule applies. + #[serde(rename = "rule")] + pub rule: crate::datadogV2::model::AutomationRuleScope, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleAttributesResponse { + pub fn new( + action: crate::datadogV2::model::MuteRuleAction, + created_at: i64, + created_by: crate::datadogV2::model::AutomationRuleCreatedBy, + enabled: bool, + modified_at: i64, + modified_by: crate::datadogV2::model::AutomationRuleModifiedBy, + name: String, + rule: crate::datadogV2::model::AutomationRuleScope, + ) -> MuteRuleAttributesResponse { + MuteRuleAttributesResponse { + action, + created_at, + created_by, + enabled, + modified_at, + modified_by, + name, + rule, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleAttributesResponseVisitor; + impl<'a> Visitor<'a> for MuteRuleAttributesResponseVisitor { + type Value = MuteRuleAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut action: Option = None; + let mut created_at: Option = None; + let mut created_by: Option = None; + let mut enabled: Option = None; + let mut modified_at: Option = None; + let mut modified_by: Option = + None; + let mut name: Option = None; + let mut rule: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "action" => { + action = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_by" => { + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_by" => { + modified_by = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rule" => { + rule = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let action = action.ok_or_else(|| M::Error::missing_field("action"))?; + let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?; + let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?; + let enabled = enabled.ok_or_else(|| M::Error::missing_field("enabled"))?; + let modified_at = + modified_at.ok_or_else(|| M::Error::missing_field("modified_at"))?; + let modified_by = + modified_by.ok_or_else(|| M::Error::missing_field("modified_by"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let rule = rule.ok_or_else(|| M::Error::missing_field("rule"))?; + + let content = MuteRuleAttributesResponse { + action, + created_at, + created_by, + enabled, + modified_at, + modified_by, + name, + rule, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_create_request.rs b/src/datadogV2/model/model_mute_rule_create_request.rs new file mode 100644 index 000000000..9cc2f4a19 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_create_request.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of a mute rule create request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleCreateRequest { + /// The data object for a mute rule create or update request. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::MuteRuleDataCreate, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleCreateRequest { + pub fn new(data: crate::datadogV2::model::MuteRuleDataCreate) -> MuteRuleCreateRequest { + MuteRuleCreateRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleCreateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleCreateRequestVisitor; + impl<'a> Visitor<'a> for MuteRuleCreateRequestVisitor { + type Value = MuteRuleCreateRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = MuteRuleCreateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleCreateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_data_create.rs b/src/datadogV2/model/model_mute_rule_data_create.rs new file mode 100644 index 000000000..e41f4371b --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_data_create.rs @@ -0,0 +1,116 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for a mute rule create or update request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleDataCreate { + /// Attributes for creating or updating a mute rule. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::MuteRuleAttributesCreate, + /// The JSON:API type for mute rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::MuteRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleDataCreate { + pub fn new( + attributes: crate::datadogV2::model::MuteRuleAttributesCreate, + type_: crate::datadogV2::model::MuteRuleType, + ) -> MuteRuleDataCreate { + MuteRuleDataCreate { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleDataCreate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleDataCreateVisitor; + impl<'a> Visitor<'a> for MuteRuleDataCreateVisitor { + type Value = MuteRuleDataCreate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::MuteRuleType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = MuteRuleDataCreate { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleDataCreateVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_data_response.rs b/src/datadogV2/model/model_mute_rule_data_response.rs new file mode 100644 index 000000000..abe14fd57 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_data_response.rs @@ -0,0 +1,127 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for a mute rule returned by the API. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleDataResponse { + /// Attributes of a mute rule returned by the API. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::MuteRuleAttributesResponse, + /// The ID of the mute rule. + #[serde(rename = "id")] + pub id: uuid::Uuid, + /// The JSON:API type for mute rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::MuteRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleDataResponse { + pub fn new( + attributes: crate::datadogV2::model::MuteRuleAttributesResponse, + id: uuid::Uuid, + type_: crate::datadogV2::model::MuteRuleType, + ) -> MuteRuleDataResponse { + MuteRuleDataResponse { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleDataResponseVisitor; + impl<'a> Visitor<'a> for MuteRuleDataResponseVisitor { + type Value = MuteRuleDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::MuteRuleType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = MuteRuleDataResponse { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_reorder_item.rs b/src/datadogV2/model/model_mute_rule_reorder_item.rs new file mode 100644 index 000000000..844b55d26 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_reorder_item.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A reference to a mute rule used for reordering. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleReorderItem { + /// The ID of the automation rule. + #[serde(rename = "id")] + pub id: uuid::Uuid, + /// The JSON:API type for mute rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::MuteRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleReorderItem { + pub fn new( + id: uuid::Uuid, + type_: crate::datadogV2::model::MuteRuleType, + ) -> MuteRuleReorderItem { + MuteRuleReorderItem { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleReorderItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleReorderItemVisitor; + impl<'a> Visitor<'a> for MuteRuleReorderItemVisitor { + type Value = MuteRuleReorderItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::MuteRuleType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = MuteRuleReorderItem { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleReorderItemVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_reorder_request.rs b/src/datadogV2/model/model_mute_rule_reorder_request.rs new file mode 100644 index 000000000..3223d70c7 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_reorder_request.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of the mute rule reorder request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleReorderRequest { + /// The ordered list of all mute rules; every rule must be included. + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleReorderRequest { + pub fn new(data: Vec) -> MuteRuleReorderRequest { + MuteRuleReorderRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleReorderRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleReorderRequestVisitor; + impl<'a> Visitor<'a> for MuteRuleReorderRequestVisitor { + type Value = MuteRuleReorderRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = MuteRuleReorderRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleReorderRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_response.rs b/src/datadogV2/model/model_mute_rule_response.rs new file mode 100644 index 000000000..d107d45e8 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_response.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A single mute rule response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleResponse { + /// The data object for a mute rule returned by the API. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::MuteRuleDataResponse, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleResponse { + pub fn new(data: crate::datadogV2::model::MuteRuleDataResponse) -> MuteRuleResponse { + MuteRuleResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleResponseVisitor; + impl<'a> Visitor<'a> for MuteRuleResponseVisitor { + type Value = MuteRuleResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = MuteRuleResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rule_type.rs b/src/datadogV2/model/model_mute_rule_type.rs new file mode 100644 index 000000000..f23829583 --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum MuteRuleType { + MUTE_RULES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for MuteRuleType { + fn to_string(&self) -> String { + match self { + Self::MUTE_RULES => String::from("mute_rules"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for MuteRuleType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for MuteRuleType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "mute_rules" => Self::MUTE_RULES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_mute_rule_update_request.rs b/src/datadogV2/model/model_mute_rule_update_request.rs new file mode 100644 index 000000000..315c0dd0b --- /dev/null +++ b/src/datadogV2/model/model_mute_rule_update_request.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of a mute rule update request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRuleUpdateRequest { + /// The data object for a mute rule create or update request. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::MuteRuleDataCreate, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRuleUpdateRequest { + pub fn new(data: crate::datadogV2::model::MuteRuleDataCreate) -> MuteRuleUpdateRequest { + MuteRuleUpdateRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRuleUpdateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRuleUpdateRequestVisitor; + impl<'a> Visitor<'a> for MuteRuleUpdateRequestVisitor { + type Value = MuteRuleUpdateRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = MuteRuleUpdateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRuleUpdateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_mute_rules_response.rs b/src/datadogV2/model/model_mute_rules_response.rs new file mode 100644 index 000000000..f724add96 --- /dev/null +++ b/src/datadogV2/model/model_mute_rules_response.rs @@ -0,0 +1,116 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A list of mute rules with pagination metadata. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct MuteRulesResponse { + /// A list of mute rule data objects. + #[serde(rename = "data")] + pub data: Vec, + /// Pagination links for the list of automation rules. + #[serde(rename = "links")] + pub links: crate::datadogV2::model::SecurityAutomationRulesLinks, + /// Metadata for the list of automation rules. + #[serde(rename = "meta")] + pub meta: crate::datadogV2::model::SecurityAutomationRulesMeta, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl MuteRulesResponse { + pub fn new( + data: Vec, + links: crate::datadogV2::model::SecurityAutomationRulesLinks, + meta: crate::datadogV2::model::SecurityAutomationRulesMeta, + ) -> MuteRulesResponse { + MuteRulesResponse { + data, + links, + meta, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for MuteRulesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MuteRulesResponseVisitor; + impl<'a> Visitor<'a> for MuteRulesResponseVisitor { + type Value = MuteRulesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = None; + let mut links: Option = None; + let mut meta: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "links" => { + links = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + let links = links.ok_or_else(|| M::Error::missing_field("links"))?; + let meta = meta.ok_or_else(|| M::Error::missing_field("meta"))?; + + let content = MuteRulesResponse { + data, + links, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(MuteRulesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_security_automation_rules_links.rs b/src/datadogV2/model/model_security_automation_rules_links.rs new file mode 100644 index 000000000..c5afaad59 --- /dev/null +++ b/src/datadogV2/model/model_security_automation_rules_links.rs @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Pagination links for the list of automation rules. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityAutomationRulesLinks { + /// Link to the first page of results. + #[serde(rename = "first")] + pub first: String, + /// Link to the last page of results. + #[serde(rename = "last")] + pub last: String, + /// Link to the next page of results. + #[serde(rename = "next")] + pub next: Option, + /// Link to the previous page of results. + #[serde(rename = "prev")] + pub prev: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityAutomationRulesLinks { + pub fn new(first: String, last: String) -> SecurityAutomationRulesLinks { + SecurityAutomationRulesLinks { + first, + last, + next: None, + prev: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn next(mut self, value: String) -> Self { + self.next = Some(value); + self + } + + pub fn prev(mut self, value: String) -> Self { + self.prev = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityAutomationRulesLinks { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityAutomationRulesLinksVisitor; + impl<'a> Visitor<'a> for SecurityAutomationRulesLinksVisitor { + type Value = SecurityAutomationRulesLinks; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut first: Option = None; + let mut last: Option = None; + let mut next: Option = None; + let mut prev: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "first" => { + first = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last" => { + last = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "next" => { + if v.is_null() { + continue; + } + next = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prev" => { + if v.is_null() { + continue; + } + prev = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let first = first.ok_or_else(|| M::Error::missing_field("first"))?; + let last = last.ok_or_else(|| M::Error::missing_field("last"))?; + + let content = SecurityAutomationRulesLinks { + first, + last, + next, + prev, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityAutomationRulesLinksVisitor) + } +} diff --git a/src/datadogV2/model/model_security_automation_rules_meta.rs b/src/datadogV2/model/model_security_automation_rules_meta.rs new file mode 100644 index 000000000..9c183b58f --- /dev/null +++ b/src/datadogV2/model/model_security_automation_rules_meta.rs @@ -0,0 +1,95 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Metadata for the list of automation rules. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityAutomationRulesMeta { + /// Pagination information for the list of automation rules. + #[serde(rename = "page")] + pub page: crate::datadogV2::model::SecurityAutomationRulesPageInfo, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityAutomationRulesMeta { + pub fn new( + page: crate::datadogV2::model::SecurityAutomationRulesPageInfo, + ) -> SecurityAutomationRulesMeta { + SecurityAutomationRulesMeta { + page, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityAutomationRulesMeta { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityAutomationRulesMetaVisitor; + impl<'a> Visitor<'a> for SecurityAutomationRulesMetaVisitor { + type Value = SecurityAutomationRulesMeta; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut page: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "page" => { + page = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let page = page.ok_or_else(|| M::Error::missing_field("page"))?; + + let content = SecurityAutomationRulesMeta { + page, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityAutomationRulesMetaVisitor) + } +} diff --git a/src/datadogV2/model/model_security_automation_rules_page_info.rs b/src/datadogV2/model/model_security_automation_rules_page_info.rs new file mode 100644 index 000000000..4359e608c --- /dev/null +++ b/src/datadogV2/model/model_security_automation_rules_page_info.rs @@ -0,0 +1,94 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Pagination information for the list of automation rules. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecurityAutomationRulesPageInfo { + /// The total number of rules matching the current filter. + #[serde(rename = "total_filtered_count")] + pub total_filtered_count: i64, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecurityAutomationRulesPageInfo { + pub fn new(total_filtered_count: i64) -> SecurityAutomationRulesPageInfo { + SecurityAutomationRulesPageInfo { + total_filtered_count, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for SecurityAutomationRulesPageInfo { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecurityAutomationRulesPageInfoVisitor; + impl<'a> Visitor<'a> for SecurityAutomationRulesPageInfoVisitor { + type Value = SecurityAutomationRulesPageInfo; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut total_filtered_count: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "total_filtered_count" => { + total_filtered_count = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let total_filtered_count = total_filtered_count + .ok_or_else(|| M::Error::missing_field("total_filtered_count"))?; + + let content = SecurityAutomationRulesPageInfo { + total_filtered_count, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecurityAutomationRulesPageInfoVisitor) + } +} diff --git a/src/datadogV2/model/model_security_finding_type.rs b/src/datadogV2/model/model_security_finding_type.rs new file mode 100644 index 000000000..c6ff8887f --- /dev/null +++ b/src/datadogV2/model/model_security_finding_type.rs @@ -0,0 +1,80 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SecurityFindingType { + API_SECURITY, + ATTACK_PATH, + HOST_AND_CONTAINER_VULNERABILITY, + IAC_MISCONFIGURATION, + IDENTITY_RISK, + LIBRARY_VULNERABILITY, + MISCONFIGURATION, + RUNTIME_CODE_VULNERABILITY, + SECRET, + STATIC_CODE_VULNERABILITY, + WORKLOAD_ACTIVITY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecurityFindingType { + fn to_string(&self) -> String { + match self { + Self::API_SECURITY => String::from("api_security"), + Self::ATTACK_PATH => String::from("attack_path"), + Self::HOST_AND_CONTAINER_VULNERABILITY => { + String::from("host_and_container_vulnerability") + } + Self::IAC_MISCONFIGURATION => String::from("iac_misconfiguration"), + Self::IDENTITY_RISK => String::from("identity_risk"), + Self::LIBRARY_VULNERABILITY => String::from("library_vulnerability"), + Self::MISCONFIGURATION => String::from("misconfiguration"), + Self::RUNTIME_CODE_VULNERABILITY => String::from("runtime_code_vulnerability"), + Self::SECRET => String::from("secret"), + Self::STATIC_CODE_VULNERABILITY => String::from("static_code_vulnerability"), + Self::WORKLOAD_ACTIVITY => String::from("workload_activity"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecurityFindingType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for SecurityFindingType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "api_security" => Self::API_SECURITY, + "attack_path" => Self::ATTACK_PATH, + "host_and_container_vulnerability" => Self::HOST_AND_CONTAINER_VULNERABILITY, + "iac_misconfiguration" => Self::IAC_MISCONFIGURATION, + "identity_risk" => Self::IDENTITY_RISK, + "library_vulnerability" => Self::LIBRARY_VULNERABILITY, + "misconfiguration" => Self::MISCONFIGURATION, + "runtime_code_vulnerability" => Self::RUNTIME_CODE_VULNERABILITY, + "secret" => Self::SECRET, + "static_code_vulnerability" => Self::STATIC_CODE_VULNERABILITY, + "workload_activity" => Self::WORKLOAD_ACTIVITY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_action.rs b/src/datadogV2/model/model_ticket_creation_rule_action.rs new file mode 100644 index 000000000..c2cb27917 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_action.rs @@ -0,0 +1,162 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The action to take when the ticket creation rule matches a finding. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleAction { + /// The UUID of the default assignee for created tickets. + #[serde(rename = "assignee_id")] + pub assignee_id: Option, + /// Custom fields of the Jira issue to create. For the list of available fields, see [Jira documentation](). + #[serde(rename = "fields")] + pub fields: Option>, + /// The maximum number of tickets the rule may create per day. If exceeded, one final ticket will be created, explaining the limit was hit and link back to the responsible rule. + #[serde(rename = "max_tickets_per_day")] + pub max_tickets_per_day: i64, + /// The UUID of the case management project. + #[serde(rename = "project_id")] + pub project_id: uuid::Uuid, + /// The ticketing system to create tickets in. + #[serde(rename = "target")] + pub target: crate::datadogV2::model::TicketCreationTarget, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleAction { + pub fn new( + max_tickets_per_day: i64, + project_id: uuid::Uuid, + target: crate::datadogV2::model::TicketCreationTarget, + ) -> TicketCreationRuleAction { + TicketCreationRuleAction { + assignee_id: None, + fields: None, + max_tickets_per_day, + project_id, + target, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn assignee_id(mut self, value: uuid::Uuid) -> Self { + self.assignee_id = Some(value); + self + } + + pub fn fields(mut self, value: std::collections::BTreeMap) -> Self { + self.fields = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleAction { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleActionVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleActionVisitor { + type Value = TicketCreationRuleAction; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut assignee_id: Option = None; + let mut fields: Option> = + None; + let mut max_tickets_per_day: Option = None; + let mut project_id: Option = None; + let mut target: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "assignee_id" => { + if v.is_null() { + continue; + } + assignee_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "fields" => { + if v.is_null() { + continue; + } + fields = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "max_tickets_per_day" => { + max_tickets_per_day = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "project_id" => { + project_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "target" => { + target = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _target) = target { + match _target { + crate::datadogV2::model::TicketCreationTarget::UnparsedObject(_target) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let max_tickets_per_day = max_tickets_per_day + .ok_or_else(|| M::Error::missing_field("max_tickets_per_day"))?; + let project_id = project_id.ok_or_else(|| M::Error::missing_field("project_id"))?; + let target = target.ok_or_else(|| M::Error::missing_field("target"))?; + + let content = TicketCreationRuleAction { + assignee_id, + fields, + max_tickets_per_day, + project_id, + target, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleActionVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_action_response.rs b/src/datadogV2/model/model_ticket_creation_rule_action_response.rs new file mode 100644 index 000000000..dceb938f0 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_action_response.rs @@ -0,0 +1,180 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The action to take when the ticket creation rule matches a finding. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleActionResponse { + /// The UUID of the default assignee for created tickets. + #[serde(rename = "assignee_id")] + pub assignee_id: Option, + /// The reason the rule was automatically disabled by the system due to a ticketing integration error. + #[serde(rename = "auto_disabled_reason")] + pub auto_disabled_reason: Option, + /// Custom fields of the Jira issue to create. For the list of available fields, see [Jira documentation](). + #[serde(rename = "fields")] + pub fields: Option>, + /// The maximum number of tickets the rule may create per day. If exceeded, one final ticket will be created, explaining the limit was hit and link back to the responsible rule. + #[serde(rename = "max_tickets_per_day")] + pub max_tickets_per_day: i64, + /// The UUID of the case management project. + #[serde(rename = "project_id")] + pub project_id: uuid::Uuid, + /// The ticketing system to create tickets in. + #[serde(rename = "target")] + pub target: crate::datadogV2::model::TicketCreationTarget, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleActionResponse { + pub fn new( + max_tickets_per_day: i64, + project_id: uuid::Uuid, + target: crate::datadogV2::model::TicketCreationTarget, + ) -> TicketCreationRuleActionResponse { + TicketCreationRuleActionResponse { + assignee_id: None, + auto_disabled_reason: None, + fields: None, + max_tickets_per_day, + project_id, + target, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn assignee_id(mut self, value: uuid::Uuid) -> Self { + self.assignee_id = Some(value); + self + } + + pub fn auto_disabled_reason(mut self, value: String) -> Self { + self.auto_disabled_reason = Some(value); + self + } + + pub fn fields(mut self, value: std::collections::BTreeMap) -> Self { + self.fields = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleActionResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleActionResponseVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleActionResponseVisitor { + type Value = TicketCreationRuleActionResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut assignee_id: Option = None; + let mut auto_disabled_reason: Option = None; + let mut fields: Option> = + None; + let mut max_tickets_per_day: Option = None; + let mut project_id: Option = None; + let mut target: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "assignee_id" => { + if v.is_null() { + continue; + } + assignee_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "auto_disabled_reason" => { + if v.is_null() { + continue; + } + auto_disabled_reason = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "fields" => { + if v.is_null() { + continue; + } + fields = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "max_tickets_per_day" => { + max_tickets_per_day = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "project_id" => { + project_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "target" => { + target = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _target) = target { + match _target { + crate::datadogV2::model::TicketCreationTarget::UnparsedObject(_target) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let max_tickets_per_day = max_tickets_per_day + .ok_or_else(|| M::Error::missing_field("max_tickets_per_day"))?; + let project_id = project_id.ok_or_else(|| M::Error::missing_field("project_id"))?; + let target = target.ok_or_else(|| M::Error::missing_field("target"))?; + + let content = TicketCreationRuleActionResponse { + assignee_id, + auto_disabled_reason, + fields, + max_tickets_per_day, + project_id, + target, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleActionResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_attributes_create.rs b/src/datadogV2/model/model_ticket_creation_rule_attributes_create.rs new file mode 100644 index 000000000..a3978876a --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_attributes_create.rs @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for creating or updating a ticket creation rule. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleAttributesCreate { + /// The action to take when the ticket creation rule matches a finding. + #[serde(rename = "action")] + pub action: crate::datadogV2::model::TicketCreationRuleAction, + /// Whether the ticket creation rule is enabled. + #[serde(rename = "enabled")] + pub enabled: Option, + /// The name of the ticket creation rule. + #[serde(rename = "name")] + pub name: String, + /// Defines the scope of findings to which the automation rule applies. + #[serde(rename = "rule")] + pub rule: crate::datadogV2::model::AutomationRuleScope, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleAttributesCreate { + pub fn new( + action: crate::datadogV2::model::TicketCreationRuleAction, + name: String, + rule: crate::datadogV2::model::AutomationRuleScope, + ) -> TicketCreationRuleAttributesCreate { + TicketCreationRuleAttributesCreate { + action, + enabled: None, + name, + rule, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleAttributesCreate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleAttributesCreateVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleAttributesCreateVisitor { + type Value = TicketCreationRuleAttributesCreate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut action: Option = None; + let mut enabled: Option = None; + let mut name: Option = None; + let mut rule: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "action" => { + action = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rule" => { + rule = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let action = action.ok_or_else(|| M::Error::missing_field("action"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let rule = rule.ok_or_else(|| M::Error::missing_field("rule"))?; + + let content = TicketCreationRuleAttributesCreate { + action, + enabled, + name, + rule, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleAttributesCreateVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_attributes_response.rs b/src/datadogV2/model/model_ticket_creation_rule_attributes_response.rs new file mode 100644 index 000000000..969dd6313 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_attributes_response.rs @@ -0,0 +1,177 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of a ticket creation rule returned by the API. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleAttributesResponse { + /// The action to take when the ticket creation rule matches a finding. + #[serde(rename = "action")] + pub action: crate::datadogV2::model::TicketCreationRuleActionResponse, + /// The Unix timestamp in milliseconds when the rule was created. + #[serde(rename = "created_at")] + pub created_at: i64, + /// The user or Datadog system who created the rule. + #[serde(rename = "created_by")] + pub created_by: crate::datadogV2::model::AutomationRuleCreatedBy, + /// Whether the ticket creation rule is enabled. + #[serde(rename = "enabled")] + pub enabled: bool, + /// The Unix timestamp in milliseconds when the rule was last modified. + #[serde(rename = "modified_at")] + pub modified_at: i64, + /// The user or Datadog system who last modified the rule. + #[serde(rename = "modified_by")] + pub modified_by: crate::datadogV2::model::AutomationRuleModifiedBy, + /// The name of the ticket creation rule. + #[serde(rename = "name")] + pub name: String, + /// Defines the scope of findings to which the automation rule applies. + #[serde(rename = "rule")] + pub rule: crate::datadogV2::model::AutomationRuleScope, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleAttributesResponse { + pub fn new( + action: crate::datadogV2::model::TicketCreationRuleActionResponse, + created_at: i64, + created_by: crate::datadogV2::model::AutomationRuleCreatedBy, + enabled: bool, + modified_at: i64, + modified_by: crate::datadogV2::model::AutomationRuleModifiedBy, + name: String, + rule: crate::datadogV2::model::AutomationRuleScope, + ) -> TicketCreationRuleAttributesResponse { + TicketCreationRuleAttributesResponse { + action, + created_at, + created_by, + enabled, + modified_at, + modified_by, + name, + rule, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleAttributesResponseVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleAttributesResponseVisitor { + type Value = TicketCreationRuleAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut action: Option = + None; + let mut created_at: Option = None; + let mut created_by: Option = None; + let mut enabled: Option = None; + let mut modified_at: Option = None; + let mut modified_by: Option = + None; + let mut name: Option = None; + let mut rule: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "action" => { + action = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_by" => { + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_by" => { + modified_by = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "rule" => { + rule = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let action = action.ok_or_else(|| M::Error::missing_field("action"))?; + let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?; + let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?; + let enabled = enabled.ok_or_else(|| M::Error::missing_field("enabled"))?; + let modified_at = + modified_at.ok_or_else(|| M::Error::missing_field("modified_at"))?; + let modified_by = + modified_by.ok_or_else(|| M::Error::missing_field("modified_by"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let rule = rule.ok_or_else(|| M::Error::missing_field("rule"))?; + + let content = TicketCreationRuleAttributesResponse { + action, + created_at, + created_by, + enabled, + modified_at, + modified_by, + name, + rule, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_create_request.rs b/src/datadogV2/model/model_ticket_creation_rule_create_request.rs new file mode 100644 index 000000000..8f5134f8c --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_create_request.rs @@ -0,0 +1,94 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of a ticket creation rule create request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleCreateRequest { + /// The data object for a ticket creation rule create or update request. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::TicketCreationRuleDataCreate, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleCreateRequest { + pub fn new( + data: crate::datadogV2::model::TicketCreationRuleDataCreate, + ) -> TicketCreationRuleCreateRequest { + TicketCreationRuleCreateRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleCreateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleCreateRequestVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleCreateRequestVisitor { + type Value = TicketCreationRuleCreateRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = TicketCreationRuleCreateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleCreateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_data_create.rs b/src/datadogV2/model/model_ticket_creation_rule_data_create.rs new file mode 100644 index 000000000..27fdc9895 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_data_create.rs @@ -0,0 +1,115 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for a ticket creation rule create or update request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleDataCreate { + /// Attributes for creating or updating a ticket creation rule. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::TicketCreationRuleAttributesCreate, + /// The JSON:API type for ticket creation rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::TicketCreationRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleDataCreate { + pub fn new( + attributes: crate::datadogV2::model::TicketCreationRuleAttributesCreate, + type_: crate::datadogV2::model::TicketCreationRuleType, + ) -> TicketCreationRuleDataCreate { + TicketCreationRuleDataCreate { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleDataCreate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleDataCreateVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleDataCreateVisitor { + type Value = TicketCreationRuleDataCreate; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::TicketCreationRuleAttributesCreate, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::TicketCreationRuleType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = TicketCreationRuleDataCreate { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleDataCreateVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_data_response.rs b/src/datadogV2/model/model_ticket_creation_rule_data_response.rs new file mode 100644 index 000000000..e2dbced77 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_data_response.rs @@ -0,0 +1,126 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for a ticket creation rule returned by the API. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleDataResponse { + /// Attributes of a ticket creation rule returned by the API. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::TicketCreationRuleAttributesResponse, + /// The ID of the ticket creation rule. + #[serde(rename = "id")] + pub id: uuid::Uuid, + /// The JSON:API type for ticket creation rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::TicketCreationRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleDataResponse { + pub fn new( + attributes: crate::datadogV2::model::TicketCreationRuleAttributesResponse, + id: uuid::Uuid, + type_: crate::datadogV2::model::TicketCreationRuleType, + ) -> TicketCreationRuleDataResponse { + TicketCreationRuleDataResponse { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleDataResponseVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleDataResponseVisitor { + type Value = TicketCreationRuleDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::TicketCreationRuleAttributesResponse, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::TicketCreationRuleType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = TicketCreationRuleDataResponse { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_reorder_item.rs b/src/datadogV2/model/model_ticket_creation_rule_reorder_item.rs new file mode 100644 index 000000000..7fc2c255e --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_reorder_item.rs @@ -0,0 +1,113 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A reference to a ticket creation rule used for reordering. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleReorderItem { + /// The ID of the automation rule. + #[serde(rename = "id")] + pub id: uuid::Uuid, + /// The JSON:API type for ticket creation rules. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::TicketCreationRuleType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleReorderItem { + pub fn new( + id: uuid::Uuid, + type_: crate::datadogV2::model::TicketCreationRuleType, + ) -> TicketCreationRuleReorderItem { + TicketCreationRuleReorderItem { + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleReorderItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleReorderItemVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleReorderItemVisitor { + type Value = TicketCreationRuleReorderItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::TicketCreationRuleType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = TicketCreationRuleReorderItem { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleReorderItemVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_reorder_request.rs b/src/datadogV2/model/model_ticket_creation_rule_reorder_request.rs new file mode 100644 index 000000000..58b54e5c3 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_reorder_request.rs @@ -0,0 +1,95 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of the ticket creation rule reorder request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleReorderRequest { + /// The ordered list of all ticket creation rules; every rule must be included. + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleReorderRequest { + pub fn new( + data: Vec, + ) -> TicketCreationRuleReorderRequest { + TicketCreationRuleReorderRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleReorderRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleReorderRequestVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleReorderRequestVisitor { + type Value = TicketCreationRuleReorderRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = TicketCreationRuleReorderRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleReorderRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_response.rs b/src/datadogV2/model/model_ticket_creation_rule_response.rs new file mode 100644 index 000000000..0eb2c7a26 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_response.rs @@ -0,0 +1,95 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A single ticket creation rule response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleResponse { + /// The data object for a ticket creation rule returned by the API. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::TicketCreationRuleDataResponse, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleResponse { + pub fn new( + data: crate::datadogV2::model::TicketCreationRuleDataResponse, + ) -> TicketCreationRuleResponse { + TicketCreationRuleResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleResponseVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleResponseVisitor { + type Value = TicketCreationRuleResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = TicketCreationRuleResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_type.rs b/src/datadogV2/model/model_ticket_creation_rule_type.rs new file mode 100644 index 000000000..5655131ec --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum TicketCreationRuleType { + TICKET_CREATION_RULES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for TicketCreationRuleType { + fn to_string(&self) -> String { + match self { + Self::TICKET_CREATION_RULES => String::from("ticket_creation_rules"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for TicketCreationRuleType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ticket_creation_rules" => Self::TICKET_CREATION_RULES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rule_update_request.rs b/src/datadogV2/model/model_ticket_creation_rule_update_request.rs new file mode 100644 index 000000000..a0834956e --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rule_update_request.rs @@ -0,0 +1,94 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The body of a ticket creation rule update request. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRuleUpdateRequest { + /// The data object for a ticket creation rule create or update request. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::TicketCreationRuleDataCreate, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRuleUpdateRequest { + pub fn new( + data: crate::datadogV2::model::TicketCreationRuleDataCreate, + ) -> TicketCreationRuleUpdateRequest { + TicketCreationRuleUpdateRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRuleUpdateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRuleUpdateRequestVisitor; + impl<'a> Visitor<'a> for TicketCreationRuleUpdateRequestVisitor { + type Value = TicketCreationRuleUpdateRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = TicketCreationRuleUpdateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRuleUpdateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_rules_response.rs b/src/datadogV2/model/model_ticket_creation_rules_response.rs new file mode 100644 index 000000000..905cab6b9 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_rules_response.rs @@ -0,0 +1,117 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A list of ticket creation rules with pagination metadata. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct TicketCreationRulesResponse { + /// A list of ticket creation rule data objects. + #[serde(rename = "data")] + pub data: Vec, + /// Pagination links for the list of automation rules. + #[serde(rename = "links")] + pub links: crate::datadogV2::model::SecurityAutomationRulesLinks, + /// Metadata for the list of automation rules. + #[serde(rename = "meta")] + pub meta: crate::datadogV2::model::SecurityAutomationRulesMeta, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl TicketCreationRulesResponse { + pub fn new( + data: Vec, + links: crate::datadogV2::model::SecurityAutomationRulesLinks, + meta: crate::datadogV2::model::SecurityAutomationRulesMeta, + ) -> TicketCreationRulesResponse { + TicketCreationRulesResponse { + data, + links, + meta, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for TicketCreationRulesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TicketCreationRulesResponseVisitor; + impl<'a> Visitor<'a> for TicketCreationRulesResponseVisitor { + type Value = TicketCreationRulesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut links: Option = None; + let mut meta: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "links" => { + links = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "meta" => { + meta = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + let links = links.ok_or_else(|| M::Error::missing_field("links"))?; + let meta = meta.ok_or_else(|| M::Error::missing_field("meta"))?; + + let content = TicketCreationRulesResponse { + data, + links, + meta, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(TicketCreationRulesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_ticket_creation_target.rs b/src/datadogV2/model/model_ticket_creation_target.rs new file mode 100644 index 000000000..e89a36050 --- /dev/null +++ b/src/datadogV2/model/model_ticket_creation_target.rs @@ -0,0 +1,51 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum TicketCreationTarget { + JIRA, + CASE_MANAGEMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for TicketCreationTarget { + fn to_string(&self) -> String { + match self { + Self::JIRA => String::from("jira"), + Self::CASE_MANAGEMENT => String::from("case_management"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for TicketCreationTarget { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for TicketCreationTarget { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "jira" => Self::JIRA, + "case_management" => Self::CASE_MANAGEMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.frozen new file mode 100644 index 000000000..f80d95376 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:00.178Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.json new file mode 100644 index 000000000..906086aa7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-due-date-rule-returns-Successfully-created-the-due-date-rule-response.json @@ -0,0 +1,63 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"due_in_days\":7,\"severity\":\"critical\"}],\"due_from\":\"first_seen\"},\"enabled\":true,\"name\":\"Test-Create_a_due_date_rule_returns_Successfully_created_the_due_date_rule_response-1781624460\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"due_date_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"51eb64b5-a519-408a-961a-137e4fe31d3c\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624462372,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624462372,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Create_a_due_date_rule_returns_Successfully_created_the_due_date_rule_response-1781624460\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:00 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/51eb64b5-a519-408a-961a-137e4fe31d3c" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:00 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.frozen new file mode 100644 index 000000000..43ceab110 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:02.989Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.json new file mode 100644 index 000000000..b0a870d06 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-mute-rule-returns-Successfully-created-the-mute-rule-response.json @@ -0,0 +1,63 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"enabled\":true,\"name\":\"Test-Create_a_mute_rule_returns_Successfully_created_the_mute_rule_response-1781624462\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"mute_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"a23423e0-da14-4698-9c01-7897eb56b76c\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624463227,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624463227,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Create_a_mute_rule_returns_Successfully_created_the_mute_rule_response-1781624462\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:02 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/a23423e0-da14-4698-9c01-7897eb56b76c" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:02 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.frozen new file mode 100644 index 000000000..65bc80d9b --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:03.837Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.json new file mode 100644 index 000000000..69a4321d9 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Create-a-ticket-creation-rule-returns-Successfully-created-the-ticket-creation-rule-response.json @@ -0,0 +1,63 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"max_tickets_per_day\":10,\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\"},\"enabled\":true,\"name\":\"Test-Create_a_ticket_creation_rule_returns_Successfully_created_the_ticket_creation_rule_response-1781624463\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"ticket_creation_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c24fb7cb-e877-491e-ae6e-2e8676b20dcb\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624464096,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624464096,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Create_a_ticket_creation_rule_returns_Successfully_created_the_ticket_creation_rule_response-1781624463\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:03 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/c24fb7cb-e877-491e-ae6e-2e8676b20dcb" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:03 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.frozen new file mode 100644 index 000000000..a1ce40185 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:04.669Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.json new file mode 100644 index 000000000..2a6d4833c --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-due-date-rule-returns-Rule-successfully-deleted-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"due_in_days\":7,\"severity\":\"critical\"}],\"due_from\":\"first_seen\"},\"enabled\":true,\"name\":\"Test-Delete_a_due_date_rule_returns_Rule_successfully_deleted_response-1781624464\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"due_date_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"139c64ad-97f6-4b26-8579-05a2e2792b6c\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624464907,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624464907,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Delete_a_due_date_rule_returns_Rule_successfully_deleted_response-1781624464\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:04 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/139c64ad-97f6-4b26-8579-05a2e2792b6c" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:04 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/139c64ad-97f6-4b26-8579-05a2e2792b6c" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"rule does not exist\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:04 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.frozen new file mode 100644 index 000000000..09f9f0ac5 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:05.734Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.json new file mode 100644 index 000000000..fe0554d92 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-mute-rule-returns-Rule-successfully-deleted-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"enabled\":true,\"name\":\"Test-Delete_a_mute_rule_returns_Rule_successfully_deleted_response-1781624465\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"mute_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"03c9e010-5a46-40b2-af26-5ff613828897\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624465962,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624465962,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Delete_a_mute_rule_returns_Rule_successfully_deleted_response-1781624465\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:05 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/03c9e010-5a46-40b2-af26-5ff613828897" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:05 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/03c9e010-5a46-40b2-af26-5ff613828897" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"rule does not exist\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:05 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.frozen new file mode 100644 index 000000000..6ce75cad4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:06.806Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.json new file mode 100644 index 000000000..aa5734189 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Delete-a-ticket-creation-rule-returns-Rule-successfully-deleted-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"max_tickets_per_day\":10,\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\"},\"enabled\":true,\"name\":\"Test-Delete_a_ticket_creation_rule_returns_Rule_successfully_deleted_response-1781624466\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"ticket_creation_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"6b2c813c-cd92-4531-b4aa-f79e1194bcb2\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624467064,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624467064,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Delete_a_ticket_creation_rule_returns_Rule_successfully_deleted_response-1781624466\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:06 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/6b2c813c-cd92-4531-b4aa-f79e1194bcb2" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:06 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/6b2c813c-cd92-4531-b4aa-f79e1194bcb2" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"rule does not exist\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.frozen new file mode 100644 index 000000000..55413b6c7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:07.946Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.json new file mode 100644 index 000000000..ab7bfb5d1 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-due-date-rule-returns-Successfully-retrieved-the-due-date-rule-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"due_in_days\":7,\"severity\":\"critical\"}],\"due_from\":\"first_seen\"},\"enabled\":true,\"name\":\"Test-Get_a_due_date_rule_returns_Successfully_retrieved_the_due_date_rule_response-1781624467\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"due_date_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7842abcf-795f-47cd-b6ba-6e05790668d5\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624468200,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624468200,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_a_due_date_rule_returns_Successfully_retrieved_the_due_date_rule_response-1781624467\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:07 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/7842abcf-795f-47cd-b6ba-6e05790668d5" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7842abcf-795f-47cd-b6ba-6e05790668d5\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624468200,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624468200,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_a_due_date_rule_returns_Successfully_retrieved_the_due_date_rule_response-1781624467\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:07 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/7842abcf-795f-47cd-b6ba-6e05790668d5" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:07 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.frozen new file mode 100644 index 000000000..865b604ab --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:09.039Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.json new file mode 100644 index 000000000..fd37f5771 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-mute-rule-returns-Successfully-retrieved-the-mute-rule-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"enabled\":true,\"name\":\"Test-Get_a_mute_rule_returns_Successfully_retrieved_the_mute_rule_response-1781624469\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"mute_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"66330741-04f8-43cc-8cd0-a4840a593658\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624469277,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624469277,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_a_mute_rule_returns_Successfully_retrieved_the_mute_rule_response-1781624469\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:09 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/66330741-04f8-43cc-8cd0-a4840a593658" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"66330741-04f8-43cc-8cd0-a4840a593658\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624469277,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624469277,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_a_mute_rule_returns_Successfully_retrieved_the_mute_rule_response-1781624469\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:09 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/66330741-04f8-43cc-8cd0-a4840a593658" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:09 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.frozen new file mode 100644 index 000000000..392abe6d0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:10.163Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.json new file mode 100644 index 000000000..ee0831a5b --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-a-ticket-creation-rule-returns-Successfully-retrieved-the-ticket-creation-rule-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"max_tickets_per_day\":10,\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\"},\"enabled\":true,\"name\":\"Test-Get_a_ticket_creation_rule_returns_Successfully_retrieved_the_ticket_creation_rule_response-1781624470\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"ticket_creation_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"065f00af-171c-4ecc-853d-ddb4c8e30c7b\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624470412,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624470412,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_a_ticket_creation_rule_returns_Successfully_retrieved_the_ticket_creation_rule_response-1781624470\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:10 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/065f00af-171c-4ecc-853d-ddb4c8e30c7b" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"065f00af-171c-4ecc-853d-ddb4c8e30c7b\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624470412,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624470412,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_a_ticket_creation_rule_returns_Successfully_retrieved_the_ticket_creation_rule_response-1781624470\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:10 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/065f00af-171c-4ecc-853d-ddb4c8e30c7b" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.frozen new file mode 100644 index 000000000..2f7495933 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:11.482Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.json new file mode 100644 index 000000000..c19e6a59f --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-due-date-rules-returns-Successfully-retrieved-the-list-of-due-date-rules-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"due_in_days\":7,\"severity\":\"critical\"}],\"due_from\":\"first_seen\"},\"enabled\":true,\"name\":\"Test-Get_all_due_date_rules_returns_Successfully_retrieved_the_list_of_due_date_rules_response-1781624471\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"due_date_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"1c8622b9-591f-472c-97ff-cac4c5a7cfe5\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624471720,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624471720,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_all_due_date_rules_returns_Successfully_retrieved_the_list_of_due_date_rules_response-1781624471\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:11 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"1c8622b9-591f-472c-97ff-cac4c5a7cfe5\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624471720,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624471720,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_all_due_date_rules_returns_Successfully_retrieved_the_list_of_due_date_rules_response-1781624471\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}],\"meta\":{\"page\":{\"total_filtered_count\":1}},\"links\":{\"first\":\"/api/v2/security/findings/automation/due_date_rules?page[size]=1000\\u0026page[number]=0\",\"last\":\"/api/v2/security/findings/automation/due_date_rules?page[size]=1000\\u0026page[number]=0\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:11 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/1c8622b9-591f-472c-97ff-cac4c5a7cfe5" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:11 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.frozen new file mode 100644 index 000000000..89c620816 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:12.599Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.json new file mode 100644 index 000000000..f90795187 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-mute-rules-returns-Successfully-retrieved-the-list-of-mute-rules-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"enabled\":true,\"name\":\"Test-Get_all_mute_rules_returns_Successfully_retrieved_the_list_of_mute_rules_response-1781624472\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"mute_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"4c72a302-c7c8-42bc-986a-f196580240c3\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624472865,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624472865,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_all_mute_rules_returns_Successfully_retrieved_the_list_of_mute_rules_response-1781624472\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:12 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"4c72a302-c7c8-42bc-986a-f196580240c3\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624472865,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624472865,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_all_mute_rules_returns_Successfully_retrieved_the_list_of_mute_rules_response-1781624472\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}],\"meta\":{\"page\":{\"total_filtered_count\":1}},\"links\":{\"first\":\"/api/v2/security/findings/automation/mute_rules?page[size]=1000\\u0026page[number]=0\",\"last\":\"/api/v2/security/findings/automation/mute_rules?page[size]=1000\\u0026page[number]=0\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:12 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/4c72a302-c7c8-42bc-986a-f196580240c3" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:12 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.frozen new file mode 100644 index 000000000..f3b009f91 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:13.714Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.json new file mode 100644 index 000000000..8bcb2bb21 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Get-all-ticket-creation-rules-returns-Successfully-retrieved-the-list-of-ticket-creation-rules-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"max_tickets_per_day\":10,\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\"},\"enabled\":true,\"name\":\"Test-Get_all_ticket_creation_rules_returns_Successfully_retrieved_the_list_of_ticket_creation_rules_respo-1781624473\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"ticket_creation_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"399d69c3-6fcd-4538-b0cc-05e6db5aac38\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624473944,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624473944,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_all_ticket_creation_rules_returns_Successfully_retrieved_the_list_of_ticket_creation_rules_respo-1781624473\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:13 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"399d69c3-6fcd-4538-b0cc-05e6db5aac38\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624473944,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624473944,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Get_all_ticket_creation_rules_returns_Successfully_retrieved_the_list_of_ticket_creation_rules_respo-1781624473\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}],\"meta\":{\"page\":{\"total_filtered_count\":1}},\"links\":{\"first\":\"/api/v2/security/findings/automation/ticket_creation_rules?page[size]=1000\\u0026page[number]=0\",\"last\":\"/api/v2/security/findings/automation/ticket_creation_rules?page[size]=1000\\u0026page[number]=0\"}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:13 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/399d69c3-6fcd-4538-b0cc-05e6db5aac38" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:13 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.frozen new file mode 100644 index 000000000..c7ce8f75a --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:14.824Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.json new file mode 100644 index 000000000..a1d439877 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-due-date-rules-returns-Successfully-reordered-the-due-date-rules-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"due_in_days\":7,\"severity\":\"critical\"}],\"due_from\":\"first_seen\"},\"enabled\":true,\"name\":\"Test-Reorder_due_date_rules_returns_Successfully_reordered_the_due_date_rules_response-1781624474\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"due_date_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"64e53941-8eba-42f9-946b-6422bead1eea\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624475039,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624475039,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Reorder_due_date_rules_returns_Successfully_reordered_the_due_date_rules_response-1781624474\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:14 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"64e53941-8eba-42f9-946b-6422bead1eea\",\"type\":\"due_date_rules\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/reorder" + }, + "response": { + "body": { + "string": "{\"data\":[{\"type\":\"due_date_rules\",\"id\":\"64e53941-8eba-42f9-946b-6422bead1eea\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:14 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/64e53941-8eba-42f9-946b-6422bead1eea" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:14 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.frozen new file mode 100644 index 000000000..a7c62ff97 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:16.028Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.json new file mode 100644 index 000000000..5be1d7e80 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-mute-rules-returns-Successfully-reordered-the-mute-rules-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"enabled\":true,\"name\":\"Test-Reorder_mute_rules_returns_Successfully_reordered_the_mute_rules_response-1781624476\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"mute_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"707a25e7-57ae-4d8f-9ce8-4840b52c7349\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624476249,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624476249,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Reorder_mute_rules_returns_Successfully_reordered_the_mute_rules_response-1781624476\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:16 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"707a25e7-57ae-4d8f-9ce8-4840b52c7349\",\"type\":\"mute_rules\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/reorder" + }, + "response": { + "body": { + "string": "{\"data\":[{\"type\":\"mute_rules\",\"id\":\"707a25e7-57ae-4d8f-9ce8-4840b52c7349\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:16 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/707a25e7-57ae-4d8f-9ce8-4840b52c7349" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:16 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.frozen new file mode 100644 index 000000000..f5acdf623 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:17.183Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.json new file mode 100644 index 000000000..4c8700fff --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Reorder-ticket-creation-rules-returns-Successfully-reordered-the-ticket-creation-rules-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"max_tickets_per_day\":10,\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\"},\"enabled\":true,\"name\":\"Test-Reorder_ticket_creation_rules_returns_Successfully_reordered_the_ticket_creation_rules_response-1781624477\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"ticket_creation_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b34dcd68-976a-49af-915b-83488a3d9f74\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624477424,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624477424,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Reorder_ticket_creation_rules_returns_Successfully_reordered_the_ticket_creation_rules_response-1781624477\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:17 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":[{\"id\":\"b34dcd68-976a-49af-915b-83488a3d9f74\",\"type\":\"ticket_creation_rules\"}]}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/reorder" + }, + "response": { + "body": { + "string": "{\"data\":[{\"type\":\"ticket_creation_rules\",\"id\":\"b34dcd68-976a-49af-915b-83488a3d9f74\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:17 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/b34dcd68-976a-49af-915b-83488a3d9f74" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:17 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.frozen new file mode 100644 index 000000000..c0e1f30ef --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:18.417Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.json new file mode 100644 index 000000000..ed7ac37d3 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-due-date-rule-returns-Successfully-updated-the-due-date-rule-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"due_in_days\":7,\"severity\":\"critical\"}],\"due_from\":\"first_seen\"},\"enabled\":true,\"name\":\"Test-Update_a_due_date_rule_returns_Successfully_updated_the_due_date_rule_response-1781624478\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"due_date_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"22df6980-9710-496d-bf46-85e0ac181dc0\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":7}],\"due_from\":\"first_seen\"},\"created_at\":1781624478629,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624478629,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Update_a_due_date_rule_returns_Successfully_updated_the_due_date_rule_response-1781624478\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:18 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"due_in_days\":14,\"severity\":\"critical\"}],\"due_from\":\"first_seen\"},\"enabled\":false,\"name\":\"Test-Update_a_due_date_rule_returns_Successfully_updated_the_due_date_rule_response-1781624478\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"due_date_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "put", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/22df6980-9710-496d-bf46-85e0ac181dc0" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"22df6980-9710-496d-bf46-85e0ac181dc0\",\"type\":\"due_date_rules\",\"attributes\":{\"action\":{\"due_days_per_severity\":[{\"severity\":\"critical\",\"due_in_days\":14}],\"due_from\":\"first_seen\"},\"created_at\":1781624478629,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":false,\"modified_at\":1781624479036,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Update_a_due_date_rule_returns_Successfully_updated_the_due_date_rule_response-1781624478\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:18 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/due_date_rules/22df6980-9710-496d-bf46-85e0ac181dc0" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:18 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.frozen new file mode 100644 index 000000000..9c2202dcb --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:19.612Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.json new file mode 100644 index 000000000..3f924be9d --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-mute-rule-returns-Successfully-updated-the-mute-rule-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"enabled\":true,\"name\":\"Test-Update_a_mute_rule_returns_Successfully_updated_the_mute_rule_response-1781624479\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"mute_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9a1d22ad-558c-4c4e-bdf5-72cd264cf7a9\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"risk_accepted\"},\"created_at\":1781624479894,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624479894,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Update_a_mute_rule_returns_Successfully_updated_the_mute_rule_response-1781624479\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:19 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"reason\":\"false_positive\"},\"enabled\":false,\"name\":\"Test-Update_a_mute_rule_returns_Successfully_updated_the_mute_rule_response-1781624479\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"mute_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "put", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/9a1d22ad-558c-4c4e-bdf5-72cd264cf7a9" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9a1d22ad-558c-4c4e-bdf5-72cd264cf7a9\",\"type\":\"mute_rules\",\"attributes\":{\"action\":{\"reason\":\"false_positive\"},\"created_at\":1781624479894,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":false,\"modified_at\":1781624480318,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Update_a_mute_rule_returns_Successfully_updated_the_mute_rule_response-1781624479\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:19 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/mute_rules/9a1d22ad-558c-4c4e-bdf5-72cd264cf7a9" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:19 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.frozen b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.frozen new file mode 100644 index 000000000..1bf1e4fad --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.frozen @@ -0,0 +1 @@ +2026-06-16T15:41:20.880Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.json b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.json new file mode 100644 index 000000000..a7b82c855 --- /dev/null +++ b/tests/scenarios/cassettes/v2/security_monitoring/Update-a-ticket-creation-rule-returns-Successfully-updated-the-ticket-creation-rule-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"max_tickets_per_day\":10,\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\"},\"enabled\":true,\"name\":\"Test-Update_a_ticket_creation_rule_returns_Successfully_updated_the_ticket_creation_rule_response-1781624480\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"ticket_creation_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d3fcec39-567f-4450-967e-ca83bb29dbe4\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":10},\"created_at\":1781624481109,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":true,\"modified_at\":1781624481109,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Update_a_ticket_creation_rule_returns_Successfully_updated_the_ticket_creation_rule_response-1781624480\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 201, + "message": "Created" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:20 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"action\":{\"max_tickets_per_day\":5,\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\"},\"enabled\":false,\"name\":\"Test-Update_a_ticket_creation_rule_returns_Successfully_updated_the_ticket_creation_rule_response-1781624480\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}},\"type\":\"ticket_creation_rules\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "put", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/d3fcec39-567f-4450-967e-ca83bb29dbe4" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d3fcec39-567f-4450-967e-ca83bb29dbe4\",\"type\":\"ticket_creation_rules\",\"attributes\":{\"action\":{\"project_id\":\"11111111-1111-1111-1111-111111111111\",\"target\":\"jira\",\"max_tickets_per_day\":5},\"created_at\":1781624481109,\"created_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"enabled\":false,\"modified_at\":1781624481511,\"modified_by\":{\"type\":\"user\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"name\":\"Test-Update_a_ticket_creation_rule_returns_Successfully_updated_the_ticket_creation_rule_response-1781624480\",\"rule\":{\"finding_types\":[\"misconfiguration\"],\"query\":\"env:staging\"}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:20 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/security/findings/automation/ticket_creation_rules/d3fcec39-567f-4450-967e-ca83bb29dbe4" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Tue, 16 Jun 2026 15:41:20 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index f5ce3365d..0f9de6d48 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -1290,6 +1290,42 @@ "tag": "Scorecards", "operationId": "CreateScorecardRule" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"due_date_rules\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"enabled\": true,\n \"rule\": {\n \"finding_types\": [\"misconfiguration\"],\n \"query\": \"env:staging\"\n },\n \"action\": {\n \"due_days_per_severity\": [\n {\"severity\": \"critical\", \"due_in_days\": 7}\n ],\n \"due_from\": \"first_seen\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"valid_due_date_rule\" in the system", + "key": "valid_due_date_rule", + "tag": "Security Monitoring", + "operationId": "CreateSecurityFindingsAutomationDueDateRule" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"mute_rules\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"enabled\": true,\n \"rule\": {\n \"finding_types\": [\"misconfiguration\"],\n \"query\": \"env:staging\"\n },\n \"action\": {\n \"reason\": \"risk_accepted\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"valid_mute_rule\" in the system", + "key": "valid_mute_rule", + "tag": "Security Monitoring", + "operationId": "CreateSecurityFindingsAutomationMuteRule" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"ticket_creation_rules\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"enabled\": true,\n \"rule\": {\n \"finding_types\": [\"misconfiguration\"],\n \"query\": \"env:staging\"\n },\n \"action\": {\n \"project_id\": \"11111111-1111-1111-1111-111111111111\",\n \"target\": \"jira\",\n \"max_tickets_per_day\": 10\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"valid_ticket_creation_rule\" in the system", + "key": "valid_ticket_creation_rule", + "tag": "Security Monitoring", + "operationId": "CreateSecurityFindingsAutomationTicketCreationRule" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index dd064c2a4..0c14124aa 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -756,6 +756,60 @@ Feature: Security Monitoring And the response "message" is equal to "Test rule" And the response "isEnabled" is equal to true + @generated @skip @team:DataDog/k9-automation + Scenario: Create a due date rule returns "Bad Request" response + Given operation "CreateSecurityFindingsAutomationDueDateRule" enabled + And new "CreateSecurityFindingsAutomationDueDateRule" request + And body with value {"data": {"attributes": {"action": {"due_days_per_severity": [{"due_in_days": 7, "severity": "critical"}], "due_from": "first_seen", "reason_description": "Applied for production findings only"}, "enabled": true, "name": "Critical findings due in 7 days", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "due_date_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Create a due date rule returns "Successfully created the due date rule" response + Given operation "CreateSecurityFindingsAutomationDueDateRule" enabled + And new "CreateSecurityFindingsAutomationDueDateRule" request + And body with value {"data": {"attributes": {"action": {"due_days_per_severity": [{"due_in_days": 7, "severity": "critical"}], "due_from": "first_seen"}, "enabled": true, "name": "{{ unique }}", "rule": {"finding_types": ["misconfiguration"], "query": "env:staging"}}, "type": "due_date_rules"}} + When the request is sent + Then the response status is 201 Successfully created the due date rule + And the response "data.type" is equal to "due_date_rules" + And the response "data.attributes.name" is equal to "{{ unique }}" + And the response "data.attributes.enabled" is equal to true + + @generated @skip @team:DataDog/k9-automation + Scenario: Create a due date rule returns "Unprocessable Entity" response + Given operation "CreateSecurityFindingsAutomationDueDateRule" enabled + And new "CreateSecurityFindingsAutomationDueDateRule" request + And body with value {"data": {"attributes": {"action": {"due_days_per_severity": [{"due_in_days": 7, "severity": "critical"}], "due_from": "first_seen", "reason_description": "Applied for production findings only"}, "enabled": true, "name": "Critical findings due in 7 days", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "due_date_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/k9-automation + Scenario: Create a mute rule returns "Bad Request" response + Given operation "CreateSecurityFindingsAutomationMuteRule" enabled + And new "CreateSecurityFindingsAutomationMuteRule" request + And body with value {"data": {"attributes": {"action": {"expire_at": 4070908800000, "reason": "risk_accepted", "reason_description": "Accepted for dev environments only"}, "enabled": true, "name": "Mute accepted risks in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "mute_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Create a mute rule returns "Successfully created the mute rule" response + Given operation "CreateSecurityFindingsAutomationMuteRule" enabled + And new "CreateSecurityFindingsAutomationMuteRule" request + And body with value {"data": {"attributes": {"action": {"reason": "risk_accepted"}, "enabled": true, "name": "{{ unique }}", "rule": {"finding_types": ["misconfiguration"], "query": "env:staging"}}, "type": "mute_rules"}} + When the request is sent + Then the response status is 201 Successfully created the mute rule + And the response "data.type" is equal to "mute_rules" + And the response "data.attributes.name" is equal to "{{ unique }}" + And the response "data.attributes.enabled" is equal to true + + @generated @skip @team:DataDog/k9-automation + Scenario: Create a mute rule returns "Unprocessable Entity" response + Given operation "CreateSecurityFindingsAutomationMuteRule" enabled + And new "CreateSecurityFindingsAutomationMuteRule" request + And body with value {"data": {"attributes": {"action": {"expire_at": 4070908800000, "reason": "risk_accepted", "reason_description": "Accepted for dev environments only"}, "enabled": true, "name": "Mute accepted risks in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "mute_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/cloud-security-posture-management Scenario: Create a new signal-based notification rule returns "Bad Request" response Given new "CreateSignalNotificationRule" request @@ -870,6 +924,33 @@ Feature: Security Monitoring And the response "data.attributes.rule_query" is equal to "type:log_detection source:cloudtrail" And the response "data.attributes.data_exclusion_query" is equal to "account_id:12345" + @generated @skip @team:DataDog/k9-automation + Scenario: Create a ticket creation rule returns "Bad Request" response + Given operation "CreateSecurityFindingsAutomationTicketCreationRule" enabled + And new "CreateSecurityFindingsAutomationTicketCreationRule" request + And body with value {"data": {"attributes": {"action": {"assignee_id": "22222222-2222-2222-2222-222222222222", "fields": {"labels": ["security"]}, "max_tickets_per_day": 100, "project_id": "11111111-1111-1111-1111-111111111111", "target": "jira"}, "enabled": true, "name": "Auto-create Jira tickets for critical findings", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "ticket_creation_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Create a ticket creation rule returns "Successfully created the ticket creation rule" response + Given operation "CreateSecurityFindingsAutomationTicketCreationRule" enabled + And new "CreateSecurityFindingsAutomationTicketCreationRule" request + And body with value {"data": {"attributes": {"action": {"max_tickets_per_day": 10, "project_id": "11111111-1111-1111-1111-111111111111", "target": "jira"}, "enabled": true, "name": "{{ unique }}", "rule": {"finding_types": ["misconfiguration"], "query": "env:staging"}}, "type": "ticket_creation_rules"}} + When the request is sent + Then the response status is 201 Successfully created the ticket creation rule + And the response "data.type" is equal to "ticket_creation_rules" + And the response "data.attributes.name" is equal to "{{ unique }}" + And the response "data.attributes.enabled" is equal to true + + @generated @skip @team:DataDog/k9-automation + Scenario: Create a ticket creation rule returns "Unprocessable Entity" response + Given operation "CreateSecurityFindingsAutomationTicketCreationRule" enabled + And new "CreateSecurityFindingsAutomationTicketCreationRule" request + And body with value {"data": {"attributes": {"action": {"assignee_id": "22222222-2222-2222-2222-222222222222", "fields": {"labels": ["security"]}, "max_tickets_per_day": 100, "project_id": "11111111-1111-1111-1111-111111111111", "target": "jira"}, "enabled": true, "name": "Auto-create Jira tickets for critical findings", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "ticket_creation_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/k9-cloud-siem Scenario: Create an entity context sync configuration returns "Bad Request" response Given operation "CreateSecurityMonitoringIntegrationConfig" enabled @@ -1042,6 +1123,40 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/k9-automation + Scenario: Delete a due date rule returns "Not Found" response + Given operation "DeleteSecurityFindingsAutomationDueDateRule" enabled + And new "DeleteSecurityFindingsAutomationDueDateRule" 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 due date rule returns "Rule successfully deleted." response + Given operation "DeleteSecurityFindingsAutomationDueDateRule" enabled + And there is a valid "valid_due_date_rule" in the system + And new "DeleteSecurityFindingsAutomationDueDateRule" request + And request contains "rule_id" parameter from "valid_due_date_rule.data.id" + When the request is sent + Then the response status is 204 Rule successfully deleted. + + @generated @skip @team:DataDog/k9-automation + Scenario: Delete a mute rule returns "Not Found" response + Given operation "DeleteSecurityFindingsAutomationMuteRule" enabled + And new "DeleteSecurityFindingsAutomationMuteRule" 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 mute rule returns "Rule successfully deleted." response + Given operation "DeleteSecurityFindingsAutomationMuteRule" enabled + And there is a valid "valid_mute_rule" in the system + And new "DeleteSecurityFindingsAutomationMuteRule" request + And request contains "rule_id" parameter from "valid_mute_rule.data.id" + When the request is sent + Then the response status is 204 Rule successfully deleted. + @skip @team:DataDog/k9-cloud-siem Scenario: Delete a non existing rule returns "Not Found" response Given new "DeleteSecurityMonitoringRule" request @@ -1101,6 +1216,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 ticket creation rule returns "Not Found" response + Given operation "DeleteSecurityFindingsAutomationTicketCreationRule" enabled + And new "DeleteSecurityFindingsAutomationTicketCreationRule" 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 ticket creation rule returns "Rule successfully deleted." response + Given operation "DeleteSecurityFindingsAutomationTicketCreationRule" enabled + And there is a valid "valid_ticket_creation_rule" in the system + And new "DeleteSecurityFindingsAutomationTicketCreationRule" request + And request contains "rule_id" parameter from "valid_ticket_creation_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 vulnerability-based notification rule returns "Not Found" response Given new "DeleteVulnerabilityNotificationRule" request @@ -1408,6 +1540,25 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-automation + Scenario: Get a due date rule returns "Not Found" response + Given operation "GetSecurityFindingsAutomationDueDateRule" enabled + And new "GetSecurityFindingsAutomationDueDateRule" 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 due date rule returns "Successfully retrieved the due date rule" response + Given operation "GetSecurityFindingsAutomationDueDateRule" enabled + And there is a valid "valid_due_date_rule" in the system + And new "GetSecurityFindingsAutomationDueDateRule" request + And request contains "rule_id" parameter from "valid_due_date_rule.data.id" + When the request is sent + Then the response status is 200 Successfully retrieved the due date rule + And the response "data.id" is equal to "{{ valid_due_date_rule.data.id }}" + And the response "data.type" is equal to "due_date_rules" + @generated @skip @team:DataDog/cloud-security-posture-management Scenario: Get a finding returns "Bad Request: The server cannot process the request due to invalid syntax in the request." response Given operation "GetFinding" enabled @@ -1529,6 +1680,25 @@ Feature: Security Monitoring Then the response status is 200 OK And the response has 3 items + @generated @skip @team:DataDog/k9-automation + Scenario: Get a mute rule returns "Not Found" response + Given operation "GetSecurityFindingsAutomationMuteRule" enabled + And new "GetSecurityFindingsAutomationMuteRule" 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 mute rule returns "Successfully retrieved the mute rule" response + Given operation "GetSecurityFindingsAutomationMuteRule" enabled + And there is a valid "valid_mute_rule" in the system + And new "GetSecurityFindingsAutomationMuteRule" request + And request contains "rule_id" parameter from "valid_mute_rule.data.id" + When the request is sent + Then the response status is 200 Successfully retrieved the mute rule + And the response "data.id" is equal to "{{ valid_mute_rule.data.id }}" + And the response "data.type" is equal to "mute_rules" + @generated @skip @team:DataDog/k9-cloud-siem Scenario: Get a quick list of security signals returns "Bad Request" response Given new "ListSecurityMonitoringSignals" request @@ -1680,12 +1850,49 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-automation + Scenario: Get a ticket creation rule returns "Not Found" response + Given operation "GetSecurityFindingsAutomationTicketCreationRule" enabled + And new "GetSecurityFindingsAutomationTicketCreationRule" 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 ticket creation rule returns "Successfully retrieved the ticket creation rule" response + Given operation "GetSecurityFindingsAutomationTicketCreationRule" enabled + And there is a valid "valid_ticket_creation_rule" in the system + And new "GetSecurityFindingsAutomationTicketCreationRule" request + And request contains "rule_id" parameter from "valid_ticket_creation_rule.data.id" + When the request is sent + Then the response status is 200 Successfully retrieved the ticket creation rule + And the response "data.id" is equal to "{{ valid_ticket_creation_rule.data.id }}" + And the response "data.type" is equal to "ticket_creation_rules" + @team:DataDog/k9-cloud-siem Scenario: Get all critical assets returns "OK" response Given new "ListSecurityMonitoringCriticalAssets" request When the request is sent Then the response status is 200 OK + @team:DataDog/k9-automation + Scenario: Get all due date rules returns "Successfully retrieved the list of due date rules" response + Given operation "ListSecurityFindingsAutomationDueDateRules" enabled + And there is a valid "valid_due_date_rule" in the system + And new "ListSecurityFindingsAutomationDueDateRules" request + When the request is sent + Then the response status is 200 Successfully retrieved the list of due date rules + And the response "data" has item with field "id" with value "{{ valid_due_date_rule.data.id }}" + + @team:DataDog/k9-automation + Scenario: Get all mute rules returns "Successfully retrieved the list of mute rules" response + Given operation "ListSecurityFindingsAutomationMuteRules" enabled + And there is a valid "valid_mute_rule" in the system + And new "ListSecurityFindingsAutomationMuteRules" request + When the request is sent + Then the response status is 200 Successfully retrieved the list of mute rules + And the response "data" has item with field "id" with value "{{ valid_mute_rule.data.id }}" + @team:DataDog/k9-cloud-siem Scenario: Get all security filters returns "OK" response Given new "ListSecurityFilters" request @@ -1734,6 +1941,15 @@ Feature: Security Monitoring Then the response status is 200 OK And the response "data[0].attributes.name" is equal to "suppression2 {{ unique_hash }}" + @team:DataDog/k9-automation + Scenario: Get all ticket creation rules returns "Successfully retrieved the list of ticket creation rules" response + Given operation "ListSecurityFindingsAutomationTicketCreationRules" enabled + And there is a valid "valid_ticket_creation_rule" in the system + And new "ListSecurityFindingsAutomationTicketCreationRules" request + When the request is sent + Then the response status is 200 Successfully retrieved the list of ticket creation rules + And the response "data" has item with field "id" with value "{{ valid_ticket_creation_rule.data.id }}" + @generated @skip @team:DataDog/k9-cloud-siem Scenario: Get an entity context sync configuration returns "Not Found" response Given operation "GetSecurityMonitoringIntegrationConfig" enabled @@ -2517,6 +2733,81 @@ Feature: Security Monitoring When the request is sent Then the response status is 422 The server cannot process the request because it contains invalid data. + @generated @skip @team:DataDog/k9-automation + Scenario: Reorder due date rules returns "Bad Request" response + Given operation "ReorderSecurityFindingsAutomationDueDateRules" enabled + And new "ReorderSecurityFindingsAutomationDueDateRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "due_date_rules"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Reorder due date rules returns "Successfully reordered the due date rules" response + Given operation "ReorderSecurityFindingsAutomationDueDateRules" enabled + And there is a valid "valid_due_date_rule" in the system + And new "ReorderSecurityFindingsAutomationDueDateRules" request + And body with value {"data": [{"id": "{{ valid_due_date_rule.data.id }}", "type": "due_date_rules"}]} + When the request is sent + Then the response status is 200 Successfully reordered the due date rules + + @generated @skip @team:DataDog/k9-automation + Scenario: Reorder due date rules returns "Unprocessable Entity" response + Given operation "ReorderSecurityFindingsAutomationDueDateRules" enabled + And new "ReorderSecurityFindingsAutomationDueDateRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "due_date_rules"}]} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/k9-automation + Scenario: Reorder mute rules returns "Bad Request" response + Given operation "ReorderSecurityFindingsAutomationMuteRules" enabled + And new "ReorderSecurityFindingsAutomationMuteRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "mute_rules"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Reorder mute rules returns "Successfully reordered the mute rules" response + Given operation "ReorderSecurityFindingsAutomationMuteRules" enabled + And there is a valid "valid_mute_rule" in the system + And new "ReorderSecurityFindingsAutomationMuteRules" request + And body with value {"data": [{"id": "{{ valid_mute_rule.data.id }}", "type": "mute_rules"}]} + When the request is sent + Then the response status is 200 Successfully reordered the mute rules + + @generated @skip @team:DataDog/k9-automation + Scenario: Reorder mute rules returns "Unprocessable Entity" response + Given operation "ReorderSecurityFindingsAutomationMuteRules" enabled + And new "ReorderSecurityFindingsAutomationMuteRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "mute_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 + And new "ReorderSecurityFindingsAutomationTicketCreationRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "ticket_creation_rules"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-automation + Scenario: Reorder ticket creation rules returns "Successfully reordered the ticket creation rules" response + Given operation "ReorderSecurityFindingsAutomationTicketCreationRules" enabled + And there is a valid "valid_ticket_creation_rule" in the system + And new "ReorderSecurityFindingsAutomationTicketCreationRules" request + And body with value {"data": [{"id": "{{ valid_ticket_creation_rule.data.id }}", "type": "ticket_creation_rules"}]} + When the request is sent + Then the response status is 200 Successfully reordered the ticket creation rules + + @generated @skip @team:DataDog/k9-automation + Scenario: Reorder ticket creation rules returns "Unprocessable Entity" response + Given operation "ReorderSecurityFindingsAutomationTicketCreationRules" enabled + And new "ReorderSecurityFindingsAutomationTicketCreationRules" request + And body with value {"data": [{"id": "00000000-0000-0000-0000-000000000000", "type": "ticket_creation_rules"}]} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/k9-cloud-siem Scenario: Restore a rule to a historical version returns "Bad Request" response Given operation "RestoreSecurityMonitoringRule" enabled @@ -2862,6 +3153,84 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/k9-automation + Scenario: Update a due date rule returns "Bad Request" response + Given operation "UpdateSecurityFindingsAutomationDueDateRule" enabled + And new "UpdateSecurityFindingsAutomationDueDateRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"due_days_per_severity": [{"due_in_days": 7, "severity": "critical"}], "due_from": "first_seen", "reason_description": "Applied for production findings only"}, "enabled": true, "name": "Critical findings due in 7 days", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "due_date_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a due date rule returns "Not Found" response + Given operation "UpdateSecurityFindingsAutomationDueDateRule" enabled + And new "UpdateSecurityFindingsAutomationDueDateRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"due_days_per_severity": [{"due_in_days": 7, "severity": "critical"}], "due_from": "first_seen", "reason_description": "Applied for production findings only"}, "enabled": true, "name": "Critical findings due in 7 days", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "due_date_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-automation + Scenario: Update a due date rule returns "Successfully updated the due date rule" response + Given operation "UpdateSecurityFindingsAutomationDueDateRule" enabled + And there is a valid "valid_due_date_rule" in the system + And new "UpdateSecurityFindingsAutomationDueDateRule" request + And request contains "rule_id" parameter from "valid_due_date_rule.data.id" + And body with value {"data": {"attributes": {"action": {"due_days_per_severity": [{"due_in_days": 14, "severity": "critical"}], "due_from": "first_seen"}, "enabled": false, "name": "{{ unique }}", "rule": {"finding_types": ["misconfiguration"], "query": "env:staging"}}, "type": "due_date_rules"}} + When the request is sent + Then the response status is 200 Successfully updated the due date rule + And the response "data.id" is equal to "{{ valid_due_date_rule.data.id }}" + And the response "data.attributes.name" is equal to "{{ unique }}" + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a due date rule returns "Unprocessable Entity" response + Given operation "UpdateSecurityFindingsAutomationDueDateRule" enabled + And new "UpdateSecurityFindingsAutomationDueDateRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"due_days_per_severity": [{"due_in_days": 7, "severity": "critical"}], "due_from": "first_seen", "reason_description": "Applied for production findings only"}, "enabled": true, "name": "Critical findings due in 7 days", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "due_date_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a mute rule returns "Bad Request" response + Given operation "UpdateSecurityFindingsAutomationMuteRule" enabled + And new "UpdateSecurityFindingsAutomationMuteRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"expire_at": 4070908800000, "reason": "risk_accepted", "reason_description": "Accepted for dev environments only"}, "enabled": true, "name": "Mute accepted risks in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "mute_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a mute rule returns "Not Found" response + Given operation "UpdateSecurityFindingsAutomationMuteRule" enabled + And new "UpdateSecurityFindingsAutomationMuteRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"expire_at": 4070908800000, "reason": "risk_accepted", "reason_description": "Accepted for dev environments only"}, "enabled": true, "name": "Mute accepted risks in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "mute_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-automation + Scenario: Update a mute rule returns "Successfully updated the mute rule" response + Given operation "UpdateSecurityFindingsAutomationMuteRule" enabled + And there is a valid "valid_mute_rule" in the system + And new "UpdateSecurityFindingsAutomationMuteRule" request + And request contains "rule_id" parameter from "valid_mute_rule.data.id" + And body with value {"data": {"attributes": {"action": {"reason": "false_positive"}, "enabled": false, "name": "{{ unique }}", "rule": {"finding_types": ["misconfiguration"], "query": "env:staging"}}, "type": "mute_rules"}} + When the request is sent + Then the response status is 200 Successfully updated the mute rule + And the response "data.id" is equal to "{{ valid_mute_rule.data.id }}" + And the response "data.attributes.name" is equal to "{{ unique }}" + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a mute rule returns "Unprocessable Entity" response + Given operation "UpdateSecurityFindingsAutomationMuteRule" enabled + And new "UpdateSecurityFindingsAutomationMuteRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"expire_at": 4070908800000, "reason": "risk_accepted", "reason_description": "Accepted for dev environments only"}, "enabled": true, "name": "Mute accepted risks in dev", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "mute_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/k9-cloud-siem Scenario: Update a security filter returns "Bad Request" response Given new "UpdateSecurityFilter" request @@ -2934,6 +3303,45 @@ Feature: Security Monitoring And the response "data.attributes.suppression_query" is equal to "env:staging status:low" And the response "data.attributes.version" is equal to 2 + @generated @skip @team:DataDog/k9-automation + Scenario: Update a ticket creation rule returns "Bad Request" response + Given operation "UpdateSecurityFindingsAutomationTicketCreationRule" enabled + And new "UpdateSecurityFindingsAutomationTicketCreationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"assignee_id": "22222222-2222-2222-2222-222222222222", "fields": {"labels": ["security"]}, "max_tickets_per_day": 100, "project_id": "11111111-1111-1111-1111-111111111111", "target": "jira"}, "enabled": true, "name": "Auto-create Jira tickets for critical findings", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "ticket_creation_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a ticket creation rule returns "Not Found" response + Given operation "UpdateSecurityFindingsAutomationTicketCreationRule" enabled + And new "UpdateSecurityFindingsAutomationTicketCreationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"assignee_id": "22222222-2222-2222-2222-222222222222", "fields": {"labels": ["security"]}, "max_tickets_per_day": 100, "project_id": "11111111-1111-1111-1111-111111111111", "target": "jira"}, "enabled": true, "name": "Auto-create Jira tickets for critical findings", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "ticket_creation_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-automation + Scenario: Update a ticket creation rule returns "Successfully updated the ticket creation rule" response + Given operation "UpdateSecurityFindingsAutomationTicketCreationRule" enabled + And there is a valid "valid_ticket_creation_rule" in the system + And new "UpdateSecurityFindingsAutomationTicketCreationRule" request + And request contains "rule_id" parameter from "valid_ticket_creation_rule.data.id" + And body with value {"data": {"attributes": {"action": {"max_tickets_per_day": 5, "project_id": "11111111-1111-1111-1111-111111111111", "target": "jira"}, "enabled": false, "name": "{{ unique }}", "rule": {"finding_types": ["misconfiguration"], "query": "env:staging"}}, "type": "ticket_creation_rules"}} + When the request is sent + Then the response status is 200 Successfully updated the ticket creation rule + And the response "data.id" is equal to "{{ valid_ticket_creation_rule.data.id }}" + And the response "data.attributes.name" is equal to "{{ unique }}" + + @generated @skip @team:DataDog/k9-automation + Scenario: Update a ticket creation rule returns "Unprocessable Entity" response + Given operation "UpdateSecurityFindingsAutomationTicketCreationRule" enabled + And new "UpdateSecurityFindingsAutomationTicketCreationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": {"assignee_id": "22222222-2222-2222-2222-222222222222", "fields": {"labels": ["security"]}, "max_tickets_per_day": 100, "project_id": "11111111-1111-1111-1111-111111111111", "target": "jira"}, "enabled": true, "name": "Auto-create Jira tickets for critical findings", "rule": {"finding_types": ["misconfiguration"], "query": "env:prod team:platform"}}, "type": "ticket_creation_rules"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/k9-cloud-siem Scenario: Update an entity context sync configuration returns "Bad Request" response Given operation "UpdateSecurityMonitoringIntegrationConfig" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 049cc1252..896b23d3d 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -6913,6 +6913,135 @@ "type": "idempotent" } }, + "ListSecurityFindingsAutomationDueDateRules": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "CreateSecurityFindingsAutomationDueDateRule": { + "tag": "Security Monitoring", + "undo": { + "operationId": "DeleteSecurityFindingsAutomationDueDateRule", + "parameters": [ + { + "name": "rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ReorderSecurityFindingsAutomationDueDateRules": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "DeleteSecurityFindingsAutomationDueDateRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "GetSecurityFindingsAutomationDueDateRule": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "UpdateSecurityFindingsAutomationDueDateRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "ListSecurityFindingsAutomationMuteRules": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "CreateSecurityFindingsAutomationMuteRule": { + "tag": "Security Monitoring", + "undo": { + "operationId": "DeleteSecurityFindingsAutomationMuteRule", + "parameters": [ + { + "name": "rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ReorderSecurityFindingsAutomationMuteRules": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "DeleteSecurityFindingsAutomationMuteRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "GetSecurityFindingsAutomationMuteRule": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "UpdateSecurityFindingsAutomationMuteRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "ListSecurityFindingsAutomationTicketCreationRules": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "CreateSecurityFindingsAutomationTicketCreationRule": { + "tag": "Security Monitoring", + "undo": { + "operationId": "DeleteSecurityFindingsAutomationTicketCreationRule", + "parameters": [ + { + "name": "rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ReorderSecurityFindingsAutomationTicketCreationRules": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "DeleteSecurityFindingsAutomationTicketCreationRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "GetSecurityFindingsAutomationTicketCreationRule": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "UpdateSecurityFindingsAutomationTicketCreationRule": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "DetachCase": { "tag": "Security Monitoring", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 2f009617d..d9deb0b6b 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -3456,6 +3456,78 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.UpdateFindingsAssignee".into(), test_v2_update_findings_assignee, ); + world.function_mappings.insert( + "v2.ListSecurityFindingsAutomationDueDateRules".into(), + test_v2_list_security_findings_automation_due_date_rules, + ); + world.function_mappings.insert( + "v2.CreateSecurityFindingsAutomationDueDateRule".into(), + test_v2_create_security_findings_automation_due_date_rule, + ); + world.function_mappings.insert( + "v2.ReorderSecurityFindingsAutomationDueDateRules".into(), + test_v2_reorder_security_findings_automation_due_date_rules, + ); + world.function_mappings.insert( + "v2.DeleteSecurityFindingsAutomationDueDateRule".into(), + test_v2_delete_security_findings_automation_due_date_rule, + ); + world.function_mappings.insert( + "v2.GetSecurityFindingsAutomationDueDateRule".into(), + test_v2_get_security_findings_automation_due_date_rule, + ); + world.function_mappings.insert( + "v2.UpdateSecurityFindingsAutomationDueDateRule".into(), + test_v2_update_security_findings_automation_due_date_rule, + ); + world.function_mappings.insert( + "v2.ListSecurityFindingsAutomationMuteRules".into(), + test_v2_list_security_findings_automation_mute_rules, + ); + world.function_mappings.insert( + "v2.CreateSecurityFindingsAutomationMuteRule".into(), + test_v2_create_security_findings_automation_mute_rule, + ); + world.function_mappings.insert( + "v2.ReorderSecurityFindingsAutomationMuteRules".into(), + test_v2_reorder_security_findings_automation_mute_rules, + ); + world.function_mappings.insert( + "v2.DeleteSecurityFindingsAutomationMuteRule".into(), + test_v2_delete_security_findings_automation_mute_rule, + ); + world.function_mappings.insert( + "v2.GetSecurityFindingsAutomationMuteRule".into(), + test_v2_get_security_findings_automation_mute_rule, + ); + world.function_mappings.insert( + "v2.UpdateSecurityFindingsAutomationMuteRule".into(), + test_v2_update_security_findings_automation_mute_rule, + ); + world.function_mappings.insert( + "v2.ListSecurityFindingsAutomationTicketCreationRules".into(), + test_v2_list_security_findings_automation_ticket_creation_rules, + ); + world.function_mappings.insert( + "v2.CreateSecurityFindingsAutomationTicketCreationRule".into(), + test_v2_create_security_findings_automation_ticket_creation_rule, + ); + world.function_mappings.insert( + "v2.ReorderSecurityFindingsAutomationTicketCreationRules".into(), + test_v2_reorder_security_findings_automation_ticket_creation_rules, + ); + world.function_mappings.insert( + "v2.DeleteSecurityFindingsAutomationTicketCreationRule".into(), + test_v2_delete_security_findings_automation_ticket_creation_rule, + ); + world.function_mappings.insert( + "v2.GetSecurityFindingsAutomationTicketCreationRule".into(), + test_v2_get_security_findings_automation_ticket_creation_rule, + ); + world.function_mappings.insert( + "v2.UpdateSecurityFindingsAutomationTicketCreationRule".into(), + test_v2_update_security_findings_automation_ticket_creation_rule, + ); world .function_mappings .insert("v2.DetachCase".into(), test_v2_detach_case); @@ -25204,6 +25276,568 @@ fn test_v2_update_findings_assignee( world.response.code = response.status.as_u16(); } +fn test_v2_list_security_findings_automation_due_date_rules( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let page_size = _parameters + .get("page[size]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page_number = _parameters + .get("page[number]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_security_monitoring::ListSecurityFindingsAutomationDueDateRulesOptionalParams::default(); + params.page_size = page_size; + params.page_number = page_number; + let response = + match block_on(api.list_security_findings_automation_due_date_rules_with_http_info(params)) + { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_security_findings_automation_due_date_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.create_security_findings_automation_due_date_rule_with_http_info(body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_reorder_security_findings_automation_due_date_rules( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.reorder_security_findings_automation_due_date_rules_with_http_info(body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_security_findings_automation_due_date_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let response = match block_on( + api.delete_security_findings_automation_due_date_rule_with_http_info(rule_id), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_security_findings_automation_due_date_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let response = match block_on( + api.get_security_findings_automation_due_date_rule_with_http_info(rule_id), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_security_findings_automation_due_date_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.update_security_findings_automation_due_date_rule_with_http_info(rule_id, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_list_security_findings_automation_mute_rules( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let page_size = _parameters + .get("page[size]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page_number = _parameters + .get("page[number]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_security_monitoring::ListSecurityFindingsAutomationMuteRulesOptionalParams::default(); + params.page_size = page_size; + params.page_number = page_number; + let response = + match block_on(api.list_security_findings_automation_mute_rules_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_security_findings_automation_mute_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = + match block_on(api.create_security_findings_automation_mute_rule_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_reorder_security_findings_automation_mute_rules( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = + match block_on(api.reorder_security_findings_automation_mute_rules_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_security_findings_automation_mute_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let response = + match block_on(api.delete_security_findings_automation_mute_rule_with_http_info(rule_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_security_findings_automation_mute_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let response = + match block_on(api.get_security_findings_automation_mute_rule_with_http_info(rule_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_security_findings_automation_mute_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.update_security_findings_automation_mute_rule_with_http_info(rule_id, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_list_security_findings_automation_ticket_creation_rules( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let page_size = _parameters + .get("page[size]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page_number = _parameters + .get("page[number]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_security_monitoring::ListSecurityFindingsAutomationTicketCreationRulesOptionalParams::default(); + params.page_size = page_size; + params.page_number = page_number; + let response = match block_on( + api.list_security_findings_automation_ticket_creation_rules_with_http_info(params), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_security_findings_automation_ticket_creation_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.create_security_findings_automation_ticket_creation_rule_with_http_info(body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_reorder_security_findings_automation_ticket_creation_rules( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.reorder_security_findings_automation_ticket_creation_rules_with_http_info(body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_security_findings_automation_ticket_creation_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let response = match block_on( + api.delete_security_findings_automation_ticket_creation_rule_with_http_info(rule_id), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_security_findings_automation_ticket_creation_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let response = match block_on( + api.get_security_findings_automation_ticket_creation_rule_with_http_info(rule_id), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_security_findings_automation_ticket_creation_rule( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_security_monitoring + .as_ref() + .expect("api instance not found"); + let rule_id = serde_json::from_value(_parameters.get("rule_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.update_security_findings_automation_ticket_creation_rule_with_http_info(rule_id, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_detach_case(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances