From 29583dceecef6bb4ae98352205ee59603563b6ba Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 26 Jun 2026 12:23:27 +0000 Subject: [PATCH] Regenerate client from commit 6ee0878 of spec repo --- .generator/schemas/v2/openapi.yaml | 1680 ++++++++++++++++- .../CreateGovernanceMitigation.java | 40 + .../GetGovernanceControlDetection.java | 28 + ...GovernanceControlNotificationSettings.java | 27 + .../ListGovernanceControlDetections.java | 27 + .../UpdateGovernanceControlDetection.java | 46 + ...GovernanceControlNotificationSettings.java | 55 + .../GetGovernanceConfig.java | 25 + .../GetGovernanceNotificationSettings.java | 27 + .../ListGovernanceLimits.java | 25 + .../ListGovernanceResourceLimits.java | 26 + .../UpdateGovernanceNotificationSettings.java | 42 + .../com/datadog/api/client/ApiClient.java | 11 + .../client/v2/api/GovernanceControlsApi.java | 1463 +++++++++++++- .../client/v2/api/GovernanceInsightsApi.java | 4 +- .../client/v2/api/GovernanceSettingsApi.java | 743 ++++++++ .../ControlNotificationEventSetting.java | 215 +++ ...ControlNotificationSettingsAttributes.java | 159 ++ .../ControlNotificationSettingsData.java | 213 +++ ...ntrolNotificationSettingsResourceType.java | 63 + .../ControlNotificationSettingsResponse.java | 148 ++ ...lNotificationSettingsUpdateAttributes.java | 156 ++ ...ControlNotificationSettingsUpdateData.java | 182 ++ ...trolNotificationSettingsUpdateRequest.java | 149 ++ .../v2/model/ControlNotificationTarget.java | 180 ++ .../model/ControlNotificationTargetType.java | 63 + .../v2/model/GovernanceConfigAttributes.java | 215 +++ .../client/v2/model/GovernanceConfigData.java | 210 +++ .../v2/model/GovernanceConfigResponse.java | 145 ++ .../GovernanceConsoleConfigResourceType.java | 59 + ...nanceControlDetectionAssignmentSource.java | 72 + .../GovernanceControlDetectionAttributes.java | 595 ++++++ .../model/GovernanceControlDetectionData.java | 213 +++ ...overnanceControlDetectionResourceType.java | 63 + .../GovernanceControlDetectionResponse.java | 148 ++ .../GovernanceControlDetectionState.java | 82 + ...nanceControlDetectionUpdateAttributes.java | 237 +++ .../GovernanceControlDetectionUpdateData.java | 183 ++ ...vernanceControlDetectionUpdateRequest.java | 149 ++ ...GovernanceControlDetectionUpdateState.java | 67 + .../GovernanceControlDetectionsResponse.java | 157 ++ .../model/GovernanceInsightQueryConfig.java | 4 +- .../v2/model/GovernanceLimitAttributes.java | 414 ++++ .../client/v2/model/GovernanceLimitData.java | 209 ++ .../client/v2/model/GovernanceLimitQuery.java | 201 ++ .../v2/model/GovernanceLimitQueryConfig.java | 257 +++ .../v2/model/GovernanceLimitResourceType.java | 55 + .../v2/model/GovernanceLimitsResponse.java | 154 ++ .../v2/model/GovernanceMitigationRequest.java | 147 ++ ...GovernanceMitigationRequestAttributes.java | 245 +++ .../GovernanceMitigationRequestData.java | 182 ++ ...ernanceNotificationSettingsAttributes.java | 155 ++ .../GovernanceNotificationSettingsData.java | 213 +++ ...nanceNotificationSettingsResourceType.java | 63 + ...overnanceNotificationSettingsResponse.java | 148 ++ ...eNotificationSettingsUpdateAttributes.java | 150 ++ ...ernanceNotificationSettingsUpdateData.java | 185 ++ ...anceNotificationSettingsUpdateRequest.java | 151 ++ .../GovernanceResourceLimitAttributes.java | 540 ++++++ .../v2/model/GovernanceResourceLimitData.java | 211 +++ .../GovernanceResourceLimitResourceType.java | 59 + .../GovernanceResourceLimitsResponse.java | 157 ++ .../client/v2/api/governance_controls.feature | 123 ++ .../client/v2/api/governance_settings.feature | 83 + .../com/datadog/api/client/v2/api/undo.json | 66 + 65 files changed, 12455 insertions(+), 109 deletions(-) create mode 100644 examples/v2/governance-controls/CreateGovernanceMitigation.java create mode 100644 examples/v2/governance-controls/GetGovernanceControlDetection.java create mode 100644 examples/v2/governance-controls/GetGovernanceControlNotificationSettings.java create mode 100644 examples/v2/governance-controls/ListGovernanceControlDetections.java create mode 100644 examples/v2/governance-controls/UpdateGovernanceControlDetection.java create mode 100644 examples/v2/governance-controls/UpdateGovernanceControlNotificationSettings.java create mode 100644 examples/v2/governance-settings/GetGovernanceConfig.java create mode 100644 examples/v2/governance-settings/GetGovernanceNotificationSettings.java create mode 100644 examples/v2/governance-settings/ListGovernanceLimits.java create mode 100644 examples/v2/governance-settings/ListGovernanceResourceLimits.java create mode 100644 examples/v2/governance-settings/UpdateGovernanceNotificationSettings.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/GovernanceSettingsApi.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 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/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_settings.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fd30acae59e..74d20bb6580 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21314,6 +21314,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: @@ -41859,6 +41978,58 @@ components: - impact_hint - status type: object + GovernanceConfigAttributes: + description: The attributes of a Governance Console configuration. + properties: + 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 + required: + - enabled + - assignment_notifications_enabled + - usage_attribution_configured + type: object + GovernanceConfigData: + description: A Governance Console configuration resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceConfigAttributes" + id: + description: The unique identifier of the organization the Governance Console configuration applies to. + example: "11111111-2222-3333-4444-555555555555" + type: string + type: + $ref: "#/components/schemas/GovernanceConsoleConfigResourceType" + required: + - id + - 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: @@ -42032,6 +42203,211 @@ 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: + description: The unique identifier of the control that produced this detection. + example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + 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_url: + description: A link to the detected resource in Datadog. + example: "/organization-settings/api-keys/api-key-12345" + type: string + state: + $ref: "#/components/schemas/GovernanceControlDetectionState" + required: + - state + - control_id + - resource_id + - resource_url + - detection_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: @@ -42497,7 +42873,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: @@ -42556,6 +42932,360 @@ components: required: - data type: object + GovernanceLimitAttributes: + description: The attributes of a governance 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 governance 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 governance limit resources. + items: + $ref: "#/components/schemas/GovernanceLimitData" + type: array + GovernanceLimitsResponse: + description: A list of governance 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 + deep_link: + description: A link to the Datadog page where the resource and its limit can be managed. + example: "/metric/summary" + type: string + 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 + - deep_link + - 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: @@ -135447,6 +136177,60 @@ 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 + id: "11111111-2222-3333-4444-555555555555" + 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 Settings + 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: |- @@ -135549,9 +136333,17 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] summary: List governance controls tags: - Governance Controls + "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/). @@ -135648,9 +136440,17 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] summary: Get a governance control tags: - Governance Controls + "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/). @@ -135754,9 +136554,481 @@ paths: description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] summary: Update a governance control tags: - Governance Controls + "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: The attribute to sort detections by. Prefix with `-` for descending order. + example: "-created_at" + 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: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + 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_url: "/organization-settings/api-keys/api-key-12345" + 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: + - governance_console_read + summary: List governance control detections + tags: + - Governance Controls + "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}/detections/{detection_id}: + get: + description: Retrieve a single detection produced by the governance control with the given detection type. + operationId: GetGovernanceControlDetection + 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: 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: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + 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_url: "/organization-settings/api-keys/api-key-12345" + 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: + - governance_console_read + summary: Get a governance control detection + tags: + - Governance Controls + "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 detection produced by the governance control with the given detection type. 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: UpdateGovernanceControlDetection + 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: 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: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + 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_url: "/organization-settings/api-keys/api-key-12345" + 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: + - governance_console_read + summary: Update a governance control detection + tags: + - Governance Controls + "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: + - governance_console_read + summary: Get governance control notification settings + tags: + - Governance Controls + "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: + - governance_console_read + - governance_console_write + summary: Update governance control notification settings + tags: + - Governance Controls + "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/). @@ -135883,9 +137155,365 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - audit_logs_read + - events_read + - metrics_read summary: List governance insights tags: - Governance Insights + "x-permission": + operator: OR + permissions: + - metrics_read + - events_read + - audit_logs_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/limits: + get: + description: |- + 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: + application/json: + examples: + default: + value: + data: + - 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/GovernanceLimitsResponse" + 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: + - governance_console_read + summary: List governance limits + tags: + - Governance Settings + "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/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: CreateGovernanceMitigation + 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: + - governance_console_read + summary: Mitigate governance detections + tags: + - Governance Controls + "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: 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: + - governance_console_read + summary: Get governance notification settings + tags: + - Governance Settings + "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 organization-wide governance notification settings. Only the attributes present in + the request are modified. + operationId: UpdateGovernanceNotificationSettings + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_notifications_enabled: true + type: "governance_notification_settings" + schema: + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateRequest" + required: true + 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: 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: + - governance_console_read + - governance_console_write + summary: Update governance notification settings + tags: + - Governance Settings + "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/resource-limits: + get: + description: |- + 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: + application/json: + examples: + default: + value: + data: + - attributes: + current_limit: 10000 + current_value: 8200 + deep_link: "/metric/summary" + 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: "metrics" + usage_status: "approaching" + id: "custom_metrics" + type: "resource-limit" + schema: + $ref: "#/components/schemas/GovernanceResourceLimitsResponse" + 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: + - governance_console_read + summary: List governance resource limits + tags: + - Governance Settings + "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/). @@ -189943,9 +191571,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/). @@ -190034,9 +191670,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/). @@ -190091,9 +191734,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/). @@ -190203,9 +191853,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/). @@ -190294,9 +191952,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/). @@ -190376,9 +192041,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/). @@ -196173,6 +197846,11 @@ tags: 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 + - description: |- + Governance Settings cover organization-wide Governance Console configuration, usage limits and + resource limits, and notification preferences that determine when and how the Console alerts + users about governance activity. + name: Governance Settings - 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-controls/CreateGovernanceMitigation.java b/examples/v2/governance-controls/CreateGovernanceMitigation.java new file mode 100644 index 00000000000..593dd14556d --- /dev/null +++ b/examples/v2/governance-controls/CreateGovernanceMitigation.java @@ -0,0 +1,40 @@ +// Mitigate governance detections returns "Accepted" 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.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.createGovernanceMitigation", true); + GovernanceControlsApi apiInstance = new GovernanceControlsApi(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.createGovernanceMitigation(body); + } catch (ApiException e) { + System.err.println("Exception when calling GovernanceControlsApi#createGovernanceMitigation"); + 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/GetGovernanceControlDetection.java b/examples/v2/governance-controls/GetGovernanceControlDetection.java new file mode 100644 index 00000000000..7b57bb16efb --- /dev/null +++ b/examples/v2/governance-controls/GetGovernanceControlDetection.java @@ -0,0 +1,28 @@ +// Get a governance control detection 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.model.GovernanceControlDetectionResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getGovernanceControlDetection", true); + GovernanceControlsApi apiInstance = new GovernanceControlsApi(defaultClient); + + try { + GovernanceControlDetectionResponse result = + apiInstance.getGovernanceControlDetection( + "unused_api_keys", "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceControlsApi#getGovernanceControlDetection"); + 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/GetGovernanceControlNotificationSettings.java b/examples/v2/governance-controls/GetGovernanceControlNotificationSettings.java new file mode 100644 index 00000000000..bdd56eafa11 --- /dev/null +++ b/examples/v2/governance-controls/GetGovernanceControlNotificationSettings.java @@ -0,0 +1,27 @@ +// Get governance 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.GovernanceControlsApi; +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); + GovernanceControlsApi apiInstance = new GovernanceControlsApi(defaultClient); + + try { + ControlNotificationSettingsResponse result = + apiInstance.getGovernanceControlNotificationSettings("unused_api_keys"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceControlsApi#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-controls/ListGovernanceControlDetections.java b/examples/v2/governance-controls/ListGovernanceControlDetections.java new file mode 100644 index 00000000000..22b2a21c0e5 --- /dev/null +++ b/examples/v2/governance-controls/ListGovernanceControlDetections.java @@ -0,0 +1,27 @@ +// List governance control detections 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.model.GovernanceControlDetectionsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listGovernanceControlDetections", true); + GovernanceControlsApi apiInstance = new GovernanceControlsApi(defaultClient); + + try { + GovernanceControlDetectionsResponse result = + apiInstance.listGovernanceControlDetections("unused_api_keys"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceControlsApi#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/UpdateGovernanceControlDetection.java b/examples/v2/governance-controls/UpdateGovernanceControlDetection.java new file mode 100644 index 00000000000..16dc18f7cc9 --- /dev/null +++ b/examples/v2/governance-controls/UpdateGovernanceControlDetection.java @@ -0,0 +1,46 @@ +// Update a governance control detection 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.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.updateGovernanceControlDetection", true); + GovernanceControlsApi apiInstance = new GovernanceControlsApi(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.updateGovernanceControlDetection( + "unused_api_keys", "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceControlsApi#updateGovernanceControlDetection"); + 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/UpdateGovernanceControlNotificationSettings.java b/examples/v2/governance-controls/UpdateGovernanceControlNotificationSettings.java new file mode 100644 index 00000000000..38ebf2c1ae7 --- /dev/null +++ b/examples/v2/governance-controls/UpdateGovernanceControlNotificationSettings.java @@ -0,0 +1,55 @@ +// Update governance 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.GovernanceControlsApi; +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); + GovernanceControlsApi apiInstance = new GovernanceControlsApi(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" + + " GovernanceControlsApi#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-settings/GetGovernanceConfig.java b/examples/v2/governance-settings/GetGovernanceConfig.java new file mode 100644 index 00000000000..c41c0ce346e --- /dev/null +++ b/examples/v2/governance-settings/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.GovernanceSettingsApi; +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); + GovernanceSettingsApi apiInstance = new GovernanceSettingsApi(defaultClient); + + try { + GovernanceConfigResponse result = apiInstance.getGovernanceConfig(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GovernanceSettingsApi#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-settings/GetGovernanceNotificationSettings.java b/examples/v2/governance-settings/GetGovernanceNotificationSettings.java new file mode 100644 index 00000000000..c79dde82dc1 --- /dev/null +++ b/examples/v2/governance-settings/GetGovernanceNotificationSettings.java @@ -0,0 +1,27 @@ +// Get governance notification settings returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceSettingsApi; +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); + GovernanceSettingsApi apiInstance = new GovernanceSettingsApi(defaultClient); + + try { + GovernanceNotificationSettingsResponse result = + apiInstance.getGovernanceNotificationSettings(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceSettingsApi#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-settings/ListGovernanceLimits.java b/examples/v2/governance-settings/ListGovernanceLimits.java new file mode 100644 index 00000000000..f814a6873b2 --- /dev/null +++ b/examples/v2/governance-settings/ListGovernanceLimits.java @@ -0,0 +1,25 @@ +// List governance limits returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceSettingsApi; +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); + GovernanceSettingsApi apiInstance = new GovernanceSettingsApi(defaultClient); + + try { + GovernanceLimitsResponse result = apiInstance.listGovernanceLimits(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GovernanceSettingsApi#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-settings/ListGovernanceResourceLimits.java b/examples/v2/governance-settings/ListGovernanceResourceLimits.java new file mode 100644 index 00000000000..98f74e352ba --- /dev/null +++ b/examples/v2/governance-settings/ListGovernanceResourceLimits.java @@ -0,0 +1,26 @@ +// List governance resource limits returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceSettingsApi; +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); + GovernanceSettingsApi apiInstance = new GovernanceSettingsApi(defaultClient); + + try { + GovernanceResourceLimitsResponse result = apiInstance.listGovernanceResourceLimits(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GovernanceSettingsApi#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-settings/UpdateGovernanceNotificationSettings.java b/examples/v2/governance-settings/UpdateGovernanceNotificationSettings.java new file mode 100644 index 00000000000..0f7d237149f --- /dev/null +++ b/examples/v2/governance-settings/UpdateGovernanceNotificationSettings.java @@ -0,0 +1,42 @@ +// Update governance notification settings returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GovernanceSettingsApi; +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); + GovernanceSettingsApi apiInstance = new GovernanceSettingsApi(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 GovernanceSettingsApi#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 bd9e92793d5..51c747934c6 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1054,9 +1054,20 @@ public class ApiClient { put("v2.upsertAndPublishFormVersion", false); put("v2.upsertFormVersion", false); put("v2.updateOrgSamlConfigurations", false); + put("v2.getGovernanceConfig", false); + put("v2.getGovernanceNotificationSettings", false); + put("v2.listGovernanceLimits", false); + put("v2.listGovernanceResourceLimits", false); + put("v2.updateGovernanceNotificationSettings", false); + put("v2.createGovernanceMitigation", false); put("v2.getGovernanceControl", false); + put("v2.getGovernanceControlDetection", false); + put("v2.getGovernanceControlNotificationSettings", false); + put("v2.listGovernanceControlDetections", false); put("v2.listGovernanceControls", false); put("v2.updateGovernanceControl", false); + put("v2.updateGovernanceControlDetection", false); + put("v2.updateGovernanceControlNotificationSettings", false); put("v2.listGovernanceInsights", false); put("v2.createHamrOrgConnection", false); put("v2.getHamrOrgConnection", false); 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 index 57c380e4d3b..e86f03041f4 100644 --- a/src/main/java/com/datadog/api/client/v2/api/GovernanceControlsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/GovernanceControlsApi.java @@ -4,13 +4,20 @@ 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.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.GovernanceMitigationRequest; 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; @@ -45,6 +52,157 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Mitigate governance detections. + * + *

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

