From 4d7b263b82e7864383ad21379b153715de2db439 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 31 Jul 2026 14:59:39 +0000 Subject: [PATCH] Regenerate client from commit 98edebf of spec repo --- .generator/schemas/v2/openapi.yaml | 2330 ++++++++++++--- .../GetGovernanceConfig.java | 25 + .../GetGovernanceControl.java | 8 +- ...GovernanceControlNotificationSettings.java | 27 + .../GetGovernanceDetection.java | 26 + .../GetGovernanceNotificationSettings.java | 27 + .../ListGovernanceControlDetections.java | 27 + .../ListGovernanceControls.java | 8 +- .../ListGovernanceInsights.java | 8 +- .../ListGovernanceLimits.java | 25 + .../ListGovernanceResourceLimits.java | 26 + .../MitigateGovernanceDetections.java | 41 + .../UpdateGovernanceControl.java | 14 +- ...GovernanceControlNotificationSettings.java | 55 + .../UpdateGovernanceDetection.java | 44 + .../UpdateGovernanceNotificationSettings.java | 42 + .../com/datadog/api/client/ApiClient.java | 13 +- .../client/v2/api/GovernanceConsoleApi.java | 2607 +++++++++++++++++ .../client/v2/api/GovernanceControlsApi.java | 529 ---- .../client/v2/api/GovernanceInsightsApi.java | 275 -- .../ControlNotificationEventSetting.java | 223 ++ ...ControlNotificationSettingsAttributes.java | 167 ++ .../ControlNotificationSettingsData.java | 216 ++ ...ntrolNotificationSettingsResourceType.java | 63 + .../ControlNotificationSettingsResponse.java | 151 + ...lNotificationSettingsUpdateAttributes.java | 163 ++ ...ControlNotificationSettingsUpdateData.java | 185 ++ ...trolNotificationSettingsUpdateRequest.java | 152 + .../v2/model/ControlNotificationTarget.java | 180 ++ .../model/ControlNotificationTargetType.java | 63 + .../GovernanceBestPracticeDefinition.java | 523 ---- .../v2/model/GovernanceConfigAttributes.java | 251 ++ .../client/v2/model/GovernanceConfigData.java | 215 ++ .../v2/model/GovernanceConfigResponse.java | 148 + .../GovernanceConsoleConfigResourceType.java | 59 + .../v2/model/GovernanceControlAttributes.java | 343 +-- .../v2/model/GovernanceControlData.java | 2 +- ...nanceControlDetectionAssignmentSource.java | 72 + .../GovernanceControlDetectionAttributes.java | 600 ++++ .../model/GovernanceControlDetectionData.java | 216 ++ ...overnanceControlDetectionResourceType.java | 63 + .../GovernanceControlDetectionResponse.java | 151 + .../GovernanceControlDetectionState.java | 82 + ...nanceControlDetectionUpdateAttributes.java | 237 ++ .../GovernanceControlDetectionUpdateData.java | 186 ++ ...vernanceControlDetectionUpdateRequest.java | 152 + ...GovernanceControlDetectionUpdateState.java | 67 + .../GovernanceControlDetectionsResponse.java | 165 ++ ...GovernanceControlMitigationDefinition.java | 140 +- .../GovernanceControlParameterDefinition.java | 29 - .../GovernanceControlUpdateAttributes.java | 130 +- .../v2/model/GovernanceControlUpdateData.java | 29 +- .../v2/model/GovernanceInsightAttributes.java | 235 +- .../v2/model/GovernanceInsightData.java | 5 +- .../GovernanceInsightDirectionality.java | 62 + .../model/GovernanceInsightQueryConfig.java | 20 +- .../v2/model/GovernanceLimitAttributes.java | 420 +++ .../client/v2/model/GovernanceLimitData.java | 212 ++ .../client/v2/model/GovernanceLimitQuery.java | 201 ++ .../v2/model/GovernanceLimitQueryConfig.java | 257 ++ .../v2/model/GovernanceLimitResourceType.java | 55 + .../v2/model/GovernanceLimitsResponse.java | 162 + .../v2/model/GovernanceMitigationRequest.java | 150 + ...GovernanceMitigationRequestAttributes.java | 245 ++ .../GovernanceMitigationRequestData.java | 185 ++ ...ernanceNotificationSettingsAttributes.java | 155 + .../GovernanceNotificationSettingsData.java | 216 ++ ...nanceNotificationSettingsResourceType.java | 63 + ...overnanceNotificationSettingsResponse.java | 151 + ...eNotificationSettingsUpdateAttributes.java | 150 + ...ernanceNotificationSettingsUpdateData.java | 188 ++ ...anceNotificationSettingsUpdateRequest.java | 154 + .../GovernanceResourceLimitAttributes.java | 520 ++++ .../v2/model/GovernanceResourceLimitData.java | 214 ++ .../GovernanceResourceLimitResourceType.java | 59 + .../GovernanceResourceLimitsResponse.java | 165 ++ .../client/v2/api/governance_console.feature | 287 ++ .../client/v2/api/governance_controls.feature | 77 - .../client/v2/api/governance_insights.feature | 24 - .../com/datadog/api/client/v2/api/undo.json | 74 +- 80 files changed, 13472 insertions(+), 2814 deletions(-) create mode 100644 examples/v2/governance-console/GetGovernanceConfig.java rename examples/v2/{governance-controls => governance-console}/GetGovernanceControl.java (72%) create mode 100644 examples/v2/governance-console/GetGovernanceControlNotificationSettings.java create mode 100644 examples/v2/governance-console/GetGovernanceDetection.java create mode 100644 examples/v2/governance-console/GetGovernanceNotificationSettings.java create mode 100644 examples/v2/governance-console/ListGovernanceControlDetections.java rename examples/v2/{governance-controls => governance-console}/ListGovernanceControls.java (72%) rename examples/v2/{governance-insights => governance-console}/ListGovernanceInsights.java (72%) create mode 100644 examples/v2/governance-console/ListGovernanceLimits.java create mode 100644 examples/v2/governance-console/ListGovernanceResourceLimits.java create mode 100644 examples/v2/governance-console/MitigateGovernanceDetections.java rename examples/v2/{governance-controls => governance-console}/UpdateGovernanceControl.java (71%) create mode 100644 examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.java create mode 100644 examples/v2/governance-console/UpdateGovernanceDetection.java create mode 100644 examples/v2/governance-console/UpdateGovernanceNotificationSettings.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/GovernanceConsoleApi.java delete mode 100644 src/main/java/com/datadog/api/client/v2/api/GovernanceControlsApi.java delete mode 100644 src/main/java/com/datadog/api/client/v2/api/GovernanceInsightsApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationEventSetting.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationTarget.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ControlNotificationTargetType.java delete mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceBestPracticeDefinition.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceConfigAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceConfigData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceConfigResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceConsoleConfigResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAssignmentSource.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionState.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateState.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceInsightDirectionality.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceLimitAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceLimitData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQuery.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQueryConfig.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceLimitResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceLimitsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitsResponse.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/governance_console.feature delete mode 100644 src/test/resources/com/datadog/api/client/v2/api/governance_controls.feature delete mode 100644 src/test/resources/com/datadog/api/client/v2/api/governance_insights.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0f86b610623..664055f3f4e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21956,6 +21956,125 @@ components: - IDENTITY - GZIP - DEFLATE + ControlNotificationEventSetting: + description: The notification settings for a single event type on a control. + properties: + enabled: + description: Whether notifications are enabled for this event type. + example: true + type: boolean + event_type: + description: The event type the notification settings apply to, such as `new_detection`. + example: "new_detection" + type: string + targets: + $ref: "#/components/schemas/ControlNotificationTargetArray" + required: + - event_type + - enabled + - targets + type: object + ControlNotificationEventSettingsArray: + description: The notification settings for each supported event type on the control. + items: + $ref: "#/components/schemas/ControlNotificationEventSetting" + type: array + ControlNotificationSettingsAttributes: + description: The attributes of a governance control's notification settings. + properties: + event_settings: + $ref: "#/components/schemas/ControlNotificationEventSettingsArray" + required: + - event_settings + type: object + ControlNotificationSettingsData: + description: A control notification settings resource. + properties: + attributes: + $ref: "#/components/schemas/ControlNotificationSettingsAttributes" + id: + description: The detection type the notification settings apply to. + example: "unused_api_keys" + type: string + type: + $ref: "#/components/schemas/ControlNotificationSettingsResourceType" + required: + - id + - type + - attributes + type: object + ControlNotificationSettingsResourceType: + description: Control notification settings resource type. + enum: + - control_notification_settings + example: "control_notification_settings" + type: string + x-enum-varnames: + - CONTROL_NOTIFICATION_SETTINGS + ControlNotificationSettingsResponse: + description: The notification settings for a governance control. + properties: + data: + $ref: "#/components/schemas/ControlNotificationSettingsData" + required: + - data + type: object + ControlNotificationSettingsUpdateAttributes: + description: The attributes of a governance control's notification settings that can be updated. + properties: + event_settings: + $ref: "#/components/schemas/ControlNotificationEventSettingsArray" + type: object + ControlNotificationSettingsUpdateData: + description: The data of a control notification settings update request. + properties: + attributes: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateAttributes" + type: + $ref: "#/components/schemas/ControlNotificationSettingsResourceType" + required: + - type + type: object + ControlNotificationSettingsUpdateRequest: + description: A request to update the notification settings for a governance control. + properties: + data: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateData" + required: + - data + type: object + ControlNotificationTarget: + description: A destination that receives notifications for an event type. + properties: + handle: + description: The destination handle, such as an email address, Slack channel, or user handle. + example: "#governance-alerts" + type: string + type: + $ref: "#/components/schemas/ControlNotificationTargetType" + required: + - type + - handle + type: object + ControlNotificationTargetArray: + description: The destinations that receive notifications for an event type. + items: + $ref: "#/components/schemas/ControlNotificationTarget" + type: array + ControlNotificationTargetType: + description: The type of notification destination. + enum: + - email + - slack + - at_mention + - case + example: "slack" + type: string + x-enum-varnames: + - EMAIL + - SLACK + - AT_MENTION + - CASE ConvertJobResultsToSignalsAttributes: description: Attributes for converting historical job results to signals. properties: @@ -43372,91 +43491,68 @@ components: - id - type type: object - GovernanceBestPracticeDefinition: - description: |- - The best practice associated with an insight. Populated with the first active best practice - matched to the insight; `null` when no best practice is attached. + GovernanceConfigAttributes: + description: The attributes of a Governance Console configuration. properties: - category: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + enabled: + description: Whether the Governance Console is enabled for the organization. + example: true + type: boolean + usage_attribution_configured: + description: Whether usage attribution is configured for the organization. + example: true + type: boolean + xorg_insights_enabled: description: |- - The value driver the best practice is grouped under, such as `access_governance`, - `security`, `compliance`, or `operational_hygiene`. - example: "access_governance" - type: string - deep_link: - description: A relative link to the configuration page where the best practice can be acted upon. - example: "/organization-settings/users?status=inactive" - type: string - description: - description: The full rationale and guidance for the best practice. - example: "Review and deactivate users who have not logged in within the last 90 days." - type: string - detection_type: - description: An optional association to a control's detection type. `null` when not associated with a control. - example: - nullable: true - type: string + Whether the organization has opted in to sharing governance data with a managing org + for cross-org insights. + example: true + type: boolean + required: + - enabled + - assignment_notifications_enabled + - usage_attribution_configured + - xorg_insights_enabled + type: object + GovernanceConfigData: + description: A Governance Console configuration resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceConfigAttributes" id: - description: The unique identifier of the best practice. - example: "bp_monitor_inactive_users" - type: string - impact: - description: The expected impact of following the best practice. - example: "Reduces unauthorized access risk." - type: string - impact_hint: - description: |- - A priority hint for ordering best practices by expected impact. Lower values indicate - higher priority. - example: 1 - format: int64 - type: integer - permissions: - description: The permissions required for the user to act on the best practice. - example: - - "user_access_manage" - items: - description: A permission required to act on the best practice. - type: string - type: array - status: - description: Whether the best practice is currently `active` or `deprecated`. - example: "active" - type: string - summary: - description: A one-line explanation of why this best practice matters. - example: "Inactive users with access increase your security surface area." - type: string - title: - description: A short, human-readable name for the best practice. - example: "Monitor inactive users" - type: string - trigger_condition: description: |- - The condition that surfaces the best practice. For an `insight` trigger, the insight - slug; for a `static` trigger, a descriptive condition key. - example: "active_users" - type: string - trigger_type: - description: |- - How the best practice is surfaced. `insight` ties it to an insight; `static` surfaces it - unless its condition is met. - example: "insight" + The unique identifier of the organization the Governance Console configuration applies + to. May be the nil UUID (`00000000-0000-0000-0000-000000000000`) when the configuration + is not tied to a specific organization record. + example: "00000000-0000-0000-0000-000000000000" type: string + type: + $ref: "#/components/schemas/GovernanceConsoleConfigResourceType" required: - id - - title - - summary - - description - - category - - impact - - trigger_type - - trigger_condition - - deep_link - - permissions - - impact_hint - - status + - type + - attributes + type: object + GovernanceConfigResponse: + description: The Governance Console configuration for an organization. + properties: + data: + $ref: "#/components/schemas/GovernanceConfigData" + required: + - data type: object + GovernanceConsoleConfigResourceType: + description: Governance console config resource type. + enum: + - governance_console_config + example: "governance_console_config" + type: string + x-enum-varnames: + - GOVERNANCE_CONSOLE_CONFIG GovernanceControlAttributes: description: The attributes of a governance control. properties: @@ -43489,17 +43585,6 @@ components: detection_parameters: $ref: "#/components/schemas/GovernanceControlParametersMap" nullable: true - detection_type: - description: The detection type that uniquely identifies the control. - example: "unused_api_keys" - type: string - feature_flags: - description: The feature flags that gate the control. - example: [] - items: - description: A feature flag that gates the control. - type: string - type: array insights: description: The insight slugs associated with the control. example: [] @@ -43531,21 +43616,6 @@ components: description: Human-readable name of the control. example: "Unused API Keys" type: string - next_steps: - description: Guidance on the next steps to remediate detections for the control. - example: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - type: string - notification_frequency: - description: The configured notification frequency for the control. Empty when not configured. - example: "" - type: string - notification_parameters: - $ref: "#/components/schemas/GovernanceControlParametersMap" - nullable: true - notification_type: - description: The configured notification type for the control. Empty when not configured. - example: "" - type: string priority: description: The priority of the control, such as `High`. example: "High" @@ -43554,10 +43624,6 @@ components: description: The product the control belongs to. example: "api_keys" type: string - release_status: - description: The release status of the control, such as `prod` or `beta`. - example: "prod" - type: string resource_type: description: The type of resource the control evaluates. example: "api_key" @@ -43568,44 +43634,24 @@ components: type: string supported_detection_parameters: $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" - supported_notification_parameters: - $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" - task: - description: A short description of the remediation task for the control. - example: "Review and revoke unused API keys." - type: string type: description: The control type, such as `Proactive` or `Detection`. example: "Proactive" type: string - usage_concern: - description: The usage concern the control addresses, such as `Security` or `Cost Optimization`. - example: "Security" - type: string required: - name - description - - detection_type - supported_detection_parameters - - supported_notification_parameters - resource_type - resource_type_display_name - product - category - insights - mitigations - - task - - next_steps - - release_status - - feature_flags - type - priority - - usage_concern - detection_parameters - detection_frequency - - notification_type - - notification_parameters - - notification_frequency - mitigation_type - mitigation_parameters - created_at @@ -43620,8 +43666,8 @@ components: attributes: $ref: "#/components/schemas/GovernanceControlAttributes" id: - description: The unique identifier of the control. - example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + description: The detection type that uniquely identifies the control. + example: "unused_api_keys" type: string type: $ref: "#/components/schemas/GovernanceControlResourceType" @@ -43630,13 +43676,217 @@ components: - type - attributes type: object + GovernanceControlDetectionAssignmentSource: + description: How the detection's current assignment was determined. Possible values are `auto_resolved`, `manual`, `reassigned`, and `cleared`. + enum: + - auto_resolved + - manual + - reassigned + - cleared + example: "manual" + type: string + x-enum-varnames: + - AUTO_RESOLVED + - MANUAL + - REASSIGNED + - CLEARED + GovernanceControlDetectionAttributes: + description: The attributes of a governance control detection. + properties: + assigned_team: + description: The identifier of the team the detection is assigned to, if any. + example: "platform-security" + type: string + assigned_to: + description: The identifier of the user the detection is assigned to, if any. + example: "11111111-2222-3333-4444-555555555555" + type: string + assignment_source: + $ref: "#/components/schemas/GovernanceControlDetectionAssignmentSource" + control_id: + deprecated: true + description: |- + DEPRECATED: mirrors `detection_type` for backward compatibility; use `detection_type` + instead. + example: "unused_api_keys" + type: string + created_at: + description: The date and time when the detection was created. + example: "2024-03-01T12:00:00Z" + format: date-time + type: string + detection_type: + description: The type of detection, which determines what condition was detected. + example: "unused_api_keys" + type: string + display_name: + description: The human-readable name of the detected resource. + example: "CI Deploy Key" + type: string + exception_at: + description: The date and time when the detection was marked as an exception, if applicable. + example: "2024-03-05T09:00:00Z" + format: date-time + type: string + exception_by: + description: The identifier of the user who marked the detection as an exception, if applicable. + example: "11111111-2222-3333-4444-555555555555" + type: string + metadata: + description: Free-form metadata associated with the detection. + example: + region: "us-east-1" + mitigate_after: + description: The date and time after which the detection is scheduled to be mitigated, if applicable. + example: "2024-03-15T00:00:00Z" + format: date-time + type: string + mitigated_at: + description: The date and time when the detection was mitigated, if applicable. + example: "2024-03-10T15:30:00Z" + format: date-time + type: string + priority: + description: The priority of the detection, if set. + example: 1 + format: int64 + type: integer + resource_id: + description: The identifier of the resource the detection applies to. + example: "api-key-12345" + type: string + resource_type: + description: The type of resource the detection applies to, for example `api_key` or `dashboard`. + example: "api_key" + type: string + state: + $ref: "#/components/schemas/GovernanceControlDetectionState" + required: + - state + - control_id + - resource_id + - detection_type + - resource_type + - display_name + - created_at + - assignment_source + - priority + type: object + GovernanceControlDetectionData: + description: A governance control detection resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceControlDetectionAttributes" + id: + description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: string + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - id + - type + - attributes + type: object + GovernanceControlDetectionResourceType: + description: Governance control detection resource type. + enum: + - governance_control_detection + example: "governance_control_detection" + type: string + x-enum-varnames: + - GOVERNANCE_CONTROL_DETECTION + GovernanceControlDetectionResponse: + description: A single governance control detection. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionData" + required: + - data + type: object + GovernanceControlDetectionState: + description: The current state of the detection. Possible values are `active`, `exception`, `mitigated`, `inactive`, `obsolete`, `resolved_externally`, and `mitigation_in_progress`. + enum: + - active + - exception + - mitigated + - inactive + - obsolete + - resolved_externally + - mitigation_in_progress + example: "active" + type: string + x-enum-varnames: + - ACTIVE + - EXCEPTION + - MITIGATED + - INACTIVE + - OBSOLETE + - RESOLVED_EXTERNALLY + - MITIGATION_IN_PROGRESS + GovernanceControlDetectionUpdateAttributes: + description: The attributes of a governance control detection that can be updated. Only the attributes present in the request are modified. + properties: + assigned_team: + description: The handle of the team the detection is assigned to. Set to an empty string to clear the assignment. + example: "platform-security" + type: string + assigned_to: + description: The UUID of the user the detection is assigned to. Set to an empty string to clear the assignment. + example: "11111111-2222-3333-4444-555555555555" + type: string + mitigate_after: + description: The timestamp after which the detection becomes eligible for mitigation. Used to defer mitigation to a later time. + example: "2024-03-15T00:00:00Z" + format: date-time + type: string + state: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateState" + type: object + GovernanceControlDetectionUpdateData: + description: The data of a governance control detection update request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateAttributes" + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - type + type: object + GovernanceControlDetectionUpdateRequest: + description: A request to update a governance control detection. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateData" + required: + - data + type: object + GovernanceControlDetectionUpdateState: + description: The new state to set for the detection. Set to `exception` to acknowledge the detection and exclude it from active counts, or `active` to reopen it. + enum: + - exception + - active + example: "exception" + type: string + x-enum-varnames: + - EXCEPTION + - ACTIVE + GovernanceControlDetectionsDataArray: + description: An array of governance control detection resources. + items: + $ref: "#/components/schemas/GovernanceControlDetectionData" + type: array + GovernanceControlDetectionsResponse: + description: A list of governance control detections. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionsDataArray" + required: + - data + type: object GovernanceControlMitigationDefinition: description: The definition of a mitigation available for a control. properties: - action_verb: - description: The verb describing the mitigation action, such as `revoke` or `delete`. - example: "revoke" - type: string description: description: A human-readable description of the mitigation. example: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." @@ -43650,21 +43900,10 @@ components: description: An execution mode the mitigation supports. type: string type: array - feature_flags: - description: The feature flags that gate the mitigation. - example: [] - items: - description: A feature flag that gates the mitigation. - type: string - type: array id: description: The unique identifier of the mitigation. example: "revoke_api_key" type: string - manual_mitigation_warning: - description: A warning shown to the user before applying the mitigation manually. - example: "These API keys will be revoked immediately upon confirmation. To revoke future API keys, you must go through this flow again." - type: string permissions: description: The permissions required to apply the mitigation. example: @@ -43674,10 +43913,6 @@ components: description: A permission required to apply the mitigation. type: string type: array - requires_ai: - description: Whether the mitigation requires AI to be enabled. - example: false - type: boolean supported_parameters: $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" title: @@ -43688,12 +43923,9 @@ components: - id - title - description - - action_verb - supported_parameters - permissions - - manual_mitigation_warning - - feature_flags - - requires_ai + - execution_modes type: object GovernanceControlMitigationDefinitionArray: description: The mitigations available for a control. @@ -43714,10 +43946,6 @@ components: description: The human-readable name of the parameter. example: "Unused API Key Threshold" type: string - hidden: - description: Whether the parameter is hidden from the UI. - example: false - type: boolean name: description: The machine-readable name of the parameter. example: "api_key_threshold" @@ -43738,7 +43966,6 @@ components: - description - type - required - - hidden - supported_values - default_value type: object @@ -43804,31 +44031,12 @@ components: description: The mitigation type to configure for the control. example: "revoke_api_key" type: string - name: - description: A new human-readable name for the control. - example: "Unused API Keys" - type: string - notification_frequency: - description: The notification frequency to configure for the control. - example: "daily" - type: string - notification_parameters: - $ref: "#/components/schemas/GovernanceControlParametersMap" - nullable: true - notification_type: - description: The notification type to configure for the control. - example: "slack" - type: string type: object GovernanceControlUpdateData: description: The data of a governance control update request. properties: attributes: $ref: "#/components/schemas/GovernanceControlUpdateAttributes" - id: - description: The unique identifier of the control. - example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: string type: $ref: "#/components/schemas/GovernanceControlResourceType" required: @@ -43856,18 +44064,14 @@ components: - data type: object GovernanceInsightAttributes: - description: The attributes of a governance insight. + description: |- + The attributes of a governance insight. Exactly one of `metric_query`, `event_query`, + `usage_query`, `audit_query`, or `percentage_query` is populated, depending on the data + source the insight is computed from; the rest are `null`. properties: audit_query: $ref: "#/components/schemas/GovernanceInsightAuditQuery" nullable: true - best_practice: - $ref: "#/components/schemas/GovernanceBestPracticeDefinition" - nullable: true - deep_link: - description: A relative link to the product surface where the insight can be acted upon. - example: "" - type: string description: description: A human-readable description of what the insight measures. example: "Number of users who have used the Dashboard in the last 30 days" @@ -43882,14 +44086,6 @@ components: metric_query: $ref: "#/components/schemas/GovernanceInsightMetricQuery" nullable: true - old_value: - description: |- - The value of the insight over the previous comparison window. `null` when values were - not requested or could not be computed. - example: 3274 - format: double - nullable: true - type: number percentage_query: $ref: "#/components/schemas/GovernanceInsightPercentageQuery" nullable: true @@ -43900,17 +44096,6 @@ components: query_config: $ref: "#/components/schemas/GovernanceInsightQueryConfig" nullable: true - sort_order: - description: The relative order in which the insight should be displayed. - example: 1 - format: int64 - type: integer - state: - description: |- - The state of the insight. A `critical` insight receives extra UI treatment to draw - attention to it. - example: "critical" - type: string sub_product: description: The sub-product the insight belongs to, if any. example: "Indexes" @@ -43926,29 +44111,13 @@ components: usage_query: $ref: "#/components/schemas/GovernanceInsightUsageQuery" nullable: true - value: - description: The current value of the insight. `null` when values were not requested or could not be computed. - example: 3601 - format: double - nullable: true - type: number required: - display_name - product - - best_practice - sub_product - unit_name - description - time_range - - state - - deep_link - - value - - old_value - - metric_query - - event_query - - usage_query - - audit_query - - percentage_query type: object GovernanceInsightAuditCompute: description: The aggregation applied to an audit log query. @@ -44018,6 +44187,18 @@ components: - type - attributes type: object + GovernanceInsightDirectionality: + description: Whether an increase in the insight's value is good, bad, or neutral. + enum: + - neutral + - increase_better + - decrease_better + example: "neutral" + type: string + x-enum-varnames: + - NEUTRAL + - INCREASE_BETTER + - DECREASE_BETTER GovernanceInsightEventCompute: description: The aggregation applied to an event query. properties: @@ -44095,7 +44276,7 @@ components: example: "line" type: string comparison_shift: - description: The window used for the previous value comparison, for example `week` or `month`. + description: The window used for the previous value comparison; for example, `week` or `month`. example: "month" type: string default_value: @@ -44104,11 +44285,7 @@ components: format: int64 type: integer directionality: - description: |- - Whether an increase in the value is good, bad, or neutral. One of `neutral`, - `increase_better`, or `decrease_better`. - example: "neutral" - type: string + $ref: "#/components/schemas/GovernanceInsightDirectionality" effective_time_window_days: description: The number of days the insight value is computed over. example: 30 @@ -44154,6 +44331,355 @@ components: required: - data type: object + GovernanceLimitAttributes: + description: The attributes of a usage limit. + properties: + description: + description: A description of what the limit measures. + example: "The number of log events indexed in the last 30 days." + type: string + display_name: + description: The human-readable name of the limit. + example: "Indexed Logs" + type: string + limit_type: + description: The type of limit, such as a rate limit or a usage limit. + example: "usage" + type: string + product: + description: The Datadog product the limit belongs to. + example: "logs" + type: string + query: + $ref: "#/components/schemas/GovernanceLimitQuery" + query_config: + $ref: "#/components/schemas/GovernanceLimitQueryConfig" + time_range: + description: The time range over which usage against the limit is measured. + example: "month" + type: string + times_hit_limit: + description: The number of times usage has reached the limit within the measured time range. + example: 2 + format: double + type: number + unit_name: + description: The unit in which the limit and its usage are measured. + example: "events" + type: string + usage_status: + description: The current usage status of the limit relative to its threshold. + example: "approaching" + type: string + required: + - display_name + - description + - product + - limit_type + - unit_name + - time_range + - query + - times_hit_limit + - usage_status + - query_config + type: object + GovernanceLimitData: + description: A usage limit resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceLimitAttributes" + id: + description: The unique identifier of the limit. + example: "logs_indexed_events" + type: string + type: + $ref: "#/components/schemas/GovernanceLimitResourceType" + required: + - id + - type + - attributes + type: object + GovernanceLimitQuery: + description: A metric query used to compute usage against a limit. + properties: + query: + description: The metric query expression used to compute the limit value. + example: "sum:datadog.estimated_usage.logs.ingested_events{*}" + type: string + reducer: + description: How the query results are aggregated into a single value (for example, sum, max, or avg). + example: "sum" + type: string + source: + description: The data source used to evaluate the metric query (for example, the metrics or events backend). + example: "metrics" + type: string + required: + - source + - query + - reducer + type: object + GovernanceLimitQueryConfig: + description: The query execution context used to visualize a limit and its usage. + properties: + chart_type: + description: The chart type used to visualize the limit and its usage. + example: "line" + type: string + comparison_shift: + description: The time shift applied to compare current usage against a prior period. + example: "month" + type: string + default_value: + description: The default value used for the limit when no explicit value is configured. + example: 0 + format: int64 + type: integer + directionality: + description: The direction in which usage approaches the limit, indicating whether higher or lower values are closer to the limit. + example: "increase_better" + type: string + effective_time_window_days: + description: The number of days of data the limit query evaluates over. + example: 30 + format: int64 + type: integer + type: object + GovernanceLimitResourceType: + description: Limit resource type. + enum: + - limit + example: "limit" + type: string + x-enum-varnames: + - LIMIT + GovernanceLimitsDataArray: + description: An array of usage limit resources. + items: + $ref: "#/components/schemas/GovernanceLimitData" + type: array + GovernanceLimitsResponse: + description: A list of usage limits. + properties: + data: + $ref: "#/components/schemas/GovernanceLimitsDataArray" + required: + - data + type: object + GovernanceMitigationRequest: + description: A request to mitigate a set of governance detections. + properties: + data: + $ref: "#/components/schemas/GovernanceMitigationRequestData" + required: + - data + type: object + GovernanceMitigationRequestAttributes: + description: The attributes of a governance mitigation request. + properties: + detection_ids: + description: The identifiers of the detections to mitigate in this request. + example: + - "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + items: + description: The identifier of a detection to mitigate in this request. + type: string + type: array + detection_type: + description: The detection type whose detections should be mitigated. + example: "unused_api_keys" + type: string + mitigation_parameters: + $ref: "#/components/schemas/GovernanceControlParametersMap" + nullable: true + mitigation_type: + description: The mitigation to apply to the selected detections. Defaults to the control's configured mitigation when omitted. + example: "revoke_api_key" + type: string + type: object + GovernanceMitigationRequestData: + description: The data of a governance mitigation request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceMitigationRequestAttributes" + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - type + type: object + GovernanceNotificationSettingsAttributes: + description: The attributes of the organization-wide governance notification settings. + properties: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + required: + - assignment_notifications_enabled + type: object + GovernanceNotificationSettingsData: + description: A governance notification settings resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceNotificationSettingsAttributes" + id: + description: The unique identifier of the organization the notification settings apply to. + example: "11111111-2222-3333-4444-555555555555" + type: string + type: + $ref: "#/components/schemas/GovernanceNotificationSettingsResourceType" + required: + - id + - type + - attributes + type: object + GovernanceNotificationSettingsResourceType: + description: Governance notification settings resource type. + enum: + - governance_notification_settings + example: "governance_notification_settings" + type: string + x-enum-varnames: + - GOVERNANCE_NOTIFICATION_SETTINGS + GovernanceNotificationSettingsResponse: + description: The organization-wide governance notification settings. + properties: + data: + $ref: "#/components/schemas/GovernanceNotificationSettingsData" + required: + - data + type: object + GovernanceNotificationSettingsUpdateAttributes: + description: The attributes of the governance notification settings that can be updated. Only the attributes present in the request are modified. + properties: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + type: object + GovernanceNotificationSettingsUpdateData: + description: The data of a governance notification settings update request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateAttributes" + type: + $ref: "#/components/schemas/GovernanceNotificationSettingsResourceType" + required: + - type + type: object + GovernanceNotificationSettingsUpdateRequest: + description: A request to update the organization-wide governance notification settings. + properties: + data: + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateData" + required: + - data + type: object + GovernanceResourceLimitAttributes: + description: The attributes of a governance resource limit. + properties: + current_limit: + description: The current limit configured for the resource. + example: 10000 + format: double + type: number + current_value: + description: The current value of the resource. + example: 8200 + format: double + type: number + default_current_value: + description: The default current value used when the resource value cannot be computed from the query. + example: 0 + format: double + type: number + default_limit_value: + description: The default limit value used when the limit cannot be computed from the query. + example: 0 + format: double + type: number + description: + description: A description of what the resource limit measures. + example: "The number of custom metrics in use against your contracted limit." + type: string + display_name: + description: The human-readable name of the resource limit. + example: "Custom Metrics" + type: string + limit_query: + $ref: "#/components/schemas/GovernanceLimitQuery" + product: + description: The Datadog product the resource limit belongs to. + example: "metrics" + type: string + query: + $ref: "#/components/schemas/GovernanceLimitQuery" + query_config: + $ref: "#/components/schemas/GovernanceLimitQueryConfig" + time_range: + description: The time range over which the resource value is measured. + example: "month" + type: string + unit_name: + description: The unit in which the resource value and limit are measured. + example: "metrics" + type: string + usage_status: + description: The current usage status of the resource relative to its limit. + example: "approaching" + type: string + required: + - display_name + - description + - product + - unit_name + - time_range + - current_value + - current_limit + - default_current_value + - default_limit_value + - query + - limit_query + - query_config + - usage_status + type: object + GovernanceResourceLimitData: + description: A governance resource limit resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceResourceLimitAttributes" + id: + description: The unique identifier of the resource limit. + example: "custom_metrics" + type: string + type: + $ref: "#/components/schemas/GovernanceResourceLimitResourceType" + required: + - id + - type + - attributes + type: object + GovernanceResourceLimitResourceType: + description: Resource limit resource type. + enum: + - resource-limit + example: "resource-limit" + type: string + x-enum-varnames: + - RESOURCE_LIMIT + GovernanceResourceLimitsDataArray: + description: An array of governance resource limit resources. + items: + $ref: "#/components/schemas/GovernanceResourceLimitData" + type: array + GovernanceResourceLimitsResponse: + description: A list of governance resource limits. + properties: + data: + $ref: "#/components/schemas/GovernanceResourceLimitsDataArray" + required: + - data + type: object GreyNoiseAPIKey: description: The definition of the `GreyNoiseAPIKey` object. properties: @@ -143508,6 +144034,61 @@ paths: operator: OR permissions: - user_access_read + /api/v2/governance/config: + get: + description: |- + Retrieve the Governance Console configuration for the organization, including whether the + Console is enabled, whether assignment notifications are enabled, and whether usage + attribution is configured. + operationId: GetGovernanceConfig + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_notifications_enabled: true + enabled: true + usage_attribution_configured: true + xorg_insights_enabled: true + id: "00000000-0000-0000-0000-000000000000" + type: "governance_console_config" + schema: + $ref: "#/components/schemas/GovernanceConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get the Governance Console configuration + tags: + - Governance Console + 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/governance/control: get: description: |- @@ -143532,60 +144113,37 @@ paths: detection_frequency: "daily" detection_parameters: api_key_threshold: 30 - detection_type: "unused_api_keys" - feature_flags: [] insights: [] last_detection_at: "2024-03-01T12:00:00Z" mitigated_detections_count: 3 mitigation_parameters: {} mitigation_type: "" mitigations: - - action_verb: "revoke" - description: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." + - description: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." execution_modes: - "manual" - "automatic" - feature_flags: [] id: "revoke_api_key" - manual_mitigation_warning: "These API keys will be revoked immediately upon confirmation. To revoke future API keys, you must go through this flow again." permissions: - "api_keys_write" - "api_keys_delete" - requires_ai: false supported_parameters: [] title: "Revoke Unused API Keys" name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" priority: "High" product: "api_keys" - release_status: "prod" resource_type: "api_key" resource_type_display_name: "API Key" supported_detection_parameters: - default_value: 30 description: "Number of days of inactivity before an API key is considered unused." display_name: "Unused API Key Threshold" - hidden: false name: "api_key_threshold" required: false supported_values: [] type: "integer" - supported_notification_parameters: - - default_value: false - description: "Enables the Governance Console to automatically assign ownership of detections based off of tagging and other internal heuristics." - display_name: "Automatic Ownership Assignment" - hidden: false - name: "governance_auto_assignment" - required: false - supported_values: [] - type: "boolean" - task: "Review and revoke unused API keys." type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + id: "unused_api_keys" type: "governance_control" schema: $ref: "#/components/schemas/GovernanceControlsResponse" @@ -143610,26 +144168,858 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: List governance controls + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List controls + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). + /api/v2/governance/control/{detection_type}: + get: + description: |- + Retrieve a single governance control by its detection type, including the organization's current + detection, notification, and mitigation configuration and detection counts. + operationId: GetGovernanceControl + parameters: + - description: The detection type that identifies the control, for example `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active_detections_count: 12 + category: "security" + created_at: "2024-01-15T09:30:00Z" + created_by: "11111111-2222-3333-4444-555555555555" + description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." + detection_frequency: "daily" + detection_parameters: + api_key_threshold: 30 + insights: [] + last_detection_at: "2024-03-01T12:00:00Z" + mitigated_detections_count: 3 + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + mitigations: [] + name: "Unused API Keys" + priority: "High" + product: "api_keys" + resource_type: "api_key" + resource_type_display_name: "API Key" + supported_detection_parameters: + - default_value: 30 + description: "Number of days of inactivity before an API key is considered unused." + display_name: "Unused API Key Threshold" + name: "api_key_threshold" + required: false + supported_values: [] + type: "integer" + type: "Proactive" + id: "unused_api_keys" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a control + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). + patch: + description: |- + Update the detection, notification, and mitigation configuration of a governance control. Only + the attributes present in the request are modified. Changing the mitigation type or its + parameters may require additional permissions. + operationId: UpdateGovernanceControl + parameters: + - description: The detection type that identifies the control, for example `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + detection_parameters: + api_key_threshold: 60 + mitigation_type: "revoke_api_key" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active_detections_count: 12 + category: "security" + created_at: "2024-01-15T09:30:00Z" + created_by: "11111111-2222-3333-4444-555555555555" + description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." + detection_frequency: "daily" + detection_parameters: + api_key_threshold: 60 + insights: [] + last_detection_at: "2024-03-01T12:00:00Z" + mitigated_detections_count: 3 + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + mitigations: [] + name: "Unused API Keys" + priority: "High" + product: "api_keys" + resource_type: "api_key" + resource_type_display_name: "API Key" + supported_detection_parameters: [] + type: "Proactive" + id: "unused_api_keys" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update a control + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_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/governance/control/{detection_type}/detections: + get: + description: |- + Retrieve the detections produced by the governance control with the given detection type. + Results can be filtered by state and free-text query, sorted, and paginated. + operationId: ListGovernanceControlDetections + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + - description: Restrict the results to detections in the given state. + example: "active" + in: query + name: filter[state] + required: false + schema: + type: string + - description: Restrict the results to detections matching the given free-text query. + example: "production" + in: query + name: filter[query] + required: false + schema: + type: string + - description: |- + A comma-separated list of attributes to sort detections by. Prefix an attribute with + `-` for descending order. + + The attributes available for sorting are `id`, `created_at`, `assigned_to`, + `detection_type`, `display_name`, `exception_at`, `mitigate_after`, `mitigated_at`, + `priority`, `resource_id`, and `state`. Defaults to `created_at,-id`. + example: "-created_at,-id" + in: query + name: sort + required: false + schema: + type: string + - description: "The zero-based index of the page to return; the first page is 0." + example: 0 + in: query + name: page[number] + required: false + schema: + default: 0 + format: int64 + type: integer + - description: The number of detections to return per page. + example: 50 + in: query + name: page[size] + required: false + schema: + format: int64 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List control detections + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). + /api/v2/governance/control/{detection_type}/notification_settings: + get: + description: |- + Retrieve the notification settings for the governance control with the given detection type, + including, for each supported event type, whether notifications are enabled and which + destinations receive them. + operationId: GetGovernanceControlNotificationSettings + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + id: "unused_api_keys" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get control notification settings + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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: |- + Replace the notification settings for the governance control with the given detection type, + setting, for each supported event type, whether notifications are enabled and which + destinations receive them. + operationId: UpdateGovernanceControlNotificationSettings + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + id: "unused_api_keys" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update control notification settings + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_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/governance/detections/mitigate: + post: + description: |- + Apply a mitigation to a set of governance detections of a given detection type. When the + mitigation type is omitted, the control's configured mitigation is used. The request is + accepted for asynchronous processing. + operationId: MitigateGovernanceDetections + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + detection_ids: + - "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + detection_type: "unused_api_keys" + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceMitigationRequest" + required: true + responses: + "202": + description: Accepted + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Mitigate detections + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). + /api/v2/governance/detections/{detection_id}: + get: + description: Retrieve a single governance detection by its unique identifier. + operationId: GetGovernanceDetection + parameters: + - description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + in: path + name: detection_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a detection + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). + patch: + description: |- + Update a governance detection by its unique identifier. Only the attributes present in the + request are modified, allowing a detection to be acknowledged as an exception, reopened, + reassigned, or deferred for mitigation. + operationId: UpdateGovernanceDetection + parameters: + - description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + in: path + name: detection_id + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_to: "11111111-2222-3333-4444-555555555555" + state: "exception" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update a detection + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). + /api/v2/governance/insights: + get: + description: |- + Retrieve the list of governance insights available to the organization. Each insight + reports the query used to compute it, so that the value can be computed client-side. + Insights can be filtered by product. + operationId: ListGovernanceInsights + parameters: + - description: |- + Restrict the results to insights belonging to the given products. May be repeated to + filter by multiple products. Matching is case-insensitive. + example: + - "Usage" + - "Logs Settings" + in: query + name: filter[product] + required: false + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + audit_query: + description: "Number of custom metrics submitted by the organization." + display_name: "Custom Metrics" + event_query: + metric_query: + query: "sum:datadog.estimated_usage.metrics.custom{*}" + reducer: "sum" + source: "metrics" + percentage_query: + product: "Usage" + query_config: + chart_type: "line" + comparison_shift: "month" + directionality: "decrease_better" + effective_time_window_days: 30 + sub_product: "" + time_range: "month" + unit_name: "custom metrics" + usage_query: + id: "498ee21f-8037-48b8-a961-a488692902f4" + type: "insight" + - attributes: + audit_query: + compute: + aggregation: "cardinality" + interval: 86400000 + metric: "@usr.id" + indexes: + - "main" + query: "@evt.name:Dashboard" + source: "audit" + description: "Number of users who have used the Dashboard in the last 30 days" + display_name: "Active Users" + event_query: + metric_query: + percentage_query: + product: "Usage" + query_config: + chart_type: "line" + comparison_shift: "month" + directionality: "neutral" + effective_time_window_days: 30 + sub_product: "" + time_range: "month" + unit_name: "active users" + usage_query: + id: "a3248d1b-5578-4345-a34e-fe9657300f22" + type: "insight" + schema: + $ref: "#/components/schemas/GovernanceInsightsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - events_read + - metrics_read + summary: List insights tags: - - Governance Controls + - Governance Console + "x-permission": + operator: OR + permissions: + - metrics_read + - events_read + - audit_logs_read + - governance_console_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/). - /api/v2/governance/control/{detection_type}: + /api/v2/governance/limits: get: description: |- - Retrieve a single governance control by its detection type, including the organization's current - detection, notification, and mitigation configuration and detection counts. - operationId: GetGovernanceControl - parameters: - - description: The detection type that identifies the control, for example `unused_api_keys`. - example: "unused_api_keys" - in: path - name: detection_type - required: true - schema: - type: string + Retrieve the list of usage limits tracked for the organization in the Governance Console. + Each limit reports the query used to compute current usage, the unit and time range it is + measured over, and its current usage status. + operationId: ListGovernanceLimits responses: "200": content: @@ -143638,50 +145028,29 @@ paths: default: value: data: - attributes: - active_detections_count: 12 - category: "security" - created_at: "2024-01-15T09:30:00Z" - created_by: "11111111-2222-3333-4444-555555555555" - description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." - detection_frequency: "daily" - detection_parameters: - api_key_threshold: 30 - detection_type: "unused_api_keys" - feature_flags: [] - insights: [] - last_detection_at: "2024-03-01T12:00:00Z" - mitigated_detections_count: 3 - mitigation_parameters: {} - mitigation_type: "revoke_api_key" - mitigations: [] - name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" - priority: "High" - product: "api_keys" - release_status: "prod" - resource_type: "api_key" - resource_type_display_name: "API Key" - supported_detection_parameters: - - default_value: 30 - description: "Number of days of inactivity before an API key is considered unused." - display_name: "Unused API Key Threshold" - hidden: false - name: "api_key_threshold" - required: false - supported_values: [] - type: "integer" - supported_notification_parameters: [] - task: "Review and revoke unused API keys." - type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: "governance_control" + - attributes: + description: "The number of log events indexed in the last 30 days." + display_name: "Indexed Logs" + limit_type: "usage" + product: "logs" + query: + query: "sum:datadog.estimated_usage.logs.ingested_events{*}" + reducer: "sum" + source: "metrics" + query_config: + chart_type: "line" + comparison_shift: "month" + default_value: 0 + directionality: "increase_better" + effective_time_window_days: 30 + time_range: "month" + times_hit_limit: 2 + unit_name: "events" + usage_status: "approaching" + id: "logs_indexed_events" + type: "limit" schema: - $ref: "#/components/schemas/GovernanceControlResponse" + $ref: "#/components/schemas/GovernanceLimitsResponse" description: OK "400": content: @@ -143701,34 +145070,82 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden - "404": + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List usage limits + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). + /api/v2/governance/notification_settings: + get: + description: |- + Retrieve the organization-wide governance notification settings, including whether users are + notified when detections are assigned to them. + operationId: GetGovernanceNotificationSettings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_notifications_enabled: true + id: "11111111-2222-3333-4444-555555555555" + type: "governance_notification_settings" + schema: + $ref: "#/components/schemas/GovernanceNotificationSettingsResponse" + description: OK + "400": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: Get a governance control + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get notification settings tags: - - Governance Controls + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). patch: description: |- - Update the detection, notification, and mitigation configuration of a governance control. Only - the attributes present in the request are modified. Changing the mitigation type or its - parameters may require additional permissions. - operationId: UpdateGovernanceControl - parameters: - - description: The detection type that identifies the control, for example `unused_api_keys`. - example: "unused_api_keys" - in: path - name: detection_type - required: true - schema: - type: string + Update the organization-wide governance notification settings. Only the attributes present in + the request are modified. + operationId: UpdateGovernanceNotificationSettings requestBody: content: application/json: @@ -143737,12 +145154,10 @@ paths: value: data: attributes: - detection_parameters: - api_key_threshold: 60 - mitigation_type: "revoke_api_key" - type: "governance_control" + assignment_notifications_enabled: true + type: "governance_notification_settings" schema: - $ref: "#/components/schemas/GovernanceControlUpdateRequest" + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateRequest" required: true responses: "200": @@ -143753,41 +145168,11 @@ paths: value: data: attributes: - active_detections_count: 12 - category: "security" - created_at: "2024-01-15T09:30:00Z" - created_by: "11111111-2222-3333-4444-555555555555" - description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." - detection_frequency: "daily" - detection_parameters: - api_key_threshold: 60 - detection_type: "unused_api_keys" - feature_flags: [] - insights: [] - last_detection_at: "2024-03-01T12:00:00Z" - mitigated_detections_count: 3 - mitigation_parameters: {} - mitigation_type: "revoke_api_key" - mitigations: [] - name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" - priority: "High" - product: "api_keys" - release_status: "prod" - resource_type: "api_key" - resource_type_display_name: "API Key" - supported_detection_parameters: [] - supported_notification_parameters: [] - task: "Review and revoke unused API keys." - type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: "governance_control" + assignment_notifications_enabled: true + id: "11111111-2222-3333-4444-555555555555" + type: "governance_notification_settings" schema: - $ref: "#/components/schemas/GovernanceControlResponse" + $ref: "#/components/schemas/GovernanceNotificationSettingsResponse" description: OK "400": content: @@ -143807,60 +145192,30 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: Update a governance control + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update notification settings tags: - - Governance Controls + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_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/governance/insights: + /api/v2/governance/resource-limits: get: description: |- - Retrieve the list of governance insights available to the organization. By default, only - insight metadata is returned; pass `withValues=true` to also compute and include each - insight's current and previous values. Insights can be filtered by product. - operationId: ListGovernanceInsights - parameters: - - description: |- - Whether to compute and include the current and previous value of each insight. - Defaults to `false`, in which case only insight metadata is returned. - example: true - in: query - name: withValues - required: false - schema: - type: boolean - - description: |- - The UUID of the organization to compute insights for. Defaults to the organization of - the authenticated user. Used to retrieve insights for a child organization from a - parent organization. - example: "11111111-2222-3333-4444-555555555555" - in: query - name: orgUuid - required: false - schema: - type: string - - description: |- - Restrict the results to insights belonging to the given products. May be repeated to - filter by multiple products. Matching is case-insensitive. - example: - - "Usage" - - "Logs Settings" - in: query - name: filter[product] - required: false - schema: - items: - type: string - type: array + Retrieve the list of resource limits tracked for the organization in the Governance Console. + Each resource limit reports its current value and configured limit, the queries used to + compute them, and its current usage status. + operationId: ListGovernanceResourceLimits responses: "200": content: @@ -143870,59 +145225,34 @@ paths: value: data: - attributes: - audit_query: - best_practice: - deep_link: "" - description: "" - display_name: "Active Dashboards" - event_query: - metric_query: - old_value: 3274 - percentage_query: - product: "Usage" - state: "" - sub_product: "" - time_range: "" - unit_name: "active dashboards" - usage_query: - value: 3601 - id: "498ee21f-8037-48b8-a961-a488692902f4" - type: "insight" - - attributes: - audit_query: - best_practice: - category: "access_governance" - deep_link: "/organization-settings/users?status=inactive" - description: "Review and deactivate users who have not logged in within the last 90 days." - detection_type: - id: "bp_monitor_inactive_users" - impact: "Reduces unauthorized access risk." - impact_hint: 1 - permissions: - - "user_access_manage" - status: "active" - summary: "Inactive users with access increase your security surface area." - title: "Monitor inactive users" - trigger_condition: "active_users" - trigger_type: "insight" - deep_link: "" - description: "Number of users who have used the Dashboard in the last 30 days" - display_name: "Active Users" - event_query: - metric_query: - old_value: 1173 - percentage_query: - product: "Usage" - state: "" - sub_product: "" + current_limit: 10000 + current_value: 8200 + default_current_value: 0 + default_limit_value: 0 + description: "The number of custom metrics in use against your contracted limit." + display_name: "Custom Metrics" + limit_query: + query: "sum:datadog.contract.metrics.custom{*}" + reducer: "max" + source: "metrics" + product: "metrics" + query: + query: "sum:datadog.estimated_usage.metrics.custom{*}" + reducer: "sum" + source: "metrics" + query_config: + chart_type: "line" + comparison_shift: "month" + default_value: 0 + directionality: "decrease_better" + effective_time_window_days: 30 time_range: "month" - unit_name: "active users" - usage_query: - value: 1291 - id: "a3248d1b-5578-4345-a34e-fe9657300f22" - type: "insight" + unit_name: "metrics" + usage_status: "approaching" + id: "custom_metrics" + type: "resource-limit" schema: - $ref: "#/components/schemas/GovernanceInsightsResponse" + $ref: "#/components/schemas/GovernanceResourceLimitsResponse" description: OK "400": content: @@ -143944,9 +145274,17 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: List governance insights + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List resource limits tags: - - Governance Insights + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_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/). @@ -203606,9 +204944,17 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: List tag policies tags: - Tag Policies + "x-permission": + operator: OR + permissions: + - telemetry_rules_read + - metrics_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/). @@ -203697,9 +205043,16 @@ paths: description: Conflict "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Create a tag policy tags: - Tag Policies + "x-permission": + operator: AND + permissions: + - telemetry_rules_create 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/). @@ -203754,9 +205107,16 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Delete a tag policy tags: - Tag Policies + "x-permission": + operator: AND + permissions: + - telemetry_rules_create 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/). @@ -203866,9 +205226,17 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Get a tag policy tags: - Tag Policies + "x-permission": + operator: OR + permissions: + - telemetry_rules_read + - metrics_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/). @@ -203957,9 +205325,16 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Update a tag policy tags: - Tag Policies + "x-permission": + operator: AND + permissions: + - telemetry_rules_create 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/). @@ -204039,9 +205414,17 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] summary: Get a tag policy compliance score tags: - Tag Policies + "x-permission": + operator: OR + permissions: + - telemetry_rules_read + - metrics_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/). @@ -210140,17 +211523,20 @@ tags: url: https://docs.datadoghq.com/integrations/google-hangouts-chat/ name: Google Chat Integration - description: |- - Governance Controls pair a detection definition with an organization's detection, notification, - and mitigation configuration within the Governance Console. Each control reports how a class of - governance issue (such as unused API keys or unqueried metrics) is detected and remediated, along - with counts of active and mitigated detections. - name: Governance Controls - - description: |- - Governance Insights surface key usage, configuration, and best-practice signals for an - organization within the Governance Console. Each insight reports a current value (and, - optionally, a previous value for comparison) along with the query used to compute it, so - that the Console can render trends and highlight areas that need attention. - name: Governance Insights + The Governance Console finds issues that build up across a Datadog organization over time, + such as API keys nobody uses, users who no longer need access, or custom metrics that are + never queried, and tracks them through to a fix. + + These endpoints allow you to: + + - Read insights: measures of how your organization uses Datadog, each with the query behind it. + - Configure controls: the rules deciding how one kind of issue is found and what is done about it. + - Act on detections: the issues a control found. Assign, defer, accept as an exception, or fix. + - Manage settings: organization-wide configuration, usage and resource limits, and notifications. + + See the [Governance Console page](https://docs.datadoghq.com/account_management/governance_console/) + for more information. + name: Governance Console - description: |- Configure High Availability Multi-Region (HAMR) connections between Datadog organizations. HAMR provides disaster recovery capabilities by maintaining synchronized data between primary diff --git a/examples/v2/governance-console/GetGovernanceConfig.java b/examples/v2/governance-console/GetGovernanceConfig.java new file mode 100644 index 00000000000..5aa0840ffa1 --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceConfig.java @@ -0,0 +1,25 @@ +// Get the Governance Console configuration returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceConfigResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getGovernanceConfig", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + try { + GovernanceConfigResponse result = apiInstance.getGovernanceConfig(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GovernanceConsoleApi#getGovernanceConfig"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-controls/GetGovernanceControl.java b/examples/v2/governance-console/GetGovernanceControl.java similarity index 72% rename from examples/v2/governance-controls/GetGovernanceControl.java rename to examples/v2/governance-console/GetGovernanceControl.java index fbed4ad7fe5..824b7813df6 100644 --- a/examples/v2/governance-controls/GetGovernanceControl.java +++ b/examples/v2/governance-console/GetGovernanceControl.java @@ -1,21 +1,21 @@ -// Get a governance control returns "OK" response +// Get a control returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.GovernanceControlsApi; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; import com.datadog.api.client.v2.model.GovernanceControlResponse; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.getGovernanceControl", true); - GovernanceControlsApi apiInstance = new GovernanceControlsApi(defaultClient); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); try { GovernanceControlResponse result = apiInstance.getGovernanceControl("unused_api_keys"); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling GovernanceControlsApi#getGovernanceControl"); + System.err.println("Exception when calling GovernanceConsoleApi#getGovernanceControl"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/governance-console/GetGovernanceControlNotificationSettings.java b/examples/v2/governance-console/GetGovernanceControlNotificationSettings.java new file mode 100644 index 00000000000..8a7c1ddcb86 --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceControlNotificationSettings.java @@ -0,0 +1,27 @@ +// Get control notification settings returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.ControlNotificationSettingsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getGovernanceControlNotificationSettings", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + try { + ControlNotificationSettingsResponse result = + apiInstance.getGovernanceControlNotificationSettings("unused_api_keys"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceConsoleApi#getGovernanceControlNotificationSettings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-console/GetGovernanceDetection.java b/examples/v2/governance-console/GetGovernanceDetection.java new file mode 100644 index 00000000000..d44458b5e4f --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceDetection.java @@ -0,0 +1,26 @@ +// Get a detection returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceControlDetectionResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getGovernanceDetection", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + try { + GovernanceControlDetectionResponse result = + apiInstance.getGovernanceDetection("3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GovernanceConsoleApi#getGovernanceDetection"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-console/GetGovernanceNotificationSettings.java b/examples/v2/governance-console/GetGovernanceNotificationSettings.java new file mode 100644 index 00000000000..66233b0d4f6 --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceNotificationSettings.java @@ -0,0 +1,27 @@ +// Get notification settings returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getGovernanceNotificationSettings", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + try { + GovernanceNotificationSettingsResponse result = + apiInstance.getGovernanceNotificationSettings(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceConsoleApi#getGovernanceNotificationSettings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-console/ListGovernanceControlDetections.java b/examples/v2/governance-console/ListGovernanceControlDetections.java new file mode 100644 index 00000000000..772fadbf966 --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceControlDetections.java @@ -0,0 +1,27 @@ +// List control detections returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceControlDetectionsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listGovernanceControlDetections", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + try { + GovernanceControlDetectionsResponse result = + apiInstance.listGovernanceControlDetections("unused_api_keys"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceConsoleApi#listGovernanceControlDetections"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-controls/ListGovernanceControls.java b/examples/v2/governance-console/ListGovernanceControls.java similarity index 72% rename from examples/v2/governance-controls/ListGovernanceControls.java rename to examples/v2/governance-console/ListGovernanceControls.java index e966ca3520f..4940d4d3ca8 100644 --- a/examples/v2/governance-controls/ListGovernanceControls.java +++ b/examples/v2/governance-console/ListGovernanceControls.java @@ -1,21 +1,21 @@ -// List governance controls returns "OK" response +// List controls returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.GovernanceControlsApi; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; import com.datadog.api.client.v2.model.GovernanceControlsResponse; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.listGovernanceControls", true); - GovernanceControlsApi apiInstance = new GovernanceControlsApi(defaultClient); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); try { GovernanceControlsResponse result = apiInstance.listGovernanceControls(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling GovernanceControlsApi#listGovernanceControls"); + System.err.println("Exception when calling GovernanceConsoleApi#listGovernanceControls"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/governance-insights/ListGovernanceInsights.java b/examples/v2/governance-console/ListGovernanceInsights.java similarity index 72% rename from examples/v2/governance-insights/ListGovernanceInsights.java rename to examples/v2/governance-console/ListGovernanceInsights.java index 3ec8610de6a..3daf2ef65e1 100644 --- a/examples/v2/governance-insights/ListGovernanceInsights.java +++ b/examples/v2/governance-console/ListGovernanceInsights.java @@ -1,21 +1,21 @@ -// List governance insights returns "OK" response +// List insights returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.GovernanceInsightsApi; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; import com.datadog.api.client.v2.model.GovernanceInsightsResponse; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.listGovernanceInsights", true); - GovernanceInsightsApi apiInstance = new GovernanceInsightsApi(defaultClient); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); try { GovernanceInsightsResponse result = apiInstance.listGovernanceInsights(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling GovernanceInsightsApi#listGovernanceInsights"); + System.err.println("Exception when calling GovernanceConsoleApi#listGovernanceInsights"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/governance-console/ListGovernanceLimits.java b/examples/v2/governance-console/ListGovernanceLimits.java new file mode 100644 index 00000000000..f9385fb966b --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceLimits.java @@ -0,0 +1,25 @@ +// List usage limits returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceLimitsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listGovernanceLimits", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + try { + GovernanceLimitsResponse result = apiInstance.listGovernanceLimits(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GovernanceConsoleApi#listGovernanceLimits"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-console/ListGovernanceResourceLimits.java b/examples/v2/governance-console/ListGovernanceResourceLimits.java new file mode 100644 index 00000000000..32e7e50ff06 --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceResourceLimits.java @@ -0,0 +1,26 @@ +// List resource limits returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceResourceLimitsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listGovernanceResourceLimits", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + try { + GovernanceResourceLimitsResponse result = apiInstance.listGovernanceResourceLimits(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceConsoleApi#listGovernanceResourceLimits"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-console/MitigateGovernanceDetections.java b/examples/v2/governance-console/MitigateGovernanceDetections.java new file mode 100644 index 00000000000..38e2105492f --- /dev/null +++ b/examples/v2/governance-console/MitigateGovernanceDetections.java @@ -0,0 +1,41 @@ +// Mitigate detections returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceControlDetectionResourceType; +import com.datadog.api.client.v2.model.GovernanceMitigationRequest; +import com.datadog.api.client.v2.model.GovernanceMitigationRequestAttributes; +import com.datadog.api.client.v2.model.GovernanceMitigationRequestData; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.mitigateGovernanceDetections", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + GovernanceMitigationRequest body = + new GovernanceMitigationRequest() + .data( + new GovernanceMitigationRequestData() + .attributes( + new GovernanceMitigationRequestAttributes() + .detectionIds( + Collections.singletonList("3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d")) + .detectionType("unused_api_keys") + .mitigationType("revoke_api_key")) + .type(GovernanceControlDetectionResourceType.GOVERNANCE_CONTROL_DETECTION)); + + try { + apiInstance.mitigateGovernanceDetections(body); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceConsoleApi#mitigateGovernanceDetections"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-controls/UpdateGovernanceControl.java b/examples/v2/governance-console/UpdateGovernanceControl.java similarity index 71% rename from examples/v2/governance-controls/UpdateGovernanceControl.java rename to examples/v2/governance-console/UpdateGovernanceControl.java index 42aefaaa80f..e40c742efe9 100644 --- a/examples/v2/governance-controls/UpdateGovernanceControl.java +++ b/examples/v2/governance-console/UpdateGovernanceControl.java @@ -1,8 +1,8 @@ -// Update a governance control returns "OK" response +// Update a control returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.GovernanceControlsApi; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; import com.datadog.api.client.v2.model.GovernanceControlResourceType; import com.datadog.api.client.v2.model.GovernanceControlResponse; import com.datadog.api.client.v2.model.GovernanceControlUpdateAttributes; @@ -13,7 +13,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.updateGovernanceControl", true); - GovernanceControlsApi apiInstance = new GovernanceControlsApi(defaultClient); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); GovernanceControlUpdateRequest body = new GovernanceControlUpdateRequest() @@ -22,11 +22,7 @@ public static void main(String[] args) { .attributes( new GovernanceControlUpdateAttributes() .detectionFrequency("daily") - .mitigationType("revoke_api_key") - .name("Unused API Keys") - .notificationFrequency("daily") - .notificationType("slack")) - .id("0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a") + .mitigationType("revoke_api_key")) .type(GovernanceControlResourceType.GOVERNANCE_CONTROL)); try { @@ -34,7 +30,7 @@ public static void main(String[] args) { apiInstance.updateGovernanceControl("unused_api_keys", body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling GovernanceControlsApi#updateGovernanceControl"); + System.err.println("Exception when calling GovernanceConsoleApi#updateGovernanceControl"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.java b/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.java new file mode 100644 index 00000000000..4a9c26b774b --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.java @@ -0,0 +1,55 @@ +// Update control notification settings returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.ControlNotificationEventSetting; +import com.datadog.api.client.v2.model.ControlNotificationSettingsResourceType; +import com.datadog.api.client.v2.model.ControlNotificationSettingsResponse; +import com.datadog.api.client.v2.model.ControlNotificationSettingsUpdateAttributes; +import com.datadog.api.client.v2.model.ControlNotificationSettingsUpdateData; +import com.datadog.api.client.v2.model.ControlNotificationSettingsUpdateRequest; +import com.datadog.api.client.v2.model.ControlNotificationTarget; +import com.datadog.api.client.v2.model.ControlNotificationTargetType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled( + "v2.updateGovernanceControlNotificationSettings", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + ControlNotificationSettingsUpdateRequest body = + new ControlNotificationSettingsUpdateRequest() + .data( + new ControlNotificationSettingsUpdateData() + .attributes( + new ControlNotificationSettingsUpdateAttributes() + .eventSettings( + Collections.singletonList( + new ControlNotificationEventSetting() + .enabled(true) + .eventType("new_detection") + .targets( + Collections.singletonList( + new ControlNotificationTarget() + .handle("#governance-alerts") + .type(ControlNotificationTargetType.SLACK)))))) + .type(ControlNotificationSettingsResourceType.CONTROL_NOTIFICATION_SETTINGS)); + + try { + ControlNotificationSettingsResponse result = + apiInstance.updateGovernanceControlNotificationSettings("unused_api_keys", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling" + + " GovernanceConsoleApi#updateGovernanceControlNotificationSettings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-console/UpdateGovernanceDetection.java b/examples/v2/governance-console/UpdateGovernanceDetection.java new file mode 100644 index 00000000000..caac66d2988 --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceDetection.java @@ -0,0 +1,44 @@ +// Update a detection returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceControlDetectionResourceType; +import com.datadog.api.client.v2.model.GovernanceControlDetectionResponse; +import com.datadog.api.client.v2.model.GovernanceControlDetectionUpdateAttributes; +import com.datadog.api.client.v2.model.GovernanceControlDetectionUpdateData; +import com.datadog.api.client.v2.model.GovernanceControlDetectionUpdateRequest; +import com.datadog.api.client.v2.model.GovernanceControlDetectionUpdateState; +import java.time.OffsetDateTime; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateGovernanceDetection", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + GovernanceControlDetectionUpdateRequest body = + new GovernanceControlDetectionUpdateRequest() + .data( + new GovernanceControlDetectionUpdateData() + .attributes( + new GovernanceControlDetectionUpdateAttributes() + .assignedTeam("platform-security") + .assignedTo("11111111-2222-3333-4444-555555555555") + .mitigateAfter(OffsetDateTime.parse("2024-03-15T00:00:00Z")) + .state(GovernanceControlDetectionUpdateState.EXCEPTION)) + .type(GovernanceControlDetectionResourceType.GOVERNANCE_CONTROL_DETECTION)); + + try { + GovernanceControlDetectionResponse result = + apiInstance.updateGovernanceDetection("3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GovernanceConsoleApi#updateGovernanceDetection"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/governance-console/UpdateGovernanceNotificationSettings.java b/examples/v2/governance-console/UpdateGovernanceNotificationSettings.java new file mode 100644 index 00000000000..91eebe0b9b5 --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceNotificationSettings.java @@ -0,0 +1,42 @@ +// Update notification settings returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceConsoleApi; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsResourceType; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsResponse; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsUpdateAttributes; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsUpdateData; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsUpdateRequest; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateGovernanceNotificationSettings", true); + GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient); + + GovernanceNotificationSettingsUpdateRequest body = + new GovernanceNotificationSettingsUpdateRequest() + .data( + new GovernanceNotificationSettingsUpdateData() + .attributes( + new GovernanceNotificationSettingsUpdateAttributes() + .assignmentNotificationsEnabled(true)) + .type( + GovernanceNotificationSettingsResourceType + .GOVERNANCE_NOTIFICATION_SETTINGS)); + + try { + GovernanceNotificationSettingsResponse result = + apiInstance.updateGovernanceNotificationSettings(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceConsoleApi#updateGovernanceNotificationSettings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 97c93bba1d2..3ee7bb5b8f0 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1030,10 +1030,21 @@ public class ApiClient { put("v2.upsertAndPublishFormVersion", false); put("v2.upsertFormVersion", false); put("v2.updateOrgSamlConfigurations", false); + put("v2.getGovernanceConfig", false); put("v2.getGovernanceControl", false); + put("v2.getGovernanceControlNotificationSettings", false); + put("v2.getGovernanceDetection", false); + put("v2.getGovernanceNotificationSettings", false); + put("v2.listGovernanceControlDetections", false); put("v2.listGovernanceControls", false); - put("v2.updateGovernanceControl", false); put("v2.listGovernanceInsights", false); + put("v2.listGovernanceLimits", false); + put("v2.listGovernanceResourceLimits", false); + put("v2.mitigateGovernanceDetections", false); + put("v2.updateGovernanceControl", false); + put("v2.updateGovernanceControlNotificationSettings", false); + put("v2.updateGovernanceDetection", false); + put("v2.updateGovernanceNotificationSettings", false); put("v2.createHamrOrgConnection", false); put("v2.getHamrOrgConnection", false); put("v2.deleteEntityIntegrationConfig", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/GovernanceConsoleApi.java b/src/main/java/com/datadog/api/client/v2/api/GovernanceConsoleApi.java new file mode 100644 index 00000000000..ffb86f94908 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/GovernanceConsoleApi.java @@ -0,0 +1,2607 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.ControlNotificationSettingsResponse; +import com.datadog.api.client.v2.model.ControlNotificationSettingsUpdateRequest; +import com.datadog.api.client.v2.model.GovernanceConfigResponse; +import com.datadog.api.client.v2.model.GovernanceControlDetectionResponse; +import com.datadog.api.client.v2.model.GovernanceControlDetectionUpdateRequest; +import com.datadog.api.client.v2.model.GovernanceControlDetectionsResponse; +import com.datadog.api.client.v2.model.GovernanceControlResponse; +import com.datadog.api.client.v2.model.GovernanceControlUpdateRequest; +import com.datadog.api.client.v2.model.GovernanceControlsResponse; +import com.datadog.api.client.v2.model.GovernanceInsightsResponse; +import com.datadog.api.client.v2.model.GovernanceLimitsResponse; +import com.datadog.api.client.v2.model.GovernanceMitigationRequest; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsResponse; +import com.datadog.api.client.v2.model.GovernanceNotificationSettingsUpdateRequest; +import com.datadog.api.client.v2.model.GovernanceResourceLimitsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceConsoleApi { + private ApiClient apiClient; + + public GovernanceConsoleApi() { + this(ApiClient.getDefaultApiClient()); + } + + public GovernanceConsoleApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the Governance Console configuration. + * + *