See {@link #createGovernanceMitigationWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture createGovernanceMitigationAsync(GovernanceMitigationRequest body) { + return createGovernanceMitigationWithHttpInfoAsync(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 createGovernanceMitigationWithHttpInfo(GovernanceMitigationRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createGovernanceMitigation"; + 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 createGovernanceMitigation"); + } + // create path and map variables + String localVarPath = "/api/v2/governance/mitigate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceControlsApi.createGovernanceMitigation", + 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 governance detections. + * + *

See {@link #createGovernanceMitigationWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> createGovernanceMitigationWithHttpInfoAsync( + GovernanceMitigationRequest body) { + // Check if unstable operation is enabled + String operationId = "createGovernanceMitigation"; + 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 createGovernanceMitigation")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/governance/mitigate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceControlsApi.createGovernanceMitigation", + 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); + } + /** * Get a governance control. * @@ -129,7 +287,7 @@ public ApiResponse getGovernanceControlWithHttpInfo( localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); return apiClient.invokeAPI( "GET", builder, @@ -191,7 +349,7 @@ public ApiResponse getGovernanceControlWithHttpInfo( localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); @@ -209,26 +367,34 @@ public ApiResponse getGovernanceControlWithHttpInfo( } /** - * List governance controls. + * Get a governance control detection. * - *

See {@link #listGovernanceControlsWithHttpInfo}. + *

See {@link #getGovernanceControlDetectionWithHttpInfo}. * - * @return GovernanceControlsResponse + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param detectionId The unique identifier of the detection. (required) + * @return GovernanceControlDetectionResponse * @throws ApiException if fails to make API call */ - public GovernanceControlsResponse listGovernanceControls() throws ApiException { - return listGovernanceControlsWithHttpInfo().getData(); + public GovernanceControlDetectionResponse getGovernanceControlDetection( + String detectionType, String detectionId) throws ApiException { + return getGovernanceControlDetectionWithHttpInfo(detectionType, detectionId).getData(); } /** - * List governance controls. + * Get a governance control detection. * - *

See {@link #listGovernanceControlsWithHttpInfoAsync}. + *

See {@link #getGovernanceControlDetectionWithHttpInfoAsync}. * - * @return CompletableFuture<GovernanceControlsResponse> + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param detectionId The unique identifier of the detection. (required) + * @return CompletableFuture<GovernanceControlDetectionResponse> */ - public CompletableFuture listGovernanceControlsAsync() { - return listGovernanceControlsWithHttpInfoAsync() + public CompletableFuture getGovernanceControlDetectionAsync( + String detectionType, String detectionId) { + return getGovernanceControlDetectionWithHttpInfoAsync(detectionType, detectionId) .thenApply( response -> { return response.getData(); @@ -236,11 +402,12 @@ public CompletableFuture listGovernanceControlsAsync } /** - * 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. + * Retrieve a single detection produced by the governance control with the given detection type. * - * @return ApiResponse<GovernanceControlsResponse> + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param detectionId The unique identifier of the detection. (required) + * @return ApiResponse<GovernanceControlDetectionResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -250,33 +417,55 @@ public CompletableFuture listGovernanceControlsAsync * * * + * * *
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
*/ - public ApiResponse listGovernanceControlsWithHttpInfo() - throws ApiException { + public ApiResponse getGovernanceControlDetectionWithHttpInfo( + String detectionType, String detectionId) throws ApiException { // Check if unstable operation is enabled - String operationId = "listGovernanceControls"; + String operationId = "getGovernanceControlDetection"; 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" + + " getGovernanceControlDetection"); + } + + // verify the required parameter 'detectionId' is set + if (detectionId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'detectionId' when calling" + + " getGovernanceControlDetection"); + } // create path and map variables - String localVarPath = "/api/v2/governance/control"; + String localVarPath = + "/api/v2/governance/control/{detection_type}/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())) + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.GovernanceControlsApi.listGovernanceControls", + "v2.GovernanceControlsApi.getGovernanceControlDetection", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); return apiClient.invokeAPI( "GET", builder, @@ -285,31 +474,64 @@ public ApiResponse listGovernanceControlsWithHttpInf localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * List governance controls. + * Get a governance control detection. * - *

See {@link #listGovernanceControlsWithHttpInfo}. + *

See {@link #getGovernanceControlDetectionWithHttpInfo}. * - * @return CompletableFuture<ApiResponse<GovernanceControlsResponse>> + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param detectionId The unique identifier of the detection. (required) + * @return CompletableFuture<ApiResponse<GovernanceControlDetectionResponse>> */ - public CompletableFuture> - listGovernanceControlsWithHttpInfoAsync() { + public CompletableFuture> + getGovernanceControlDetectionWithHttpInfoAsync(String detectionType, String detectionId) { // Check if unstable operation is enabled - String operationId = "listGovernanceControls"; + String operationId = "getGovernanceControlDetection"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } Object localVarPostBody = null; + + // verify the required parameter 'detectionType' is set + if (detectionType == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'detectionType' when calling" + + " getGovernanceControlDetection")); + return result; + } + + // 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" + + " getGovernanceControlDetection")); + return result; + } // create path and map variables - String localVarPath = "/api/v2/governance/control"; + String localVarPath = + "/api/v2/governance/control/{detection_type}/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())) + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); Map localVarHeaderParams = new HashMap(); @@ -317,15 +539,16 @@ public ApiResponse listGovernanceControlsWithHttpInf try { builder = apiClient.createBuilder( - "v2.GovernanceControlsApi.listGovernanceControls", + "v2.GovernanceControlsApi.getGovernanceControlDetection", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -337,38 +560,36 @@ public ApiResponse listGovernanceControlsWithHttpInf localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Update a governance control. + * Get governance control notification settings. * - *

See {@link #updateGovernanceControlWithHttpInfo}. + *

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

See {@link #updateGovernanceControlWithHttpInfoAsync}. + *

See {@link #getGovernanceControlNotificationSettingsWithHttpInfoAsync}. * - * @param detectionType The detection type that identifies the control, for example + * @param detectionType The detection type that identifies the control; for example, * unused_api_keys. (required) - * @param body (required) - * @return CompletableFuture<GovernanceControlResponse> + * @return CompletableFuture<ControlNotificationSettingsResponse> */ - public CompletableFuture updateGovernanceControlAsync( - String detectionType, GovernanceControlUpdateRequest body) { - return updateGovernanceControlWithHttpInfoAsync(detectionType, body) + public CompletableFuture + getGovernanceControlNotificationSettingsAsync(String detectionType) { + return getGovernanceControlNotificationSettingsWithHttpInfoAsync(detectionType) .thenApply( response -> { return response.getData(); @@ -376,14 +597,13 @@ public CompletableFuture updateGovernanceControlAsync } /** - * 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. + * 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 + * @param detectionType The detection type that identifies the control; for example, * unused_api_keys. (required) - * @param body (required) - * @return ApiResponse<GovernanceControlResponse> + * @return ApiResponse<ControlNotificationSettingsResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -393,36 +613,31 @@ public CompletableFuture updateGovernanceControlAsync * * * - * * *
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
*/ - public ApiResponse updateGovernanceControlWithHttpInfo( - String detectionType, GovernanceControlUpdateRequest body) throws ApiException { + public ApiResponse + getGovernanceControlNotificationSettingsWithHttpInfo(String detectionType) + throws ApiException { // Check if unstable operation is enabled - String operationId = "updateGovernanceControl"; + 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 = body; + Object localVarPostBody = null; // 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"); + "Missing the required parameter 'detectionType' when calling" + + " getGovernanceControlNotificationSettings"); } // create path and map variables String localVarPath = - "/api/v2/governance/control/{detection_type}" + "/api/v2/governance/control/{detection_type}/notification_settings" .replaceAll( "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); @@ -430,71 +645,62 @@ public ApiResponse updateGovernanceControlWithHttpInf Invocation.Builder builder = apiClient.createBuilder( - "v2.GovernanceControlsApi.updateGovernanceControl", + "v2.GovernanceControlsApi.getGovernanceControlNotificationSettings", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); return apiClient.invokeAPI( - "PATCH", + "GET", builder, localVarHeaderParams, - new String[] {"application/json"}, + new String[] {}, localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Update a governance control. + * Get governance control notification settings. * - *

See {@link #updateGovernanceControlWithHttpInfo}. + *

See {@link #getGovernanceControlNotificationSettingsWithHttpInfo}. * - * @param detectionType The detection type that identifies the control, for example + * @param detectionType The detection type that identifies the control; for example, * unused_api_keys. (required) - * @param body (required) - * @return CompletableFuture<ApiResponse<GovernanceControlResponse>> + * @return CompletableFuture<ApiResponse<ControlNotificationSettingsResponse>> */ - public CompletableFuture> - updateGovernanceControlWithHttpInfoAsync( - String detectionType, GovernanceControlUpdateRequest body) { + public CompletableFuture> + getGovernanceControlNotificationSettingsWithHttpInfoAsync(String detectionType) { // Check if unstable operation is enabled - String operationId = "updateGovernanceControl"; + String operationId = "getGovernanceControlNotificationSettings"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } - Object localVarPostBody = body; + Object localVarPostBody = null; // verify the required parameter 'detectionType' is set if (detectionType == null) { - CompletableFuture> result = new CompletableFuture<>(); + 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")); + + " getGovernanceControlNotificationSettings")); return result; } // create path and map variables String localVarPath = - "/api/v2/governance/control/{detection_type}" + "/api/v2/governance/control/{detection_type}/notification_settings" .replaceAll( "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())); @@ -504,26 +710,1075 @@ public ApiResponse updateGovernanceControlWithHttpInf try { builder = apiClient.createBuilder( - "v2.GovernanceControlsApi.updateGovernanceControl", + "v2.GovernanceControlsApi.getGovernanceControlNotificationSettings", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( - "PATCH", + "GET", builder, localVarHeaderParams, - new String[] {"application/json"}, + new String[] {}, localVarPostBody, new HashMap(), false, - new GenericType() {}); + 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 The attribute to sort detections by. Prefix with - for descending + * order. (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 governance 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 governance 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 governance 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 governance 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.GovernanceControlsApi.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 governance 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.GovernanceControlsApi.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 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", "AuthZ"}); + 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", "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() {}); + } + + /** + * 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", "AuthZ"}); + 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", "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 a governance control detection. + * + *

See {@link #updateGovernanceControlDetectionWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param detectionId The unique identifier of the detection. (required) + * @param body (required) + * @return GovernanceControlDetectionResponse + * @throws ApiException if fails to make API call + */ + public GovernanceControlDetectionResponse updateGovernanceControlDetection( + String detectionType, String detectionId, GovernanceControlDetectionUpdateRequest body) + throws ApiException { + return updateGovernanceControlDetectionWithHttpInfo(detectionType, detectionId, body).getData(); + } + + /** + * Update a governance control detection. + * + *

See {@link #updateGovernanceControlDetectionWithHttpInfoAsync}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param detectionId The unique identifier of the detection. (required) + * @param body (required) + * @return CompletableFuture<GovernanceControlDetectionResponse> + */ + public CompletableFuture + updateGovernanceControlDetectionAsync( + String detectionType, String detectionId, GovernanceControlDetectionUpdateRequest body) { + return updateGovernanceControlDetectionWithHttpInfoAsync(detectionType, detectionId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a detection produced by the governance control with the given detection type. 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 detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @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 + updateGovernanceControlDetectionWithHttpInfo( + String detectionType, String detectionId, GovernanceControlDetectionUpdateRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateGovernanceControlDetection"; + 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" + + " updateGovernanceControlDetection"); + } + + // verify the required parameter 'detectionId' is set + if (detectionId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'detectionId' when calling" + + " updateGovernanceControlDetection"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling updateGovernanceControlDetection"); + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())) + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GovernanceControlsApi.updateGovernanceControlDetection", + 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 governance control detection. + * + *

See {@link #updateGovernanceControlDetectionWithHttpInfo}. + * + * @param detectionType The detection type that identifies the control; for example, + * unused_api_keys. (required) + * @param detectionId The unique identifier of the detection. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<GovernanceControlDetectionResponse>> + */ + public CompletableFuture> + updateGovernanceControlDetectionWithHttpInfoAsync( + String detectionType, String detectionId, GovernanceControlDetectionUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateGovernanceControlDetection"; + 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" + + " updateGovernanceControlDetection")); + return result; + } + + // 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" + + " updateGovernanceControlDetection")); + 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" + + " updateGovernanceControlDetection")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/governance/control/{detection_type}/detections/{detection_id}" + .replaceAll( + "\\{" + "detection_type" + "\\}", apiClient.escapeString(detectionType.toString())) + .replaceAll( + "\\{" + "detection_id" + "\\}", apiClient.escapeString(detectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GovernanceControlsApi.updateGovernanceControlDetection", + 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 governance 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 governance 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.GovernanceControlsApi.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 governance 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.GovernanceControlsApi.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() {}); } } 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 index cfc8d9c0898..bdf55724510 100644 --- a/src/main/java/com/datadog/api/client/v2/api/GovernanceInsightsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/GovernanceInsightsApi.java @@ -199,7 +199,7 @@ public ApiResponse listGovernanceInsightsWithHttpInf localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); return apiClient.invokeAPI( "GET", builder, @@ -256,7 +256,7 @@ public ApiResponse listGovernanceInsightsWithHttpInf localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); diff --git a/src/main/java/com/datadog/api/client/v2/api/GovernanceSettingsApi.java b/src/main/java/com/datadog/api/client/v2/api/GovernanceSettingsApi.java new file mode 100644 index 00000000000..c0164c7a713 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/GovernanceSettingsApi.java @@ -0,0 +1,743 @@ +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.GovernanceConfigResponse; +import com.datadog.api.client.v2.model.GovernanceLimitsResponse; +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.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GovernanceSettingsApi { + private ApiClient apiClient; + + public GovernanceSettingsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public GovernanceSettingsApi(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.GovernanceSettingsApi.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.GovernanceSettingsApi.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 governance notification settings. + * + *

See {@link #getGovernanceNotificationSettingsWithHttpInfo}. + * + * @return GovernanceNotificationSettingsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceNotificationSettingsResponse getGovernanceNotificationSettings() + throws ApiException { + return getGovernanceNotificationSettingsWithHttpInfo().getData(); + } + + /** + * Get governance 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.GovernanceSettingsApi.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 governance 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.GovernanceSettingsApi.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() {}); + } + + /** + * List governance limits. + * + *

See {@link #listGovernanceLimitsWithHttpInfo}. + * + * @return GovernanceLimitsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceLimitsResponse listGovernanceLimits() throws ApiException { + return listGovernanceLimitsWithHttpInfo().getData(); + } + + /** + * List governance 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.GovernanceSettingsApi.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 governance 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.GovernanceSettingsApi.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 governance resource limits. + * + *

See {@link #listGovernanceResourceLimitsWithHttpInfo}. + * + * @return GovernanceResourceLimitsResponse + * @throws ApiException if fails to make API call + */ + public GovernanceResourceLimitsResponse listGovernanceResourceLimits() throws ApiException { + return listGovernanceResourceLimitsWithHttpInfo().getData(); + } + + /** + * List governance 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.GovernanceSettingsApi.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 governance 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.GovernanceSettingsApi.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() {}); + } + + /** + * Update governance 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 governance 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.GovernanceSettingsApi.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 governance 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.GovernanceSettingsApi.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/model/ControlNotificationEventSetting.java b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationEventSetting.java new file mode 100644 index 00000000000..31f4c067d4f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationEventSetting.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.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; + } + + 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; + } + + /** + * 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..9572858b6c3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsAttributes.java @@ -0,0 +1,159 @@ +/* + * 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; + } + + 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; + } + + /** + * 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..4cd330a2f58 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsData.java @@ -0,0 +1,213 @@ +/* + * 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; + } + + 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..d178b67b676 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsResponse.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 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; + } + + /** + * 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..7e165b9298d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateAttributes.java @@ -0,0 +1,156 @@ +/* + * 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; + 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; + } + + /** + * 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..bb191f062f5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateData.java @@ -0,0 +1,182 @@ +/* + * 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; + } + + 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..a9f5524c9ef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ControlNotificationSettingsUpdateRequest.java @@ -0,0 +1,149 @@ +/* + * 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; + } + + /** + * 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/GovernanceConfigAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigAttributes.java new file mode 100644 index 00000000000..b8d466fc90b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigAttributes.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; + +/** The attributes of a Governance Console configuration. */ +@JsonPropertyOrder({ + GovernanceConfigAttributes.JSON_PROPERTY_ASSIGNMENT_NOTIFICATIONS_ENABLED, + GovernanceConfigAttributes.JSON_PROPERTY_ENABLED, + GovernanceConfigAttributes.JSON_PROPERTY_USAGE_ATTRIBUTION_CONFIGURED +}) +@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 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) { + this.assignmentNotificationsEnabled = assignmentNotificationsEnabled; + this.enabled = enabled; + this.usageAttributionConfigured = usageAttributionConfigured; + } + + 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; + } + + /** + * 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.additionalProperties, governanceConfigAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + assignmentNotificationsEnabled, enabled, usageAttributionConfigured, 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(" 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..c86317b4855 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigData.java @@ -0,0 +1,210 @@ +/* + * 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; + } + + public GovernanceConfigData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the organization the Governance Console configuration applies 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 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..bd317568bce --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceConfigResponse.java @@ -0,0 +1,145 @@ +/* + * 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; + } + + /** + * 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/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..363a3d8002a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionAttributes.java @@ -0,0 +1,595 @@ +/* + * 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_URL, + 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_URL = "resource_url"; + private String resourceUrl; + + 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_URL) String resourceUrl, + @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.resourceUrl = resourceUrl; + 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; + } + + /** + * The unique identifier of the control that produced this detection. + * + * @return controlId + */ + @JsonProperty(JSON_PROPERTY_CONTROL_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getControlId() { + return controlId; + } + + 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 resourceUrl(String resourceUrl) { + this.resourceUrl = resourceUrl; + return this; + } + + /** + * A link to the detected resource in Datadog. + * + * @return resourceUrl + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceUrl() { + return resourceUrl; + } + + public void setResourceUrl(String resourceUrl) { + this.resourceUrl = resourceUrl; + } + + 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.resourceUrl, governanceControlDetectionAttributes.resourceUrl) + && 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, + resourceUrl, + 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(" resourceUrl: ").append(toIndentedString(resourceUrl)).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..74374f6a323 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionData.java @@ -0,0 +1,213 @@ +/* + * 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; + } + + 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..6ae95ceaec1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionResponse.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; + +/** 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; + } + + /** + * 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..93d4d14fa5f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateData.java @@ -0,0 +1,183 @@ +/* + * 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; + } + + 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..e39674d706f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionUpdateRequest.java @@ -0,0 +1,149 @@ +/* + * 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; + } + + /** + * 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..aabd1a18151 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceControlDetectionsResponse.java @@ -0,0 +1,157 @@ +/* + * 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; + } + + 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; + } + + /** + * 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/GovernanceInsightQueryConfig.java b/src/main/java/com/datadog/api/client/v2/model/GovernanceInsightQueryConfig.java index dae8784a5cd..39d373d986c 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 @@ -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 */ 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..0c9c34d11e2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitAttributes.java @@ -0,0 +1,414 @@ +/* + * 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 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; + } + + 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; + } + + 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..3aeccd1675c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitData.java @@ -0,0 +1,209 @@ +/* + * 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 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 governance 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; + } + + 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..338fc619449 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceLimitsResponse.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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A list of governance 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; + } + + 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 governance 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; + } + + /** + * 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..16efc2a4854 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequest.java @@ -0,0 +1,147 @@ +/* + * 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; + } + + /** + * 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..cd0294747d0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceMitigationRequestData.java @@ -0,0 +1,182 @@ +/* + * 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; + } + + 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..dab7c0c5e80 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsData.java @@ -0,0 +1,213 @@ +/* + * 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; + } + + 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..79f50774b5c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsResponse.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 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; + } + + /** + * 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..cfd8ad264a3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateData.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 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; + } + + 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..602dff13f4e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceNotificationSettingsUpdateRequest.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 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; + } + + /** + * 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..0535737b02f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitAttributes.java @@ -0,0 +1,540 @@ +/* + * 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_DEEP_LINK, + 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_DEEP_LINK = "deep_link"; + private String deepLink; + + 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_DEEP_LINK) String deepLink, + @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.deepLink = deepLink; + 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 deepLink(String deepLink) { + this.deepLink = deepLink; + return this; + } + + /** + * A link to the Datadog page where the resource and its limit can be managed. + * + * @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 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; + } + + 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; + } + + 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; + } + + 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.deepLink, governanceResourceLimitAttributes.deepLink) + && 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, + deepLink, + 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(" deepLink: ").append(toIndentedString(deepLink)).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..68e9471889f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitData.java @@ -0,0 +1,211 @@ +/* + * 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; + } + + 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..b55b14f0c2b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GovernanceResourceLimitsResponse.java @@ -0,0 +1,157 @@ +/* + * 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; + } + + 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; + } + + /** + * 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_controls.feature b/src/test/resources/com/datadog/api/client/v2/api/governance_controls.feature index 1207f5cf507..c16b9650883 100644 --- 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 @@ -11,6 +11,33 @@ Feature: Governance Controls 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 detection returns "Bad Request" response + Given operation "GetGovernanceControlDetection" enabled + And new "GetGovernanceControlDetection" request + And request contains "detection_type" parameter from "REPLACE.ME" + 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 governance control detection returns "Not Found" response + Given operation "GetGovernanceControlDetection" enabled + And new "GetGovernanceControlDetection" request + And request contains "detection_type" parameter from "REPLACE.ME" + 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 governance control detection returns "OK" response + Given operation "GetGovernanceControlDetection" enabled + And new "GetGovernanceControlDetection" request + And request contains "detection_type" parameter from "REPLACE.ME" + 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 a governance control returns "Bad Request" response Given operation "GetGovernanceControl" enabled @@ -35,6 +62,38 @@ Feature: Governance Controls When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get governance 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 governance 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: List governance 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 governance 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 governance controls returns "Bad Request" response Given operation "ListGovernanceControls" enabled @@ -49,6 +108,52 @@ Feature: Governance Controls When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Mitigate governance detections returns "Accepted" response + Given operation "CreateGovernanceMitigation" enabled + And new "CreateGovernanceMitigation" 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 governance detections returns "Bad Request" response + Given operation "CreateGovernanceMitigation" enabled + And new "CreateGovernanceMitigation" 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 governance control detection returns "Bad Request" response + Given operation "UpdateGovernanceControlDetection" enabled + And new "UpdateGovernanceControlDetection" request + And request contains "detection_type" parameter from "REPLACE.ME" + 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 governance control detection returns "Not Found" response + Given operation "UpdateGovernanceControlDetection" enabled + And new "UpdateGovernanceControlDetection" request + And request contains "detection_type" parameter from "REPLACE.ME" + 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 governance control detection returns "OK" response + Given operation "UpdateGovernanceControlDetection" enabled + And new "UpdateGovernanceControlDetection" request + And request contains "detection_type" parameter from "REPLACE.ME" + 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 a governance control returns "Bad Request" response Given operation "UpdateGovernanceControl" enabled @@ -75,3 +180,21 @@ Feature: Governance Controls 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 + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update governance 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 governance 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 diff --git a/src/test/resources/com/datadog/api/client/v2/api/governance_settings.feature b/src/test/resources/com/datadog/api/client/v2/api/governance_settings.feature new file mode 100644 index 00000000000..a4485723121 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/governance_settings.feature @@ -0,0 +1,83 @@ +@endpoint(governance-settings) @endpoint(governance-settings-v2) +Feature: Governance Settings + Governance Settings cover organization-wide Governance Console + configuration, usage limits and resource limits, and notification + preferences that determine when and how the Console alerts users about + governance activity. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "GovernanceSettings" API + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get governance 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 governance 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 governance 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 governance 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: List governance 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 governance 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: Update governance 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 governance 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/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index c07e3792ac5..2f2c9c766b0 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 @@ -2792,6 +2792,12 @@ "type": "safe" } }, + "GetGovernanceConfig": { + "tag": "Governance Settings", + "undo": { + "type": "safe" + } + }, "ListGovernanceControls": { "tag": "Governance Controls", "undo": { @@ -2810,12 +2816,72 @@ "type": "idempotent" } }, + "ListGovernanceControlDetections": { + "tag": "Governance Controls", + "undo": { + "type": "safe" + } + }, + "GetGovernanceControlDetection": { + "tag": "Governance Controls", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceControlDetection": { + "tag": "Governance Controls", + "undo": { + "type": "idempotent" + } + }, + "GetGovernanceControlNotificationSettings": { + "tag": "Governance Controls", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceControlNotificationSettings": { + "tag": "Governance Controls", + "undo": { + "type": "idempotent" + } + }, "ListGovernanceInsights": { "tag": "Governance Insights", "undo": { "type": "safe" } }, + "ListGovernanceLimits": { + "tag": "Governance Settings", + "undo": { + "type": "safe" + } + }, + "CreateGovernanceMitigation": { + "tag": "Governance Controls", + "undo": { + "type": "unsafe" + } + }, + "GetGovernanceNotificationSettings": { + "tag": "Governance Settings", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceNotificationSettings": { + "tag": "Governance Settings", + "undo": { + "type": "idempotent" + } + }, + "ListGovernanceResourceLimits": { + "tag": "Governance Settings", + "undo": { + "type": "safe" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": {