See {@link #getGovernanceConfigWithHttpInfo}. + * + * @return GovernanceConfigResponse + * @throws ApiException if fails to make API call + */ + public GovernanceConfigResponse getGovernanceConfig() throws ApiException { + return getGovernanceConfigWithHttpInfo().getData(); + } + + /** + * Get the Governance Console configuration. + * + *

See {@link #getGovernanceConfigWithHttpInfoAsync}. + * + * @return CompletableFuture<GovernanceConfigResponse> + */ + public CompletableFuture getGovernanceConfigAsync() { + return getGovernanceConfigWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the Governance Console configuration for the organization, including whether the + * Console is enabled, whether assignment notifications are enabled, and whether usage attribution + * is configured. + * + * @return ApiResponse<GovernanceConfigResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse getGovernanceConfigWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getGovernanceConfig"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/config"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get the Governance Console configuration. + * + *

See {@link #getGovernanceConfigWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GovernanceConfigResponse>> + */ + public CompletableFuture> + getGovernanceConfigWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "getGovernanceConfig"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/config"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a control. + * + *

See {@link #getGovernanceControlWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @return GovernanceControlResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlResponse getGovernanceControl(String detectionType) throws ApiException { + return getGovernanceControlWithHttpInfo(detectionType).getData(); + } + + /** + * Get a control. + * + *

See {@link #getGovernanceControlWithHttpInfoAsync}. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @return CompletableFuture<GovernanceControlResponse> + */ + public CompletableFuture getGovernanceControlAsync( + String detectionType) { + return getGovernanceControlWithHttpInfoAsync(detectionType) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a single governance control by its detection type, including the organization's + * current detection, notification, and mitigation configuration and detection counts. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @return ApiResponse<GovernanceControlResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getGovernanceControlWithHttpInfo( + String detectionType) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getGovernanceControl"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + throw new ApiException( + 400, "Missing the required parameter 'detectionType' when calling getGovernanceControl"); + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceControl", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a control. + * + *

See {@link #getGovernanceControlWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @return CompletableFuture<ApiResponse<GovernanceControlResponse>> + */ + public CompletableFuture> + getGovernanceControlWithHttpInfoAsync(String detectionType) { + // Check if unstable operation is enabled + String operationId = "getGovernanceControl"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling getGovernanceControl")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceControl", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get control notification settings. + * + *

See {@link #getGovernanceControlNotificationSettingsWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @return ControlNotificationSettingsResponse + * @throws ApiException if fails to make API call + */ + public ControlNotificationSettingsResponse getGovernanceControlNotificationSettings( + String detectionType) throws ApiException { + return getGovernanceControlNotificationSettingsWithHttpInfo(detectionType).getData(); + } + + /** + * Get control notification settings. + * + *

See {@link #getGovernanceControlNotificationSettingsWithHttpInfoAsync}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @return CompletableFuture<ControlNotificationSettingsResponse> + */ + public CompletableFuture + getGovernanceControlNotificationSettingsAsync(String detectionType) { + return getGovernanceControlNotificationSettingsWithHttpInfoAsync(detectionType) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the notification settings for the governance control with the given detection type, + * including, for each supported event type, whether notifications are enabled and which + * destinations receive them. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @return ApiResponse<ControlNotificationSettingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse + getGovernanceControlNotificationSettingsWithHttpInfo(String detectionType) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getGovernanceControlNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + throw new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " getGovernanceControlNotificationSettings"); + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/notification_settings" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceControlNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get control notification settings. + * + *

See {@link #getGovernanceControlNotificationSettingsWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @return CompletableFuture<ApiResponse<ControlNotificationSettingsResponse>> + */ + public CompletableFuture> + getGovernanceControlNotificationSettingsWithHttpInfoAsync(String detectionType) { + // Check if unstable operation is enabled + String operationId = "getGovernanceControlNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " getGovernanceControlNotificationSettings")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/notification_settings" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceControlNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a detection. + * + *

See {@link #getGovernanceDetectionWithHttpInfo}. + * + * @param detectionId The unique identifier of the detection. (required) + * @return GovernanceControlDetectionResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlDetectionResponse getGovernanceDetection(String detectionId) + throws ApiException { + return getGovernanceDetectionWithHttpInfo(detectionId).getData(); + } + + /** + * Get a detection. + * + *

See {@link #getGovernanceDetectionWithHttpInfoAsync}. + * + * @param detectionId The unique identifier of the detection. (required) + * @return CompletableFuture<GovernanceControlDetectionResponse> + */ + public CompletableFuture getGovernanceDetectionAsync( + String detectionId) { + return getGovernanceDetectionWithHttpInfoAsync(detectionId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a single governance detection by its unique identifier. + * + * @param detectionId The unique identifier of the detection. (required) + * @return ApiResponse<GovernanceControlDetectionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getGovernanceDetectionWithHttpInfo( + String detectionId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getGovernanceDetection"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionId' is set + if (detectionId == null) { + throw new ApiException( + 400, "Missing the required parameter 'detectionId' when calling getGovernanceDetection"); + } + // create path and map variables + String localVarPath = + "/api/v2/governance/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceDetection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a detection. + * + *

See {@link #getGovernanceDetectionWithHttpInfo}. + * + * @param detectionId The unique identifier of the detection. (required) + * @return CompletableFuture<ApiResponse<GovernanceControlDetectionResponse>> + */ + public CompletableFuture> + getGovernanceDetectionWithHttpInfoAsync(String detectionId) { + // Check if unstable operation is enabled + String operationId = "getGovernanceDetection"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionId' is set + if (detectionId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionId' when calling getGovernanceDetection")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/governance/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceDetection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get notification settings. + * + *

See {@link #getGovernanceNotificationSettingsWithHttpInfo}. + * + * @return GovernanceNotificationSettingsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceNotificationSettingsResponse getGovernanceNotificationSettings() + throws ApiException { + return getGovernanceNotificationSettingsWithHttpInfo().getData(); + } + + /** + * Get notification settings. + * + *

See {@link #getGovernanceNotificationSettingsWithHttpInfoAsync}. + * + * @return CompletableFuture<GovernanceNotificationSettingsResponse> + */ + public CompletableFuture + getGovernanceNotificationSettingsAsync() { + return getGovernanceNotificationSettingsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the organization-wide governance notification settings, including whether users are + * notified when detections are assigned to them. + * + * @return ApiResponse<GovernanceNotificationSettingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse + getGovernanceNotificationSettingsWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "getGovernanceNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/notification_settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get notification settings. + * + *

See {@link #getGovernanceNotificationSettingsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GovernanceNotificationSettingsResponse>> + */ + public CompletableFuture> + getGovernanceNotificationSettingsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "getGovernanceNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/notification_settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.getGovernanceNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listGovernanceControlDetections. */ + public static class ListGovernanceControlDetectionsOptionalParameters { + private String filterState; + private String filterQuery; + private String sort; + private Long pageNumber; + private Long pageSize; + + /** + * Set filterState. + * + * @param filterState Restrict the results to detections in the given state. (optional) + * @return ListGovernanceControlDetectionsOptionalParameters + */ + public ListGovernanceControlDetectionsOptionalParameters filterState(String filterState) { + this.filterState = filterState; + return this; + } + + /** + * Set filterQuery. + * + * @param filterQuery Restrict the results to detections matching the given free-text query. + * (optional) + * @return ListGovernanceControlDetectionsOptionalParameters + */ + public ListGovernanceControlDetectionsOptionalParameters filterQuery(String filterQuery) { + this.filterQuery = filterQuery; + return this; + } + + /** + * Set sort. + * + * @param sort A comma-separated list of attributes to sort detections by. Prefix an attribute + * with - for descending order. The attributes available for sorting are + * id, created_at, assigned_to, detection_type + * , display_name, exception_at, mitigate_after, + * mitigated_at, priority, resource_id, and + * state. Defaults to created_at,-id. (optional) + * @return ListGovernanceControlDetectionsOptionalParameters + */ + public ListGovernanceControlDetectionsOptionalParameters sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber The zero-based index of the page to return; the first page is 0. (optional, + * default to 0) + * @return ListGovernanceControlDetectionsOptionalParameters + */ + public ListGovernanceControlDetectionsOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize The number of detections to return per page. (optional) + * @return ListGovernanceControlDetectionsOptionalParameters + */ + public ListGovernanceControlDetectionsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + } + + /** + * List control detections. + * + *

See {@link #listGovernanceControlDetectionsWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @return GovernanceControlDetectionsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlDetectionsResponse listGovernanceControlDetections(String detectionType) + throws ApiException { + return listGovernanceControlDetectionsWithHttpInfo( + detectionType, new ListGovernanceControlDetectionsOptionalParameters()) + .getData(); + } + + /** + * List control detections. + * + *

See {@link #listGovernanceControlDetectionsWithHttpInfoAsync}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @return CompletableFuture<GovernanceControlDetectionsResponse> + */ + public CompletableFuture + listGovernanceControlDetectionsAsync(String detectionType) { + return listGovernanceControlDetectionsWithHttpInfoAsync( + detectionType, new ListGovernanceControlDetectionsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List control detections. + * + *

See {@link #listGovernanceControlDetectionsWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param parameters Optional parameters for the request. + * @return GovernanceControlDetectionsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlDetectionsResponse listGovernanceControlDetections( + String detectionType, ListGovernanceControlDetectionsOptionalParameters parameters) + throws ApiException { + return listGovernanceControlDetectionsWithHttpInfo(detectionType, parameters).getData(); + } + + /** + * List control detections. + * + *

See {@link #listGovernanceControlDetectionsWithHttpInfoAsync}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<GovernanceControlDetectionsResponse> + */ + public CompletableFuture + listGovernanceControlDetectionsAsync( + String detectionType, ListGovernanceControlDetectionsOptionalParameters parameters) { + return listGovernanceControlDetectionsWithHttpInfoAsync(detectionType, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the detections produced by the governance control with the given detection type. + * Results can be filtered by state and free-text query, sorted, and paginated. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<GovernanceControlDetectionsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse + listGovernanceControlDetectionsWithHttpInfo( + String detectionType, ListGovernanceControlDetectionsOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listGovernanceControlDetections"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + throw new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " listGovernanceControlDetections"); + } + String filterState = parameters.filterState; + String filterQuery = parameters.filterQuery; + String sort = parameters.sort; + Long pageNumber = parameters.pageNumber; + Long pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/detections" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[state]", filterState)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[query]", filterQuery)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceControlDetections", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List control detections. + * + *

See {@link #listGovernanceControlDetectionsWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<GovernanceControlDetectionsResponse>> + */ + public CompletableFuture> + listGovernanceControlDetectionsWithHttpInfoAsync( + String detectionType, ListGovernanceControlDetectionsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listGovernanceControlDetections"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " listGovernanceControlDetections")); + return result; + } + String filterState = parameters.filterState; + String filterQuery = parameters.filterQuery; + String sort = parameters.sort; + Long pageNumber = parameters.pageNumber; + Long pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/detections" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[state]", filterState)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[query]", filterQuery)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceControlDetections", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List controls. + * + *

See {@link #listGovernanceControlsWithHttpInfo}. + * + * @return GovernanceControlsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlsResponse listGovernanceControls() throws ApiException { + return listGovernanceControlsWithHttpInfo().getData(); + } + + /** + * List controls. + * + *

See {@link #listGovernanceControlsWithHttpInfoAsync}. + * + * @return CompletableFuture<GovernanceControlsResponse> + */ + public CompletableFuture listGovernanceControlsAsync() { + return listGovernanceControlsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the list of governance controls configured for the organization. Each control pairs a + * detection definition with the organization's current detection, notification, and mitigation + * configuration, along with counts of active and mitigated detections. + * + * @return ApiResponse<GovernanceControlsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listGovernanceControlsWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listGovernanceControls"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/control"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceControls", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List controls. + * + *

See {@link #listGovernanceControlsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GovernanceControlsResponse>> + */ + public CompletableFuture> + listGovernanceControlsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listGovernanceControls"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/control"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceControls", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listGovernanceInsights. */ + public static class ListGovernanceInsightsOptionalParameters { + private List filterProduct; + + /** + * Set filterProduct. + * + * @param filterProduct Restrict the results to insights belonging to the given products. May be + * repeated to filter by multiple products. Matching is case-insensitive. (optional) + * @return ListGovernanceInsightsOptionalParameters + */ + public ListGovernanceInsightsOptionalParameters filterProduct(List filterProduct) { + this.filterProduct = filterProduct; + return this; + } + } + + /** + * List insights. + * + *

See {@link #listGovernanceInsightsWithHttpInfo}. + * + * @return GovernanceInsightsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceInsightsResponse listGovernanceInsights() throws ApiException { + return listGovernanceInsightsWithHttpInfo(new ListGovernanceInsightsOptionalParameters()) + .getData(); + } + + /** + * List insights. + * + *

See {@link #listGovernanceInsightsWithHttpInfoAsync}. + * + * @return CompletableFuture<GovernanceInsightsResponse> + */ + public CompletableFuture listGovernanceInsightsAsync() { + return listGovernanceInsightsWithHttpInfoAsync(new ListGovernanceInsightsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List insights. + * + *

See {@link #listGovernanceInsightsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return GovernanceInsightsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceInsightsResponse listGovernanceInsights( + ListGovernanceInsightsOptionalParameters parameters) throws ApiException { + return listGovernanceInsightsWithHttpInfo(parameters).getData(); + } + + /** + * List insights. + * + *

See {@link #listGovernanceInsightsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<GovernanceInsightsResponse> + */ + public CompletableFuture listGovernanceInsightsAsync( + ListGovernanceInsightsOptionalParameters parameters) { + return listGovernanceInsightsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the list of governance insights available to the organization. Each insight reports + * the query used to compute it, so that the value can be computed client-side. Insights can be + * filtered by product. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<GovernanceInsightsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listGovernanceInsightsWithHttpInfo( + ListGovernanceInsightsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listGovernanceInsights"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + List filterProduct = parameters.filterProduct; + // create path and map variables + String localVarPath = "/api/v2/governance/insights"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[product]", filterProduct)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceInsights", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List insights. + * + *

See {@link #listGovernanceInsightsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<GovernanceInsightsResponse>> + */ + public CompletableFuture> + listGovernanceInsightsWithHttpInfoAsync(ListGovernanceInsightsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listGovernanceInsights"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + List filterProduct = parameters.filterProduct; + // create path and map variables + String localVarPath = "/api/v2/governance/insights"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "filter[product]", filterProduct)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceInsights", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List usage limits. + * + *

See {@link #listGovernanceLimitsWithHttpInfo}. + * + * @return GovernanceLimitsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceLimitsResponse listGovernanceLimits() throws ApiException { + return listGovernanceLimitsWithHttpInfo().getData(); + } + + /** + * List usage limits. + * + *

See {@link #listGovernanceLimitsWithHttpInfoAsync}. + * + * @return CompletableFuture<GovernanceLimitsResponse> + */ + public CompletableFuture listGovernanceLimitsAsync() { + return listGovernanceLimitsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the list of usage limits tracked for the organization in the Governance Console. Each + * limit reports the query used to compute current usage, the unit and time range it is measured + * over, and its current usage status. + * + * @return ApiResponse<GovernanceLimitsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listGovernanceLimitsWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listGovernanceLimits"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/limits"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceLimits", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List usage limits. + * + *

See {@link #listGovernanceLimitsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GovernanceLimitsResponse>> + */ + public CompletableFuture> + listGovernanceLimitsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listGovernanceLimits"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/limits"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceLimits", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List resource limits. + * + *

See {@link #listGovernanceResourceLimitsWithHttpInfo}. + * + * @return GovernanceResourceLimitsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceResourceLimitsResponse listGovernanceResourceLimits() throws ApiException { + return listGovernanceResourceLimitsWithHttpInfo().getData(); + } + + /** + * List resource limits. + * + *

See {@link #listGovernanceResourceLimitsWithHttpInfoAsync}. + * + * @return CompletableFuture<GovernanceResourceLimitsResponse> + */ + public CompletableFuture listGovernanceResourceLimitsAsync() { + return listGovernanceResourceLimitsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the list of resource limits tracked for the organization in the Governance Console. + * Each resource limit reports its current value and configured limit, the queries used to compute + * them, and its current usage status. + * + * @return ApiResponse<GovernanceResourceLimitsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listGovernanceResourceLimitsWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listGovernanceResourceLimits"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/resource-limits"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceResourceLimits", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List resource limits. + * + *

See {@link #listGovernanceResourceLimitsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GovernanceResourceLimitsResponse>> + */ + public CompletableFuture> + listGovernanceResourceLimitsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listGovernanceResourceLimits"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/governance/resource-limits"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.listGovernanceResourceLimits", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Mitigate detections. + * + *

See {@link #mitigateGovernanceDetectionsWithHttpInfo}. + * + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void mitigateGovernanceDetections(GovernanceMitigationRequest body) throws ApiException { + mitigateGovernanceDetectionsWithHttpInfo(body); + } + + /** + * Mitigate detections. + * + *

See {@link #mitigateGovernanceDetectionsWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture mitigateGovernanceDetectionsAsync( + GovernanceMitigationRequest body) { + return mitigateGovernanceDetectionsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Apply a mitigation to a set of governance detections of a given detection type. When the + * mitigation type is omitted, the control's configured mitigation is used. The request is + * accepted for asynchronous processing. + * + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse mitigateGovernanceDetectionsWithHttpInfo( + GovernanceMitigationRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "mitigateGovernanceDetections"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling mitigateGovernanceDetections"); + } + // create path and map variables + String localVarPath = "/api/v2/governance/detections/mitigate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.mitigateGovernanceDetections", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Mitigate detections. + * + *

See {@link #mitigateGovernanceDetectionsWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> mitigateGovernanceDetectionsWithHttpInfoAsync( + GovernanceMitigationRequest body) { + // Check if unstable operation is enabled + String operationId = "mitigateGovernanceDetections"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling mitigateGovernanceDetections")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/governance/detections/mitigate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.mitigateGovernanceDetections", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Update a control. + * + *

See {@link #updateGovernanceControlWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @param body (required) + * @return GovernanceControlResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlResponse updateGovernanceControl( + String detectionType, GovernanceControlUpdateRequest body) throws ApiException { + return updateGovernanceControlWithHttpInfo(detectionType, body).getData(); + } + + /** + * Update a control. + * + *

See {@link #updateGovernanceControlWithHttpInfoAsync}. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @param body (required) + * @return CompletableFuture<GovernanceControlResponse> + */ + public CompletableFuture updateGovernanceControlAsync( + String detectionType, GovernanceControlUpdateRequest body) { + return updateGovernanceControlWithHttpInfoAsync(detectionType, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update the detection, notification, and mitigation configuration of a governance control. Only + * the attributes present in the request are modified. Changing the mitigation type or its + * parameters may require additional permissions. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @param body (required) + * @return ApiResponse<GovernanceControlResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateGovernanceControlWithHttpInfo( + String detectionType, GovernanceControlUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateGovernanceControl"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + throw new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling updateGovernanceControl"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateGovernanceControl"); + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceControl", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a control. + * + *

See {@link #updateGovernanceControlWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control, for example + * unused_api_keys. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<GovernanceControlResponse>> + */ + public CompletableFuture> + updateGovernanceControlWithHttpInfoAsync( + String detectionType, GovernanceControlUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateGovernanceControl"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " updateGovernanceControl")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateGovernanceControl")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceControl", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update control notification settings. + * + *

See {@link #updateGovernanceControlNotificationSettingsWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param body (required) + * @return ControlNotificationSettingsResponse + * @throws ApiException if fails to make API call + */ + public ControlNotificationSettingsResponse updateGovernanceControlNotificationSettings( + String detectionType, ControlNotificationSettingsUpdateRequest body) throws ApiException { + return updateGovernanceControlNotificationSettingsWithHttpInfo(detectionType, body).getData(); + } + + /** + * Update control notification settings. + * + *

See {@link #updateGovernanceControlNotificationSettingsWithHttpInfoAsync}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param body (required) + * @return CompletableFuture<ControlNotificationSettingsResponse> + */ + public CompletableFuture + updateGovernanceControlNotificationSettingsAsync( + String detectionType, ControlNotificationSettingsUpdateRequest body) { + return updateGovernanceControlNotificationSettingsWithHttpInfoAsync(detectionType, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Replace the notification settings for the governance control with the given detection type, + * setting, for each supported event type, whether notifications are enabled and which + * destinations receive them. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param body (required) + * @return ApiResponse<ControlNotificationSettingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse + updateGovernanceControlNotificationSettingsWithHttpInfo( + String detectionType, ControlNotificationSettingsUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateGovernanceControlNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + throw new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " updateGovernanceControlNotificationSettings"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateGovernanceControlNotificationSettings"); + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/notification_settings" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceControlNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update control notification settings. + * + *

See {@link #updateGovernanceControlNotificationSettingsWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<ControlNotificationSettingsResponse>> + */ + public CompletableFuture> + updateGovernanceControlNotificationSettingsWithHttpInfoAsync( + String detectionType, ControlNotificationSettingsUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateGovernanceControlNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " updateGovernanceControlNotificationSettings")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateGovernanceControlNotificationSettings")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/notification_settings" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceControlNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a detection. + * + *

See {@link #updateGovernanceDetectionWithHttpInfo}. + * + * @param detectionId The unique identifier of the detection. (required) + * @param body (required) + * @return GovernanceControlDetectionResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlDetectionResponse updateGovernanceDetection( + String detectionId, GovernanceControlDetectionUpdateRequest body) throws ApiException { + return updateGovernanceDetectionWithHttpInfo(detectionId, body).getData(); + } + + /** + * Update a detection. + * + *

See {@link #updateGovernanceDetectionWithHttpInfoAsync}. + * + * @param detectionId The unique identifier of the detection. (required) + * @param body (required) + * @return CompletableFuture<GovernanceControlDetectionResponse> + */ + public CompletableFuture updateGovernanceDetectionAsync( + String detectionId, GovernanceControlDetectionUpdateRequest body) { + return updateGovernanceDetectionWithHttpInfoAsync(detectionId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a governance detection by its unique identifier. Only the attributes present in the + * request are modified, allowing a detection to be acknowledged as an exception, reopened, + * reassigned, or deferred for mitigation. + * + * @param detectionId The unique identifier of the detection. (required) + * @param body (required) + * @return ApiResponse<GovernanceControlDetectionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateGovernanceDetectionWithHttpInfo( + String detectionId, GovernanceControlDetectionUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateGovernanceDetection"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'detectionId' is set + if (detectionId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'detectionId' when calling updateGovernanceDetection"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateGovernanceDetection"); + } + // create path and map variables + String localVarPath = + "/api/v2/governance/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceDetection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a detection. + * + *

See {@link #updateGovernanceDetectionWithHttpInfo}. + * + * @param detectionId The unique identifier of the detection. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<GovernanceControlDetectionResponse>> + */ + public CompletableFuture> + updateGovernanceDetectionWithHttpInfoAsync( + String detectionId, GovernanceControlDetectionUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateGovernanceDetection"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'detectionId' is set + if (detectionId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionId' when calling" + + " updateGovernanceDetection")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateGovernanceDetection")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/governance/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceDetection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update notification settings. + * + *

See {@link #updateGovernanceNotificationSettingsWithHttpInfo}. + * + * @param body (required) + * @return GovernanceNotificationSettingsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceNotificationSettingsResponse updateGovernanceNotificationSettings( + GovernanceNotificationSettingsUpdateRequest body) throws ApiException { + return updateGovernanceNotificationSettingsWithHttpInfo(body).getData(); + } + + /** + * Update notification settings. + * + *

See {@link #updateGovernanceNotificationSettingsWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<GovernanceNotificationSettingsResponse> + */ + public CompletableFuture + updateGovernanceNotificationSettingsAsync(GovernanceNotificationSettingsUpdateRequest body) { + return updateGovernanceNotificationSettingsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update the organization-wide governance notification settings. Only the attributes present in + * the request are modified. + * + * @param body (required) + * @return ApiResponse<GovernanceNotificationSettingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse + updateGovernanceNotificationSettingsWithHttpInfo( + GovernanceNotificationSettingsUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateGovernanceNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateGovernanceNotificationSettings"); + } + // create path and map variables + String localVarPath = "/api/v2/governance/notification_settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update notification settings. + * + *

See {@link #updateGovernanceNotificationSettingsWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<GovernanceNotificationSettingsResponse>> + */ + public CompletableFuture> + updateGovernanceNotificationSettingsWithHttpInfoAsync( + GovernanceNotificationSettingsUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateGovernanceNotificationSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateGovernanceNotificationSettings")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/governance/notification_settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceConsoleApi.updateGovernanceNotificationSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/GovernanceControlsApi.java b/src/main/java/com/datadog/api/client/v2/api/GovernanceControlsApi.java deleted file mode 100644 index 57c380e4d3b..00000000000 --- a/src/main/java/com/datadog/api/client/v2/api/GovernanceControlsApi.java +++ /dev/null @@ -1,529 +0,0 @@ -package com.datadog.api.client.v2.api; - -import com.datadog.api.client.ApiClient; -import com.datadog.api.client.ApiException; -import com.datadog.api.client.ApiResponse; -import com.datadog.api.client.Pair; -import com.datadog.api.client.v2.model.GovernanceControlResponse; -import com.datadog.api.client.v2.model.GovernanceControlUpdateRequest; -import com.datadog.api.client.v2.model.GovernanceControlsResponse; -import jakarta.ws.rs.client.Invocation; -import jakarta.ws.rs.core.GenericType; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class GovernanceControlsApi { - private ApiClient apiClient; - - public GovernanceControlsApi() { - this(ApiClient.getDefaultApiClient()); - } - - public GovernanceControlsApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API client. - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API client. - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get a governance control. - * - *

See {@link #getGovernanceControlWithHttpInfo}. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @return GovernanceControlResponse - * @throws ApiException if fails to make API call - */ - public GovernanceControlResponse getGovernanceControl(String detectionType) throws ApiException { - return getGovernanceControlWithHttpInfo(detectionType).getData(); - } - - /** - * Get a governance control. - * - *

See {@link #getGovernanceControlWithHttpInfoAsync}. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @return CompletableFuture<GovernanceControlResponse> - */ - public CompletableFuture getGovernanceControlAsync( - String detectionType) { - return getGovernanceControlWithHttpInfoAsync(detectionType) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * Retrieve a single governance control by its detection type, including the organization's - * current detection, notification, and mitigation configuration and detection counts. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @return ApiResponse<GovernanceControlResponse> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
- */ - public ApiResponse getGovernanceControlWithHttpInfo( - String detectionType) throws ApiException { - // Check if unstable operation is enabled - String operationId = "getGovernanceControl"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } - Object localVarPostBody = null; - - // verify the required parameter 'detectionType' is set - if (detectionType == null) { - throw new ApiException( - 400, "Missing the required parameter 'detectionType' when calling getGovernanceControl"); - } - // create path and map variables - String localVarPath = - "/api/v2/governance/control/{detection_type}" - .replaceAll( - "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.GovernanceControlsApi.getGovernanceControl", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - return apiClient.invokeAPI( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * Get a governance control. - * - *

See {@link #getGovernanceControlWithHttpInfo}. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @return CompletableFuture<ApiResponse<GovernanceControlResponse>> - */ - public CompletableFuture> - getGovernanceControlWithHttpInfoAsync(String detectionType) { - // Check if unstable operation is enabled - String operationId = "getGovernanceControl"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } - Object localVarPostBody = null; - - // verify the required parameter 'detectionType' is set - if (detectionType == null) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, - "Missing the required parameter 'detectionType' when calling getGovernanceControl")); - return result; - } - // create path and map variables - String localVarPath = - "/api/v2/governance/control/{detection_type}" - .replaceAll( - "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.GovernanceControlsApi.getGovernanceControl", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally(ex); - return result; - } - return apiClient.invokeAPIAsync( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * List governance controls. - * - *

See {@link #listGovernanceControlsWithHttpInfo}. - * - * @return GovernanceControlsResponse - * @throws ApiException if fails to make API call - */ - public GovernanceControlsResponse listGovernanceControls() throws ApiException { - return listGovernanceControlsWithHttpInfo().getData(); - } - - /** - * List governance controls. - * - *

See {@link #listGovernanceControlsWithHttpInfoAsync}. - * - * @return CompletableFuture<GovernanceControlsResponse> - */ - public CompletableFuture listGovernanceControlsAsync() { - return listGovernanceControlsWithHttpInfoAsync() - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * Retrieve the list of governance controls configured for the organization. Each control pairs a - * detection definition with the organization's current detection, notification, and mitigation - * configuration, along with counts of active and mitigated detections. - * - * @return ApiResponse<GovernanceControlsResponse> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
- */ - public ApiResponse listGovernanceControlsWithHttpInfo() - throws ApiException { - // Check if unstable operation is enabled - String operationId = "listGovernanceControls"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } - Object localVarPostBody = null; - // create path and map variables - String localVarPath = "/api/v2/governance/control"; - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.GovernanceControlsApi.listGovernanceControls", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - return apiClient.invokeAPI( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * List governance controls. - * - *

See {@link #listGovernanceControlsWithHttpInfo}. - * - * @return CompletableFuture<ApiResponse<GovernanceControlsResponse>> - */ - public CompletableFuture> - listGovernanceControlsWithHttpInfoAsync() { - // Check if unstable operation is enabled - String operationId = "listGovernanceControls"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } - Object localVarPostBody = null; - // create path and map variables - String localVarPath = "/api/v2/governance/control"; - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.GovernanceControlsApi.listGovernanceControls", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally(ex); - return result; - } - return apiClient.invokeAPIAsync( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * Update a governance control. - * - *

See {@link #updateGovernanceControlWithHttpInfo}. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @param body (required) - * @return GovernanceControlResponse - * @throws ApiException if fails to make API call - */ - public GovernanceControlResponse updateGovernanceControl( - String detectionType, GovernanceControlUpdateRequest body) throws ApiException { - return updateGovernanceControlWithHttpInfo(detectionType, body).getData(); - } - - /** - * Update a governance control. - * - *

See {@link #updateGovernanceControlWithHttpInfoAsync}. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @param body (required) - * @return CompletableFuture<GovernanceControlResponse> - */ - public CompletableFuture updateGovernanceControlAsync( - String detectionType, GovernanceControlUpdateRequest body) { - return updateGovernanceControlWithHttpInfoAsync(detectionType, body) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * Update the detection, notification, and mitigation configuration of a governance control. Only - * the attributes present in the request are modified. Changing the mitigation type or its - * parameters may require additional permissions. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @param body (required) - * @return ApiResponse<GovernanceControlResponse> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
- */ - public ApiResponse updateGovernanceControlWithHttpInfo( - String detectionType, GovernanceControlUpdateRequest body) throws ApiException { - // Check if unstable operation is enabled - String operationId = "updateGovernanceControl"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } - Object localVarPostBody = body; - - // verify the required parameter 'detectionType' is set - if (detectionType == null) { - throw new ApiException( - 400, - "Missing the required parameter 'detectionType' when calling updateGovernanceControl"); - } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException( - 400, "Missing the required parameter 'body' when calling updateGovernanceControl"); - } - // create path and map variables - String localVarPath = - "/api/v2/governance/control/{detection_type}" - .replaceAll( - "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.GovernanceControlsApi.updateGovernanceControl", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - return apiClient.invokeAPI( - "PATCH", - builder, - localVarHeaderParams, - new String[] {"application/json"}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * Update a governance control. - * - *

See {@link #updateGovernanceControlWithHttpInfo}. - * - * @param detectionType The detection type that identifies the control, for example - * unused_api_keys. (required) - * @param body (required) - * @return CompletableFuture<ApiResponse<GovernanceControlResponse>> - */ - public CompletableFuture> - updateGovernanceControlWithHttpInfoAsync( - String detectionType, GovernanceControlUpdateRequest body) { - // Check if unstable operation is enabled - String operationId = "updateGovernanceControl"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } - Object localVarPostBody = body; - - // verify the required parameter 'detectionType' is set - if (detectionType == null) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, - "Missing the required parameter 'detectionType' when calling" - + " updateGovernanceControl")); - return result; - } - - // verify the required parameter 'body' is set - if (body == null) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, "Missing the required parameter 'body' when calling updateGovernanceControl")); - return result; - } - // create path and map variables - String localVarPath = - "/api/v2/governance/control/{detection_type}" - .replaceAll( - "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); - - Map localVarHeaderParams = new HashMap(); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.GovernanceControlsApi.updateGovernanceControl", - localVarPath, - new ArrayList(), - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally(ex); - return result; - } - return apiClient.invokeAPIAsync( - "PATCH", - builder, - localVarHeaderParams, - new String[] {"application/json"}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/api/GovernanceInsightsApi.java b/src/main/java/com/datadog/api/client/v2/api/GovernanceInsightsApi.java deleted file mode 100644 index cfc8d9c0898..00000000000 --- a/src/main/java/com/datadog/api/client/v2/api/GovernanceInsightsApi.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.datadog.api.client.v2.api; - -import com.datadog.api.client.ApiClient; -import com.datadog.api.client.ApiException; -import com.datadog.api.client.ApiResponse; -import com.datadog.api.client.Pair; -import com.datadog.api.client.v2.model.GovernanceInsightsResponse; -import jakarta.ws.rs.client.Invocation; -import jakarta.ws.rs.core.GenericType; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class GovernanceInsightsApi { - private ApiClient apiClient; - - public GovernanceInsightsApi() { - this(ApiClient.getDefaultApiClient()); - } - - public GovernanceInsightsApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Get the API client. - * - * @return API client - */ - public ApiClient getApiClient() { - return apiClient; - } - - /** - * Set the API client. - * - * @param apiClient an instance of API client - */ - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** Manage optional parameters to listGovernanceInsights. */ - public static class ListGovernanceInsightsOptionalParameters { - private Boolean withValues; - private String orgUuid; - private List filterProduct; - - /** - * Set withValues. - * - * @param withValues Whether to compute and include the current and previous value of each - * insight. Defaults to false, in which case only insight metadata is returned. - * (optional) - * @return ListGovernanceInsightsOptionalParameters - */ - public ListGovernanceInsightsOptionalParameters withValues(Boolean withValues) { - this.withValues = withValues; - return this; - } - - /** - * Set orgUuid. - * - * @param orgUuid The UUID of the organization to compute insights for. Defaults to the - * organization of the authenticated user. Used to retrieve insights for a child - * organization from a parent organization. (optional) - * @return ListGovernanceInsightsOptionalParameters - */ - public ListGovernanceInsightsOptionalParameters orgUuid(String orgUuid) { - this.orgUuid = orgUuid; - return this; - } - - /** - * Set filterProduct. - * - * @param filterProduct Restrict the results to insights belonging to the given products. May be - * repeated to filter by multiple products. Matching is case-insensitive. (optional) - * @return ListGovernanceInsightsOptionalParameters - */ - public ListGovernanceInsightsOptionalParameters filterProduct(List filterProduct) { - this.filterProduct = filterProduct; - return this; - } - } - - /** - * List governance insights. - * - *

See {@link #listGovernanceInsightsWithHttpInfo}. - * - * @return GovernanceInsightsResponse - * @throws ApiException if fails to make API call - */ - public GovernanceInsightsResponse listGovernanceInsights() throws ApiException { - return listGovernanceInsightsWithHttpInfo(new ListGovernanceInsightsOptionalParameters()) - .getData(); - } - - /** - * List governance insights. - * - *

See {@link #listGovernanceInsightsWithHttpInfoAsync}. - * - * @return CompletableFuture<GovernanceInsightsResponse> - */ - public CompletableFuture listGovernanceInsightsAsync() { - return listGovernanceInsightsWithHttpInfoAsync(new ListGovernanceInsightsOptionalParameters()) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * List governance insights. - * - *

See {@link #listGovernanceInsightsWithHttpInfo}. - * - * @param parameters Optional parameters for the request. - * @return GovernanceInsightsResponse - * @throws ApiException if fails to make API call - */ - public GovernanceInsightsResponse listGovernanceInsights( - ListGovernanceInsightsOptionalParameters parameters) throws ApiException { - return listGovernanceInsightsWithHttpInfo(parameters).getData(); - } - - /** - * List governance insights. - * - *

See {@link #listGovernanceInsightsWithHttpInfoAsync}. - * - * @param parameters Optional parameters for the request. - * @return CompletableFuture<GovernanceInsightsResponse> - */ - public CompletableFuture listGovernanceInsightsAsync( - ListGovernanceInsightsOptionalParameters parameters) { - return listGovernanceInsightsWithHttpInfoAsync(parameters) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * Retrieve the list of governance insights available to the organization. By default, only - * insight metadata is returned; pass withValues=true to also compute and include - * each insight's current and previous values. Insights can be filtered by product. - * - * @param parameters Optional parameters for the request. - * @return ApiResponse<GovernanceInsightsResponse> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
- */ - public ApiResponse listGovernanceInsightsWithHttpInfo( - ListGovernanceInsightsOptionalParameters parameters) throws ApiException { - // Check if unstable operation is enabled - String operationId = "listGovernanceInsights"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } - Object localVarPostBody = null; - Boolean withValues = parameters.withValues; - String orgUuid = parameters.orgUuid; - List filterProduct = parameters.filterProduct; - // create path and map variables - String localVarPath = "/api/v2/governance/insights"; - - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "withValues", withValues)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "orgUuid", orgUuid)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("multi", "filter[product]", filterProduct)); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.GovernanceInsightsApi.listGovernanceInsights", - localVarPath, - localVarQueryParams, - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - return apiClient.invokeAPI( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * List governance insights. - * - *

See {@link #listGovernanceInsightsWithHttpInfo}. - * - * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<GovernanceInsightsResponse>> - */ - public CompletableFuture> - listGovernanceInsightsWithHttpInfoAsync(ListGovernanceInsightsOptionalParameters parameters) { - // Check if unstable operation is enabled - String operationId = "listGovernanceInsights"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } - Object localVarPostBody = null; - Boolean withValues = parameters.withValues; - String orgUuid = parameters.orgUuid; - List filterProduct = parameters.filterProduct; - // create path and map variables - String localVarPath = "/api/v2/governance/insights"; - - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "withValues", withValues)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "orgUuid", orgUuid)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("multi", "filter[product]", filterProduct)); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.GovernanceInsightsApi.listGovernanceInsights", - localVarPath, - localVarQueryParams, - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); - } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally(ex); - return result; - } - return apiClient.invokeAPIAsync( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationEventSetting.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationEventSetting.java new file mode 100644 index 00000000000..6ba360f05be --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationEventSetting.java @@ -0,0 +1,223 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The notification settings for a single event type on a control. */ +@JsonPropertyOrder({ + ControlNotificationEventSetting.JSON_PROPERTY_ENABLED, + ControlNotificationEventSetting.JSON_PROPERTY_EVENT_TYPE, + ControlNotificationEventSetting.JSON_PROPERTY_TARGETS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationEventSetting { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_EVENT_TYPE = "event_type"; + private String eventType; + + public static final String JSON_PROPERTY_TARGETS = "targets"; + private List targets = new ArrayList<>(); + + public ControlNotificationEventSetting() {} + + @JsonCreator + public ControlNotificationEventSetting( + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, + @JsonProperty(required = true, value = JSON_PROPERTY_EVENT_TYPE) String eventType, + @JsonProperty(required = true, value = JSON_PROPERTY_TARGETS) + List targets) { + this.enabled = enabled; + this.eventType = eventType; + this.targets = targets; + for (ControlNotificationTarget item : targets) { + this.unparsed |= item.unparsed; + } + } + + public ControlNotificationEventSetting enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether notifications are enabled for this event type. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public ControlNotificationEventSetting eventType(String eventType) { + this.eventType = eventType; + return this; + } + + /** + * The event type the notification settings apply to, such as new_detection. + * + * @return eventType + */ + @JsonProperty(JSON_PROPERTY_EVENT_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public ControlNotificationEventSetting targets(List targets) { + this.targets = targets; + for (ControlNotificationTarget item : targets) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ControlNotificationEventSetting addTargetsItem(ControlNotificationTarget targetsItem) { + this.targets.add(targetsItem); + this.unparsed |= targetsItem.unparsed; + return this; + } + + /** + * The destinations that receive notifications for an event type. + * + * @return targets + */ + @JsonProperty(JSON_PROPERTY_TARGETS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTargets() { + return targets; + } + + public void setTargets(List targets) { + this.targets = targets; + if (targets != null) { + for (ControlNotificationTarget item : targets) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationEventSetting + */ + @JsonAnySetter + public ControlNotificationEventSetting putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationEventSetting object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationEventSetting controlNotificationEventSetting = + (ControlNotificationEventSetting) o; + return Objects.equals(this.enabled, controlNotificationEventSetting.enabled) + && Objects.equals(this.eventType, controlNotificationEventSetting.eventType) + && Objects.equals(this.targets, controlNotificationEventSetting.targets) + && Objects.equals( + this.additionalProperties, controlNotificationEventSetting.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, eventType, targets, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationEventSetting {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" targets: ").append(toIndentedString(targets)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsAttributes.java new file mode 100644 index 00000000000..4924f68e412 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsAttributes.java @@ -0,0 +1,167 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a governance control's notification settings. */ +@JsonPropertyOrder({ControlNotificationSettingsAttributes.JSON_PROPERTY_EVENT_SETTINGS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationSettingsAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EVENT_SETTINGS = "event_settings"; + private List eventSettings = new ArrayList<>(); + + public ControlNotificationSettingsAttributes() {} + + @JsonCreator + public ControlNotificationSettingsAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_EVENT_SETTINGS) + List eventSettings) { + this.eventSettings = eventSettings; + for (ControlNotificationEventSetting item : eventSettings) { + this.unparsed |= item.unparsed; + } + } + + public ControlNotificationSettingsAttributes eventSettings( + List eventSettings) { + this.eventSettings = eventSettings; + for (ControlNotificationEventSetting item : eventSettings) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ControlNotificationSettingsAttributes addEventSettingsItem( + ControlNotificationEventSetting eventSettingsItem) { + this.eventSettings.add(eventSettingsItem); + this.unparsed |= eventSettingsItem.unparsed; + return this; + } + + /** + * The notification settings for each supported event type on the control. + * + * @return eventSettings + */ + @JsonProperty(JSON_PROPERTY_EVENT_SETTINGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEventSettings() { + return eventSettings; + } + + public void setEventSettings(List eventSettings) { + this.eventSettings = eventSettings; + if (eventSettings != null) { + for (ControlNotificationEventSetting item : eventSettings) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationSettingsAttributes + */ + @JsonAnySetter + public ControlNotificationSettingsAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationSettingsAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationSettingsAttributes controlNotificationSettingsAttributes = + (ControlNotificationSettingsAttributes) o; + return Objects.equals(this.eventSettings, controlNotificationSettingsAttributes.eventSettings) + && Objects.equals( + this.additionalProperties, controlNotificationSettingsAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(eventSettings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationSettingsAttributes {\n"); + sb.append(" eventSettings: ").append(toIndentedString(eventSettings)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsData.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsData.java new file mode 100644 index 00000000000..b1db59cb261 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsData.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A control notification settings resource. */ +@JsonPropertyOrder({ + ControlNotificationSettingsData.JSON_PROPERTY_ATTRIBUTES, + ControlNotificationSettingsData.JSON_PROPERTY_ID, + ControlNotificationSettingsData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationSettingsData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ControlNotificationSettingsAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ControlNotificationSettingsResourceType type; + + public ControlNotificationSettingsData() {} + + @JsonCreator + public ControlNotificationSettingsData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ControlNotificationSettingsAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + ControlNotificationSettingsResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ControlNotificationSettingsData attributes( + ControlNotificationSettingsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a governance control's notification settings. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ControlNotificationSettingsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ControlNotificationSettingsAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public ControlNotificationSettingsData id(String id) { + this.id = id; + return this; + } + + /** + * The detection type the notification settings apply to. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ControlNotificationSettingsData type(ControlNotificationSettingsResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Control notification settings resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ControlNotificationSettingsResourceType getType() { + return type; + } + + public void setType(ControlNotificationSettingsResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationSettingsData + */ + @JsonAnySetter + public ControlNotificationSettingsData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationSettingsData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationSettingsData controlNotificationSettingsData = + (ControlNotificationSettingsData) o; + return Objects.equals(this.attributes, controlNotificationSettingsData.attributes) + && Objects.equals(this.id, controlNotificationSettingsData.id) + && Objects.equals(this.type, controlNotificationSettingsData.type) + && Objects.equals( + this.additionalProperties, controlNotificationSettingsData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationSettingsData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResourceType.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResourceType.java new file mode 100644 index 00000000000..103bc73d159 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResourceType.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Control notification settings resource type. */ +@JsonSerialize( + using = + ControlNotificationSettingsResourceType.ControlNotificationSettingsResourceTypeSerializer + .class) +public class ControlNotificationSettingsResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("control_notification_settings")); + + public static final ControlNotificationSettingsResourceType CONTROL_NOTIFICATION_SETTINGS = + new ControlNotificationSettingsResourceType("control_notification_settings"); + + ControlNotificationSettingsResourceType(String value) { + super(value, allowedValues); + } + + public static class ControlNotificationSettingsResourceTypeSerializer + extends StdSerializer { + public ControlNotificationSettingsResourceTypeSerializer( + Class t) { + super(t); + } + + public ControlNotificationSettingsResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ControlNotificationSettingsResourceType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ControlNotificationSettingsResourceType fromValue(String value) { + return new ControlNotificationSettingsResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResponse.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResponse.java new file mode 100644 index 00000000000..b5bd175f16b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResponse.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The notification settings for a governance control. */ +@JsonPropertyOrder({ControlNotificationSettingsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationSettingsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ControlNotificationSettingsData data; + + public ControlNotificationSettingsResponse() {} + + @JsonCreator + public ControlNotificationSettingsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + ControlNotificationSettingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ControlNotificationSettingsResponse data(ControlNotificationSettingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A control notification settings resource. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ControlNotificationSettingsData getData() { + return data; + } + + public void setData(ControlNotificationSettingsData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationSettingsResponse + */ + @JsonAnySetter + public ControlNotificationSettingsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationSettingsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationSettingsResponse controlNotificationSettingsResponse = + (ControlNotificationSettingsResponse) o; + return Objects.equals(this.data, controlNotificationSettingsResponse.data) + && Objects.equals( + this.additionalProperties, controlNotificationSettingsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationSettingsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateAttributes.java new file mode 100644 index 00000000000..90d92e3e8d1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateAttributes.java @@ -0,0 +1,163 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a governance control's notification settings that can be updated. */ +@JsonPropertyOrder({ControlNotificationSettingsUpdateAttributes.JSON_PROPERTY_EVENT_SETTINGS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationSettingsUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EVENT_SETTINGS = "event_settings"; + private List eventSettings = null; + + public ControlNotificationSettingsUpdateAttributes eventSettings( + List eventSettings) { + this.eventSettings = eventSettings; + if (eventSettings != null) { + for (ControlNotificationEventSetting item : eventSettings) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public ControlNotificationSettingsUpdateAttributes addEventSettingsItem( + ControlNotificationEventSetting eventSettingsItem) { + if (this.eventSettings == null) { + this.eventSettings = new ArrayList<>(); + } + this.eventSettings.add(eventSettingsItem); + this.unparsed |= eventSettingsItem.unparsed; + return this; + } + + /** + * The notification settings for each supported event type on the control. + * + * @return eventSettings + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVENT_SETTINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getEventSettings() { + return eventSettings; + } + + public void setEventSettings(List eventSettings) { + this.eventSettings = eventSettings; + if (eventSettings != null) { + for (ControlNotificationEventSetting item : eventSettings) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationSettingsUpdateAttributes + */ + @JsonAnySetter + public ControlNotificationSettingsUpdateAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationSettingsUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationSettingsUpdateAttributes controlNotificationSettingsUpdateAttributes = + (ControlNotificationSettingsUpdateAttributes) o; + return Objects.equals( + this.eventSettings, controlNotificationSettingsUpdateAttributes.eventSettings) + && Objects.equals( + this.additionalProperties, + controlNotificationSettingsUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(eventSettings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationSettingsUpdateAttributes {\n"); + sb.append(" eventSettings: ").append(toIndentedString(eventSettings)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateData.java new file mode 100644 index 00000000000..08cf775aa6a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateData.java @@ -0,0 +1,185 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data of a control notification settings update request. */ +@JsonPropertyOrder({ + ControlNotificationSettingsUpdateData.JSON_PROPERTY_ATTRIBUTES, + ControlNotificationSettingsUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationSettingsUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ControlNotificationSettingsUpdateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ControlNotificationSettingsResourceType type; + + public ControlNotificationSettingsUpdateData() {} + + @JsonCreator + public ControlNotificationSettingsUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + ControlNotificationSettingsResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ControlNotificationSettingsUpdateData attributes( + ControlNotificationSettingsUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a governance control's notification settings that can be updated. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ControlNotificationSettingsUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ControlNotificationSettingsUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public ControlNotificationSettingsUpdateData type(ControlNotificationSettingsResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Control notification settings resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ControlNotificationSettingsResourceType getType() { + return type; + } + + public void setType(ControlNotificationSettingsResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationSettingsUpdateData + */ + @JsonAnySetter + public ControlNotificationSettingsUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationSettingsUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationSettingsUpdateData controlNotificationSettingsUpdateData = + (ControlNotificationSettingsUpdateData) o; + return Objects.equals(this.attributes, controlNotificationSettingsUpdateData.attributes) + && Objects.equals(this.type, controlNotificationSettingsUpdateData.type) + && Objects.equals( + this.additionalProperties, controlNotificationSettingsUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationSettingsUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateRequest.java new file mode 100644 index 00000000000..43206dd4e0a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateRequest.java @@ -0,0 +1,152 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A request to update the notification settings for a governance control. */ +@JsonPropertyOrder({ControlNotificationSettingsUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationSettingsUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ControlNotificationSettingsUpdateData data; + + public ControlNotificationSettingsUpdateRequest() {} + + @JsonCreator + public ControlNotificationSettingsUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + ControlNotificationSettingsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ControlNotificationSettingsUpdateRequest data(ControlNotificationSettingsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data of a control notification settings update request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ControlNotificationSettingsUpdateData getData() { + return data; + } + + public void setData(ControlNotificationSettingsUpdateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationSettingsUpdateRequest + */ + @JsonAnySetter + public ControlNotificationSettingsUpdateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationSettingsUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationSettingsUpdateRequest controlNotificationSettingsUpdateRequest = + (ControlNotificationSettingsUpdateRequest) o; + return Objects.equals(this.data, controlNotificationSettingsUpdateRequest.data) + && Objects.equals( + this.additionalProperties, + controlNotificationSettingsUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationSettingsUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationTarget.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationTarget.java new file mode 100644 index 00000000000..04db90c79dc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationTarget.java @@ -0,0 +1,180 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A destination that receives notifications for an event type. */ +@JsonPropertyOrder({ + ControlNotificationTarget.JSON_PROPERTY_HANDLE, + ControlNotificationTarget.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ControlNotificationTarget { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HANDLE = "handle"; + private String handle; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ControlNotificationTargetType type; + + public ControlNotificationTarget() {} + + @JsonCreator + public ControlNotificationTarget( + @JsonProperty(required = true, value = JSON_PROPERTY_HANDLE) String handle, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + ControlNotificationTargetType type) { + this.handle = handle; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ControlNotificationTarget handle(String handle) { + this.handle = handle; + return this; + } + + /** + * The destination handle, such as an email address, Slack channel, or user handle. + * + * @return handle + */ + @JsonProperty(JSON_PROPERTY_HANDLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public ControlNotificationTarget type(ControlNotificationTargetType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of notification destination. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ControlNotificationTargetType getType() { + return type; + } + + public void setType(ControlNotificationTargetType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ControlNotificationTarget + */ + @JsonAnySetter + public ControlNotificationTarget putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ControlNotificationTarget object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ControlNotificationTarget controlNotificationTarget = (ControlNotificationTarget) o; + return Objects.equals(this.handle, controlNotificationTarget.handle) + && Objects.equals(this.type, controlNotificationTarget.type) + && Objects.equals( + this.additionalProperties, controlNotificationTarget.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(handle, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ControlNotificationTarget {\n"); + sb.append(" handle: ").append(toIndentedString(handle)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ControlNotificationTargetType.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationTargetType.java new file mode 100644 index 00000000000..6950180ca68 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationTargetType.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of notification destination. */ +@JsonSerialize(using = ControlNotificationTargetType.ControlNotificationTargetTypeSerializer.class) +public class ControlNotificationTargetType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("email", "slack", "at_mention", "case")); + + public static final ControlNotificationTargetType EMAIL = + new ControlNotificationTargetType("email"); + public static final ControlNotificationTargetType SLACK = + new ControlNotificationTargetType("slack"); + public static final ControlNotificationTargetType AT_MENTION = + new ControlNotificationTargetType("at_mention"); + public static final ControlNotificationTargetType CASE = + new ControlNotificationTargetType("case"); + + ControlNotificationTargetType(String value) { + super(value, allowedValues); + } + + public static class ControlNotificationTargetTypeSerializer + extends StdSerializer { + public ControlNotificationTargetTypeSerializer(Class t) { + super(t); + } + + public ControlNotificationTargetTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ControlNotificationTargetType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ControlNotificationTargetType fromValue(String value) { + return new ControlNotificationTargetType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceBestPracticeDefinition.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceBestPracticeDefinition.java deleted file mode 100644 index be44c65d496..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceBestPracticeDefinition.java +++ /dev/null @@ -1,523 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.openapitools.jackson.nullable.JsonNullable; - -/** - * The best practice associated with an insight. Populated with the first active best practice - * matched to the insight; null when no best practice is attached. - */ -@JsonPropertyOrder({ - GovernanceBestPracticeDefinition.JSON_PROPERTY_CATEGORY, - GovernanceBestPracticeDefinition.JSON_PROPERTY_DEEP_LINK, - GovernanceBestPracticeDefinition.JSON_PROPERTY_DESCRIPTION, - GovernanceBestPracticeDefinition.JSON_PROPERTY_DETECTION_TYPE, - GovernanceBestPracticeDefinition.JSON_PROPERTY_ID, - GovernanceBestPracticeDefinition.JSON_PROPERTY_IMPACT, - GovernanceBestPracticeDefinition.JSON_PROPERTY_IMPACT_HINT, - GovernanceBestPracticeDefinition.JSON_PROPERTY_PERMISSIONS, - GovernanceBestPracticeDefinition.JSON_PROPERTY_STATUS, - GovernanceBestPracticeDefinition.JSON_PROPERTY_SUMMARY, - GovernanceBestPracticeDefinition.JSON_PROPERTY_TITLE, - GovernanceBestPracticeDefinition.JSON_PROPERTY_TRIGGER_CONDITION, - GovernanceBestPracticeDefinition.JSON_PROPERTY_TRIGGER_TYPE -}) -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class GovernanceBestPracticeDefinition { - @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_CATEGORY = "category"; - private String category; - - public static final String JSON_PROPERTY_DEEP_LINK = "deep_link"; - private String deepLink; - - public static final String JSON_PROPERTY_DESCRIPTION = "description"; - private String description; - - public static final String JSON_PROPERTY_DETECTION_TYPE = "detection_type"; - private JsonNullable detectionType = JsonNullable.undefined(); - - public static final String JSON_PROPERTY_ID = "id"; - private String id; - - public static final String JSON_PROPERTY_IMPACT = "impact"; - private String impact; - - public static final String JSON_PROPERTY_IMPACT_HINT = "impact_hint"; - private Long impactHint; - - public static final String JSON_PROPERTY_PERMISSIONS = "permissions"; - private List permissions = new ArrayList<>(); - - public static final String JSON_PROPERTY_STATUS = "status"; - private String status; - - public static final String JSON_PROPERTY_SUMMARY = "summary"; - private String summary; - - public static final String JSON_PROPERTY_TITLE = "title"; - private String title; - - public static final String JSON_PROPERTY_TRIGGER_CONDITION = "trigger_condition"; - private String triggerCondition; - - public static final String JSON_PROPERTY_TRIGGER_TYPE = "trigger_type"; - private String triggerType; - - public GovernanceBestPracticeDefinition() {} - - @JsonCreator - public GovernanceBestPracticeDefinition( - @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) String category, - @JsonProperty(required = true, value = JSON_PROPERTY_DEEP_LINK) String deepLink, - @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, - @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, - @JsonProperty(required = true, value = JSON_PROPERTY_IMPACT) String impact, - @JsonProperty(required = true, value = JSON_PROPERTY_IMPACT_HINT) Long impactHint, - @JsonProperty(required = true, value = JSON_PROPERTY_PERMISSIONS) List permissions, - @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) String status, - @JsonProperty(required = true, value = JSON_PROPERTY_SUMMARY) String summary, - @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title, - @JsonProperty(required = true, value = JSON_PROPERTY_TRIGGER_CONDITION) - String triggerCondition, - @JsonProperty(required = true, value = JSON_PROPERTY_TRIGGER_TYPE) String triggerType) { - this.category = category; - this.deepLink = deepLink; - this.description = description; - this.id = id; - this.impact = impact; - this.impactHint = impactHint; - this.permissions = permissions; - this.status = status; - this.summary = summary; - this.title = title; - this.triggerCondition = triggerCondition; - this.triggerType = triggerType; - } - - public GovernanceBestPracticeDefinition category(String category) { - this.category = category; - return this; - } - - /** - * The value driver the best practice is grouped under, such as access_governance, - * security, compliance, or operational_hygiene. - * - * @return category - */ - @JsonProperty(JSON_PROPERTY_CATEGORY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public GovernanceBestPracticeDefinition deepLink(String deepLink) { - this.deepLink = deepLink; - return this; - } - - /** - * A relative link to the configuration page where the best practice can be acted upon. - * - * @return deepLink - */ - @JsonProperty(JSON_PROPERTY_DEEP_LINK) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getDeepLink() { - return deepLink; - } - - public void setDeepLink(String deepLink) { - this.deepLink = deepLink; - } - - public GovernanceBestPracticeDefinition description(String description) { - this.description = description; - return this; - } - - /** - * The full rationale and guidance for the best practice. - * - * @return description - */ - @JsonProperty(JSON_PROPERTY_DESCRIPTION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public GovernanceBestPracticeDefinition detectionType(String detectionType) { - this.detectionType = JsonNullable.of(detectionType); - return this; - } - - /** - * An optional association to a control's detection type. null when not associated - * with a control. - * - * @return detectionType - */ - @jakarta.annotation.Nullable - @JsonIgnore - public String getDetectionType() { - return detectionType.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_DETECTION_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getDetectionType_JsonNullable() { - return detectionType; - } - - @JsonProperty(JSON_PROPERTY_DETECTION_TYPE) - public void setDetectionType_JsonNullable(JsonNullable detectionType) { - this.detectionType = detectionType; - } - - public void setDetectionType(String detectionType) { - this.detectionType = JsonNullable.of(detectionType); - } - - public GovernanceBestPracticeDefinition id(String id) { - this.id = id; - return this; - } - - /** - * The unique identifier of the best practice. - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public GovernanceBestPracticeDefinition impact(String impact) { - this.impact = impact; - return this; - } - - /** - * The expected impact of following the best practice. - * - * @return impact - */ - @JsonProperty(JSON_PROPERTY_IMPACT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getImpact() { - return impact; - } - - public void setImpact(String impact) { - this.impact = impact; - } - - public GovernanceBestPracticeDefinition impactHint(Long impactHint) { - this.impactHint = impactHint; - return this; - } - - /** - * A priority hint for ordering best practices by expected impact. Lower values indicate higher - * priority. - * - * @return impactHint - */ - @JsonProperty(JSON_PROPERTY_IMPACT_HINT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Long getImpactHint() { - return impactHint; - } - - public void setImpactHint(Long impactHint) { - this.impactHint = impactHint; - } - - public GovernanceBestPracticeDefinition permissions(List permissions) { - this.permissions = permissions; - return this; - } - - public GovernanceBestPracticeDefinition addPermissionsItem(String permissionsItem) { - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions required for the user to act on the best practice. - * - * @return permissions - */ - @JsonProperty(JSON_PROPERTY_PERMISSIONS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getPermissions() { - return permissions; - } - - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - public GovernanceBestPracticeDefinition status(String status) { - this.status = status; - return this; - } - - /** - * Whether the best practice is currently active or deprecated. - * - * @return status - */ - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public GovernanceBestPracticeDefinition summary(String summary) { - this.summary = summary; - return this; - } - - /** - * A one-line explanation of why this best practice matters. - * - * @return summary - */ - @JsonProperty(JSON_PROPERTY_SUMMARY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getSummary() { - return summary; - } - - public void setSummary(String summary) { - this.summary = summary; - } - - public GovernanceBestPracticeDefinition title(String title) { - this.title = title; - return this; - } - - /** - * A short, human-readable name for the best practice. - * - * @return title - */ - @JsonProperty(JSON_PROPERTY_TITLE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public GovernanceBestPracticeDefinition triggerCondition(String triggerCondition) { - this.triggerCondition = triggerCondition; - return this; - } - - /** - * The condition that surfaces the best practice. For an insight trigger, the insight - * slug; for a static trigger, a descriptive condition key. - * - * @return triggerCondition - */ - @JsonProperty(JSON_PROPERTY_TRIGGER_CONDITION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTriggerCondition() { - return triggerCondition; - } - - public void setTriggerCondition(String triggerCondition) { - this.triggerCondition = triggerCondition; - } - - public GovernanceBestPracticeDefinition triggerType(String triggerType) { - this.triggerType = triggerType; - return this; - } - - /** - * How the best practice is surfaced. insight ties it to an insight; static - * surfaces it unless its condition is met. - * - * @return triggerType - */ - @JsonProperty(JSON_PROPERTY_TRIGGER_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTriggerType() { - return triggerType; - } - - public void setTriggerType(String triggerType) { - this.triggerType = triggerType; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key The arbitrary key to set - * @param value The associated value - * @return GovernanceBestPracticeDefinition - */ - @JsonAnySetter - public GovernanceBestPracticeDefinition putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return The additional properties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key The arbitrary key to get - * @return The specific additional property for the given key - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - /** Return true if this GovernanceBestPracticeDefinition object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GovernanceBestPracticeDefinition governanceBestPracticeDefinition = - (GovernanceBestPracticeDefinition) o; - return Objects.equals(this.category, governanceBestPracticeDefinition.category) - && Objects.equals(this.deepLink, governanceBestPracticeDefinition.deepLink) - && Objects.equals(this.description, governanceBestPracticeDefinition.description) - && Objects.equals(this.detectionType, governanceBestPracticeDefinition.detectionType) - && Objects.equals(this.id, governanceBestPracticeDefinition.id) - && Objects.equals(this.impact, governanceBestPracticeDefinition.impact) - && Objects.equals(this.impactHint, governanceBestPracticeDefinition.impactHint) - && Objects.equals(this.permissions, governanceBestPracticeDefinition.permissions) - && Objects.equals(this.status, governanceBestPracticeDefinition.status) - && Objects.equals(this.summary, governanceBestPracticeDefinition.summary) - && Objects.equals(this.title, governanceBestPracticeDefinition.title) - && Objects.equals(this.triggerCondition, governanceBestPracticeDefinition.triggerCondition) - && Objects.equals(this.triggerType, governanceBestPracticeDefinition.triggerType) - && Objects.equals( - this.additionalProperties, governanceBestPracticeDefinition.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash( - category, - deepLink, - description, - detectionType, - id, - impact, - impactHint, - permissions, - status, - summary, - title, - triggerCondition, - triggerType, - additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GovernanceBestPracticeDefinition {\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" deepLink: ").append(toIndentedString(deepLink)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" detectionType: ").append(toIndentedString(detectionType)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" impact: ").append(toIndentedString(impact)).append("\n"); - sb.append(" impactHint: ").append(toIndentedString(impactHint)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" triggerCondition: ").append(toIndentedString(triggerCondition)).append("\n"); - sb.append(" triggerType: ").append(toIndentedString(triggerType)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append('}'); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigAttributes.java new file mode 100644 index 00000000000..7e910b4cb85 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigAttributes.java @@ -0,0 +1,251 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a Governance Console configuration. */ +@JsonPropertyOrder({ + GovernanceConfigAttributes.JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED, + GovernanceConfigAttributes.JSON_PROPERTY_ENABLED, + GovernanceConfigAttributes.JSON_PROPERTY_USAGE_ATTRIBUTION_CONFIGURED, + GovernanceConfigAttributes.JSON_PROPERTY_XORG_INSIGHTS_ENABLED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceConfigAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED = + "assignment_notifications_enabled"; + private Boolean assignmentNotificationsEnabled; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_USAGE_ATTRIBUTION_CONFIGURED = + "usage_attribution_configured"; + private Boolean usageAttributionConfigured; + + public static final String JSON_PROPERTY_XORG_INSIGHTS_ENABLED = "xorg_insights_enabled"; + private Boolean xorgInsightsEnabled; + + public GovernanceConfigAttributes() {} + + @JsonCreator + public GovernanceConfigAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED) + Boolean assignmentNotificationsEnabled, + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, + @JsonProperty(required = true, value = JSON_PROPERTY_USAGE_ATTRIBUTION_CONFIGURED) + Boolean usageAttributionConfigured, + @JsonProperty(required = true, value = JSON_PROPERTY_XORG_INSIGHTS_ENABLED) + Boolean xorgInsightsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + this.enabled = enabled; + this.usageAttributionConfigured = usageAttributionConfigured; + this.xorgInsightsEnabled = xorgInsightsEnabled; + } + + public GovernanceConfigAttributes assignmentNotificationsEnabled( + Boolean assignmentNotificationsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + return this; + } + + /** + * Whether notifications are sent to users when detections are assigned to them. + * + * @return assignmentNotificationsEnabled + */ + @JsonProperty(JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAssignmentNotificationsEnabled() { + return assignmentNotificationsEnabled; + } + + public void setAssignmentNotificationsEnabled(Boolean assignmentNotificationsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + } + + public GovernanceConfigAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the Governance Console is enabled for the organization. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public GovernanceConfigAttributes usageAttributionConfigured(Boolean usageAttributionConfigured) { + this.usageAttributionConfigured = usageAttributionConfigured; + return this; + } + + /** + * Whether usage attribution is configured for the organization. + * + * @return usageAttributionConfigured + */ + @JsonProperty(JSON_PROPERTY_USAGE_ATTRIBUTION_CONFIGURED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getUsageAttributionConfigured() { + return usageAttributionConfigured; + } + + public void setUsageAttributionConfigured(Boolean usageAttributionConfigured) { + this.usageAttributionConfigured = usageAttributionConfigured; + } + + public GovernanceConfigAttributes xorgInsightsEnabled(Boolean xorgInsightsEnabled) { + this.xorgInsightsEnabled = xorgInsightsEnabled; + return this; + } + + /** + * Whether the organization has opted in to sharing governance data with a managing org for + * cross-org insights. + * + * @return xorgInsightsEnabled + */ + @JsonProperty(JSON_PROPERTY_XORG_INSIGHTS_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getXorgInsightsEnabled() { + return xorgInsightsEnabled; + } + + public void setXorgInsightsEnabled(Boolean xorgInsightsEnabled) { + this.xorgInsightsEnabled = xorgInsightsEnabled; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceConfigAttributes + */ + @JsonAnySetter + public GovernanceConfigAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceConfigAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceConfigAttributes governanceConfigAttributes = (GovernanceConfigAttributes) o; + return Objects.equals( + this.assignmentNotificationsEnabled, + governanceConfigAttributes.assignmentNotificationsEnabled) + && Objects.equals(this.enabled, governanceConfigAttributes.enabled) + && Objects.equals( + this.usageAttributionConfigured, governanceConfigAttributes.usageAttributionConfigured) + && Objects.equals(this.xorgInsightsEnabled, governanceConfigAttributes.xorgInsightsEnabled) + && Objects.equals( + this.additionalProperties, governanceConfigAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + assignmentNotificationsEnabled, + enabled, + usageAttributionConfigured, + xorgInsightsEnabled, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceConfigAttributes {\n"); + sb.append(" assignmentNotificationsEnabled: ") + .append(toIndentedString(assignmentNotificationsEnabled)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" usageAttributionConfigured: ") + .append(toIndentedString(usageAttributionConfigured)) + .append("\n"); + sb.append(" xorgInsightsEnabled: ") + .append(toIndentedString(xorgInsightsEnabled)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigData.java new file mode 100644 index 00000000000..1b3313e4e31 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigData.java @@ -0,0 +1,215 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A Governance Console configuration resource. */ +@JsonPropertyOrder({ + GovernanceConfigData.JSON_PROPERTY_ATTRIBUTES, + GovernanceConfigData.JSON_PROPERTY_ID, + GovernanceConfigData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceConfigData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceConfigAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceConsoleConfigResourceType type; + + public GovernanceConfigData() {} + + @JsonCreator + public GovernanceConfigData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GovernanceConfigAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GovernanceConsoleConfigResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceConfigData attributes(GovernanceConfigAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a Governance Console configuration. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceConfigAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceConfigAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceConfigData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the organization the Governance Console configuration applies to. May + * be the nil UUID (00000000-0000-0000-0000-000000000000) when the configuration is + * not tied to a specific organization record. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GovernanceConfigData type(GovernanceConsoleConfigResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Governance console config resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceConsoleConfigResourceType getType() { + return type; + } + + public void setType(GovernanceConsoleConfigResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceConfigData + */ + @JsonAnySetter + public GovernanceConfigData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceConfigData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceConfigData governanceConfigData = (GovernanceConfigData) o; + return Objects.equals(this.attributes, governanceConfigData.attributes) + && Objects.equals(this.id, governanceConfigData.id) + && Objects.equals(this.type, governanceConfigData.type) + && Objects.equals(this.additionalProperties, governanceConfigData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceConfigData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigResponse.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigResponse.java new file mode 100644 index 00000000000..e301538fab0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigResponse.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The Governance Console configuration for an organization. */ +@JsonPropertyOrder({GovernanceConfigResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceConfigResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GovernanceConfigData data; + + public GovernanceConfigResponse() {} + + @JsonCreator + public GovernanceConfigResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) GovernanceConfigData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GovernanceConfigResponse data(GovernanceConfigData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A Governance Console configuration resource. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceConfigData getData() { + return data; + } + + public void setData(GovernanceConfigData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceConfigResponse + */ + @JsonAnySetter + public GovernanceConfigResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceConfigResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceConfigResponse governanceConfigResponse = (GovernanceConfigResponse) o; + return Objects.equals(this.data, governanceConfigResponse.data) + && Objects.equals(this.additionalProperties, governanceConfigResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceConfigResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceConsoleConfigResourceType.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceConsoleConfigResourceType.java new file mode 100644 index 00000000000..88eb85a09a7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceConsoleConfigResourceType.java @@ -0,0 +1,59 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Governance console config resource type. */ +@JsonSerialize( + using = GovernanceConsoleConfigResourceType.GovernanceConsoleConfigResourceTypeSerializer.class) +public class GovernanceConsoleConfigResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("governance_console_config")); + + public static final GovernanceConsoleConfigResourceType GOVERNANCE_CONSOLE_CONFIG = + new GovernanceConsoleConfigResourceType("governance_console_config"); + + GovernanceConsoleConfigResourceType(String value) { + super(value, allowedValues); + } + + public static class GovernanceConsoleConfigResourceTypeSerializer + extends StdSerializer { + public GovernanceConsoleConfigResourceTypeSerializer( + Class t) { + super(t); + } + + public GovernanceConsoleConfigResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceConsoleConfigResourceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceConsoleConfigResourceType fromValue(String value) { + return new GovernanceConsoleConfigResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlAttributes.java index a3d78938a86..4bdefa92118 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlAttributes.java @@ -29,8 +29,6 @@ GovernanceControlAttributes.JSON_PROPERTY_DESCRIPTION, GovernanceControlAttributes.JSON_PROPERTY_DETECTION_FREQUENCY, GovernanceControlAttributes.JSON_PROPERTY_DETECTION_PARAMETERS, - GovernanceControlAttributes.JSON_PROPERTY_DETECTION_TYPE, - GovernanceControlAttributes.JSON_PROPERTY_FEATURE_FLAGS, GovernanceControlAttributes.JSON_PROPERTY_INSIGHTS, GovernanceControlAttributes.JSON_PROPERTY_LAST_DETECTION_AT, GovernanceControlAttributes.JSON_PROPERTY_MITIGATED_DETECTIONS_COUNT, @@ -38,20 +36,12 @@ GovernanceControlAttributes.JSON_PROPERTY_MITIGATION_TYPE, GovernanceControlAttributes.JSON_PROPERTY_MITIGATIONS, GovernanceControlAttributes.JSON_PROPERTY_NAME, - GovernanceControlAttributes.JSON_PROPERTY_NEXT_STEPS, - GovernanceControlAttributes.JSON_PROPERTY_NOTIFICATION_FREQUENCY, - GovernanceControlAttributes.JSON_PROPERTY_NOTIFICATION_PARAMETERS, - GovernanceControlAttributes.JSON_PROPERTY_NOTIFICATION_TYPE, GovernanceControlAttributes.JSON_PROPERTY_PRIORITY, GovernanceControlAttributes.JSON_PROPERTY_PRODUCT, - GovernanceControlAttributes.JSON_PROPERTY_RELEASE_STATUS, GovernanceControlAttributes.JSON_PROPERTY_RESOURCE_TYPE, GovernanceControlAttributes.JSON_PROPERTY_RESOURCE_TYPE_DISPLAY_NAME, GovernanceControlAttributes.JSON_PROPERTY_SUPPORTED_DETECTION_PARAMETERS, - GovernanceControlAttributes.JSON_PROPERTY_SUPPORTED_NOTIFICATION_PARAMETERS, - GovernanceControlAttributes.JSON_PROPERTY_TASK, - GovernanceControlAttributes.JSON_PROPERTY_TYPE, - GovernanceControlAttributes.JSON_PROPERTY_USAGE_CONCERN + GovernanceControlAttributes.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -78,12 +68,6 @@ public class GovernanceControlAttributes { public static final String JSON_PROPERTY_DETECTION_PARAMETERS = "detection_parameters"; private Map detectionParameters = new HashMap(); - public static final String JSON_PROPERTY_DETECTION_TYPE = "detection_type"; - private String detectionType; - - public static final String JSON_PROPERTY_FEATURE_FLAGS = "feature_flags"; - private List featureFlags = new ArrayList<>(); - public static final String JSON_PROPERTY_INSIGHTS = "insights"; private List insights = new ArrayList<>(); @@ -106,27 +90,12 @@ public class GovernanceControlAttributes { public static final String JSON_PROPERTY_NAME = "name"; private String name; - public static final String JSON_PROPERTY_NEXT_STEPS = "next_steps"; - private String nextSteps; - - public static final String JSON_PROPERTY_NOTIFICATION_FREQUENCY = "notification_frequency"; - private String notificationFrequency; - - public static final String JSON_PROPERTY_NOTIFICATION_PARAMETERS = "notification_parameters"; - private Map notificationParameters = new HashMap(); - - public static final String JSON_PROPERTY_NOTIFICATION_TYPE = "notification_type"; - private String notificationType; - public static final String JSON_PROPERTY_PRIORITY = "priority"; private String priority; public static final String JSON_PROPERTY_PRODUCT = "product"; private String product; - public static final String JSON_PROPERTY_RELEASE_STATUS = "release_status"; - private String releaseStatus; - public static final String JSON_PROPERTY_RESOURCE_TYPE = "resource_type"; private String resourceType; @@ -139,20 +108,9 @@ public class GovernanceControlAttributes { private List supportedDetectionParameters = new ArrayList<>(); - public static final String JSON_PROPERTY_SUPPORTED_NOTIFICATION_PARAMETERS = - "supported_notification_parameters"; - private List supportedNotificationParameters = - new ArrayList<>(); - - public static final String JSON_PROPERTY_TASK = "task"; - private String task; - public static final String JSON_PROPERTY_TYPE = "type"; private String type; - public static final String JSON_PROPERTY_USAGE_CONCERN = "usage_concern"; - private String usageConcern; - public GovernanceControlAttributes() {} @JsonCreator @@ -167,8 +125,6 @@ public GovernanceControlAttributes( String detectionFrequency, @JsonProperty(required = true, value = JSON_PROPERTY_DETECTION_PARAMETERS) Map detectionParameters, - @JsonProperty(required = true, value = JSON_PROPERTY_DETECTION_TYPE) String detectionType, - @JsonProperty(required = true, value = JSON_PROPERTY_FEATURE_FLAGS) List featureFlags, @JsonProperty(required = true, value = JSON_PROPERTY_INSIGHTS) List insights, @JsonProperty(required = true, value = JSON_PROPERTY_LAST_DETECTION_AT) OffsetDateTime lastDetectionAt, @@ -180,26 +136,14 @@ public GovernanceControlAttributes( @JsonProperty(required = true, value = JSON_PROPERTY_MITIGATIONS) List mitigations, @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, - @JsonProperty(required = true, value = JSON_PROPERTY_NEXT_STEPS) String nextSteps, - @JsonProperty(required = true, value = JSON_PROPERTY_NOTIFICATION_FREQUENCY) - String notificationFrequency, - @JsonProperty(required = true, value = JSON_PROPERTY_NOTIFICATION_PARAMETERS) - Map notificationParameters, - @JsonProperty(required = true, value = JSON_PROPERTY_NOTIFICATION_TYPE) - String notificationType, @JsonProperty(required = true, value = JSON_PROPERTY_PRIORITY) String priority, @JsonProperty(required = true, value = JSON_PROPERTY_PRODUCT) String product, - @JsonProperty(required = true, value = JSON_PROPERTY_RELEASE_STATUS) String releaseStatus, @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_TYPE) String resourceType, @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_TYPE_DISPLAY_NAME) String resourceTypeDisplayName, @JsonProperty(required = true, value = JSON_PROPERTY_SUPPORTED_DETECTION_PARAMETERS) List supportedDetectionParameters, - @JsonProperty(required = true, value = JSON_PROPERTY_SUPPORTED_NOTIFICATION_PARAMETERS) - List supportedNotificationParameters, - @JsonProperty(required = true, value = JSON_PROPERTY_TASK) String task, - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type, - @JsonProperty(required = true, value = JSON_PROPERTY_USAGE_CONCERN) String usageConcern) { + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { this.activeDetectionsCount = activeDetectionsCount; this.category = category; this.createdAt = createdAt; @@ -207,8 +151,6 @@ public GovernanceControlAttributes( this.description = description; this.detectionFrequency = detectionFrequency; this.detectionParameters = detectionParameters; - this.detectionType = detectionType; - this.featureFlags = featureFlags; this.insights = insights; this.lastDetectionAt = lastDetectionAt; if (lastDetectionAt != null) {} @@ -220,26 +162,15 @@ public GovernanceControlAttributes( this.unparsed |= item.unparsed; } this.name = name; - this.nextSteps = nextSteps; - this.notificationFrequency = notificationFrequency; - this.notificationParameters = notificationParameters; - this.notificationType = notificationType; this.priority = priority; this.product = product; - this.releaseStatus = releaseStatus; this.resourceType = resourceType; this.resourceTypeDisplayName = resourceTypeDisplayName; this.supportedDetectionParameters = supportedDetectionParameters; for (GovernanceControlParameterDefinition item : supportedDetectionParameters) { this.unparsed |= item.unparsed; } - this.supportedNotificationParameters = supportedNotificationParameters; - for (GovernanceControlParameterDefinition item : supportedNotificationParameters) { - this.unparsed |= item.unparsed; - } - this.task = task; this.type = type; - this.usageConcern = usageConcern; } public GovernanceControlAttributes activeDetectionsCount(Long activeDetectionsCount) { @@ -389,51 +320,6 @@ public void setDetectionParameters(Map detectionParameters) { this.detectionParameters = detectionParameters; } - public GovernanceControlAttributes detectionType(String detectionType) { - this.detectionType = detectionType; - return this; - } - - /** - * The detection type that uniquely identifies the control. - * - * @return detectionType - */ - @JsonProperty(JSON_PROPERTY_DETECTION_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getDetectionType() { - return detectionType; - } - - public void setDetectionType(String detectionType) { - this.detectionType = detectionType; - } - - public GovernanceControlAttributes featureFlags(List featureFlags) { - this.featureFlags = featureFlags; - return this; - } - - public GovernanceControlAttributes addFeatureFlagsItem(String featureFlagsItem) { - this.featureFlags.add(featureFlagsItem); - return this; - } - - /** - * The feature flags that gate the control. - * - * @return featureFlags - */ - @JsonProperty(JSON_PROPERTY_FEATURE_FLAGS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getFeatureFlags() { - return featureFlags; - } - - public void setFeatureFlags(List featureFlags) { - this.featureFlags = featureFlags; - } - public GovernanceControlAttributes insights(List insights) { this.insights = insights; return this; @@ -605,93 +491,6 @@ public void setName(String name) { this.name = name; } - public GovernanceControlAttributes nextSteps(String nextSteps) { - this.nextSteps = nextSteps; - return this; - } - - /** - * Guidance on the next steps to remediate detections for the control. - * - * @return nextSteps - */ - @JsonProperty(JSON_PROPERTY_NEXT_STEPS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getNextSteps() { - return nextSteps; - } - - public void setNextSteps(String nextSteps) { - this.nextSteps = nextSteps; - } - - public GovernanceControlAttributes notificationFrequency(String notificationFrequency) { - this.notificationFrequency = notificationFrequency; - return this; - } - - /** - * The configured notification frequency for the control. Empty when not configured. - * - * @return notificationFrequency - */ - @JsonProperty(JSON_PROPERTY_NOTIFICATION_FREQUENCY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getNotificationFrequency() { - return notificationFrequency; - } - - public void setNotificationFrequency(String notificationFrequency) { - this.notificationFrequency = notificationFrequency; - } - - public GovernanceControlAttributes notificationParameters( - Map notificationParameters) { - this.notificationParameters = notificationParameters; - return this; - } - - public GovernanceControlAttributes putNotificationParametersItem( - String key, Object notificationParametersItem) { - this.notificationParameters.put(key, notificationParametersItem); - return this; - } - - /** - * A free-form map of parameter names to their configured values. - * - * @return notificationParameters - */ - @JsonProperty(JSON_PROPERTY_NOTIFICATION_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Map getNotificationParameters() { - return notificationParameters; - } - - public void setNotificationParameters(Map notificationParameters) { - this.notificationParameters = notificationParameters; - } - - public GovernanceControlAttributes notificationType(String notificationType) { - this.notificationType = notificationType; - return this; - } - - /** - * The configured notification type for the control. Empty when not configured. - * - * @return notificationType - */ - @JsonProperty(JSON_PROPERTY_NOTIFICATION_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getNotificationType() { - return notificationType; - } - - public void setNotificationType(String notificationType) { - this.notificationType = notificationType; - } - public GovernanceControlAttributes priority(String priority) { this.priority = priority; return this; @@ -732,26 +531,6 @@ public void setProduct(String product) { this.product = product; } - public GovernanceControlAttributes releaseStatus(String releaseStatus) { - this.releaseStatus = releaseStatus; - return this; - } - - /** - * The release status of the control, such as prod or beta. - * - * @return releaseStatus - */ - @JsonProperty(JSON_PROPERTY_RELEASE_STATUS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getReleaseStatus() { - return releaseStatus; - } - - public void setReleaseStatus(String releaseStatus) { - this.releaseStatus = releaseStatus; - } - public GovernanceControlAttributes resourceType(String resourceType) { this.resourceType = resourceType; return this; @@ -829,63 +608,6 @@ public void setSupportedDetectionParameters( } } - public GovernanceControlAttributes supportedNotificationParameters( - List supportedNotificationParameters) { - this.supportedNotificationParameters = supportedNotificationParameters; - for (GovernanceControlParameterDefinition item : supportedNotificationParameters) { - this.unparsed |= item.unparsed; - } - return this; - } - - public GovernanceControlAttributes addSupportedNotificationParametersItem( - GovernanceControlParameterDefinition supportedNotificationParametersItem) { - this.supportedNotificationParameters.add(supportedNotificationParametersItem); - this.unparsed |= supportedNotificationParametersItem.unparsed; - return this; - } - - /** - * An array of parameter definitions. - * - * @return supportedNotificationParameters - */ - @JsonProperty(JSON_PROPERTY_SUPPORTED_NOTIFICATION_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getSupportedNotificationParameters() { - return supportedNotificationParameters; - } - - public void setSupportedNotificationParameters( - List supportedNotificationParameters) { - this.supportedNotificationParameters = supportedNotificationParameters; - if (supportedNotificationParameters != null) { - for (GovernanceControlParameterDefinition item : supportedNotificationParameters) { - this.unparsed |= item.unparsed; - } - } - } - - public GovernanceControlAttributes task(String task) { - this.task = task; - return this; - } - - /** - * A short description of the remediation task for the control. - * - * @return task - */ - @JsonProperty(JSON_PROPERTY_TASK) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTask() { - return task; - } - - public void setTask(String task) { - this.task = task; - } - public GovernanceControlAttributes type(String type) { this.type = type; return this; @@ -906,27 +628,6 @@ public void setType(String type) { this.type = type; } - public GovernanceControlAttributes usageConcern(String usageConcern) { - this.usageConcern = usageConcern; - return this; - } - - /** - * The usage concern the control addresses, such as Security or - * Cost Optimization. - * - * @return usageConcern - */ - @JsonProperty(JSON_PROPERTY_USAGE_CONCERN) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getUsageConcern() { - return usageConcern; - } - - public void setUsageConcern(String usageConcern) { - this.usageConcern = usageConcern; - } - /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -991,8 +692,6 @@ public boolean equals(Object o) { && Objects.equals(this.description, governanceControlAttributes.description) && Objects.equals(this.detectionFrequency, governanceControlAttributes.detectionFrequency) && Objects.equals(this.detectionParameters, governanceControlAttributes.detectionParameters) - && Objects.equals(this.detectionType, governanceControlAttributes.detectionType) - && Objects.equals(this.featureFlags, governanceControlAttributes.featureFlags) && Objects.equals(this.insights, governanceControlAttributes.insights) && Objects.equals(this.lastDetectionAt, governanceControlAttributes.lastDetectionAt) && Objects.equals( @@ -1002,27 +701,15 @@ public boolean equals(Object o) { && Objects.equals(this.mitigationType, governanceControlAttributes.mitigationType) && Objects.equals(this.mitigations, governanceControlAttributes.mitigations) && Objects.equals(this.name, governanceControlAttributes.name) - && Objects.equals(this.nextSteps, governanceControlAttributes.nextSteps) - && Objects.equals( - this.notificationFrequency, governanceControlAttributes.notificationFrequency) - && Objects.equals( - this.notificationParameters, governanceControlAttributes.notificationParameters) - && Objects.equals(this.notificationType, governanceControlAttributes.notificationType) && Objects.equals(this.priority, governanceControlAttributes.priority) && Objects.equals(this.product, governanceControlAttributes.product) - && Objects.equals(this.releaseStatus, governanceControlAttributes.releaseStatus) && Objects.equals(this.resourceType, governanceControlAttributes.resourceType) && Objects.equals( this.resourceTypeDisplayName, governanceControlAttributes.resourceTypeDisplayName) && Objects.equals( this.supportedDetectionParameters, governanceControlAttributes.supportedDetectionParameters) - && Objects.equals( - this.supportedNotificationParameters, - governanceControlAttributes.supportedNotificationParameters) - && Objects.equals(this.task, governanceControlAttributes.task) && Objects.equals(this.type, governanceControlAttributes.type) - && Objects.equals(this.usageConcern, governanceControlAttributes.usageConcern) && Objects.equals( this.additionalProperties, governanceControlAttributes.additionalProperties); } @@ -1037,8 +724,6 @@ public int hashCode() { description, detectionFrequency, detectionParameters, - detectionType, - featureFlags, insights, lastDetectionAt, mitigatedDetectionsCount, @@ -1046,20 +731,12 @@ public int hashCode() { mitigationType, mitigations, name, - nextSteps, - notificationFrequency, - notificationParameters, - notificationType, priority, product, - releaseStatus, resourceType, resourceTypeDisplayName, supportedDetectionParameters, - supportedNotificationParameters, - task, type, - usageConcern, additionalProperties); } @@ -1078,8 +755,6 @@ public String toString() { sb.append(" detectionParameters: ") .append(toIndentedString(detectionParameters)) .append("\n"); - sb.append(" detectionType: ").append(toIndentedString(detectionType)).append("\n"); - sb.append(" featureFlags: ").append(toIndentedString(featureFlags)).append("\n"); sb.append(" insights: ").append(toIndentedString(insights)).append("\n"); sb.append(" lastDetectionAt: ").append(toIndentedString(lastDetectionAt)).append("\n"); sb.append(" mitigatedDetectionsCount: ") @@ -1091,17 +766,8 @@ public String toString() { sb.append(" mitigationType: ").append(toIndentedString(mitigationType)).append("\n"); sb.append(" mitigations: ").append(toIndentedString(mitigations)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" nextSteps: ").append(toIndentedString(nextSteps)).append("\n"); - sb.append(" notificationFrequency: ") - .append(toIndentedString(notificationFrequency)) - .append("\n"); - sb.append(" notificationParameters: ") - .append(toIndentedString(notificationParameters)) - .append("\n"); - sb.append(" notificationType: ").append(toIndentedString(notificationType)).append("\n"); sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" releaseStatus: ").append(toIndentedString(releaseStatus)).append("\n"); sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); sb.append(" resourceTypeDisplayName: ") .append(toIndentedString(resourceTypeDisplayName)) @@ -1109,12 +775,7 @@ public String toString() { sb.append(" supportedDetectionParameters: ") .append(toIndentedString(supportedDetectionParameters)) .append("\n"); - sb.append(" supportedNotificationParameters: ") - .append(toIndentedString(supportedNotificationParameters)) - .append("\n"); - sb.append(" task: ").append(toIndentedString(task)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" usageConcern: ").append(toIndentedString(usageConcern)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlData.java index 46c2df26161..5e14cd5d025 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlData.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlData.java @@ -82,7 +82,7 @@ public GovernanceControlData id(String id) { } /** - * The unique identifier of the control. + * The detection type that uniquely identifies the control. * * @return id */ diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAssignmentSource.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAssignmentSource.java new file mode 100644 index 00000000000..e721be4665a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAssignmentSource.java @@ -0,0 +1,72 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * How the detection's current assignment was determined. Possible values are auto_resolved + * , manual, reassigned, and cleared. + */ +@JsonSerialize( + using = + GovernanceControlDetectionAssignmentSource + .GovernanceControlDetectionAssignmentSourceSerializer.class) +public class GovernanceControlDetectionAssignmentSource extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("auto_resolved", "manual", "reassigned", "cleared")); + + public static final GovernanceControlDetectionAssignmentSource AUTO_RESOLVED = + new GovernanceControlDetectionAssignmentSource("auto_resolved"); + public static final GovernanceControlDetectionAssignmentSource MANUAL = + new GovernanceControlDetectionAssignmentSource("manual"); + public static final GovernanceControlDetectionAssignmentSource REASSIGNED = + new GovernanceControlDetectionAssignmentSource("reassigned"); + public static final GovernanceControlDetectionAssignmentSource CLEARED = + new GovernanceControlDetectionAssignmentSource("cleared"); + + GovernanceControlDetectionAssignmentSource(String value) { + super(value, allowedValues); + } + + public static class GovernanceControlDetectionAssignmentSourceSerializer + extends StdSerializer { + public GovernanceControlDetectionAssignmentSourceSerializer( + Class t) { + super(t); + } + + public GovernanceControlDetectionAssignmentSourceSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceControlDetectionAssignmentSource value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceControlDetectionAssignmentSource fromValue(String value) { + return new GovernanceControlDetectionAssignmentSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAttributes.java new file mode 100644 index 00000000000..bc19a41f952 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAttributes.java @@ -0,0 +1,600 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a governance control detection. */ +@JsonPropertyOrder({ + GovernanceControlDetectionAttributes.JSON_PROPERTY_ASSIGNED_TEAM, + GovernanceControlDetectionAttributes.JSON_PROPERTY_ASSIGNED_TO, + GovernanceControlDetectionAttributes.JSON_PROPERTY_ASSIGNMENT_SOURCE, + GovernanceControlDetectionAttributes.JSON_PROPERTY_CONTROL_ID, + GovernanceControlDetectionAttributes.JSON_PROPERTY_CREATED_AT, + GovernanceControlDetectionAttributes.JSON_PROPERTY_DETECTION_TYPE, + GovernanceControlDetectionAttributes.JSON_PROPERTY_DISPLAY_NAME, + GovernanceControlDetectionAttributes.JSON_PROPERTY_EXCEPTION_AT, + GovernanceControlDetectionAttributes.JSON_PROPERTY_EXCEPTION_BY, + GovernanceControlDetectionAttributes.JSON_PROPERTY_METADATA, + GovernanceControlDetectionAttributes.JSON_PROPERTY_MITIGATE_AFTER, + GovernanceControlDetectionAttributes.JSON_PROPERTY_MITIGATED_AT, + GovernanceControlDetectionAttributes.JSON_PROPERTY_PRIORITY, + GovernanceControlDetectionAttributes.JSON_PROPERTY_RESOURCE_ID, + GovernanceControlDetectionAttributes.JSON_PROPERTY_RESOURCE_TYPE, + GovernanceControlDetectionAttributes.JSON_PROPERTY_STATE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceControlDetectionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ASSIGNED_TEAM = "assigned_team"; + private String assignedTeam; + + public static final String JSON_PROPERTY_ASSIGNED_TO = "assigned_to"; + private String assignedTo; + + public static final String JSON_PROPERTY_ASSIGNMENT_SOURCE = "assignment_source"; + private GovernanceControlDetectionAssignmentSource assignmentSource; + + public static final String JSON_PROPERTY_CONTROL_ID = "control_id"; + private String controlId; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DETECTION_TYPE = "detection_type"; + private String detectionType; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "display_name"; + private String displayName; + + public static final String JSON_PROPERTY_EXCEPTION_AT = "exception_at"; + private OffsetDateTime exceptionAt; + + public static final String JSON_PROPERTY_EXCEPTION_BY = "exception_by"; + private String exceptionBy; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private Object metadata = null; + + public static final String JSON_PROPERTY_MITIGATE_AFTER = "mitigate_after"; + private OffsetDateTime mitigateAfter; + + public static final String JSON_PROPERTY_MITIGATED_AT = "mitigated_at"; + private OffsetDateTime mitigatedAt; + + public static final String JSON_PROPERTY_PRIORITY = "priority"; + private Long priority; + + public static final String JSON_PROPERTY_RESOURCE_ID = "resource_id"; + private String resourceId; + + public static final String JSON_PROPERTY_RESOURCE_TYPE = "resource_type"; + private String resourceType; + + public static final String JSON_PROPERTY_STATE = "state"; + private GovernanceControlDetectionState state; + + public GovernanceControlDetectionAttributes() {} + + @JsonCreator + public GovernanceControlDetectionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ASSIGNMENT_SOURCE) + GovernanceControlDetectionAssignmentSource assignmentSource, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTROL_ID) String controlId, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_DETECTION_TYPE) String detectionType, + @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_NAME) String displayName, + @JsonProperty(required = true, value = JSON_PROPERTY_PRIORITY) Long priority, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_ID) String resourceId, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_TYPE) String resourceType, + @JsonProperty(required = true, value = JSON_PROPERTY_STATE) + GovernanceControlDetectionState state) { + this.assignmentSource = assignmentSource; + this.unparsed |= !assignmentSource.isValid(); + this.controlId = controlId; + this.createdAt = createdAt; + this.detectionType = detectionType; + this.displayName = displayName; + this.priority = priority; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.state = state; + this.unparsed |= !state.isValid(); + } + + public GovernanceControlDetectionAttributes assignedTeam(String assignedTeam) { + this.assignedTeam = assignedTeam; + return this; + } + + /** + * The identifier of the team the detection is assigned to, if any. + * + * @return assignedTeam + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSIGNED_TEAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAssignedTeam() { + return assignedTeam; + } + + public void setAssignedTeam(String assignedTeam) { + this.assignedTeam = assignedTeam; + } + + public GovernanceControlDetectionAttributes assignedTo(String assignedTo) { + this.assignedTo = assignedTo; + return this; + } + + /** + * The identifier of the user the detection is assigned to, if any. + * + * @return assignedTo + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSIGNED_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAssignedTo() { + return assignedTo; + } + + public void setAssignedTo(String assignedTo) { + this.assignedTo = assignedTo; + } + + public GovernanceControlDetectionAttributes assignmentSource( + GovernanceControlDetectionAssignmentSource assignmentSource) { + this.assignmentSource = assignmentSource; + this.unparsed |= !assignmentSource.isValid(); + return this; + } + + /** + * How the detection's current assignment was determined. Possible values are auto_resolved + * , manual, reassigned, and cleared. + * + * @return assignmentSource + */ + @JsonProperty(JSON_PROPERTY_ASSIGNMENT_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionAssignmentSource getAssignmentSource() { + return assignmentSource; + } + + public void setAssignmentSource(GovernanceControlDetectionAssignmentSource assignmentSource) { + if (!assignmentSource.isValid()) { + this.unparsed = true; + } + this.assignmentSource = assignmentSource; + } + + public GovernanceControlDetectionAttributes controlId(String controlId) { + this.controlId = controlId; + return this; + } + + /** + * DEPRECATED: mirrors detection_type for backward compatibility; use + * detection_type instead. + * + * @return controlId + * @deprecated + */ + @Deprecated + @JsonProperty(JSON_PROPERTY_CONTROL_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getControlId() { + return controlId; + } + + @Deprecated + public void setControlId(String controlId) { + this.controlId = controlId; + } + + public GovernanceControlDetectionAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time when the detection was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public GovernanceControlDetectionAttributes detectionType(String detectionType) { + this.detectionType = detectionType; + return this; + } + + /** + * The type of detection, which determines what condition was detected. + * + * @return detectionType + */ + @JsonProperty(JSON_PROPERTY_DETECTION_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDetectionType() { + return detectionType; + } + + public void setDetectionType(String detectionType) { + this.detectionType = detectionType; + } + + public GovernanceControlDetectionAttributes displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The human-readable name of the detected resource. + * + * @return displayName + */ + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public GovernanceControlDetectionAttributes exceptionAt(OffsetDateTime exceptionAt) { + this.exceptionAt = exceptionAt; + return this; + } + + /** + * The date and time when the detection was marked as an exception, if applicable. + * + * @return exceptionAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXCEPTION_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getExceptionAt() { + return exceptionAt; + } + + public void setExceptionAt(OffsetDateTime exceptionAt) { + this.exceptionAt = exceptionAt; + } + + public GovernanceControlDetectionAttributes exceptionBy(String exceptionBy) { + this.exceptionBy = exceptionBy; + return this; + } + + /** + * The identifier of the user who marked the detection as an exception, if applicable. + * + * @return exceptionBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXCEPTION_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getExceptionBy() { + return exceptionBy; + } + + public void setExceptionBy(String exceptionBy) { + this.exceptionBy = exceptionBy; + } + + public GovernanceControlDetectionAttributes metadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Free-form metadata associated with the detection. + * + * @return metadata + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getMetadata() { + return metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + public GovernanceControlDetectionAttributes mitigateAfter(OffsetDateTime mitigateAfter) { + this.mitigateAfter = mitigateAfter; + return this; + } + + /** + * The date and time after which the detection is scheduled to be mitigated, if applicable. + * + * @return mitigateAfter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MITIGATE_AFTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getMitigateAfter() { + return mitigateAfter; + } + + public void setMitigateAfter(OffsetDateTime mitigateAfter) { + this.mitigateAfter = mitigateAfter; + } + + public GovernanceControlDetectionAttributes mitigatedAt(OffsetDateTime mitigatedAt) { + this.mitigatedAt = mitigatedAt; + return this; + } + + /** + * The date and time when the detection was mitigated, if applicable. + * + * @return mitigatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MITIGATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getMitigatedAt() { + return mitigatedAt; + } + + public void setMitigatedAt(OffsetDateTime mitigatedAt) { + this.mitigatedAt = mitigatedAt; + } + + public GovernanceControlDetectionAttributes priority(Long priority) { + this.priority = priority; + return this; + } + + /** + * The priority of the detection, if set. + * + * @return priority + */ + @JsonProperty(JSON_PROPERTY_PRIORITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPriority() { + return priority; + } + + public void setPriority(Long priority) { + this.priority = priority; + } + + public GovernanceControlDetectionAttributes resourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * The identifier of the resource the detection applies to. + * + * @return resourceId + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public GovernanceControlDetectionAttributes resourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * The type of resource the detection applies to, for example api_key or + * dashboard. + * + * @return resourceType + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public GovernanceControlDetectionAttributes state(GovernanceControlDetectionState state) { + this.state = state; + this.unparsed |= !state.isValid(); + return this; + } + + /** + * The current state of the detection. Possible values are active, exception + * , mitigated, inactive, obsolete, + * resolved_externally, and mitigation_in_progress. + * + * @return state + */ + @JsonProperty(JSON_PROPERTY_STATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionState getState() { + return state; + } + + public void setState(GovernanceControlDetectionState state) { + if (!state.isValid()) { + this.unparsed = true; + } + this.state = state; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceControlDetectionAttributes + */ + @JsonAnySetter + public GovernanceControlDetectionAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceControlDetectionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceControlDetectionAttributes governanceControlDetectionAttributes = + (GovernanceControlDetectionAttributes) o; + return Objects.equals(this.assignedTeam, governanceControlDetectionAttributes.assignedTeam) + && Objects.equals(this.assignedTo, governanceControlDetectionAttributes.assignedTo) + && Objects.equals( + this.assignmentSource, governanceControlDetectionAttributes.assignmentSource) + && Objects.equals(this.controlId, governanceControlDetectionAttributes.controlId) + && Objects.equals(this.createdAt, governanceControlDetectionAttributes.createdAt) + && Objects.equals(this.detectionType, governanceControlDetectionAttributes.detectionType) + && Objects.equals(this.displayName, governanceControlDetectionAttributes.displayName) + && Objects.equals(this.exceptionAt, governanceControlDetectionAttributes.exceptionAt) + && Objects.equals(this.exceptionBy, governanceControlDetectionAttributes.exceptionBy) + && Objects.equals(this.metadata, governanceControlDetectionAttributes.metadata) + && Objects.equals(this.mitigateAfter, governanceControlDetectionAttributes.mitigateAfter) + && Objects.equals(this.mitigatedAt, governanceControlDetectionAttributes.mitigatedAt) + && Objects.equals(this.priority, governanceControlDetectionAttributes.priority) + && Objects.equals(this.resourceId, governanceControlDetectionAttributes.resourceId) + && Objects.equals(this.resourceType, governanceControlDetectionAttributes.resourceType) + && Objects.equals(this.state, governanceControlDetectionAttributes.state) + && Objects.equals( + this.additionalProperties, governanceControlDetectionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + assignedTeam, + assignedTo, + assignmentSource, + controlId, + createdAt, + detectionType, + displayName, + exceptionAt, + exceptionBy, + metadata, + mitigateAfter, + mitigatedAt, + priority, + resourceId, + resourceType, + state, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceControlDetectionAttributes {\n"); + sb.append(" assignedTeam: ").append(toIndentedString(assignedTeam)).append("\n"); + sb.append(" assignedTo: ").append(toIndentedString(assignedTo)).append("\n"); + sb.append(" assignmentSource: ").append(toIndentedString(assignmentSource)).append("\n"); + sb.append(" controlId: ").append(toIndentedString(controlId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" detectionType: ").append(toIndentedString(detectionType)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" exceptionAt: ").append(toIndentedString(exceptionAt)).append("\n"); + sb.append(" exceptionBy: ").append(toIndentedString(exceptionBy)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" mitigateAfter: ").append(toIndentedString(mitigateAfter)).append("\n"); + sb.append(" mitigatedAt: ").append(toIndentedString(mitigatedAt)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" resourceId: ").append(toIndentedString(resourceId)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionData.java new file mode 100644 index 00000000000..460cc29f053 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionData.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A governance control detection resource. */ +@JsonPropertyOrder({ + GovernanceControlDetectionData.JSON_PROPERTY_ATTRIBUTES, + GovernanceControlDetectionData.JSON_PROPERTY_ID, + GovernanceControlDetectionData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceControlDetectionData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceControlDetectionAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceControlDetectionResourceType type; + + public GovernanceControlDetectionData() {} + + @JsonCreator + public GovernanceControlDetectionData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GovernanceControlDetectionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GovernanceControlDetectionResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceControlDetectionData attributes( + GovernanceControlDetectionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a governance control detection. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceControlDetectionAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceControlDetectionData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the detection. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GovernanceControlDetectionData type(GovernanceControlDetectionResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Governance control detection resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionResourceType getType() { + return type; + } + + public void setType(GovernanceControlDetectionResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceControlDetectionData + */ + @JsonAnySetter + public GovernanceControlDetectionData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceControlDetectionData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceControlDetectionData governanceControlDetectionData = + (GovernanceControlDetectionData) o; + return Objects.equals(this.attributes, governanceControlDetectionData.attributes) + && Objects.equals(this.id, governanceControlDetectionData.id) + && Objects.equals(this.type, governanceControlDetectionData.type) + && Objects.equals( + this.additionalProperties, governanceControlDetectionData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceControlDetectionData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResourceType.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResourceType.java new file mode 100644 index 00000000000..aef69553f33 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResourceType.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Governance control detection resource type. */ +@JsonSerialize( + using = + GovernanceControlDetectionResourceType.GovernanceControlDetectionResourceTypeSerializer + .class) +public class GovernanceControlDetectionResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("governance_control_detection")); + + public static final GovernanceControlDetectionResourceType GOVERNANCE_CONTROL_DETECTION = + new GovernanceControlDetectionResourceType("governance_control_detection"); + + GovernanceControlDetectionResourceType(String value) { + super(value, allowedValues); + } + + public static class GovernanceControlDetectionResourceTypeSerializer + extends StdSerializer { + public GovernanceControlDetectionResourceTypeSerializer( + Class t) { + super(t); + } + + public GovernanceControlDetectionResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceControlDetectionResourceType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceControlDetectionResourceType fromValue(String value) { + return new GovernanceControlDetectionResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResponse.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResponse.java new file mode 100644 index 00000000000..0faeb6dca44 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResponse.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A single governance control detection. */ +@JsonPropertyOrder({GovernanceControlDetectionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceControlDetectionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GovernanceControlDetectionData data; + + public GovernanceControlDetectionResponse() {} + + @JsonCreator + public GovernanceControlDetectionResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GovernanceControlDetectionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GovernanceControlDetectionResponse data(GovernanceControlDetectionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A governance control detection resource. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionData getData() { + return data; + } + + public void setData(GovernanceControlDetectionData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceControlDetectionResponse + */ + @JsonAnySetter + public GovernanceControlDetectionResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceControlDetectionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceControlDetectionResponse governanceControlDetectionResponse = + (GovernanceControlDetectionResponse) o; + return Objects.equals(this.data, governanceControlDetectionResponse.data) + && Objects.equals( + this.additionalProperties, governanceControlDetectionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceControlDetectionResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionState.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionState.java new file mode 100644 index 00000000000..83b82020c9c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionState.java @@ -0,0 +1,82 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The current state of the detection. Possible values are active, exception + * , mitigated, inactive, obsolete, + * resolved_externally, and mitigation_in_progress. + */ +@JsonSerialize( + using = GovernanceControlDetectionState.GovernanceControlDetectionStateSerializer.class) +public class GovernanceControlDetectionState extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "active", + "exception", + "mitigated", + "inactive", + "obsolete", + "resolved_externally", + "mitigation_in_progress")); + + public static final GovernanceControlDetectionState ACTIVE = + new GovernanceControlDetectionState("active"); + public static final GovernanceControlDetectionState EXCEPTION = + new GovernanceControlDetectionState("exception"); + public static final GovernanceControlDetectionState MITIGATED = + new GovernanceControlDetectionState("mitigated"); + public static final GovernanceControlDetectionState INACTIVE = + new GovernanceControlDetectionState("inactive"); + public static final GovernanceControlDetectionState OBSOLETE = + new GovernanceControlDetectionState("obsolete"); + public static final GovernanceControlDetectionState RESOLVED_EXTERNALLY = + new GovernanceControlDetectionState("resolved_externally"); + public static final GovernanceControlDetectionState MITIGATION_IN_PROGRESS = + new GovernanceControlDetectionState("mitigation_in_progress"); + + GovernanceControlDetectionState(String value) { + super(value, allowedValues); + } + + public static class GovernanceControlDetectionStateSerializer + extends StdSerializer { + public GovernanceControlDetectionStateSerializer(Class t) { + super(t); + } + + public GovernanceControlDetectionStateSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceControlDetectionState value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceControlDetectionState fromValue(String value) { + return new GovernanceControlDetectionState(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateAttributes.java new file mode 100644 index 00000000000..ea5f4695999 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateAttributes.java @@ -0,0 +1,237 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * The attributes of a governance control detection that can be updated. Only the attributes present + * in the request are modified. + */ +@JsonPropertyOrder({ + GovernanceControlDetectionUpdateAttributes.JSON_PROPERTY_ASSIGNED_TEAM, + GovernanceControlDetectionUpdateAttributes.JSON_PROPERTY_ASSIGNED_TO, + GovernanceControlDetectionUpdateAttributes.JSON_PROPERTY_MITIGATE_AFTER, + GovernanceControlDetectionUpdateAttributes.JSON_PROPERTY_STATE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceControlDetectionUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ASSIGNED_TEAM = "assigned_team"; + private String assignedTeam; + + public static final String JSON_PROPERTY_ASSIGNED_TO = "assigned_to"; + private String assignedTo; + + public static final String JSON_PROPERTY_MITIGATE_AFTER = "mitigate_after"; + private OffsetDateTime mitigateAfter; + + public static final String JSON_PROPERTY_STATE = "state"; + private GovernanceControlDetectionUpdateState state; + + public GovernanceControlDetectionUpdateAttributes assignedTeam(String assignedTeam) { + this.assignedTeam = assignedTeam; + return this; + } + + /** + * The handle of the team the detection is assigned to. Set to an empty string to clear the + * assignment. + * + * @return assignedTeam + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSIGNED_TEAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAssignedTeam() { + return assignedTeam; + } + + public void setAssignedTeam(String assignedTeam) { + this.assignedTeam = assignedTeam; + } + + public GovernanceControlDetectionUpdateAttributes assignedTo(String assignedTo) { + this.assignedTo = assignedTo; + return this; + } + + /** + * The UUID of the user the detection is assigned to. Set to an empty string to clear the + * assignment. + * + * @return assignedTo + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSIGNED_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAssignedTo() { + return assignedTo; + } + + public void setAssignedTo(String assignedTo) { + this.assignedTo = assignedTo; + } + + public GovernanceControlDetectionUpdateAttributes mitigateAfter(OffsetDateTime mitigateAfter) { + this.mitigateAfter = mitigateAfter; + return this; + } + + /** + * The timestamp after which the detection becomes eligible for mitigation. Used to defer + * mitigation to a later time. + * + * @return mitigateAfter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MITIGATE_AFTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getMitigateAfter() { + return mitigateAfter; + } + + public void setMitigateAfter(OffsetDateTime mitigateAfter) { + this.mitigateAfter = mitigateAfter; + } + + public GovernanceControlDetectionUpdateAttributes state( + GovernanceControlDetectionUpdateState state) { + this.state = state; + this.unparsed |= !state.isValid(); + return this; + } + + /** + * The new state to set for the detection. Set to exception to acknowledge the + * detection and exclude it from active counts, or active to reopen it. + * + * @return state + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GovernanceControlDetectionUpdateState getState() { + return state; + } + + public void setState(GovernanceControlDetectionUpdateState state) { + if (!state.isValid()) { + this.unparsed = true; + } + this.state = state; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceControlDetectionUpdateAttributes + */ + @JsonAnySetter + public GovernanceControlDetectionUpdateAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceControlDetectionUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceControlDetectionUpdateAttributes governanceControlDetectionUpdateAttributes = + (GovernanceControlDetectionUpdateAttributes) o; + return Objects.equals( + this.assignedTeam, governanceControlDetectionUpdateAttributes.assignedTeam) + && Objects.equals(this.assignedTo, governanceControlDetectionUpdateAttributes.assignedTo) + && Objects.equals( + this.mitigateAfter, governanceControlDetectionUpdateAttributes.mitigateAfter) + && Objects.equals(this.state, governanceControlDetectionUpdateAttributes.state) + && Objects.equals( + this.additionalProperties, + governanceControlDetectionUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(assignedTeam, assignedTo, mitigateAfter, state, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceControlDetectionUpdateAttributes {\n"); + sb.append(" assignedTeam: ").append(toIndentedString(assignedTeam)).append("\n"); + sb.append(" assignedTo: ").append(toIndentedString(assignedTo)).append("\n"); + sb.append(" mitigateAfter: ").append(toIndentedString(mitigateAfter)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateData.java new file mode 100644 index 00000000000..39fadb4de6b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateData.java @@ -0,0 +1,186 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data of a governance control detection update request. */ +@JsonPropertyOrder({ + GovernanceControlDetectionUpdateData.JSON_PROPERTY_ATTRIBUTES, + GovernanceControlDetectionUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceControlDetectionUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceControlDetectionUpdateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceControlDetectionResourceType type; + + public GovernanceControlDetectionUpdateData() {} + + @JsonCreator + public GovernanceControlDetectionUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GovernanceControlDetectionResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceControlDetectionUpdateData attributes( + GovernanceControlDetectionUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a governance control detection that can be updated. Only the attributes + * present in the request are modified. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GovernanceControlDetectionUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceControlDetectionUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceControlDetectionUpdateData type(GovernanceControlDetectionResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Governance control detection resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionResourceType getType() { + return type; + } + + public void setType(GovernanceControlDetectionResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceControlDetectionUpdateData + */ + @JsonAnySetter + public GovernanceControlDetectionUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceControlDetectionUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceControlDetectionUpdateData governanceControlDetectionUpdateData = + (GovernanceControlDetectionUpdateData) o; + return Objects.equals(this.attributes, governanceControlDetectionUpdateData.attributes) + && Objects.equals(this.type, governanceControlDetectionUpdateData.type) + && Objects.equals( + this.additionalProperties, governanceControlDetectionUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceControlDetectionUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateRequest.java new file mode 100644 index 00000000000..9a75e212814 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateRequest.java @@ -0,0 +1,152 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A request to update a governance control detection. */ +@JsonPropertyOrder({GovernanceControlDetectionUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceControlDetectionUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GovernanceControlDetectionUpdateData data; + + public GovernanceControlDetectionUpdateRequest() {} + + @JsonCreator + public GovernanceControlDetectionUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GovernanceControlDetectionUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GovernanceControlDetectionUpdateRequest data(GovernanceControlDetectionUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data of a governance control detection update request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionUpdateData getData() { + return data; + } + + public void setData(GovernanceControlDetectionUpdateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceControlDetectionUpdateRequest + */ + @JsonAnySetter + public GovernanceControlDetectionUpdateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceControlDetectionUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceControlDetectionUpdateRequest governanceControlDetectionUpdateRequest = + (GovernanceControlDetectionUpdateRequest) o; + return Objects.equals(this.data, governanceControlDetectionUpdateRequest.data) + && Objects.equals( + this.additionalProperties, + governanceControlDetectionUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceControlDetectionUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateState.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateState.java new file mode 100644 index 00000000000..8d5edbb7aa4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateState.java @@ -0,0 +1,67 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The new state to set for the detection. Set to exception to acknowledge the + * detection and exclude it from active counts, or active to reopen it. + */ +@JsonSerialize( + using = + GovernanceControlDetectionUpdateState.GovernanceControlDetectionUpdateStateSerializer.class) +public class GovernanceControlDetectionUpdateState extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("exception", "active")); + + public static final GovernanceControlDetectionUpdateState EXCEPTION = + new GovernanceControlDetectionUpdateState("exception"); + public static final GovernanceControlDetectionUpdateState ACTIVE = + new GovernanceControlDetectionUpdateState("active"); + + GovernanceControlDetectionUpdateState(String value) { + super(value, allowedValues); + } + + public static class GovernanceControlDetectionUpdateStateSerializer + extends StdSerializer { + public GovernanceControlDetectionUpdateStateSerializer( + Class t) { + super(t); + } + + public GovernanceControlDetectionUpdateStateSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceControlDetectionUpdateState value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceControlDetectionUpdateState fromValue(String value) { + return new GovernanceControlDetectionUpdateState(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionsResponse.java new file mode 100644 index 00000000000..77a0cf1b93d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionsResponse.java @@ -0,0 +1,165 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A list of governance control detections. */ +@JsonPropertyOrder({GovernanceControlDetectionsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceControlDetectionsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public GovernanceControlDetectionsResponse() {} + + @JsonCreator + public GovernanceControlDetectionsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (GovernanceControlDetectionData item : data) { + this.unparsed |= item.unparsed; + } + } + + public GovernanceControlDetectionsResponse data(List data) { + this.data = data; + for (GovernanceControlDetectionData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GovernanceControlDetectionsResponse addDataItem(GovernanceControlDetectionData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * An array of governance control detection resources. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (GovernanceControlDetectionData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceControlDetectionsResponse + */ + @JsonAnySetter + public GovernanceControlDetectionsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceControlDetectionsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceControlDetectionsResponse governanceControlDetectionsResponse = + (GovernanceControlDetectionsResponse) o; + return Objects.equals(this.data, governanceControlDetectionsResponse.data) + && Objects.equals( + this.additionalProperties, governanceControlDetectionsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceControlDetectionsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlMitigationDefinition.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlMitigationDefinition.java index aecf3989c16..455c21587d9 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlMitigationDefinition.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlMitigationDefinition.java @@ -21,14 +21,10 @@ /** The definition of a mitigation available for a control. */ @JsonPropertyOrder({ - GovernanceControlMitigationDefinition.JSON_PROPERTY_ACTION_VERB, GovernanceControlMitigationDefinition.JSON_PROPERTY_DESCRIPTION, GovernanceControlMitigationDefinition.JSON_PROPERTY_EXECUTION_MODES, - GovernanceControlMitigationDefinition.JSON_PROPERTY_FEATURE_FLAGS, GovernanceControlMitigationDefinition.JSON_PROPERTY_ID, - GovernanceControlMitigationDefinition.JSON_PROPERTY_MANUAL_MITIGATION_WARNING, GovernanceControlMitigationDefinition.JSON_PROPERTY_PERMISSIONS, - GovernanceControlMitigationDefinition.JSON_PROPERTY_REQUIRES_AI, GovernanceControlMitigationDefinition.JSON_PROPERTY_SUPPORTED_PARAMETERS, GovernanceControlMitigationDefinition.JSON_PROPERTY_TITLE }) @@ -36,30 +32,18 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class GovernanceControlMitigationDefinition { @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ACTION_VERB = "action_verb"; - private String actionVerb; - public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; public static final String JSON_PROPERTY_EXECUTION_MODES = "execution_modes"; - private List executionModes = null; - - public static final String JSON_PROPERTY_FEATURE_FLAGS = "feature_flags"; - private List featureFlags = new ArrayList<>(); + private List executionModes = new ArrayList<>(); public static final String JSON_PROPERTY_ID = "id"; private String id; - public static final String JSON_PROPERTY_MANUAL_MITIGATION_WARNING = "manual_mitigation_warning"; - private String manualMitigationWarning; - public static final String JSON_PROPERTY_PERMISSIONS = "permissions"; private List permissions = new ArrayList<>(); - public static final String JSON_PROPERTY_REQUIRES_AI = "requires_ai"; - private Boolean requiresAi; - public static final String JSON_PROPERTY_SUPPORTED_PARAMETERS = "supported_parameters"; private List supportedParameters = new ArrayList<>(); @@ -70,24 +54,18 @@ public GovernanceControlMitigationDefinition() {} @JsonCreator public GovernanceControlMitigationDefinition( - @JsonProperty(required = true, value = JSON_PROPERTY_ACTION_VERB) String actionVerb, @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, - @JsonProperty(required = true, value = JSON_PROPERTY_FEATURE_FLAGS) List featureFlags, + @JsonProperty(required = true, value = JSON_PROPERTY_EXECUTION_MODES) + List executionModes, @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, - @JsonProperty(required = true, value = JSON_PROPERTY_MANUAL_MITIGATION_WARNING) - String manualMitigationWarning, @JsonProperty(required = true, value = JSON_PROPERTY_PERMISSIONS) List permissions, - @JsonProperty(required = true, value = JSON_PROPERTY_REQUIRES_AI) Boolean requiresAi, @JsonProperty(required = true, value = JSON_PROPERTY_SUPPORTED_PARAMETERS) List supportedParameters, @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { - this.actionVerb = actionVerb; this.description = description; - this.featureFlags = featureFlags; + this.executionModes = executionModes; this.id = id; - this.manualMitigationWarning = manualMitigationWarning; this.permissions = permissions; - this.requiresAi = requiresAi; this.supportedParameters = supportedParameters; for (GovernanceControlParameterDefinition item : supportedParameters) { this.unparsed |= item.unparsed; @@ -95,26 +73,6 @@ public GovernanceControlMitigationDefinition( this.title = title; } - public GovernanceControlMitigationDefinition actionVerb(String actionVerb) { - this.actionVerb = actionVerb; - return this; - } - - /** - * The verb describing the mitigation action, such as revoke or delete. - * - * @return actionVerb - */ - @JsonProperty(JSON_PROPERTY_ACTION_VERB) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getActionVerb() { - return actionVerb; - } - - public void setActionVerb(String actionVerb) { - this.actionVerb = actionVerb; - } - public GovernanceControlMitigationDefinition description(String description) { this.description = description; return this; @@ -141,9 +99,6 @@ public GovernanceControlMitigationDefinition executionModes(List executi } public GovernanceControlMitigationDefinition addExecutionModesItem(String executionModesItem) { - if (this.executionModes == null) { - this.executionModes = new ArrayList<>(); - } this.executionModes.add(executionModesItem); return this; } @@ -154,9 +109,8 @@ public GovernanceControlMitigationDefinition addExecutionModesItem(String execut * * @return executionModes */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_EXECUTION_MODES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getExecutionModes() { return executionModes; } @@ -165,31 +119,6 @@ public void setExecutionModes(List executionModes) { this.executionModes = executionModes; } - public GovernanceControlMitigationDefinition featureFlags(List featureFlags) { - this.featureFlags = featureFlags; - return this; - } - - public GovernanceControlMitigationDefinition addFeatureFlagsItem(String featureFlagsItem) { - this.featureFlags.add(featureFlagsItem); - return this; - } - - /** - * The feature flags that gate the mitigation. - * - * @return featureFlags - */ - @JsonProperty(JSON_PROPERTY_FEATURE_FLAGS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getFeatureFlags() { - return featureFlags; - } - - public void setFeatureFlags(List featureFlags) { - this.featureFlags = featureFlags; - } - public GovernanceControlMitigationDefinition id(String id) { this.id = id; return this; @@ -210,27 +139,6 @@ public void setId(String id) { this.id = id; } - public GovernanceControlMitigationDefinition manualMitigationWarning( - String manualMitigationWarning) { - this.manualMitigationWarning = manualMitigationWarning; - return this; - } - - /** - * A warning shown to the user before applying the mitigation manually. - * - * @return manualMitigationWarning - */ - @JsonProperty(JSON_PROPERTY_MANUAL_MITIGATION_WARNING) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getManualMitigationWarning() { - return manualMitigationWarning; - } - - public void setManualMitigationWarning(String manualMitigationWarning) { - this.manualMitigationWarning = manualMitigationWarning; - } - public GovernanceControlMitigationDefinition permissions(List permissions) { this.permissions = permissions; return this; @@ -256,26 +164,6 @@ public void setPermissions(List permissions) { this.permissions = permissions; } - public GovernanceControlMitigationDefinition requiresAi(Boolean requiresAi) { - this.requiresAi = requiresAi; - return this; - } - - /** - * Whether the mitigation requires AI to be enabled. - * - * @return requiresAi - */ - @JsonProperty(JSON_PROPERTY_REQUIRES_AI) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Boolean getRequiresAi() { - return requiresAi; - } - - public void setRequiresAi(Boolean requiresAi) { - this.requiresAi = requiresAi; - } - public GovernanceControlMitigationDefinition supportedParameters( List supportedParameters) { this.supportedParameters = supportedParameters; @@ -390,16 +278,10 @@ public boolean equals(Object o) { } GovernanceControlMitigationDefinition governanceControlMitigationDefinition = (GovernanceControlMitigationDefinition) o; - return Objects.equals(this.actionVerb, governanceControlMitigationDefinition.actionVerb) - && Objects.equals(this.description, governanceControlMitigationDefinition.description) + return Objects.equals(this.description, governanceControlMitigationDefinition.description) && Objects.equals(this.executionModes, governanceControlMitigationDefinition.executionModes) - && Objects.equals(this.featureFlags, governanceControlMitigationDefinition.featureFlags) && Objects.equals(this.id, governanceControlMitigationDefinition.id) - && Objects.equals( - this.manualMitigationWarning, - governanceControlMitigationDefinition.manualMitigationWarning) && Objects.equals(this.permissions, governanceControlMitigationDefinition.permissions) - && Objects.equals(this.requiresAi, governanceControlMitigationDefinition.requiresAi) && Objects.equals( this.supportedParameters, governanceControlMitigationDefinition.supportedParameters) && Objects.equals(this.title, governanceControlMitigationDefinition.title) @@ -410,14 +292,10 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - actionVerb, description, executionModes, - featureFlags, id, - manualMitigationWarning, permissions, - requiresAi, supportedParameters, title, additionalProperties); @@ -427,16 +305,10 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GovernanceControlMitigationDefinition {\n"); - sb.append(" actionVerb: ").append(toIndentedString(actionVerb)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" executionModes: ").append(toIndentedString(executionModes)).append("\n"); - sb.append(" featureFlags: ").append(toIndentedString(featureFlags)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" manualMitigationWarning: ") - .append(toIndentedString(manualMitigationWarning)) - .append("\n"); sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append(" requiresAi: ").append(toIndentedString(requiresAi)).append("\n"); sb.append(" supportedParameters: ") .append(toIndentedString(supportedParameters)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlParameterDefinition.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlParameterDefinition.java index deb605c3b16..44a12d6fce7 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlParameterDefinition.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlParameterDefinition.java @@ -24,7 +24,6 @@ GovernanceControlParameterDefinition.JSON_PROPERTY_DEFAULT_VALUE, GovernanceControlParameterDefinition.JSON_PROPERTY_DESCRIPTION, GovernanceControlParameterDefinition.JSON_PROPERTY_DISPLAY_NAME, - GovernanceControlParameterDefinition.JSON_PROPERTY_HIDDEN, GovernanceControlParameterDefinition.JSON_PROPERTY_NAME, GovernanceControlParameterDefinition.JSON_PROPERTY_REQUIRED, GovernanceControlParameterDefinition.JSON_PROPERTY_SUPPORTED_VALUES, @@ -43,9 +42,6 @@ public class GovernanceControlParameterDefinition { public static final String JSON_PROPERTY_DISPLAY_NAME = "display_name"; private String displayName; - public static final String JSON_PROPERTY_HIDDEN = "hidden"; - private Boolean hidden; - public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -65,7 +61,6 @@ public GovernanceControlParameterDefinition( @JsonProperty(required = true, value = JSON_PROPERTY_DEFAULT_VALUE) Object defaultValue, @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_NAME) String displayName, - @JsonProperty(required = true, value = JSON_PROPERTY_HIDDEN) Boolean hidden, @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, @JsonProperty(required = true, value = JSON_PROPERTY_REQUIRED) Boolean required, @JsonProperty(required = true, value = JSON_PROPERTY_SUPPORTED_VALUES) @@ -74,7 +69,6 @@ public GovernanceControlParameterDefinition( this.defaultValue = defaultValue; this.description = description; this.displayName = displayName; - this.hidden = hidden; this.name = name; this.required = required; this.supportedValues = supportedValues; @@ -144,26 +138,6 @@ public void setDisplayName(String displayName) { this.displayName = displayName; } - public GovernanceControlParameterDefinition hidden(Boolean hidden) { - this.hidden = hidden; - return this; - } - - /** - * Whether the parameter is hidden from the UI. - * - * @return hidden - */ - @JsonProperty(JSON_PROPERTY_HIDDEN) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Boolean getHidden() { - return hidden; - } - - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } - public GovernanceControlParameterDefinition name(String name) { this.name = name; return this; @@ -321,7 +295,6 @@ public boolean equals(Object o) { return Objects.equals(this.defaultValue, governanceControlParameterDefinition.defaultValue) && Objects.equals(this.description, governanceControlParameterDefinition.description) && Objects.equals(this.displayName, governanceControlParameterDefinition.displayName) - && Objects.equals(this.hidden, governanceControlParameterDefinition.hidden) && Objects.equals(this.name, governanceControlParameterDefinition.name) && Objects.equals(this.required, governanceControlParameterDefinition.required) && Objects.equals( @@ -337,7 +310,6 @@ public int hashCode() { defaultValue, description, displayName, - hidden, name, required, supportedValues, @@ -352,7 +324,6 @@ public String toString() { sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" hidden: ").append(toIndentedString(hidden)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" required: ").append(toIndentedString(required)).append("\n"); sb.append(" supportedValues: ").append(toIndentedString(supportedValues)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateAttributes.java index 58ba5375e54..62da1facd7b 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateAttributes.java @@ -24,11 +24,7 @@ GovernanceControlUpdateAttributes.JSON_PROPERTY_DETECTION_FREQUENCY, GovernanceControlUpdateAttributes.JSON_PROPERTY_DETECTION_PARAMETERS, GovernanceControlUpdateAttributes.JSON_PROPERTY_MITIGATION_PARAMETERS, - GovernanceControlUpdateAttributes.JSON_PROPERTY_MITIGATION_TYPE, - GovernanceControlUpdateAttributes.JSON_PROPERTY_NAME, - GovernanceControlUpdateAttributes.JSON_PROPERTY_NOTIFICATION_FREQUENCY, - GovernanceControlUpdateAttributes.JSON_PROPERTY_NOTIFICATION_PARAMETERS, - GovernanceControlUpdateAttributes.JSON_PROPERTY_NOTIFICATION_TYPE + GovernanceControlUpdateAttributes.JSON_PROPERTY_MITIGATION_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -46,18 +42,6 @@ public class GovernanceControlUpdateAttributes { public static final String JSON_PROPERTY_MITIGATION_TYPE = "mitigation_type"; private String mitigationType; - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - public static final String JSON_PROPERTY_NOTIFICATION_FREQUENCY = "notification_frequency"; - private String notificationFrequency; - - public static final String JSON_PROPERTY_NOTIFICATION_PARAMETERS = "notification_parameters"; - private Map notificationParameters = null; - - public static final String JSON_PROPERTY_NOTIFICATION_TYPE = "notification_type"; - private String notificationType; - public GovernanceControlUpdateAttributes detectionFrequency(String detectionFrequency) { this.detectionFrequency = detectionFrequency; return this; @@ -162,100 +146,6 @@ public void setMitigationType(String mitigationType) { this.mitigationType = mitigationType; } - public GovernanceControlUpdateAttributes name(String name) { - this.name = name; - return this; - } - - /** - * A new human-readable name for the control. - * - * @return name - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public GovernanceControlUpdateAttributes notificationFrequency(String notificationFrequency) { - this.notificationFrequency = notificationFrequency; - return this; - } - - /** - * The notification frequency to configure for the control. - * - * @return notificationFrequency - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_NOTIFICATION_FREQUENCY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getNotificationFrequency() { - return notificationFrequency; - } - - public void setNotificationFrequency(String notificationFrequency) { - this.notificationFrequency = notificationFrequency; - } - - public GovernanceControlUpdateAttributes notificationParameters( - Map notificationParameters) { - this.notificationParameters = notificationParameters; - return this; - } - - public GovernanceControlUpdateAttributes putNotificationParametersItem( - String key, Object notificationParametersItem) { - if (this.notificationParameters == null) { - this.notificationParameters = new HashMap<>(); - } - this.notificationParameters.put(key, notificationParametersItem); - return this; - } - - /** - * A free-form map of parameter names to their configured values. - * - * @return notificationParameters - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_NOTIFICATION_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map getNotificationParameters() { - return notificationParameters; - } - - public void setNotificationParameters(Map notificationParameters) { - this.notificationParameters = notificationParameters; - } - - public GovernanceControlUpdateAttributes notificationType(String notificationType) { - this.notificationType = notificationType; - return this; - } - - /** - * The notification type to configure for the control. - * - * @return notificationType - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_NOTIFICATION_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getNotificationType() { - return notificationType; - } - - public void setNotificationType(String notificationType) { - this.notificationType = notificationType; - } - /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -320,12 +210,6 @@ public boolean equals(Object o) { && Objects.equals( this.mitigationParameters, governanceControlUpdateAttributes.mitigationParameters) && Objects.equals(this.mitigationType, governanceControlUpdateAttributes.mitigationType) - && Objects.equals(this.name, governanceControlUpdateAttributes.name) - && Objects.equals( - this.notificationFrequency, governanceControlUpdateAttributes.notificationFrequency) - && Objects.equals( - this.notificationParameters, governanceControlUpdateAttributes.notificationParameters) - && Objects.equals(this.notificationType, governanceControlUpdateAttributes.notificationType) && Objects.equals( this.additionalProperties, governanceControlUpdateAttributes.additionalProperties); } @@ -337,10 +221,6 @@ public int hashCode() { detectionParameters, mitigationParameters, mitigationType, - name, - notificationFrequency, - notificationParameters, - notificationType, additionalProperties); } @@ -356,14 +236,6 @@ public String toString() { .append(toIndentedString(mitigationParameters)) .append("\n"); sb.append(" mitigationType: ").append(toIndentedString(mitigationType)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" notificationFrequency: ") - .append(toIndentedString(notificationFrequency)) - .append("\n"); - sb.append(" notificationParameters: ") - .append(toIndentedString(notificationParameters)) - .append("\n"); - sb.append(" notificationType: ").append(toIndentedString(notificationType)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateData.java index a8b7568b978..47b34c9d4b0 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlUpdateData.java @@ -20,7 +20,6 @@ /** The data of a governance control update request. */ @JsonPropertyOrder({ GovernanceControlUpdateData.JSON_PROPERTY_ATTRIBUTES, - GovernanceControlUpdateData.JSON_PROPERTY_ID, GovernanceControlUpdateData.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( @@ -30,9 +29,6 @@ public class GovernanceControlUpdateData { public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; private GovernanceControlUpdateAttributes attributes; - public static final String JSON_PROPERTY_ID = "id"; - private String id; - public static final String JSON_PROPERTY_TYPE = "type"; private GovernanceControlResourceType type; @@ -72,27 +68,6 @@ public void setAttributes(GovernanceControlUpdateAttributes attributes) { } } - public GovernanceControlUpdateData id(String id) { - this.id = id; - return this; - } - - /** - * The unique identifier of the control. - * - * @return id - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - public GovernanceControlUpdateData type(GovernanceControlResourceType type) { this.type = type; this.unparsed |= !type.isValid(); @@ -174,7 +149,6 @@ public boolean equals(Object o) { } GovernanceControlUpdateData governanceControlUpdateData = (GovernanceControlUpdateData) o; return Objects.equals(this.attributes, governanceControlUpdateData.attributes) - && Objects.equals(this.id, governanceControlUpdateData.id) && Objects.equals(this.type, governanceControlUpdateData.type) && Objects.equals( this.additionalProperties, governanceControlUpdateData.additionalProperties); @@ -182,7 +156,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(attributes, id, type, additionalProperties); + return Objects.hash(attributes, type, additionalProperties); } @Override @@ -190,7 +164,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GovernanceControlUpdateData {\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightAttributes.java index 293f09f38e0..ede3d2bee7b 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightAttributes.java @@ -17,26 +17,25 @@ import java.util.Map; import java.util.Objects; -/** The attributes of a governance insight. */ +/** + * The attributes of a governance insight. Exactly one of metric_query, + * event_query, usage_query, audit_query, or percentage_query + * is populated, depending on the data source the insight is computed from; the rest are + * null. + */ @JsonPropertyOrder({ GovernanceInsightAttributes.JSON_PROPERTY_AUDIT_QUERY, - GovernanceInsightAttributes.JSON_PROPERTY_BEST_PRACTICE, - GovernanceInsightAttributes.JSON_PROPERTY_DEEP_LINK, GovernanceInsightAttributes.JSON_PROPERTY_DESCRIPTION, GovernanceInsightAttributes.JSON_PROPERTY_DISPLAY_NAME, GovernanceInsightAttributes.JSON_PROPERTY_EVENT_QUERY, GovernanceInsightAttributes.JSON_PROPERTY_METRIC_QUERY, - GovernanceInsightAttributes.JSON_PROPERTY_OLD_VALUE, GovernanceInsightAttributes.JSON_PROPERTY_PERCENTAGE_QUERY, GovernanceInsightAttributes.JSON_PROPERTY_PRODUCT, GovernanceInsightAttributes.JSON_PROPERTY_QUERY_CONFIG, - GovernanceInsightAttributes.JSON_PROPERTY_SORT_ORDER, - GovernanceInsightAttributes.JSON_PROPERTY_STATE, GovernanceInsightAttributes.JSON_PROPERTY_SUB_PRODUCT, GovernanceInsightAttributes.JSON_PROPERTY_TIME_RANGE, GovernanceInsightAttributes.JSON_PROPERTY_UNIT_NAME, - GovernanceInsightAttributes.JSON_PROPERTY_USAGE_QUERY, - GovernanceInsightAttributes.JSON_PROPERTY_VALUE + GovernanceInsightAttributes.JSON_PROPERTY_USAGE_QUERY }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -45,12 +44,6 @@ public class GovernanceInsightAttributes { public static final String JSON_PROPERTY_AUDIT_QUERY = "audit_query"; private GovernanceInsightAuditQuery auditQuery; - public static final String JSON_PROPERTY_BEST_PRACTICE = "best_practice"; - private GovernanceBestPracticeDefinition bestPractice; - - public static final String JSON_PROPERTY_DEEP_LINK = "deep_link"; - private String deepLink; - public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; @@ -63,9 +56,6 @@ public class GovernanceInsightAttributes { public static final String JSON_PROPERTY_METRIC_QUERY = "metric_query"; private GovernanceInsightMetricQuery metricQuery; - public static final String JSON_PROPERTY_OLD_VALUE = "old_value"; - private Double oldValue; - public static final String JSON_PROPERTY_PERCENTAGE_QUERY = "percentage_query"; private GovernanceInsightPercentageQuery percentageQuery; @@ -75,12 +65,6 @@ public class GovernanceInsightAttributes { public static final String JSON_PROPERTY_QUERY_CONFIG = "query_config"; private GovernanceInsightQueryConfig queryConfig; - public static final String JSON_PROPERTY_SORT_ORDER = "sort_order"; - private Long sortOrder; - - public static final String JSON_PROPERTY_STATE = "state"; - private String state; - public static final String JSON_PROPERTY_SUB_PRODUCT = "sub_product"; private String subProduct; @@ -93,59 +77,22 @@ public class GovernanceInsightAttributes { public static final String JSON_PROPERTY_USAGE_QUERY = "usage_query"; private GovernanceInsightUsageQuery usageQuery; - public static final String JSON_PROPERTY_VALUE = "value"; - private Double value; - public GovernanceInsightAttributes() {} @JsonCreator public GovernanceInsightAttributes( - @JsonProperty(required = true, value = JSON_PROPERTY_AUDIT_QUERY) - GovernanceInsightAuditQuery auditQuery, - @JsonProperty(required = true, value = JSON_PROPERTY_BEST_PRACTICE) - GovernanceBestPracticeDefinition bestPractice, - @JsonProperty(required = true, value = JSON_PROPERTY_DEEP_LINK) String deepLink, @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_NAME) String displayName, - @JsonProperty(required = true, value = JSON_PROPERTY_EVENT_QUERY) - GovernanceInsightEventQuery eventQuery, - @JsonProperty(required = true, value = JSON_PROPERTY_METRIC_QUERY) - GovernanceInsightMetricQuery metricQuery, - @JsonProperty(required = true, value = JSON_PROPERTY_OLD_VALUE) Double oldValue, - @JsonProperty(required = true, value = JSON_PROPERTY_PERCENTAGE_QUERY) - GovernanceInsightPercentageQuery percentageQuery, @JsonProperty(required = true, value = JSON_PROPERTY_PRODUCT) String product, - @JsonProperty(required = true, value = JSON_PROPERTY_STATE) String state, @JsonProperty(required = true, value = JSON_PROPERTY_SUB_PRODUCT) String subProduct, @JsonProperty(required = true, value = JSON_PROPERTY_TIME_RANGE) String timeRange, - @JsonProperty(required = true, value = JSON_PROPERTY_UNIT_NAME) String unitName, - @JsonProperty(required = true, value = JSON_PROPERTY_USAGE_QUERY) - GovernanceInsightUsageQuery usageQuery, - @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) Double value) { - this.auditQuery = auditQuery; - this.unparsed |= auditQuery.unparsed; - this.bestPractice = bestPractice; - this.unparsed |= bestPractice.unparsed; - this.deepLink = deepLink; + @JsonProperty(required = true, value = JSON_PROPERTY_UNIT_NAME) String unitName) { this.description = description; this.displayName = displayName; - this.eventQuery = eventQuery; - this.unparsed |= eventQuery.unparsed; - this.metricQuery = metricQuery; - this.unparsed |= metricQuery.unparsed; - this.oldValue = oldValue; - if (oldValue != null) {} - this.percentageQuery = percentageQuery; - this.unparsed |= percentageQuery.unparsed; this.product = product; - this.state = state; this.subProduct = subProduct; this.timeRange = timeRange; this.unitName = unitName; - this.usageQuery = usageQuery; - this.unparsed |= usageQuery.unparsed; - this.value = value; - if (value != null) {} } public GovernanceInsightAttributes auditQuery(GovernanceInsightAuditQuery auditQuery) { @@ -159,8 +106,9 @@ public GovernanceInsightAttributes auditQuery(GovernanceInsightAuditQuery auditQ * * @return auditQuery */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_AUDIT_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public GovernanceInsightAuditQuery getAuditQuery() { return auditQuery; } @@ -172,51 +120,6 @@ public void setAuditQuery(GovernanceInsightAuditQuery auditQuery) { } } - public GovernanceInsightAttributes bestPractice(GovernanceBestPracticeDefinition bestPractice) { - this.bestPractice = bestPractice; - this.unparsed |= bestPractice.unparsed; - return this; - } - - /** - * The best practice associated with an insight. Populated with the first active best practice - * matched to the insight; null when no best practice is attached. - * - * @return bestPractice - */ - @JsonProperty(JSON_PROPERTY_BEST_PRACTICE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public GovernanceBestPracticeDefinition getBestPractice() { - return bestPractice; - } - - public void setBestPractice(GovernanceBestPracticeDefinition bestPractice) { - this.bestPractice = bestPractice; - if (bestPractice != null) { - this.unparsed |= bestPractice.unparsed; - } - } - - public GovernanceInsightAttributes deepLink(String deepLink) { - this.deepLink = deepLink; - return this; - } - - /** - * A relative link to the product surface where the insight can be acted upon. - * - * @return deepLink - */ - @JsonProperty(JSON_PROPERTY_DEEP_LINK) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getDeepLink() { - return deepLink; - } - - public void setDeepLink(String deepLink) { - this.deepLink = deepLink; - } - public GovernanceInsightAttributes description(String description) { this.description = description; return this; @@ -268,8 +171,9 @@ public GovernanceInsightAttributes eventQuery(GovernanceInsightEventQuery eventQ * * @return eventQuery */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_EVENT_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public GovernanceInsightEventQuery getEventQuery() { return eventQuery; } @@ -292,8 +196,9 @@ public GovernanceInsightAttributes metricQuery(GovernanceInsightMetricQuery metr * * @return metricQuery */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_METRIC_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public GovernanceInsightMetricQuery getMetricQuery() { return metricQuery; } @@ -305,29 +210,6 @@ public void setMetricQuery(GovernanceInsightMetricQuery metricQuery) { } } - public GovernanceInsightAttributes oldValue(Double oldValue) { - this.oldValue = oldValue; - if (oldValue != null) {} - return this; - } - - /** - * The value of the insight over the previous comparison window. null when values - * were not requested or could not be computed. - * - * @return oldValue - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_OLD_VALUE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Double getOldValue() { - return oldValue; - } - - public void setOldValue(Double oldValue) { - this.oldValue = oldValue; - } - public GovernanceInsightAttributes percentageQuery( GovernanceInsightPercentageQuery percentageQuery) { this.percentageQuery = percentageQuery; @@ -340,8 +222,9 @@ public GovernanceInsightAttributes percentageQuery( * * @return percentageQuery */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_PERCENTAGE_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public GovernanceInsightPercentageQuery getPercentageQuery() { return percentageQuery; } @@ -398,48 +281,6 @@ public void setQueryConfig(GovernanceInsightQueryConfig queryConfig) { } } - public GovernanceInsightAttributes sortOrder(Long sortOrder) { - this.sortOrder = sortOrder; - return this; - } - - /** - * The relative order in which the insight should be displayed. - * - * @return sortOrder - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_SORT_ORDER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getSortOrder() { - return sortOrder; - } - - public void setSortOrder(Long sortOrder) { - this.sortOrder = sortOrder; - } - - public GovernanceInsightAttributes state(String state) { - this.state = state; - return this; - } - - /** - * The state of the insight. A critical insight receives extra UI treatment to draw - * attention to it. - * - * @return state - */ - @JsonProperty(JSON_PROPERTY_STATE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - public GovernanceInsightAttributes subProduct(String subProduct) { this.subProduct = subProduct; return this; @@ -511,8 +352,9 @@ public GovernanceInsightAttributes usageQuery(GovernanceInsightUsageQuery usageQ * * @return usageQuery */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_USAGE_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public GovernanceInsightUsageQuery getUsageQuery() { return usageQuery; } @@ -524,29 +366,6 @@ public void setUsageQuery(GovernanceInsightUsageQuery usageQuery) { } } - public GovernanceInsightAttributes value(Double value) { - this.value = value; - if (value != null) {} - return this; - } - - /** - * The current value of the insight. null when values were not requested or could not - * be computed. - * - * @return value - */ - @jakarta.annotation.Nullable - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Double getValue() { - return value; - } - - public void setValue(Double value) { - this.value = value; - } - /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -604,23 +423,17 @@ public boolean equals(Object o) { } GovernanceInsightAttributes governanceInsightAttributes = (GovernanceInsightAttributes) o; return Objects.equals(this.auditQuery, governanceInsightAttributes.auditQuery) - && Objects.equals(this.bestPractice, governanceInsightAttributes.bestPractice) - && Objects.equals(this.deepLink, governanceInsightAttributes.deepLink) && Objects.equals(this.description, governanceInsightAttributes.description) && Objects.equals(this.displayName, governanceInsightAttributes.displayName) && Objects.equals(this.eventQuery, governanceInsightAttributes.eventQuery) && Objects.equals(this.metricQuery, governanceInsightAttributes.metricQuery) - && Objects.equals(this.oldValue, governanceInsightAttributes.oldValue) && Objects.equals(this.percentageQuery, governanceInsightAttributes.percentageQuery) && Objects.equals(this.product, governanceInsightAttributes.product) && Objects.equals(this.queryConfig, governanceInsightAttributes.queryConfig) - && Objects.equals(this.sortOrder, governanceInsightAttributes.sortOrder) - && Objects.equals(this.state, governanceInsightAttributes.state) && Objects.equals(this.subProduct, governanceInsightAttributes.subProduct) && Objects.equals(this.timeRange, governanceInsightAttributes.timeRange) && Objects.equals(this.unitName, governanceInsightAttributes.unitName) && Objects.equals(this.usageQuery, governanceInsightAttributes.usageQuery) - && Objects.equals(this.value, governanceInsightAttributes.value) && Objects.equals( this.additionalProperties, governanceInsightAttributes.additionalProperties); } @@ -629,23 +442,17 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash( auditQuery, - bestPractice, - deepLink, description, displayName, eventQuery, metricQuery, - oldValue, percentageQuery, product, queryConfig, - sortOrder, - state, subProduct, timeRange, unitName, usageQuery, - value, additionalProperties); } @@ -654,23 +461,17 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GovernanceInsightAttributes {\n"); sb.append(" auditQuery: ").append(toIndentedString(auditQuery)).append("\n"); - sb.append(" bestPractice: ").append(toIndentedString(bestPractice)).append("\n"); - sb.append(" deepLink: ").append(toIndentedString(deepLink)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" eventQuery: ").append(toIndentedString(eventQuery)).append("\n"); sb.append(" metricQuery: ").append(toIndentedString(metricQuery)).append("\n"); - sb.append(" oldValue: ").append(toIndentedString(oldValue)).append("\n"); sb.append(" percentageQuery: ").append(toIndentedString(percentageQuery)).append("\n"); sb.append(" product: ").append(toIndentedString(product)).append("\n"); sb.append(" queryConfig: ").append(toIndentedString(queryConfig)).append("\n"); - sb.append(" sortOrder: ").append(toIndentedString(sortOrder)).append("\n"); - sb.append(" state: ").append(toIndentedString(state)).append("\n"); sb.append(" subProduct: ").append(toIndentedString(subProduct)).append("\n"); sb.append(" timeRange: ").append(toIndentedString(timeRange)).append("\n"); sb.append(" unitName: ").append(toIndentedString(unitName)).append("\n"); sb.append(" usageQuery: ").append(toIndentedString(usageQuery)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightData.java index 482fc1d0421..5ed63a63843 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightData.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightData.java @@ -59,7 +59,10 @@ public GovernanceInsightData attributes(GovernanceInsightAttributes attributes) } /** - * The attributes of a governance insight. + * The attributes of a governance insight. Exactly one of metric_query, + * event_query, usage_query, audit_query, or + * percentage_query is populated, depending on the data source the insight is computed + * from; the rest are null. * * @return attributes */ diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightDirectionality.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightDirectionality.java new file mode 100644 index 00000000000..f2ffade31df --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightDirectionality.java @@ -0,0 +1,62 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Whether an increase in the insight's value is good, bad, or neutral. */ +@JsonSerialize( + using = GovernanceInsightDirectionality.GovernanceInsightDirectionalitySerializer.class) +public class GovernanceInsightDirectionality extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("neutral", "increase_better", "decrease_better")); + + public static final GovernanceInsightDirectionality NEUTRAL = + new GovernanceInsightDirectionality("neutral"); + public static final GovernanceInsightDirectionality INCREASE_BETTER = + new GovernanceInsightDirectionality("increase_better"); + public static final GovernanceInsightDirectionality DECREASE_BETTER = + new GovernanceInsightDirectionality("decrease_better"); + + GovernanceInsightDirectionality(String value) { + super(value, allowedValues); + } + + public static class GovernanceInsightDirectionalitySerializer + extends StdSerializer { + public GovernanceInsightDirectionalitySerializer(Class t) { + super(t); + } + + public GovernanceInsightDirectionalitySerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceInsightDirectionality value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceInsightDirectionality fromValue(String value) { + return new GovernanceInsightDirectionality(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightQueryConfig.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightQueryConfig.java index dae8784a5cd..08834dfed13 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightQueryConfig.java +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightQueryConfig.java @@ -39,7 +39,7 @@ public class GovernanceInsightQueryConfig { private Long defaultValue; public static final String JSON_PROPERTY_DIRECTIONALITY = "directionality"; - private String directionality; + private GovernanceInsightDirectionality directionality; public static final String JSON_PROPERTY_EFFECTIVE_TIME_WINDOW_DAYS = "effective_time_window_days"; @@ -83,8 +83,8 @@ public GovernanceInsightQueryConfig comparisonShift(String comparisonShift) { } /** - * The window used for the previous value comparison, for example week or month - * . + * The window used for the previous value comparison; for example, week or + * month. * * @return comparisonShift */ @@ -119,25 +119,29 @@ public void setDefaultValue(Long defaultValue) { this.defaultValue = defaultValue; } - public GovernanceInsightQueryConfig directionality(String directionality) { + public GovernanceInsightQueryConfig directionality( + GovernanceInsightDirectionality directionality) { this.directionality = directionality; + this.unparsed |= !directionality.isValid(); return this; } /** - * Whether an increase in the value is good, bad, or neutral. One of neutral, - * increase_better, or decrease_better. + * Whether an increase in the insight's value is good, bad, or neutral. * * @return directionality */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DIRECTIONALITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDirectionality() { + public GovernanceInsightDirectionality getDirectionality() { return directionality; } - public void setDirectionality(String directionality) { + public void setDirectionality(GovernanceInsightDirectionality directionality) { + if (!directionality.isValid()) { + this.unparsed = true; + } this.directionality = directionality; } diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitAttributes.java new file mode 100644 index 00000000000..d0175ae7581 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitAttributes.java @@ -0,0 +1,420 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a usage limit. */ +@JsonPropertyOrder({ + GovernanceLimitAttributes.JSON_PROPERTY_DESCRIPTION, + GovernanceLimitAttributes.JSON_PROPERTY_DISPLAY_NAME, + GovernanceLimitAttributes.JSON_PROPERTY_LIMIT_TYPE, + GovernanceLimitAttributes.JSON_PROPERTY_PRODUCT, + GovernanceLimitAttributes.JSON_PROPERTY_QUERY, + GovernanceLimitAttributes.JSON_PROPERTY_QUERY_CONFIG, + GovernanceLimitAttributes.JSON_PROPERTY_TIME_RANGE, + GovernanceLimitAttributes.JSON_PROPERTY_TIMES_HIT_LIMIT, + GovernanceLimitAttributes.JSON_PROPERTY_UNIT_NAME, + GovernanceLimitAttributes.JSON_PROPERTY_USAGE_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceLimitAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "display_name"; + private String displayName; + + public static final String JSON_PROPERTY_LIMIT_TYPE = "limit_type"; + private String limitType; + + public static final String JSON_PROPERTY_PRODUCT = "product"; + private String product; + + public static final String JSON_PROPERTY_QUERY = "query"; + private GovernanceLimitQuery query; + + public static final String JSON_PROPERTY_QUERY_CONFIG = "query_config"; + private GovernanceLimitQueryConfig queryConfig; + + public static final String JSON_PROPERTY_TIME_RANGE = "time_range"; + private String timeRange; + + public static final String JSON_PROPERTY_TIMES_HIT_LIMIT = "times_hit_limit"; + private Double timesHitLimit; + + public static final String JSON_PROPERTY_UNIT_NAME = "unit_name"; + private String unitName; + + public static final String JSON_PROPERTY_USAGE_STATUS = "usage_status"; + private String usageStatus; + + public GovernanceLimitAttributes() {} + + @JsonCreator + public GovernanceLimitAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_NAME) String displayName, + @JsonProperty(required = true, value = JSON_PROPERTY_LIMIT_TYPE) String limitType, + @JsonProperty(required = true, value = JSON_PROPERTY_PRODUCT) String product, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY) GovernanceLimitQuery query, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY_CONFIG) + GovernanceLimitQueryConfig queryConfig, + @JsonProperty(required = true, value = JSON_PROPERTY_TIME_RANGE) String timeRange, + @JsonProperty(required = true, value = JSON_PROPERTY_TIMES_HIT_LIMIT) Double timesHitLimit, + @JsonProperty(required = true, value = JSON_PROPERTY_UNIT_NAME) String unitName, + @JsonProperty(required = true, value = JSON_PROPERTY_USAGE_STATUS) String usageStatus) { + this.description = description; + this.displayName = displayName; + this.limitType = limitType; + this.product = product; + this.query = query; + this.unparsed |= query.unparsed; + this.queryConfig = queryConfig; + this.unparsed |= queryConfig.unparsed; + this.timeRange = timeRange; + this.timesHitLimit = timesHitLimit; + this.unitName = unitName; + this.usageStatus = usageStatus; + } + + public GovernanceLimitAttributes description(String description) { + this.description = description; + return this; + } + + /** + * A description of what the limit measures. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public GovernanceLimitAttributes displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The human-readable name of the limit. + * + * @return displayName + */ + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public GovernanceLimitAttributes limitType(String limitType) { + this.limitType = limitType; + return this; + } + + /** + * The type of limit, such as a rate limit or a usage limit. + * + * @return limitType + */ + @JsonProperty(JSON_PROPERTY_LIMIT_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getLimitType() { + return limitType; + } + + public void setLimitType(String limitType) { + this.limitType = limitType; + } + + public GovernanceLimitAttributes product(String product) { + this.product = product; + return this; + } + + /** + * The Datadog product the limit belongs to. + * + * @return product + */ + @JsonProperty(JSON_PROPERTY_PRODUCT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProduct() { + return product; + } + + public void setProduct(String product) { + this.product = product; + } + + public GovernanceLimitAttributes query(GovernanceLimitQuery query) { + this.query = query; + this.unparsed |= query.unparsed; + return this; + } + + /** + * A metric query used to compute usage against a limit. + * + * @return query + */ + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceLimitQuery getQuery() { + return query; + } + + public void setQuery(GovernanceLimitQuery query) { + this.query = query; + if (query != null) { + this.unparsed |= query.unparsed; + } + } + + public GovernanceLimitAttributes queryConfig(GovernanceLimitQueryConfig queryConfig) { + this.queryConfig = queryConfig; + this.unparsed |= queryConfig.unparsed; + return this; + } + + /** + * The query execution context used to visualize a limit and its usage. + * + * @return queryConfig + */ + @JsonProperty(JSON_PROPERTY_QUERY_CONFIG) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceLimitQueryConfig getQueryConfig() { + return queryConfig; + } + + public void setQueryConfig(GovernanceLimitQueryConfig queryConfig) { + this.queryConfig = queryConfig; + if (queryConfig != null) { + this.unparsed |= queryConfig.unparsed; + } + } + + public GovernanceLimitAttributes timeRange(String timeRange) { + this.timeRange = timeRange; + return this; + } + + /** + * The time range over which usage against the limit is measured. + * + * @return timeRange + */ + @JsonProperty(JSON_PROPERTY_TIME_RANGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTimeRange() { + return timeRange; + } + + public void setTimeRange(String timeRange) { + this.timeRange = timeRange; + } + + public GovernanceLimitAttributes timesHitLimit(Double timesHitLimit) { + this.timesHitLimit = timesHitLimit; + return this; + } + + /** + * The number of times usage has reached the limit within the measured time range. + * + * @return timesHitLimit + */ + @JsonProperty(JSON_PROPERTY_TIMES_HIT_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getTimesHitLimit() { + return timesHitLimit; + } + + public void setTimesHitLimit(Double timesHitLimit) { + this.timesHitLimit = timesHitLimit; + } + + public GovernanceLimitAttributes unitName(String unitName) { + this.unitName = unitName; + return this; + } + + /** + * The unit in which the limit and its usage are measured. + * + * @return unitName + */ + @JsonProperty(JSON_PROPERTY_UNIT_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUnitName() { + return unitName; + } + + public void setUnitName(String unitName) { + this.unitName = unitName; + } + + public GovernanceLimitAttributes usageStatus(String usageStatus) { + this.usageStatus = usageStatus; + return this; + } + + /** + * The current usage status of the limit relative to its threshold. + * + * @return usageStatus + */ + @JsonProperty(JSON_PROPERTY_USAGE_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUsageStatus() { + return usageStatus; + } + + public void setUsageStatus(String usageStatus) { + this.usageStatus = usageStatus; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceLimitAttributes + */ + @JsonAnySetter + public GovernanceLimitAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceLimitAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceLimitAttributes governanceLimitAttributes = (GovernanceLimitAttributes) o; + return Objects.equals(this.description, governanceLimitAttributes.description) + && Objects.equals(this.displayName, governanceLimitAttributes.displayName) + && Objects.equals(this.limitType, governanceLimitAttributes.limitType) + && Objects.equals(this.product, governanceLimitAttributes.product) + && Objects.equals(this.query, governanceLimitAttributes.query) + && Objects.equals(this.queryConfig, governanceLimitAttributes.queryConfig) + && Objects.equals(this.timeRange, governanceLimitAttributes.timeRange) + && Objects.equals(this.timesHitLimit, governanceLimitAttributes.timesHitLimit) + && Objects.equals(this.unitName, governanceLimitAttributes.unitName) + && Objects.equals(this.usageStatus, governanceLimitAttributes.usageStatus) + && Objects.equals( + this.additionalProperties, governanceLimitAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + description, + displayName, + limitType, + product, + query, + queryConfig, + timeRange, + timesHitLimit, + unitName, + usageStatus, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceLimitAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" limitType: ").append(toIndentedString(limitType)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryConfig: ").append(toIndentedString(queryConfig)).append("\n"); + sb.append(" timeRange: ").append(toIndentedString(timeRange)).append("\n"); + sb.append(" timesHitLimit: ").append(toIndentedString(timesHitLimit)).append("\n"); + sb.append(" unitName: ").append(toIndentedString(unitName)).append("\n"); + sb.append(" usageStatus: ").append(toIndentedString(usageStatus)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitData.java new file mode 100644 index 00000000000..bd9acd2f350 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitData.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A usage limit resource. */ +@JsonPropertyOrder({ + GovernanceLimitData.JSON_PROPERTY_ATTRIBUTES, + GovernanceLimitData.JSON_PROPERTY_ID, + GovernanceLimitData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceLimitData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceLimitAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceLimitResourceType type; + + public GovernanceLimitData() {} + + @JsonCreator + public GovernanceLimitData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GovernanceLimitAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GovernanceLimitResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceLimitData attributes(GovernanceLimitAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a usage limit. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceLimitAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceLimitAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceLimitData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the limit. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GovernanceLimitData type(GovernanceLimitResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Limit resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceLimitResourceType getType() { + return type; + } + + public void setType(GovernanceLimitResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceLimitData + */ + @JsonAnySetter + public GovernanceLimitData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceLimitData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceLimitData governanceLimitData = (GovernanceLimitData) o; + return Objects.equals(this.attributes, governanceLimitData.attributes) + && Objects.equals(this.id, governanceLimitData.id) + && Objects.equals(this.type, governanceLimitData.type) + && Objects.equals(this.additionalProperties, governanceLimitData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceLimitData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQuery.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQuery.java new file mode 100644 index 00000000000..54a8ada5d2b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQuery.java @@ -0,0 +1,201 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A metric query used to compute usage against a limit. */ +@JsonPropertyOrder({ + GovernanceLimitQuery.JSON_PROPERTY_QUERY, + GovernanceLimitQuery.JSON_PROPERTY_REDUCER, + GovernanceLimitQuery.JSON_PROPERTY_SOURCE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceLimitQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_QUERY = "query"; + private String query; + + public static final String JSON_PROPERTY_REDUCER = "reducer"; + private String reducer; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private String source; + + public GovernanceLimitQuery() {} + + @JsonCreator + public GovernanceLimitQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY) String query, + @JsonProperty(required = true, value = JSON_PROPERTY_REDUCER) String reducer, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCE) String source) { + this.query = query; + this.reducer = reducer; + this.source = source; + } + + public GovernanceLimitQuery query(String query) { + this.query = query; + return this; + } + + /** + * The metric query expression used to compute the limit value. + * + * @return query + */ + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public GovernanceLimitQuery reducer(String reducer) { + this.reducer = reducer; + return this; + } + + /** + * How the query results are aggregated into a single value (for example, sum, max, or avg). + * + * @return reducer + */ + @JsonProperty(JSON_PROPERTY_REDUCER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getReducer() { + return reducer; + } + + public void setReducer(String reducer) { + this.reducer = reducer; + } + + public GovernanceLimitQuery source(String source) { + this.source = source; + return this; + } + + /** + * The data source used to evaluate the metric query (for example, the metrics or events backend). + * + * @return source + */ + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceLimitQuery + */ + @JsonAnySetter + public GovernanceLimitQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceLimitQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceLimitQuery governanceLimitQuery = (GovernanceLimitQuery) o; + return Objects.equals(this.query, governanceLimitQuery.query) + && Objects.equals(this.reducer, governanceLimitQuery.reducer) + && Objects.equals(this.source, governanceLimitQuery.source) + && Objects.equals(this.additionalProperties, governanceLimitQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(query, reducer, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceLimitQuery {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" reducer: ").append(toIndentedString(reducer)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQueryConfig.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQueryConfig.java new file mode 100644 index 00000000000..3d87779be32 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitQueryConfig.java @@ -0,0 +1,257 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The query execution context used to visualize a limit and its usage. */ +@JsonPropertyOrder({ + GovernanceLimitQueryConfig.JSON_PROPERTY_CHART_TYPE, + GovernanceLimitQueryConfig.JSON_PROPERTY_COMPARISON_SHIFT, + GovernanceLimitQueryConfig.JSON_PROPERTY_DEFAULT_VALUE, + GovernanceLimitQueryConfig.JSON_PROPERTY_DIRECTIONALITY, + GovernanceLimitQueryConfig.JSON_PROPERTY_EFFECTIVE_TIME_WINDOW_DAYS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceLimitQueryConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHART_TYPE = "chart_type"; + private String chartType; + + public static final String JSON_PROPERTY_COMPARISON_SHIFT = "comparison_shift"; + private String comparisonShift; + + public static final String JSON_PROPERTY_DEFAULT_VALUE = "default_value"; + private Long defaultValue; + + public static final String JSON_PROPERTY_DIRECTIONALITY = "directionality"; + private String directionality; + + public static final String JSON_PROPERTY_EFFECTIVE_TIME_WINDOW_DAYS = + "effective_time_window_days"; + private Long effectiveTimeWindowDays; + + public GovernanceLimitQueryConfig chartType(String chartType) { + this.chartType = chartType; + return this; + } + + /** + * The chart type used to visualize the limit and its usage. + * + * @return chartType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHART_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getChartType() { + return chartType; + } + + public void setChartType(String chartType) { + this.chartType = chartType; + } + + public GovernanceLimitQueryConfig comparisonShift(String comparisonShift) { + this.comparisonShift = comparisonShift; + return this; + } + + /** + * The time shift applied to compare current usage against a prior period. + * + * @return comparisonShift + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPARISON_SHIFT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getComparisonShift() { + return comparisonShift; + } + + public void setComparisonShift(String comparisonShift) { + this.comparisonShift = comparisonShift; + } + + public GovernanceLimitQueryConfig defaultValue(Long defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * The default value used for the limit when no explicit value is configured. + * + * @return defaultValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Long defaultValue) { + this.defaultValue = defaultValue; + } + + public GovernanceLimitQueryConfig directionality(String directionality) { + this.directionality = directionality; + return this; + } + + /** + * The direction in which usage approaches the limit, indicating whether higher or lower values + * are closer to the limit. + * + * @return directionality + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DIRECTIONALITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDirectionality() { + return directionality; + } + + public void setDirectionality(String directionality) { + this.directionality = directionality; + } + + public GovernanceLimitQueryConfig effectiveTimeWindowDays(Long effectiveTimeWindowDays) { + this.effectiveTimeWindowDays = effectiveTimeWindowDays; + return this; + } + + /** + * The number of days of data the limit query evaluates over. + * + * @return effectiveTimeWindowDays + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EFFECTIVE_TIME_WINDOW_DAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEffectiveTimeWindowDays() { + return effectiveTimeWindowDays; + } + + public void setEffectiveTimeWindowDays(Long effectiveTimeWindowDays) { + this.effectiveTimeWindowDays = effectiveTimeWindowDays; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceLimitQueryConfig + */ + @JsonAnySetter + public GovernanceLimitQueryConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceLimitQueryConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceLimitQueryConfig governanceLimitQueryConfig = (GovernanceLimitQueryConfig) o; + return Objects.equals(this.chartType, governanceLimitQueryConfig.chartType) + && Objects.equals(this.comparisonShift, governanceLimitQueryConfig.comparisonShift) + && Objects.equals(this.defaultValue, governanceLimitQueryConfig.defaultValue) + && Objects.equals(this.directionality, governanceLimitQueryConfig.directionality) + && Objects.equals( + this.effectiveTimeWindowDays, governanceLimitQueryConfig.effectiveTimeWindowDays) + && Objects.equals( + this.additionalProperties, governanceLimitQueryConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + chartType, + comparisonShift, + defaultValue, + directionality, + effectiveTimeWindowDays, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceLimitQueryConfig {\n"); + sb.append(" chartType: ").append(toIndentedString(chartType)).append("\n"); + sb.append(" comparisonShift: ").append(toIndentedString(comparisonShift)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" directionality: ").append(toIndentedString(directionality)).append("\n"); + sb.append(" effectiveTimeWindowDays: ") + .append(toIndentedString(effectiveTimeWindowDays)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitResourceType.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitResourceType.java new file mode 100644 index 00000000000..d7d1d9fa040 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitResourceType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Limit resource type. */ +@JsonSerialize(using = GovernanceLimitResourceType.GovernanceLimitResourceTypeSerializer.class) +public class GovernanceLimitResourceType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("limit")); + + public static final GovernanceLimitResourceType LIMIT = new GovernanceLimitResourceType("limit"); + + GovernanceLimitResourceType(String value) { + super(value, allowedValues); + } + + public static class GovernanceLimitResourceTypeSerializer + extends StdSerializer { + public GovernanceLimitResourceTypeSerializer(Class t) { + super(t); + } + + public GovernanceLimitResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceLimitResourceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceLimitResourceType fromValue(String value) { + return new GovernanceLimitResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitsResponse.java new file mode 100644 index 00000000000..519d0e8785d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitsResponse.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A list of usage limits. */ +@JsonPropertyOrder({GovernanceLimitsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceLimitsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public GovernanceLimitsResponse() {} + + @JsonCreator + public GovernanceLimitsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + for (GovernanceLimitData item : data) { + this.unparsed |= item.unparsed; + } + } + + public GovernanceLimitsResponse data(List data) { + this.data = data; + for (GovernanceLimitData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GovernanceLimitsResponse addDataItem(GovernanceLimitData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * An array of usage limit resources. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (GovernanceLimitData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceLimitsResponse + */ + @JsonAnySetter + public GovernanceLimitsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceLimitsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceLimitsResponse governanceLimitsResponse = (GovernanceLimitsResponse) o; + return Objects.equals(this.data, governanceLimitsResponse.data) + && Objects.equals(this.additionalProperties, governanceLimitsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceLimitsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequest.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequest.java new file mode 100644 index 00000000000..0046f265857 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequest.java @@ -0,0 +1,150 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A request to mitigate a set of governance detections. */ +@JsonPropertyOrder({GovernanceMitigationRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceMitigationRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GovernanceMitigationRequestData data; + + public GovernanceMitigationRequest() {} + + @JsonCreator + public GovernanceMitigationRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GovernanceMitigationRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GovernanceMitigationRequest data(GovernanceMitigationRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data of a governance mitigation request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceMitigationRequestData getData() { + return data; + } + + public void setData(GovernanceMitigationRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceMitigationRequest + */ + @JsonAnySetter + public GovernanceMitigationRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceMitigationRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceMitigationRequest governanceMitigationRequest = (GovernanceMitigationRequest) o; + return Objects.equals(this.data, governanceMitigationRequest.data) + && Objects.equals( + this.additionalProperties, governanceMitigationRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceMitigationRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestAttributes.java new file mode 100644 index 00000000000..ace26dfa699 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestAttributes.java @@ -0,0 +1,245 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a governance mitigation request. */ +@JsonPropertyOrder({ + GovernanceMitigationRequestAttributes.JSON_PROPERTY_DETECTION_IDS, + GovernanceMitigationRequestAttributes.JSON_PROPERTY_DETECTION_TYPE, + GovernanceMitigationRequestAttributes.JSON_PROPERTY_MITIGATION_PARAMETERS, + GovernanceMitigationRequestAttributes.JSON_PROPERTY_MITIGATION_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceMitigationRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DETECTION_IDS = "detection_ids"; + private List detectionIds = null; + + public static final String JSON_PROPERTY_DETECTION_TYPE = "detection_type"; + private String detectionType; + + public static final String JSON_PROPERTY_MITIGATION_PARAMETERS = "mitigation_parameters"; + private Map mitigationParameters = null; + + public static final String JSON_PROPERTY_MITIGATION_TYPE = "mitigation_type"; + private String mitigationType; + + public GovernanceMitigationRequestAttributes detectionIds(List detectionIds) { + this.detectionIds = detectionIds; + return this; + } + + public GovernanceMitigationRequestAttributes addDetectionIdsItem(String detectionIdsItem) { + if (this.detectionIds == null) { + this.detectionIds = new ArrayList<>(); + } + this.detectionIds.add(detectionIdsItem); + return this; + } + + /** + * The identifiers of the detections to mitigate in this request. + * + * @return detectionIds + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETECTION_IDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDetectionIds() { + return detectionIds; + } + + public void setDetectionIds(List detectionIds) { + this.detectionIds = detectionIds; + } + + public GovernanceMitigationRequestAttributes detectionType(String detectionType) { + this.detectionType = detectionType; + return this; + } + + /** + * The detection type whose detections should be mitigated. + * + * @return detectionType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETECTION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDetectionType() { + return detectionType; + } + + public void setDetectionType(String detectionType) { + this.detectionType = detectionType; + } + + public GovernanceMitigationRequestAttributes mitigationParameters( + Map mitigationParameters) { + this.mitigationParameters = mitigationParameters; + return this; + } + + public GovernanceMitigationRequestAttributes putMitigationParametersItem( + String key, Object mitigationParametersItem) { + if (this.mitigationParameters == null) { + this.mitigationParameters = new HashMap<>(); + } + this.mitigationParameters.put(key, mitigationParametersItem); + return this; + } + + /** + * A free-form map of parameter names to their configured values. + * + * @return mitigationParameters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MITIGATION_PARAMETERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMitigationParameters() { + return mitigationParameters; + } + + public void setMitigationParameters(Map mitigationParameters) { + this.mitigationParameters = mitigationParameters; + } + + public GovernanceMitigationRequestAttributes mitigationType(String mitigationType) { + this.mitigationType = mitigationType; + return this; + } + + /** + * The mitigation to apply to the selected detections. Defaults to the control's configured + * mitigation when omitted. + * + * @return mitigationType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MITIGATION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMitigationType() { + return mitigationType; + } + + public void setMitigationType(String mitigationType) { + this.mitigationType = mitigationType; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceMitigationRequestAttributes + */ + @JsonAnySetter + public GovernanceMitigationRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceMitigationRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceMitigationRequestAttributes governanceMitigationRequestAttributes = + (GovernanceMitigationRequestAttributes) o; + return Objects.equals(this.detectionIds, governanceMitigationRequestAttributes.detectionIds) + && Objects.equals(this.detectionType, governanceMitigationRequestAttributes.detectionType) + && Objects.equals( + this.mitigationParameters, governanceMitigationRequestAttributes.mitigationParameters) + && Objects.equals(this.mitigationType, governanceMitigationRequestAttributes.mitigationType) + && Objects.equals( + this.additionalProperties, governanceMitigationRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + detectionIds, detectionType, mitigationParameters, mitigationType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceMitigationRequestAttributes {\n"); + sb.append(" detectionIds: ").append(toIndentedString(detectionIds)).append("\n"); + sb.append(" detectionType: ").append(toIndentedString(detectionType)).append("\n"); + sb.append(" mitigationParameters: ") + .append(toIndentedString(mitigationParameters)) + .append("\n"); + sb.append(" mitigationType: ").append(toIndentedString(mitigationType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestData.java new file mode 100644 index 00000000000..36e513fef49 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestData.java @@ -0,0 +1,185 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data of a governance mitigation request. */ +@JsonPropertyOrder({ + GovernanceMitigationRequestData.JSON_PROPERTY_ATTRIBUTES, + GovernanceMitigationRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceMitigationRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceMitigationRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceControlDetectionResourceType type; + + public GovernanceMitigationRequestData() {} + + @JsonCreator + public GovernanceMitigationRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GovernanceControlDetectionResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceMitigationRequestData attributes( + GovernanceMitigationRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a governance mitigation request. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GovernanceMitigationRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceMitigationRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceMitigationRequestData type(GovernanceControlDetectionResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Governance control detection resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceControlDetectionResourceType getType() { + return type; + } + + public void setType(GovernanceControlDetectionResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceMitigationRequestData + */ + @JsonAnySetter + public GovernanceMitigationRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceMitigationRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceMitigationRequestData governanceMitigationRequestData = + (GovernanceMitigationRequestData) o; + return Objects.equals(this.attributes, governanceMitigationRequestData.attributes) + && Objects.equals(this.type, governanceMitigationRequestData.type) + && Objects.equals( + this.additionalProperties, governanceMitigationRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceMitigationRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsAttributes.java new file mode 100644 index 00000000000..4c3d1e8d08f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsAttributes.java @@ -0,0 +1,155 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of the organization-wide governance notification settings. */ +@JsonPropertyOrder({ + GovernanceNotificationSettingsAttributes.JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceNotificationSettingsAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED = + "assignment_notifications_enabled"; + private Boolean assignmentNotificationsEnabled; + + public GovernanceNotificationSettingsAttributes() {} + + @JsonCreator + public GovernanceNotificationSettingsAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED) + Boolean assignmentNotificationsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + } + + public GovernanceNotificationSettingsAttributes assignmentNotificationsEnabled( + Boolean assignmentNotificationsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + return this; + } + + /** + * Whether notifications are sent to users when detections are assigned to them. + * + * @return assignmentNotificationsEnabled + */ + @JsonProperty(JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAssignmentNotificationsEnabled() { + return assignmentNotificationsEnabled; + } + + public void setAssignmentNotificationsEnabled(Boolean assignmentNotificationsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceNotificationSettingsAttributes + */ + @JsonAnySetter + public GovernanceNotificationSettingsAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceNotificationSettingsAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceNotificationSettingsAttributes governanceNotificationSettingsAttributes = + (GovernanceNotificationSettingsAttributes) o; + return Objects.equals( + this.assignmentNotificationsEnabled, + governanceNotificationSettingsAttributes.assignmentNotificationsEnabled) + && Objects.equals( + this.additionalProperties, + governanceNotificationSettingsAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(assignmentNotificationsEnabled, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceNotificationSettingsAttributes {\n"); + sb.append(" assignmentNotificationsEnabled: ") + .append(toIndentedString(assignmentNotificationsEnabled)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsData.java new file mode 100644 index 00000000000..590df8c4c63 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsData.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A governance notification settings resource. */ +@JsonPropertyOrder({ + GovernanceNotificationSettingsData.JSON_PROPERTY_ATTRIBUTES, + GovernanceNotificationSettingsData.JSON_PROPERTY_ID, + GovernanceNotificationSettingsData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceNotificationSettingsData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceNotificationSettingsAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceNotificationSettingsResourceType type; + + public GovernanceNotificationSettingsData() {} + + @JsonCreator + public GovernanceNotificationSettingsData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GovernanceNotificationSettingsAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GovernanceNotificationSettingsResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceNotificationSettingsData attributes( + GovernanceNotificationSettingsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the organization-wide governance notification settings. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceNotificationSettingsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceNotificationSettingsAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceNotificationSettingsData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the organization the notification settings apply to. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GovernanceNotificationSettingsData type(GovernanceNotificationSettingsResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Governance notification settings resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceNotificationSettingsResourceType getType() { + return type; + } + + public void setType(GovernanceNotificationSettingsResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceNotificationSettingsData + */ + @JsonAnySetter + public GovernanceNotificationSettingsData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceNotificationSettingsData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceNotificationSettingsData governanceNotificationSettingsData = + (GovernanceNotificationSettingsData) o; + return Objects.equals(this.attributes, governanceNotificationSettingsData.attributes) + && Objects.equals(this.id, governanceNotificationSettingsData.id) + && Objects.equals(this.type, governanceNotificationSettingsData.type) + && Objects.equals( + this.additionalProperties, governanceNotificationSettingsData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceNotificationSettingsData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResourceType.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResourceType.java new file mode 100644 index 00000000000..fdeee916d09 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResourceType.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Governance notification settings resource type. */ +@JsonSerialize( + using = + GovernanceNotificationSettingsResourceType + .GovernanceNotificationSettingsResourceTypeSerializer.class) +public class GovernanceNotificationSettingsResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("governance_notification_settings")); + + public static final GovernanceNotificationSettingsResourceType GOVERNANCE_NOTIFICATION_SETTINGS = + new GovernanceNotificationSettingsResourceType("governance_notification_settings"); + + GovernanceNotificationSettingsResourceType(String value) { + super(value, allowedValues); + } + + public static class GovernanceNotificationSettingsResourceTypeSerializer + extends StdSerializer { + public GovernanceNotificationSettingsResourceTypeSerializer( + Class t) { + super(t); + } + + public GovernanceNotificationSettingsResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceNotificationSettingsResourceType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceNotificationSettingsResourceType fromValue(String value) { + return new GovernanceNotificationSettingsResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResponse.java new file mode 100644 index 00000000000..2c1aa4007e3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResponse.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The organization-wide governance notification settings. */ +@JsonPropertyOrder({GovernanceNotificationSettingsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceNotificationSettingsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GovernanceNotificationSettingsData data; + + public GovernanceNotificationSettingsResponse() {} + + @JsonCreator + public GovernanceNotificationSettingsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GovernanceNotificationSettingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GovernanceNotificationSettingsResponse data(GovernanceNotificationSettingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A governance notification settings resource. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceNotificationSettingsData getData() { + return data; + } + + public void setData(GovernanceNotificationSettingsData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceNotificationSettingsResponse + */ + @JsonAnySetter + public GovernanceNotificationSettingsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceNotificationSettingsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceNotificationSettingsResponse governanceNotificationSettingsResponse = + (GovernanceNotificationSettingsResponse) o; + return Objects.equals(this.data, governanceNotificationSettingsResponse.data) + && Objects.equals( + this.additionalProperties, governanceNotificationSettingsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceNotificationSettingsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateAttributes.java new file mode 100644 index 00000000000..a86a9642bd4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateAttributes.java @@ -0,0 +1,150 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * The attributes of the governance notification settings that can be updated. Only the attributes + * present in the request are modified. + */ +@JsonPropertyOrder({ + GovernanceNotificationSettingsUpdateAttributes.JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceNotificationSettingsUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED = + "assignment_notifications_enabled"; + private Boolean assignmentNotificationsEnabled; + + public GovernanceNotificationSettingsUpdateAttributes assignmentNotificationsEnabled( + Boolean assignmentNotificationsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + return this; + } + + /** + * Whether notifications are sent to users when detections are assigned to them. + * + * @return assignmentNotificationsEnabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getAssignmentNotificationsEnabled() { + return assignmentNotificationsEnabled; + } + + public void setAssignmentNotificationsEnabled(Boolean assignmentNotificationsEnabled) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceNotificationSettingsUpdateAttributes + */ + @JsonAnySetter + public GovernanceNotificationSettingsUpdateAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceNotificationSettingsUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceNotificationSettingsUpdateAttributes governanceNotificationSettingsUpdateAttributes = + (GovernanceNotificationSettingsUpdateAttributes) o; + return Objects.equals( + this.assignmentNotificationsEnabled, + governanceNotificationSettingsUpdateAttributes.assignmentNotificationsEnabled) + && Objects.equals( + this.additionalProperties, + governanceNotificationSettingsUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(assignmentNotificationsEnabled, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceNotificationSettingsUpdateAttributes {\n"); + sb.append(" assignmentNotificationsEnabled: ") + .append(toIndentedString(assignmentNotificationsEnabled)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateData.java new file mode 100644 index 00000000000..993fafaeeef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateData.java @@ -0,0 +1,188 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The data of a governance notification settings update request. */ +@JsonPropertyOrder({ + GovernanceNotificationSettingsUpdateData.JSON_PROPERTY_ATTRIBUTES, + GovernanceNotificationSettingsUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceNotificationSettingsUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceNotificationSettingsUpdateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceNotificationSettingsResourceType type; + + public GovernanceNotificationSettingsUpdateData() {} + + @JsonCreator + public GovernanceNotificationSettingsUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GovernanceNotificationSettingsResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceNotificationSettingsUpdateData attributes( + GovernanceNotificationSettingsUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the governance notification settings that can be updated. Only the attributes + * present in the request are modified. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GovernanceNotificationSettingsUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceNotificationSettingsUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceNotificationSettingsUpdateData type( + GovernanceNotificationSettingsResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Governance notification settings resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceNotificationSettingsResourceType getType() { + return type; + } + + public void setType(GovernanceNotificationSettingsResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceNotificationSettingsUpdateData + */ + @JsonAnySetter + public GovernanceNotificationSettingsUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceNotificationSettingsUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceNotificationSettingsUpdateData governanceNotificationSettingsUpdateData = + (GovernanceNotificationSettingsUpdateData) o; + return Objects.equals(this.attributes, governanceNotificationSettingsUpdateData.attributes) + && Objects.equals(this.type, governanceNotificationSettingsUpdateData.type) + && Objects.equals( + this.additionalProperties, + governanceNotificationSettingsUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceNotificationSettingsUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateRequest.java new file mode 100644 index 00000000000..3921f6f5d92 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateRequest.java @@ -0,0 +1,154 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A request to update the organization-wide governance notification settings. */ +@JsonPropertyOrder({GovernanceNotificationSettingsUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceNotificationSettingsUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GovernanceNotificationSettingsUpdateData data; + + public GovernanceNotificationSettingsUpdateRequest() {} + + @JsonCreator + public GovernanceNotificationSettingsUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GovernanceNotificationSettingsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GovernanceNotificationSettingsUpdateRequest data( + GovernanceNotificationSettingsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data of a governance notification settings update request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceNotificationSettingsUpdateData getData() { + return data; + } + + public void setData(GovernanceNotificationSettingsUpdateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceNotificationSettingsUpdateRequest + */ + @JsonAnySetter + public GovernanceNotificationSettingsUpdateRequest putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceNotificationSettingsUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceNotificationSettingsUpdateRequest governanceNotificationSettingsUpdateRequest = + (GovernanceNotificationSettingsUpdateRequest) o; + return Objects.equals(this.data, governanceNotificationSettingsUpdateRequest.data) + && Objects.equals( + this.additionalProperties, + governanceNotificationSettingsUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceNotificationSettingsUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitAttributes.java new file mode 100644 index 00000000000..c6b8b67695c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitAttributes.java @@ -0,0 +1,520 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a governance resource limit. */ +@JsonPropertyOrder({ + GovernanceResourceLimitAttributes.JSON_PROPERTY_CURRENT_LIMIT, + GovernanceResourceLimitAttributes.JSON_PROPERTY_CURRENT_VALUE, + GovernanceResourceLimitAttributes.JSON_PROPERTY_DEFAULT_CURRENT_VALUE, + GovernanceResourceLimitAttributes.JSON_PROPERTY_DEFAULT_LIMIT_VALUE, + GovernanceResourceLimitAttributes.JSON_PROPERTY_DESCRIPTION, + GovernanceResourceLimitAttributes.JSON_PROPERTY_DISPLAY_NAME, + GovernanceResourceLimitAttributes.JSON_PROPERTY_LIMIT_QUERY, + GovernanceResourceLimitAttributes.JSON_PROPERTY_PRODUCT, + GovernanceResourceLimitAttributes.JSON_PROPERTY_QUERY, + GovernanceResourceLimitAttributes.JSON_PROPERTY_QUERY_CONFIG, + GovernanceResourceLimitAttributes.JSON_PROPERTY_TIME_RANGE, + GovernanceResourceLimitAttributes.JSON_PROPERTY_UNIT_NAME, + GovernanceResourceLimitAttributes.JSON_PROPERTY_USAGE_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceResourceLimitAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CURRENT_LIMIT = "current_limit"; + private Double currentLimit; + + public static final String JSON_PROPERTY_CURRENT_VALUE = "current_value"; + private Double currentValue; + + public static final String JSON_PROPERTY_DEFAULT_CURRENT_VALUE = "default_current_value"; + private Double defaultCurrentValue; + + public static final String JSON_PROPERTY_DEFAULT_LIMIT_VALUE = "default_limit_value"; + private Double defaultLimitValue; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "display_name"; + private String displayName; + + public static final String JSON_PROPERTY_LIMIT_QUERY = "limit_query"; + private GovernanceLimitQuery limitQuery; + + public static final String JSON_PROPERTY_PRODUCT = "product"; + private String product; + + public static final String JSON_PROPERTY_QUERY = "query"; + private GovernanceLimitQuery query; + + public static final String JSON_PROPERTY_QUERY_CONFIG = "query_config"; + private GovernanceLimitQueryConfig queryConfig; + + public static final String JSON_PROPERTY_TIME_RANGE = "time_range"; + private String timeRange; + + public static final String JSON_PROPERTY_UNIT_NAME = "unit_name"; + private String unitName; + + public static final String JSON_PROPERTY_USAGE_STATUS = "usage_status"; + private String usageStatus; + + public GovernanceResourceLimitAttributes() {} + + @JsonCreator + public GovernanceResourceLimitAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CURRENT_LIMIT) Double currentLimit, + @JsonProperty(required = true, value = JSON_PROPERTY_CURRENT_VALUE) Double currentValue, + @JsonProperty(required = true, value = JSON_PROPERTY_DEFAULT_CURRENT_VALUE) + Double defaultCurrentValue, + @JsonProperty(required = true, value = JSON_PROPERTY_DEFAULT_LIMIT_VALUE) + Double defaultLimitValue, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_NAME) String displayName, + @JsonProperty(required = true, value = JSON_PROPERTY_LIMIT_QUERY) + GovernanceLimitQuery limitQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_PRODUCT) String product, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY) GovernanceLimitQuery query, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY_CONFIG) + GovernanceLimitQueryConfig queryConfig, + @JsonProperty(required = true, value = JSON_PROPERTY_TIME_RANGE) String timeRange, + @JsonProperty(required = true, value = JSON_PROPERTY_UNIT_NAME) String unitName, + @JsonProperty(required = true, value = JSON_PROPERTY_USAGE_STATUS) String usageStatus) { + this.currentLimit = currentLimit; + this.currentValue = currentValue; + this.defaultCurrentValue = defaultCurrentValue; + this.defaultLimitValue = defaultLimitValue; + this.description = description; + this.displayName = displayName; + this.limitQuery = limitQuery; + this.unparsed |= limitQuery.unparsed; + this.product = product; + this.query = query; + this.unparsed |= query.unparsed; + this.queryConfig = queryConfig; + this.unparsed |= queryConfig.unparsed; + this.timeRange = timeRange; + this.unitName = unitName; + this.usageStatus = usageStatus; + } + + public GovernanceResourceLimitAttributes currentLimit(Double currentLimit) { + this.currentLimit = currentLimit; + return this; + } + + /** + * The current limit configured for the resource. + * + * @return currentLimit + */ + @JsonProperty(JSON_PROPERTY_CURRENT_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getCurrentLimit() { + return currentLimit; + } + + public void setCurrentLimit(Double currentLimit) { + this.currentLimit = currentLimit; + } + + public GovernanceResourceLimitAttributes currentValue(Double currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * The current value of the resource. + * + * @return currentValue + */ + @JsonProperty(JSON_PROPERTY_CURRENT_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getCurrentValue() { + return currentValue; + } + + public void setCurrentValue(Double currentValue) { + this.currentValue = currentValue; + } + + public GovernanceResourceLimitAttributes defaultCurrentValue(Double defaultCurrentValue) { + this.defaultCurrentValue = defaultCurrentValue; + return this; + } + + /** + * The default current value used when the resource value cannot be computed from the query. + * + * @return defaultCurrentValue + */ + @JsonProperty(JSON_PROPERTY_DEFAULT_CURRENT_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getDefaultCurrentValue() { + return defaultCurrentValue; + } + + public void setDefaultCurrentValue(Double defaultCurrentValue) { + this.defaultCurrentValue = defaultCurrentValue; + } + + public GovernanceResourceLimitAttributes defaultLimitValue(Double defaultLimitValue) { + this.defaultLimitValue = defaultLimitValue; + return this; + } + + /** + * The default limit value used when the limit cannot be computed from the query. + * + * @return defaultLimitValue + */ + @JsonProperty(JSON_PROPERTY_DEFAULT_LIMIT_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getDefaultLimitValue() { + return defaultLimitValue; + } + + public void setDefaultLimitValue(Double defaultLimitValue) { + this.defaultLimitValue = defaultLimitValue; + } + + public GovernanceResourceLimitAttributes description(String description) { + this.description = description; + return this; + } + + /** + * A description of what the resource limit measures. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public GovernanceResourceLimitAttributes displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The human-readable name of the resource limit. + * + * @return displayName + */ + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public GovernanceResourceLimitAttributes limitQuery(GovernanceLimitQuery limitQuery) { + this.limitQuery = limitQuery; + this.unparsed |= limitQuery.unparsed; + return this; + } + + /** + * A metric query used to compute usage against a limit. + * + * @return limitQuery + */ + @JsonProperty(JSON_PROPERTY_LIMIT_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceLimitQuery getLimitQuery() { + return limitQuery; + } + + public void setLimitQuery(GovernanceLimitQuery limitQuery) { + this.limitQuery = limitQuery; + if (limitQuery != null) { + this.unparsed |= limitQuery.unparsed; + } + } + + public GovernanceResourceLimitAttributes product(String product) { + this.product = product; + return this; + } + + /** + * The Datadog product the resource limit belongs to. + * + * @return product + */ + @JsonProperty(JSON_PROPERTY_PRODUCT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProduct() { + return product; + } + + public void setProduct(String product) { + this.product = product; + } + + public GovernanceResourceLimitAttributes query(GovernanceLimitQuery query) { + this.query = query; + this.unparsed |= query.unparsed; + return this; + } + + /** + * A metric query used to compute usage against a limit. + * + * @return query + */ + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceLimitQuery getQuery() { + return query; + } + + public void setQuery(GovernanceLimitQuery query) { + this.query = query; + if (query != null) { + this.unparsed |= query.unparsed; + } + } + + public GovernanceResourceLimitAttributes queryConfig(GovernanceLimitQueryConfig queryConfig) { + this.queryConfig = queryConfig; + this.unparsed |= queryConfig.unparsed; + return this; + } + + /** + * The query execution context used to visualize a limit and its usage. + * + * @return queryConfig + */ + @JsonProperty(JSON_PROPERTY_QUERY_CONFIG) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceLimitQueryConfig getQueryConfig() { + return queryConfig; + } + + public void setQueryConfig(GovernanceLimitQueryConfig queryConfig) { + this.queryConfig = queryConfig; + if (queryConfig != null) { + this.unparsed |= queryConfig.unparsed; + } + } + + public GovernanceResourceLimitAttributes timeRange(String timeRange) { + this.timeRange = timeRange; + return this; + } + + /** + * The time range over which the resource value is measured. + * + * @return timeRange + */ + @JsonProperty(JSON_PROPERTY_TIME_RANGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTimeRange() { + return timeRange; + } + + public void setTimeRange(String timeRange) { + this.timeRange = timeRange; + } + + public GovernanceResourceLimitAttributes unitName(String unitName) { + this.unitName = unitName; + return this; + } + + /** + * The unit in which the resource value and limit are measured. + * + * @return unitName + */ + @JsonProperty(JSON_PROPERTY_UNIT_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUnitName() { + return unitName; + } + + public void setUnitName(String unitName) { + this.unitName = unitName; + } + + public GovernanceResourceLimitAttributes usageStatus(String usageStatus) { + this.usageStatus = usageStatus; + return this; + } + + /** + * The current usage status of the resource relative to its limit. + * + * @return usageStatus + */ + @JsonProperty(JSON_PROPERTY_USAGE_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUsageStatus() { + return usageStatus; + } + + public void setUsageStatus(String usageStatus) { + this.usageStatus = usageStatus; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceResourceLimitAttributes + */ + @JsonAnySetter + public GovernanceResourceLimitAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceResourceLimitAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceResourceLimitAttributes governanceResourceLimitAttributes = + (GovernanceResourceLimitAttributes) o; + return Objects.equals(this.currentLimit, governanceResourceLimitAttributes.currentLimit) + && Objects.equals(this.currentValue, governanceResourceLimitAttributes.currentValue) + && Objects.equals( + this.defaultCurrentValue, governanceResourceLimitAttributes.defaultCurrentValue) + && Objects.equals( + this.defaultLimitValue, governanceResourceLimitAttributes.defaultLimitValue) + && Objects.equals(this.description, governanceResourceLimitAttributes.description) + && Objects.equals(this.displayName, governanceResourceLimitAttributes.displayName) + && Objects.equals(this.limitQuery, governanceResourceLimitAttributes.limitQuery) + && Objects.equals(this.product, governanceResourceLimitAttributes.product) + && Objects.equals(this.query, governanceResourceLimitAttributes.query) + && Objects.equals(this.queryConfig, governanceResourceLimitAttributes.queryConfig) + && Objects.equals(this.timeRange, governanceResourceLimitAttributes.timeRange) + && Objects.equals(this.unitName, governanceResourceLimitAttributes.unitName) + && Objects.equals(this.usageStatus, governanceResourceLimitAttributes.usageStatus) + && Objects.equals( + this.additionalProperties, governanceResourceLimitAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + currentLimit, + currentValue, + defaultCurrentValue, + defaultLimitValue, + description, + displayName, + limitQuery, + product, + query, + queryConfig, + timeRange, + unitName, + usageStatus, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceResourceLimitAttributes {\n"); + sb.append(" currentLimit: ").append(toIndentedString(currentLimit)).append("\n"); + sb.append(" currentValue: ").append(toIndentedString(currentValue)).append("\n"); + sb.append(" defaultCurrentValue: ") + .append(toIndentedString(defaultCurrentValue)) + .append("\n"); + sb.append(" defaultLimitValue: ").append(toIndentedString(defaultLimitValue)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" limitQuery: ").append(toIndentedString(limitQuery)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryConfig: ").append(toIndentedString(queryConfig)).append("\n"); + sb.append(" timeRange: ").append(toIndentedString(timeRange)).append("\n"); + sb.append(" unitName: ").append(toIndentedString(unitName)).append("\n"); + sb.append(" usageStatus: ").append(toIndentedString(usageStatus)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitData.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitData.java new file mode 100644 index 00000000000..af04298ada4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitData.java @@ -0,0 +1,214 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A governance resource limit resource. */ +@JsonPropertyOrder({ + GovernanceResourceLimitData.JSON_PROPERTY_ATTRIBUTES, + GovernanceResourceLimitData.JSON_PROPERTY_ID, + GovernanceResourceLimitData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceResourceLimitData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GovernanceResourceLimitAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GovernanceResourceLimitResourceType type; + + public GovernanceResourceLimitData() {} + + @JsonCreator + public GovernanceResourceLimitData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GovernanceResourceLimitAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GovernanceResourceLimitResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GovernanceResourceLimitData attributes(GovernanceResourceLimitAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a governance resource limit. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceResourceLimitAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GovernanceResourceLimitAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GovernanceResourceLimitData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the resource limit. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GovernanceResourceLimitData type(GovernanceResourceLimitResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Resource limit resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GovernanceResourceLimitResourceType getType() { + return type; + } + + public void setType(GovernanceResourceLimitResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceResourceLimitData + */ + @JsonAnySetter + public GovernanceResourceLimitData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceResourceLimitData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceResourceLimitData governanceResourceLimitData = (GovernanceResourceLimitData) o; + return Objects.equals(this.attributes, governanceResourceLimitData.attributes) + && Objects.equals(this.id, governanceResourceLimitData.id) + && Objects.equals(this.type, governanceResourceLimitData.type) + && Objects.equals( + this.additionalProperties, governanceResourceLimitData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceResourceLimitData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitResourceType.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitResourceType.java new file mode 100644 index 00000000000..fd4bd2cf84a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitResourceType.java @@ -0,0 +1,59 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Resource limit resource type. */ +@JsonSerialize( + using = GovernanceResourceLimitResourceType.GovernanceResourceLimitResourceTypeSerializer.class) +public class GovernanceResourceLimitResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("resource-limit")); + + public static final GovernanceResourceLimitResourceType RESOURCE_LIMIT = + new GovernanceResourceLimitResourceType("resource-limit"); + + GovernanceResourceLimitResourceType(String value) { + super(value, allowedValues); + } + + public static class GovernanceResourceLimitResourceTypeSerializer + extends StdSerializer { + public GovernanceResourceLimitResourceTypeSerializer( + Class t) { + super(t); + } + + public GovernanceResourceLimitResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GovernanceResourceLimitResourceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GovernanceResourceLimitResourceType fromValue(String value) { + return new GovernanceResourceLimitResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitsResponse.java new file mode 100644 index 00000000000..a76ea8eb537 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitsResponse.java @@ -0,0 +1,165 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A list of governance resource limits. */ +@JsonPropertyOrder({GovernanceResourceLimitsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceResourceLimitsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public GovernanceResourceLimitsResponse() {} + + @JsonCreator + public GovernanceResourceLimitsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (GovernanceResourceLimitData item : data) { + this.unparsed |= item.unparsed; + } + } + + public GovernanceResourceLimitsResponse data(List data) { + this.data = data; + for (GovernanceResourceLimitData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GovernanceResourceLimitsResponse addDataItem(GovernanceResourceLimitData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * An array of governance resource limit resources. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (GovernanceResourceLimitData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GovernanceResourceLimitsResponse + */ + @JsonAnySetter + public GovernanceResourceLimitsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GovernanceResourceLimitsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GovernanceResourceLimitsResponse governanceResourceLimitsResponse = + (GovernanceResourceLimitsResponse) o; + return Objects.equals(this.data, governanceResourceLimitsResponse.data) + && Objects.equals( + this.additionalProperties, governanceResourceLimitsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GovernanceResourceLimitsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/governance_console.feature b/src/test/resources/com/datadog/api/client/v2/api/governance_console.feature new file mode 100644 index 00000000000..07f6d64b514 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/governance_console.feature @@ -0,0 +1,287 @@ +@endpoint(governance-console) @endpoint(governance-console-v2) +Feature: Governance Console + The Governance Console finds issues that build up across a Datadog + organization over time, such as API keys nobody uses, users who no longer + need access, or custom metrics that are never queried, and tracks them + through to a fix. These endpoints allow you to: - Read insights: + measures of how your organization uses Datadog, each with the query behind + it. - Configure controls: the rules deciding how one kind of issue is + found and what is done about it. - Act on detections: the issues a control + found. Assign, defer, accept as an exception, or fix. - Manage settings: + organization-wide configuration, usage and resource limits, and + notifications. See the [Governance Console + page](https://docs.datadoghq.com/account_management/governance_console/) + for more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "GovernanceConsole" API + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "Bad Request" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "Not Found" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "OK" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "Bad Request" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "Not Found" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "OK" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get control notification settings returns "Bad Request" response + Given operation "GetGovernanceControlNotificationSettings" enabled + And new "GetGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get control notification settings returns "OK" response + Given operation "GetGovernanceControlNotificationSettings" enabled + And new "GetGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get notification settings returns "Bad Request" response + Given operation "GetGovernanceNotificationSettings" enabled + And new "GetGovernanceNotificationSettings" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get notification settings returns "OK" response + Given operation "GetGovernanceNotificationSettings" enabled + And new "GetGovernanceNotificationSettings" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get the Governance Console configuration returns "Bad Request" response + Given operation "GetGovernanceConfig" enabled + And new "GetGovernanceConfig" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get the Governance Console configuration returns "OK" response + Given operation "GetGovernanceConfig" enabled + And new "GetGovernanceConfig" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List control detections returns "Bad Request" response + Given operation "ListGovernanceControlDetections" enabled + And new "ListGovernanceControlDetections" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List control detections returns "OK" response + Given operation "ListGovernanceControlDetections" enabled + And new "ListGovernanceControlDetections" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List controls returns "Bad Request" response + Given operation "ListGovernanceControls" enabled + And new "ListGovernanceControls" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List controls returns "OK" response + Given operation "ListGovernanceControls" enabled + And new "ListGovernanceControls" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List insights returns "Bad Request" response + Given operation "ListGovernanceInsights" enabled + And new "ListGovernanceInsights" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List insights returns "OK" response + Given operation "ListGovernanceInsights" enabled + And new "ListGovernanceInsights" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List resource limits returns "Bad Request" response + Given operation "ListGovernanceResourceLimits" enabled + And new "ListGovernanceResourceLimits" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List resource limits returns "OK" response + Given operation "ListGovernanceResourceLimits" enabled + And new "ListGovernanceResourceLimits" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List usage limits returns "Bad Request" response + Given operation "ListGovernanceLimits" enabled + And new "ListGovernanceLimits" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List usage limits returns "OK" response + Given operation "ListGovernanceLimits" enabled + And new "ListGovernanceLimits" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Mitigate detections returns "Accepted" response + Given operation "MitigateGovernanceDetections" enabled + And new "MitigateGovernanceDetections" request + And body with value {"data": {"attributes": {"detection_ids": ["3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"], "detection_type": "unused_api_keys", "mitigation_type": "revoke_api_key"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Mitigate detections returns "Bad Request" response + Given operation "MitigateGovernanceDetections" enabled + And new "MitigateGovernanceDetections" request + And body with value {"data": {"attributes": {"detection_ids": ["3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"], "detection_type": "unused_api_keys", "mitigation_type": "revoke_api_key"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "Bad Request" response + Given operation "UpdateGovernanceControl" enabled + And new "UpdateGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "Not Found" response + Given operation "UpdateGovernanceControl" enabled + And new "UpdateGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "OK" response + Given operation "UpdateGovernanceControl" enabled + And new "UpdateGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "Bad Request" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "Not Found" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "OK" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update control notification settings returns "Bad Request" response + Given operation "UpdateGovernanceControlNotificationSettings" enabled + And new "UpdateGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"event_settings": [{"enabled": true, "event_type": "new_detection", "targets": [{"handle": "#governance-alerts", "type": "slack"}]}]}, "type": "control_notification_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update control notification settings returns "OK" response + Given operation "UpdateGovernanceControlNotificationSettings" enabled + And new "UpdateGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"event_settings": [{"enabled": true, "event_type": "new_detection", "targets": [{"handle": "#governance-alerts", "type": "slack"}]}]}, "type": "control_notification_settings"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update notification settings returns "Bad Request" response + Given operation "UpdateGovernanceNotificationSettings" enabled + And new "UpdateGovernanceNotificationSettings" request + And body with value {"data": {"attributes": {"assignment_notifications_enabled": true}, "type": "governance_notification_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update notification settings returns "OK" response + Given operation "UpdateGovernanceNotificationSettings" enabled + And new "UpdateGovernanceNotificationSettings" request + And body with value {"data": {"attributes": {"assignment_notifications_enabled": true}, "type": "governance_notification_settings"}} + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/governance_controls.feature b/src/test/resources/com/datadog/api/client/v2/api/governance_controls.feature deleted file mode 100644 index 1207f5cf507..00000000000 --- a/src/test/resources/com/datadog/api/client/v2/api/governance_controls.feature +++ /dev/null @@ -1,77 +0,0 @@ -@endpoint(governance-controls) @endpoint(governance-controls-v2) -Feature: Governance Controls - Governance Controls pair a detection definition with an organization's - detection, notification, and mitigation configuration within the - Governance Console. Each control reports how a class of governance issue - (such as unused API keys or unqueried metrics) is detected and remediated, - along with counts of active and mitigated detections. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "GovernanceControls" API - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "Bad Request" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "Not Found" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "OK" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance controls returns "Bad Request" response - Given operation "ListGovernanceControls" enabled - And new "ListGovernanceControls" request - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance controls returns "OK" response - Given operation "ListGovernanceControls" enabled - And new "ListGovernanceControls" request - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "Bad Request" response - Given operation "UpdateGovernanceControl" enabled - And new "UpdateGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "Not Found" response - Given operation "UpdateGovernanceControl" enabled - And new "UpdateGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "OK" response - Given operation "UpdateGovernanceControl" enabled - And new "UpdateGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/governance_insights.feature b/src/test/resources/com/datadog/api/client/v2/api/governance_insights.feature deleted file mode 100644 index 0327e119c54..00000000000 --- a/src/test/resources/com/datadog/api/client/v2/api/governance_insights.feature +++ /dev/null @@ -1,24 +0,0 @@ -@endpoint(governance-insights) @endpoint(governance-insights-v2) -Feature: Governance Insights - Governance Insights surface key usage, configuration, and best-practice - signals for an organization within the Governance Console. Each insight - reports a current value (and, optionally, a previous value for comparison) - along with the query used to compute it, so that the Console can render - trends and highlight areas that need attention. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "GovernanceInsights" API - And operation "ListGovernanceInsights" enabled - And new "ListGovernanceInsights" request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance insights returns "Bad Request" response - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance insights returns "OK" response - When the request is sent - Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 9c1ff8a4f2f..a33727a04e7 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -2834,26 +2834,92 @@ "type": "safe" } }, + "GetGovernanceConfig": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, "ListGovernanceControls": { - "tag": "Governance Controls", + "tag": "Governance Console", "undo": { "type": "safe" } }, "GetGovernanceControl": { - "tag": "Governance Controls", + "tag": "Governance Console", "undo": { "type": "safe" } }, "UpdateGovernanceControl": { - "tag": "Governance Controls", + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "ListGovernanceControlDetections": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "GetGovernanceControlNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceControlNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "MitigateGovernanceDetections": { + "tag": "Governance Console", + "undo": { + "type": "unsafe" + } + }, + "GetGovernanceDetection": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceDetection": { + "tag": "Governance Console", "undo": { "type": "idempotent" } }, "ListGovernanceInsights": { - "tag": "Governance Insights", + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "ListGovernanceLimits": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "GetGovernanceNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "ListGovernanceResourceLimits": { + "tag": "Governance Console", "undo": { "type": "safe" }