From 5d130106315b792017a638601843ed77f0e52032 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 26 Jun 2026 12:20:13 +0000 Subject: [PATCH] Regenerate client from commit 6ee0878 of spec repo --- .generator/schemas/v2/openapi.yaml | 1680 ++++++++++++++++- .../CreateGovernanceMitigation.rb | 21 + .../GetGovernanceControlDetection.rb | 8 + ...etGovernanceControlNotificationSettings.rb | 8 + .../ListGovernanceControlDetections.rb | 8 + .../UpdateGovernanceControlDetection.rb | 20 + ...teGovernanceControlNotificationSettings.rb | 28 + .../GetGovernanceConfig.rb | 8 + .../GetGovernanceNotificationSettings.rb | 8 + .../ListGovernanceLimits.rb | 8 + .../ListGovernanceResourceLimits.rb | 8 + .../UpdateGovernanceNotificationSettings.rb | 17 + features/scenarios_model_mapping.rb | 30 + features/v2/governance_controls.feature | 123 ++ features/v2/governance_settings.feature | 83 + features/v2/undo.json | 66 + lib/datadog_api_client/configuration.rb | 11 + lib/datadog_api_client/inflector.rb | 46 + .../v2/api/governance_controls_api.rb | 477 ++++- .../v2/api/governance_insights_api.rb | 2 +- .../v2/api/governance_settings_api.rb | 371 ++++ .../control_notification_event_setting.rb | 167 ++ ...ontrol_notification_settings_attributes.rb | 125 ++ .../control_notification_settings_data.rb | 165 ++ ...rol_notification_settings_resource_type.rb | 26 + .../control_notification_settings_response.rb | 123 ++ ...notification_settings_update_attributes.rb | 107 ++ ...ntrol_notification_settings_update_data.rb | 133 ++ ...ol_notification_settings_update_request.rb | 123 ++ .../v2/models/control_notification_target.rb | 144 ++ .../control_notification_target_type.rb | 29 + .../v2/models/governance_config_attributes.rb | 165 ++ .../v2/models/governance_config_data.rb | 165 ++ .../v2/models/governance_config_response.rb | 123 ++ ...governance_console_config_resource_type.rb | 26 + ...nce_control_detection_assignment_source.rb | 29 + ...governance_control_detection_attributes.rb | 361 ++++ .../governance_control_detection_data.rb | 165 ++ ...ernance_control_detection_resource_type.rb | 26 + .../governance_control_detection_response.rb | 123 ++ .../governance_control_detection_state.rb | 32 + ...nce_control_detection_update_attributes.rb | 135 ++ ...overnance_control_detection_update_data.rb | 133 ++ ...rnance_control_detection_update_request.rb | 123 ++ ...vernance_control_detection_update_state.rb | 27 + .../governance_control_detections_response.rb | 125 ++ .../models/governance_insight_query_config.rb | 2 +- .../v2/models/governance_limit_attributes.rb | 312 +++ .../v2/models/governance_limit_data.rb | 165 ++ .../v2/models/governance_limit_query.rb | 165 ++ .../models/governance_limit_query_config.rb | 145 ++ .../models/governance_limit_resource_type.rb | 26 + .../v2/models/governance_limits_response.rb | 125 ++ .../models/governance_mitigation_request.rb | 123 ++ ...overnance_mitigation_request_attributes.rb | 137 ++ .../governance_mitigation_request_data.rb | 133 ++ ...rnance_notification_settings_attributes.rb | 123 ++ .../governance_notification_settings_data.rb | 165 ++ ...nce_notification_settings_resource_type.rb | 26 + ...vernance_notification_settings_response.rb | 123 ++ ...notification_settings_update_attributes.rb | 105 ++ ...nance_notification_settings_update_data.rb | 133 ++ ...ce_notification_settings_update_request.rb | 123 ++ .../governance_resource_limit_attributes.rb | 396 ++++ .../models/governance_resource_limit_data.rb | 165 ++ ...governance_resource_limit_resource_type.rb | 26 + .../governance_resource_limits_response.rb | 125 ++ 67 files changed, 8768 insertions(+), 6 deletions(-) create mode 100644 examples/v2/governance-controls/CreateGovernanceMitigation.rb create mode 100644 examples/v2/governance-controls/GetGovernanceControlDetection.rb create mode 100644 examples/v2/governance-controls/GetGovernanceControlNotificationSettings.rb create mode 100644 examples/v2/governance-controls/ListGovernanceControlDetections.rb create mode 100644 examples/v2/governance-controls/UpdateGovernanceControlDetection.rb create mode 100644 examples/v2/governance-controls/UpdateGovernanceControlNotificationSettings.rb create mode 100644 examples/v2/governance-settings/GetGovernanceConfig.rb create mode 100644 examples/v2/governance-settings/GetGovernanceNotificationSettings.rb create mode 100644 examples/v2/governance-settings/ListGovernanceLimits.rb create mode 100644 examples/v2/governance-settings/ListGovernanceResourceLimits.rb create mode 100644 examples/v2/governance-settings/UpdateGovernanceNotificationSettings.rb create mode 100644 features/v2/governance_settings.feature create mode 100644 lib/datadog_api_client/v2/api/governance_settings_api.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_event_setting.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_settings_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_settings_data.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_settings_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_settings_response.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_settings_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_settings_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_settings_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_target.rb create mode 100644 lib/datadog_api_client/v2/models/control_notification_target_type.rb create mode 100644 lib/datadog_api_client/v2/models/governance_config_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_config_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_config_response.rb create mode 100644 lib/datadog_api_client/v2/models/governance_console_config_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_assignment_source.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_response.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_state.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detection_update_state.rb create mode 100644 lib/datadog_api_client/v2/models/governance_control_detections_response.rb create mode 100644 lib/datadog_api_client/v2/models/governance_limit_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_limit_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_limit_query.rb create mode 100644 lib/datadog_api_client/v2/models/governance_limit_query_config.rb create mode 100644 lib/datadog_api_client/v2/models/governance_limit_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/governance_limits_response.rb create mode 100644 lib/datadog_api_client/v2/models/governance_mitigation_request.rb create mode 100644 lib/datadog_api_client/v2/models/governance_mitigation_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_mitigation_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_notification_settings_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_notification_settings_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_notification_settings_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/governance_notification_settings_response.rb create mode 100644 lib/datadog_api_client/v2/models/governance_notification_settings_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_notification_settings_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_notification_settings_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/governance_resource_limit_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/governance_resource_limit_data.rb create mode 100644 lib/datadog_api_client/v2/models/governance_resource_limit_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/governance_resource_limits_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fd30acae59e1..74d20bb6580e 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.rb b/examples/v2/governance-controls/CreateGovernanceMitigation.rb new file mode 100644 index 000000000000..5d1217c0dfbb --- /dev/null +++ b/examples/v2/governance-controls/CreateGovernanceMitigation.rb @@ -0,0 +1,21 @@ +# Mitigate governance detections returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_governance_mitigation".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new + +body = DatadogAPIClient::V2::GovernanceMitigationRequest.new({ + data: DatadogAPIClient::V2::GovernanceMitigationRequestData.new({ + attributes: DatadogAPIClient::V2::GovernanceMitigationRequestAttributes.new({ + detection_ids: [ + "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d", + ], + detection_type: "unused_api_keys", + mitigation_type: "revoke_api_key", + }), + type: DatadogAPIClient::V2::GovernanceControlDetectionResourceType::GOVERNANCE_CONTROL_DETECTION, + }), +}) +p api_instance.create_governance_mitigation(body) diff --git a/examples/v2/governance-controls/GetGovernanceControlDetection.rb b/examples/v2/governance-controls/GetGovernanceControlDetection.rb new file mode 100644 index 000000000000..ed779b856e33 --- /dev/null +++ b/examples/v2/governance-controls/GetGovernanceControlDetection.rb @@ -0,0 +1,8 @@ +# Get a governance control detection returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_governance_control_detection".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new +p api_instance.get_governance_control_detection("detection_type", "detection_id") diff --git a/examples/v2/governance-controls/GetGovernanceControlNotificationSettings.rb b/examples/v2/governance-controls/GetGovernanceControlNotificationSettings.rb new file mode 100644 index 000000000000..a56c4e927dc7 --- /dev/null +++ b/examples/v2/governance-controls/GetGovernanceControlNotificationSettings.rb @@ -0,0 +1,8 @@ +# Get governance control notification settings returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_governance_control_notification_settings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new +p api_instance.get_governance_control_notification_settings("detection_type") diff --git a/examples/v2/governance-controls/ListGovernanceControlDetections.rb b/examples/v2/governance-controls/ListGovernanceControlDetections.rb new file mode 100644 index 000000000000..d647e8705400 --- /dev/null +++ b/examples/v2/governance-controls/ListGovernanceControlDetections.rb @@ -0,0 +1,8 @@ +# List governance control detections returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_governance_control_detections".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new +p api_instance.list_governance_control_detections("detection_type") diff --git a/examples/v2/governance-controls/UpdateGovernanceControlDetection.rb b/examples/v2/governance-controls/UpdateGovernanceControlDetection.rb new file mode 100644 index 000000000000..420fc6eec82e --- /dev/null +++ b/examples/v2/governance-controls/UpdateGovernanceControlDetection.rb @@ -0,0 +1,20 @@ +# Update a governance control detection returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_governance_control_detection".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new + +body = DatadogAPIClient::V2::GovernanceControlDetectionUpdateRequest.new({ + data: DatadogAPIClient::V2::GovernanceControlDetectionUpdateData.new({ + attributes: DatadogAPIClient::V2::GovernanceControlDetectionUpdateAttributes.new({ + assigned_team: "platform-security", + assigned_to: "11111111-2222-3333-4444-555555555555", + mitigate_after: "2024-03-15T00:00:00Z", + state: DatadogAPIClient::V2::GovernanceControlDetectionUpdateState::EXCEPTION, + }), + type: DatadogAPIClient::V2::GovernanceControlDetectionResourceType::GOVERNANCE_CONTROL_DETECTION, + }), +}) +p api_instance.update_governance_control_detection("detection_type", "detection_id", body) diff --git a/examples/v2/governance-controls/UpdateGovernanceControlNotificationSettings.rb b/examples/v2/governance-controls/UpdateGovernanceControlNotificationSettings.rb new file mode 100644 index 000000000000..80e39672bae9 --- /dev/null +++ b/examples/v2/governance-controls/UpdateGovernanceControlNotificationSettings.rb @@ -0,0 +1,28 @@ +# Update governance control notification settings returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_governance_control_notification_settings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new + +body = DatadogAPIClient::V2::ControlNotificationSettingsUpdateRequest.new({ + data: DatadogAPIClient::V2::ControlNotificationSettingsUpdateData.new({ + attributes: DatadogAPIClient::V2::ControlNotificationSettingsUpdateAttributes.new({ + event_settings: [ + DatadogAPIClient::V2::ControlNotificationEventSetting.new({ + enabled: true, + event_type: "new_detection", + targets: [ + DatadogAPIClient::V2::ControlNotificationTarget.new({ + handle: "#governance-alerts", + type: DatadogAPIClient::V2::ControlNotificationTargetType::SLACK, + }), + ], + }), + ], + }), + type: DatadogAPIClient::V2::ControlNotificationSettingsResourceType::CONTROL_NOTIFICATION_SETTINGS, + }), +}) +p api_instance.update_governance_control_notification_settings("detection_type", body) diff --git a/examples/v2/governance-settings/GetGovernanceConfig.rb b/examples/v2/governance-settings/GetGovernanceConfig.rb new file mode 100644 index 000000000000..9c21f397d260 --- /dev/null +++ b/examples/v2/governance-settings/GetGovernanceConfig.rb @@ -0,0 +1,8 @@ +# Get the governance console configuration returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_governance_config".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceSettingsAPI.new +p api_instance.get_governance_config() diff --git a/examples/v2/governance-settings/GetGovernanceNotificationSettings.rb b/examples/v2/governance-settings/GetGovernanceNotificationSettings.rb new file mode 100644 index 000000000000..ee0191fad1b3 --- /dev/null +++ b/examples/v2/governance-settings/GetGovernanceNotificationSettings.rb @@ -0,0 +1,8 @@ +# Get governance notification settings returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_governance_notification_settings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceSettingsAPI.new +p api_instance.get_governance_notification_settings() diff --git a/examples/v2/governance-settings/ListGovernanceLimits.rb b/examples/v2/governance-settings/ListGovernanceLimits.rb new file mode 100644 index 000000000000..cdcda7977109 --- /dev/null +++ b/examples/v2/governance-settings/ListGovernanceLimits.rb @@ -0,0 +1,8 @@ +# List governance limits returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_governance_limits".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceSettingsAPI.new +p api_instance.list_governance_limits() diff --git a/examples/v2/governance-settings/ListGovernanceResourceLimits.rb b/examples/v2/governance-settings/ListGovernanceResourceLimits.rb new file mode 100644 index 000000000000..b5a5b86174e8 --- /dev/null +++ b/examples/v2/governance-settings/ListGovernanceResourceLimits.rb @@ -0,0 +1,8 @@ +# List governance resource limits returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_governance_resource_limits".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceSettingsAPI.new +p api_instance.list_governance_resource_limits() diff --git a/examples/v2/governance-settings/UpdateGovernanceNotificationSettings.rb b/examples/v2/governance-settings/UpdateGovernanceNotificationSettings.rb new file mode 100644 index 000000000000..743f88d73b4e --- /dev/null +++ b/examples/v2/governance-settings/UpdateGovernanceNotificationSettings.rb @@ -0,0 +1,17 @@ +# Update governance notification settings returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_governance_notification_settings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceSettingsAPI.new + +body = DatadogAPIClient::V2::GovernanceNotificationSettingsUpdateRequest.new({ + data: DatadogAPIClient::V2::GovernanceNotificationSettingsUpdateData.new({ + attributes: DatadogAPIClient::V2::GovernanceNotificationSettingsUpdateAttributes.new({ + assignment_notifications_enabled: true, + }), + type: DatadogAPIClient::V2::GovernanceNotificationSettingsResourceType::GOVERNANCE_NOTIFICATION_SETTINGS, + }), +}) +p api_instance.update_governance_notification_settings(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 126df7bea216..7b4dcc931212 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3376,6 +3376,9 @@ "saml_config_uuid" => "String", "body" => "SAMLConfigurationUpdateRequest", }, + "v2.UpdateGovernanceNotificationSettings" => { + "body" => "GovernanceNotificationSettingsUpdateRequest", + }, "v2.GetGovernanceControl" => { "detection_type" => "String", }, @@ -3383,6 +3386,33 @@ "detection_type" => "String", "body" => "GovernanceControlUpdateRequest", }, + "v2.ListGovernanceControlDetections" => { + "detection_type" => "String", + "filter_state" => "String", + "filter_query" => "String", + "sort" => "String", + "page_number" => "Integer", + "page_size" => "Integer", + }, + "v2.GetGovernanceControlDetection" => { + "detection_type" => "String", + "detection_id" => "String", + }, + "v2.UpdateGovernanceControlDetection" => { + "detection_type" => "String", + "detection_id" => "String", + "body" => "GovernanceControlDetectionUpdateRequest", + }, + "v2.GetGovernanceControlNotificationSettings" => { + "detection_type" => "String", + }, + "v2.UpdateGovernanceControlNotificationSettings" => { + "detection_type" => "String", + "body" => "ControlNotificationSettingsUpdateRequest", + }, + "v2.CreateGovernanceMitigation" => { + "body" => "GovernanceMitigationRequest", + }, "v2.ListGovernanceInsights" => { "with_values" => "Boolean", "org_uuid" => "String", diff --git a/features/v2/governance_controls.feature b/features/v2/governance_controls.feature index 1207f5cf507f..c16b9650883c 100644 --- a/features/v2/governance_controls.feature +++ b/features/v2/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/features/v2/governance_settings.feature b/features/v2/governance_settings.feature new file mode 100644 index 000000000000..a44857231215 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index c07e3792ac55..2f2c9c766b03 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 8ce53bbd79d1..c75a625820ef 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -488,9 +488,20 @@ def initialize "v2.upsert_and_publish_form_version": false, "v2.upsert_form_version": false, "v2.update_org_saml_configurations": false, + "v2.get_governance_config": false, + "v2.get_governance_notification_settings": false, + "v2.list_governance_limits": false, + "v2.list_governance_resource_limits": false, + "v2.update_governance_notification_settings": false, + "v2.create_governance_mitigation": false, "v2.get_governance_control": false, + "v2.get_governance_control_detection": false, + "v2.get_governance_control_notification_settings": false, + "v2.list_governance_control_detections": false, "v2.list_governance_controls": false, "v2.update_governance_control": false, + "v2.update_governance_control_detection": false, + "v2.update_governance_control_notification_settings": false, "v2.list_governance_insights": false, "v2.create_hamr_org_connection": false, "v2.get_hamr_org_connection": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 5be0a02cbd93..5afac41abd76 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2283,6 +2283,16 @@ def overrides "v2.container_timeseries_query" => "ContainerTimeseriesQuery", "v2.container_type" => "ContainerType", "v2.content_encoding" => "ContentEncoding", + "v2.control_notification_event_setting" => "ControlNotificationEventSetting", + "v2.control_notification_settings_attributes" => "ControlNotificationSettingsAttributes", + "v2.control_notification_settings_data" => "ControlNotificationSettingsData", + "v2.control_notification_settings_resource_type" => "ControlNotificationSettingsResourceType", + "v2.control_notification_settings_response" => "ControlNotificationSettingsResponse", + "v2.control_notification_settings_update_attributes" => "ControlNotificationSettingsUpdateAttributes", + "v2.control_notification_settings_update_data" => "ControlNotificationSettingsUpdateData", + "v2.control_notification_settings_update_request" => "ControlNotificationSettingsUpdateRequest", + "v2.control_notification_target" => "ControlNotificationTarget", + "v2.control_notification_target_type" => "ControlNotificationTargetType", "v2.convert_job_results_to_signals_attributes" => "ConvertJobResultsToSignalsAttributes", "v2.convert_job_results_to_signals_data" => "ConvertJobResultsToSignalsData", "v2.convert_job_results_to_signals_data_type" => "ConvertJobResultsToSignalsDataType", @@ -3559,8 +3569,23 @@ def overrides "v2.google_meet_configuration_reference" => "GoogleMeetConfigurationReference", "v2.google_meet_configuration_reference_data" => "GoogleMeetConfigurationReferenceData", "v2.governance_best_practice_definition" => "GovernanceBestPracticeDefinition", + "v2.governance_config_attributes" => "GovernanceConfigAttributes", + "v2.governance_config_data" => "GovernanceConfigData", + "v2.governance_config_response" => "GovernanceConfigResponse", + "v2.governance_console_config_resource_type" => "GovernanceConsoleConfigResourceType", "v2.governance_control_attributes" => "GovernanceControlAttributes", "v2.governance_control_data" => "GovernanceControlData", + "v2.governance_control_detection_assignment_source" => "GovernanceControlDetectionAssignmentSource", + "v2.governance_control_detection_attributes" => "GovernanceControlDetectionAttributes", + "v2.governance_control_detection_data" => "GovernanceControlDetectionData", + "v2.governance_control_detection_resource_type" => "GovernanceControlDetectionResourceType", + "v2.governance_control_detection_response" => "GovernanceControlDetectionResponse", + "v2.governance_control_detections_response" => "GovernanceControlDetectionsResponse", + "v2.governance_control_detection_state" => "GovernanceControlDetectionState", + "v2.governance_control_detection_update_attributes" => "GovernanceControlDetectionUpdateAttributes", + "v2.governance_control_detection_update_data" => "GovernanceControlDetectionUpdateData", + "v2.governance_control_detection_update_request" => "GovernanceControlDetectionUpdateRequest", + "v2.governance_control_detection_update_state" => "GovernanceControlDetectionUpdateState", "v2.governance_control_mitigation_definition" => "GovernanceControlMitigationDefinition", "v2.governance_control_parameter_definition" => "GovernanceControlParameterDefinition", "v2.governance_control_resource_type" => "GovernanceControlResourceType", @@ -3582,6 +3607,26 @@ def overrides "v2.governance_insight_resource_type" => "GovernanceInsightResourceType", "v2.governance_insights_response" => "GovernanceInsightsResponse", "v2.governance_insight_usage_query" => "GovernanceInsightUsageQuery", + "v2.governance_limit_attributes" => "GovernanceLimitAttributes", + "v2.governance_limit_data" => "GovernanceLimitData", + "v2.governance_limit_query" => "GovernanceLimitQuery", + "v2.governance_limit_query_config" => "GovernanceLimitQueryConfig", + "v2.governance_limit_resource_type" => "GovernanceLimitResourceType", + "v2.governance_limits_response" => "GovernanceLimitsResponse", + "v2.governance_mitigation_request" => "GovernanceMitigationRequest", + "v2.governance_mitigation_request_attributes" => "GovernanceMitigationRequestAttributes", + "v2.governance_mitigation_request_data" => "GovernanceMitigationRequestData", + "v2.governance_notification_settings_attributes" => "GovernanceNotificationSettingsAttributes", + "v2.governance_notification_settings_data" => "GovernanceNotificationSettingsData", + "v2.governance_notification_settings_resource_type" => "GovernanceNotificationSettingsResourceType", + "v2.governance_notification_settings_response" => "GovernanceNotificationSettingsResponse", + "v2.governance_notification_settings_update_attributes" => "GovernanceNotificationSettingsUpdateAttributes", + "v2.governance_notification_settings_update_data" => "GovernanceNotificationSettingsUpdateData", + "v2.governance_notification_settings_update_request" => "GovernanceNotificationSettingsUpdateRequest", + "v2.governance_resource_limit_attributes" => "GovernanceResourceLimitAttributes", + "v2.governance_resource_limit_data" => "GovernanceResourceLimitData", + "v2.governance_resource_limit_resource_type" => "GovernanceResourceLimitResourceType", + "v2.governance_resource_limits_response" => "GovernanceResourceLimitsResponse", "v2.grey_noise_api_key" => "GreyNoiseAPIKey", "v2.grey_noise_api_key_type" => "GreyNoiseAPIKeyType", "v2.grey_noise_api_key_update" => "GreyNoiseAPIKeyUpdate", @@ -7940,6 +7985,7 @@ def overrides "v2.google_chat_integration_api" => "GoogleChatIntegrationAPI", "v2.governance_controls_api" => "GovernanceControlsAPI", "v2.governance_insights_api" => "GovernanceInsightsAPI", + "v2.governance_settings_api" => "GovernanceSettingsAPI", "v2.high_availability_multi_region_api" => "HighAvailabilityMultiRegionAPI", "v2.incidents_api" => "IncidentsAPI", "v2.integrations_api" => "IntegrationsAPI", diff --git a/lib/datadog_api_client/v2/api/governance_controls_api.rb b/lib/datadog_api_client/v2/api/governance_controls_api.rb index a5267c68fbf5..f712b1973198 100644 --- a/lib/datadog_api_client/v2/api/governance_controls_api.rb +++ b/lib/datadog_api_client/v2/api/governance_controls_api.rb @@ -23,6 +23,81 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Mitigate governance detections. + # + # @see #create_governance_mitigation_with_http_info + def create_governance_mitigation(body, opts = {}) + create_governance_mitigation_with_http_info(body, opts) + nil + end + + # Mitigate governance detections. + # + # 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 [GovernanceMitigationRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def create_governance_mitigation_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_governance_mitigation".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_governance_mitigation") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_governance_mitigation")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.create_governance_mitigation ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling GovernanceControlsAPI.create_governance_mitigation" + end + # resource path + local_var_path = '/api/v2/governance/mitigate' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_governance_mitigation, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceControlsAPI#create_governance_mitigation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a governance control. # # @see #get_governance_control_with_http_info @@ -75,7 +150,7 @@ def get_governance_control_with_http_info(detection_type, opts = {}) return_type = opts[:debug_return_type] || 'GovernanceControlResponse' # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :get_governance_control, @@ -95,6 +170,237 @@ def get_governance_control_with_http_info(detection_type, opts = {}) return data, status_code, headers end + # Get a governance control detection. + # + # @see #get_governance_control_detection_with_http_info + def get_governance_control_detection(detection_type, detection_id, opts = {}) + data, _status_code, _headers = get_governance_control_detection_with_http_info(detection_type, detection_id, opts) + data + end + + # Get a governance control detection. + # + # Retrieve a single detection produced by the governance control with the given detection type. + # + # @param detection_type [String] The detection type that identifies the control; for example, `unused_api_keys`. + # @param detection_id [String] The unique identifier of the detection. + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceControlDetectionResponse, Integer, Hash)>] GovernanceControlDetectionResponse data, response status code and response headers + def get_governance_control_detection_with_http_info(detection_type, detection_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_governance_control_detection".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_governance_control_detection") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_governance_control_detection")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.get_governance_control_detection ...' + end + # verify the required parameter 'detection_type' is set + if @api_client.config.client_side_validation && detection_type.nil? + fail ArgumentError, "Missing the required parameter 'detection_type' when calling GovernanceControlsAPI.get_governance_control_detection" + end + # verify the required parameter 'detection_id' is set + if @api_client.config.client_side_validation && detection_id.nil? + fail ArgumentError, "Missing the required parameter 'detection_id' when calling GovernanceControlsAPI.get_governance_control_detection" + end + # resource path + local_var_path = '/api/v2/governance/control/{detection_type}/detections/{detection_id}'.sub('{detection_type}', CGI.escape(detection_type.to_s).gsub('%2F', '/')).sub('{detection_id}', CGI.escape(detection_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceControlDetectionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_governance_control_detection, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceControlsAPI#get_governance_control_detection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get governance control notification settings. + # + # @see #get_governance_control_notification_settings_with_http_info + def get_governance_control_notification_settings(detection_type, opts = {}) + data, _status_code, _headers = get_governance_control_notification_settings_with_http_info(detection_type, opts) + data + end + + # Get governance control notification settings. + # + # 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 detection_type [String] The detection type that identifies the control; for example, `unused_api_keys`. + # @param opts [Hash] the optional parameters + # @return [Array<(ControlNotificationSettingsResponse, Integer, Hash)>] ControlNotificationSettingsResponse data, response status code and response headers + def get_governance_control_notification_settings_with_http_info(detection_type, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_governance_control_notification_settings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_governance_control_notification_settings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_governance_control_notification_settings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.get_governance_control_notification_settings ...' + end + # verify the required parameter 'detection_type' is set + if @api_client.config.client_side_validation && detection_type.nil? + fail ArgumentError, "Missing the required parameter 'detection_type' when calling GovernanceControlsAPI.get_governance_control_notification_settings" + end + # resource path + local_var_path = '/api/v2/governance/control/{detection_type}/notification_settings'.sub('{detection_type}', CGI.escape(detection_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ControlNotificationSettingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_governance_control_notification_settings, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceControlsAPI#get_governance_control_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List governance control detections. + # + # @see #list_governance_control_detections_with_http_info + def list_governance_control_detections(detection_type, opts = {}) + data, _status_code, _headers = list_governance_control_detections_with_http_info(detection_type, opts) + data + end + + # List governance control detections. + # + # 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 detection_type [String] The detection type that identifies the control; for example, `unused_api_keys`. + # @param opts [Hash] the optional parameters + # @option opts [String] :filter_state Restrict the results to detections in the given state. + # @option opts [String] :filter_query Restrict the results to detections matching the given free-text query. + # @option opts [String] :sort The attribute to sort detections by. Prefix with `-` for descending order. + # @option opts [Integer] :page_number The zero-based index of the page to return; the first page is 0. + # @option opts [Integer] :page_size The number of detections to return per page. + # @return [Array<(GovernanceControlDetectionsResponse, Integer, Hash)>] GovernanceControlDetectionsResponse data, response status code and response headers + def list_governance_control_detections_with_http_info(detection_type, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_control_detections".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_control_detections") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_control_detections")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.list_governance_control_detections ...' + end + # verify the required parameter 'detection_type' is set + if @api_client.config.client_side_validation && detection_type.nil? + fail ArgumentError, "Missing the required parameter 'detection_type' when calling GovernanceControlsAPI.list_governance_control_detections" + end + # resource path + local_var_path = '/api/v2/governance/control/{detection_type}/detections'.sub('{detection_type}', CGI.escape(detection_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[state]'] = opts[:'filter_state'] if !opts[:'filter_state'].nil? + query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil? + query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceControlDetectionsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_governance_control_detections, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceControlsAPI#list_governance_control_detections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List governance controls. # # @see #list_governance_controls_with_http_info @@ -143,7 +449,7 @@ def list_governance_controls_with_http_info(opts = {}) return_type = opts[:debug_return_type] || 'GovernanceControlsResponse' # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :list_governance_controls, @@ -223,7 +529,7 @@ def update_governance_control_with_http_info(detection_type, body, opts = {}) return_type = opts[:debug_return_type] || 'GovernanceControlResponse' # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :update_governance_control, @@ -242,5 +548,170 @@ def update_governance_control_with_http_info(detection_type, body, opts = {}) end return data, status_code, headers end + + # Update a governance control detection. + # + # @see #update_governance_control_detection_with_http_info + def update_governance_control_detection(detection_type, detection_id, body, opts = {}) + data, _status_code, _headers = update_governance_control_detection_with_http_info(detection_type, detection_id, body, opts) + data + end + + # Update a governance control detection. + # + # 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 detection_type [String] The detection type that identifies the control; for example, `unused_api_keys`. + # @param detection_id [String] The unique identifier of the detection. + # @param body [GovernanceControlDetectionUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceControlDetectionResponse, Integer, Hash)>] GovernanceControlDetectionResponse data, response status code and response headers + def update_governance_control_detection_with_http_info(detection_type, detection_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_governance_control_detection".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_governance_control_detection") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_governance_control_detection")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.update_governance_control_detection ...' + end + # verify the required parameter 'detection_type' is set + if @api_client.config.client_side_validation && detection_type.nil? + fail ArgumentError, "Missing the required parameter 'detection_type' when calling GovernanceControlsAPI.update_governance_control_detection" + end + # verify the required parameter 'detection_id' is set + if @api_client.config.client_side_validation && detection_id.nil? + fail ArgumentError, "Missing the required parameter 'detection_id' when calling GovernanceControlsAPI.update_governance_control_detection" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling GovernanceControlsAPI.update_governance_control_detection" + end + # resource path + local_var_path = '/api/v2/governance/control/{detection_type}/detections/{detection_id}'.sub('{detection_type}', CGI.escape(detection_type.to_s).gsub('%2F', '/')).sub('{detection_id}', CGI.escape(detection_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceControlDetectionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_governance_control_detection, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceControlsAPI#update_governance_control_detection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update governance control notification settings. + # + # @see #update_governance_control_notification_settings_with_http_info + def update_governance_control_notification_settings(detection_type, body, opts = {}) + data, _status_code, _headers = update_governance_control_notification_settings_with_http_info(detection_type, body, opts) + data + end + + # Update governance control notification settings. + # + # 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 detection_type [String] The detection type that identifies the control; for example, `unused_api_keys`. + # @param body [ControlNotificationSettingsUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(ControlNotificationSettingsResponse, Integer, Hash)>] ControlNotificationSettingsResponse data, response status code and response headers + def update_governance_control_notification_settings_with_http_info(detection_type, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_governance_control_notification_settings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_governance_control_notification_settings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_governance_control_notification_settings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.update_governance_control_notification_settings ...' + end + # verify the required parameter 'detection_type' is set + if @api_client.config.client_side_validation && detection_type.nil? + fail ArgumentError, "Missing the required parameter 'detection_type' when calling GovernanceControlsAPI.update_governance_control_notification_settings" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling GovernanceControlsAPI.update_governance_control_notification_settings" + end + # resource path + local_var_path = '/api/v2/governance/control/{detection_type}/notification_settings'.sub('{detection_type}', CGI.escape(detection_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ControlNotificationSettingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_governance_control_notification_settings, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceControlsAPI#update_governance_control_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/api/governance_insights_api.rb b/lib/datadog_api_client/v2/api/governance_insights_api.rb index 3c95d8cc2004..56c690356532 100644 --- a/lib/datadog_api_client/v2/api/governance_insights_api.rb +++ b/lib/datadog_api_client/v2/api/governance_insights_api.rb @@ -77,7 +77,7 @@ def list_governance_insights_with_http_info(opts = {}) return_type = opts[:debug_return_type] || 'GovernanceInsightsResponse' # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :list_governance_insights, diff --git a/lib/datadog_api_client/v2/api/governance_settings_api.rb b/lib/datadog_api_client/v2/api/governance_settings_api.rb new file mode 100644 index 000000000000..8817ebfd690a --- /dev/null +++ b/lib/datadog_api_client/v2/api/governance_settings_api.rb @@ -0,0 +1,371 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class GovernanceSettingsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Get the governance console configuration. + # + # @see #get_governance_config_with_http_info + def get_governance_config(opts = {}) + data, _status_code, _headers = get_governance_config_with_http_info(opts) + data + end + + # Get the governance console configuration. + # + # 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. + # + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceConfigResponse, Integer, Hash)>] GovernanceConfigResponse data, response status code and response headers + def get_governance_config_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_governance_config".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_governance_config") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_governance_config")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceSettingsAPI.get_governance_config ...' + end + # resource path + local_var_path = '/api/v2/governance/config' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceConfigResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_governance_config, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceSettingsAPI#get_governance_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get governance notification settings. + # + # @see #get_governance_notification_settings_with_http_info + def get_governance_notification_settings(opts = {}) + data, _status_code, _headers = get_governance_notification_settings_with_http_info(opts) + data + end + + # Get governance notification settings. + # + # Retrieve the organization-wide governance notification settings, including whether users are + # notified when detections are assigned to them. + # + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceNotificationSettingsResponse, Integer, Hash)>] GovernanceNotificationSettingsResponse data, response status code and response headers + def get_governance_notification_settings_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_governance_notification_settings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_governance_notification_settings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_governance_notification_settings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceSettingsAPI.get_governance_notification_settings ...' + end + # resource path + local_var_path = '/api/v2/governance/notification_settings' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceNotificationSettingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_governance_notification_settings, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceSettingsAPI#get_governance_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List governance limits. + # + # @see #list_governance_limits_with_http_info + def list_governance_limits(opts = {}) + data, _status_code, _headers = list_governance_limits_with_http_info(opts) + data + end + + # List governance limits. + # + # 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. + # + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceLimitsResponse, Integer, Hash)>] GovernanceLimitsResponse data, response status code and response headers + def list_governance_limits_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_limits".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_limits") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_limits")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceSettingsAPI.list_governance_limits ...' + end + # resource path + local_var_path = '/api/v2/governance/limits' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceLimitsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_governance_limits, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceSettingsAPI#list_governance_limits\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List governance resource limits. + # + # @see #list_governance_resource_limits_with_http_info + def list_governance_resource_limits(opts = {}) + data, _status_code, _headers = list_governance_resource_limits_with_http_info(opts) + data + end + + # List governance resource limits. + # + # 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. + # + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceResourceLimitsResponse, Integer, Hash)>] GovernanceResourceLimitsResponse data, response status code and response headers + def list_governance_resource_limits_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_resource_limits".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_resource_limits") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_resource_limits")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceSettingsAPI.list_governance_resource_limits ...' + end + # resource path + local_var_path = '/api/v2/governance/resource-limits' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceResourceLimitsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_governance_resource_limits, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceSettingsAPI#list_governance_resource_limits\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update governance notification settings. + # + # @see #update_governance_notification_settings_with_http_info + def update_governance_notification_settings(body, opts = {}) + data, _status_code, _headers = update_governance_notification_settings_with_http_info(body, opts) + data + end + + # Update governance notification settings. + # + # Update the organization-wide governance notification settings. Only the attributes present in + # the request are modified. + # + # @param body [GovernanceNotificationSettingsUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceNotificationSettingsResponse, Integer, Hash)>] GovernanceNotificationSettingsResponse data, response status code and response headers + def update_governance_notification_settings_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_governance_notification_settings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_governance_notification_settings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_governance_notification_settings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceSettingsAPI.update_governance_notification_settings ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling GovernanceSettingsAPI.update_governance_notification_settings" + end + # resource path + local_var_path = '/api/v2/governance/notification_settings' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'GovernanceNotificationSettingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_governance_notification_settings, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceSettingsAPI#update_governance_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_event_setting.rb b/lib/datadog_api_client/v2/models/control_notification_event_setting.rb new file mode 100644 index 000000000000..a413e1059b31 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_event_setting.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The notification settings for a single event type on a control. + class ControlNotificationEventSetting + include BaseGenericModel + + # Whether notifications are enabled for this event type. + attr_reader :enabled + + # The event type the notification settings apply to, such as `new_detection`. + attr_reader :event_type + + # The destinations that receive notifications for an event type. + attr_reader :targets + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'enabled' => :'enabled', + :'event_type' => :'event_type', + :'targets' => :'targets' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'event_type' => :'String', + :'targets' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationEventSetting` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'event_type') + self.event_type = attributes[:'event_type'] + end + + if attributes.key?(:'targets') + if (value = attributes[:'targets']).is_a?(Array) + self.targets = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @enabled.nil? + return false if @event_type.nil? + return false if @targets.nil? + true + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param event_type [Object] Object to be assigned + # @!visibility private + def event_type=(event_type) + if event_type.nil? + fail ArgumentError, 'invalid value for "event_type", event_type cannot be nil.' + end + @event_type = event_type + end + + # Custom attribute writer method with validation + # @param targets [Object] Object to be assigned + # @!visibility private + def targets=(targets) + if targets.nil? + fail ArgumentError, 'invalid value for "targets", targets cannot be nil.' + end + @targets = targets + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + event_type == o.event_type && + targets == o.targets && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, event_type, targets, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_settings_attributes.rb b/lib/datadog_api_client/v2/models/control_notification_settings_attributes.rb new file mode 100644 index 000000000000..6de3d031e643 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_settings_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a governance control's notification settings. + class ControlNotificationSettingsAttributes + include BaseGenericModel + + # The notification settings for each supported event type on the control. + attr_reader :event_settings + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'event_settings' => :'event_settings' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'event_settings' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationSettingsAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'event_settings') + if (value = attributes[:'event_settings']).is_a?(Array) + self.event_settings = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @event_settings.nil? + true + end + + # Custom attribute writer method with validation + # @param event_settings [Object] Object to be assigned + # @!visibility private + def event_settings=(event_settings) + if event_settings.nil? + fail ArgumentError, 'invalid value for "event_settings", event_settings cannot be nil.' + end + @event_settings = event_settings + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + event_settings == o.event_settings && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [event_settings, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_settings_data.rb b/lib/datadog_api_client/v2/models/control_notification_settings_data.rb new file mode 100644 index 000000000000..5c64abffe869 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_settings_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A control notification settings resource. + class ControlNotificationSettingsData + include BaseGenericModel + + # The attributes of a governance control's notification settings. + attr_reader :attributes + + # The detection type the notification settings apply to. + attr_reader :id + + # Control notification settings resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ControlNotificationSettingsAttributes', + :'id' => :'String', + :'type' => :'ControlNotificationSettingsResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationSettingsData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_settings_resource_type.rb b/lib/datadog_api_client/v2/models/control_notification_settings_resource_type.rb new file mode 100644 index 000000000000..60a04888eb12 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_settings_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Control notification settings resource type. + class ControlNotificationSettingsResourceType + include BaseEnumModel + + CONTROL_NOTIFICATION_SETTINGS = "control_notification_settings".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_settings_response.rb b/lib/datadog_api_client/v2/models/control_notification_settings_response.rb new file mode 100644 index 000000000000..340a0562bf8c --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_settings_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The notification settings for a governance control. + class ControlNotificationSettingsResponse + include BaseGenericModel + + # A control notification settings resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ControlNotificationSettingsData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationSettingsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_settings_update_attributes.rb b/lib/datadog_api_client/v2/models/control_notification_settings_update_attributes.rb new file mode 100644 index 000000000000..0a2b0ce4bc30 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_settings_update_attributes.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a governance control's notification settings that can be updated. + class ControlNotificationSettingsUpdateAttributes + include BaseGenericModel + + # The notification settings for each supported event type on the control. + attr_accessor :event_settings + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'event_settings' => :'event_settings' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'event_settings' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationSettingsUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'event_settings') + if (value = attributes[:'event_settings']).is_a?(Array) + self.event_settings = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + event_settings == o.event_settings && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [event_settings, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_settings_update_data.rb b/lib/datadog_api_client/v2/models/control_notification_settings_update_data.rb new file mode 100644 index 000000000000..b588768dd126 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_settings_update_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data of a control notification settings update request. + class ControlNotificationSettingsUpdateData + include BaseGenericModel + + # The attributes of a governance control's notification settings that can be updated. + attr_accessor :attributes + + # Control notification settings resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ControlNotificationSettingsUpdateAttributes', + :'type' => :'ControlNotificationSettingsResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationSettingsUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_settings_update_request.rb b/lib/datadog_api_client/v2/models/control_notification_settings_update_request.rb new file mode 100644 index 000000000000..406e15320dde --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_settings_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to update the notification settings for a governance control. + class ControlNotificationSettingsUpdateRequest + include BaseGenericModel + + # The data of a control notification settings update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ControlNotificationSettingsUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationSettingsUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_target.rb b/lib/datadog_api_client/v2/models/control_notification_target.rb new file mode 100644 index 000000000000..befbc615f075 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_target.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A destination that receives notifications for an event type. + class ControlNotificationTarget + include BaseGenericModel + + # The destination handle, such as an email address, Slack channel, or user handle. + attr_reader :handle + + # The type of notification destination. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'handle' => :'handle', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'handle' => :'String', + :'type' => :'ControlNotificationTargetType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ControlNotificationTarget` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'handle') + self.handle = attributes[:'handle'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @handle.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param handle [Object] Object to be assigned + # @!visibility private + def handle=(handle) + if handle.nil? + fail ArgumentError, 'invalid value for "handle", handle cannot be nil.' + end + @handle = handle + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + handle == o.handle && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [handle, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/control_notification_target_type.rb b/lib/datadog_api_client/v2/models/control_notification_target_type.rb new file mode 100644 index 000000000000..bb64ff145aa0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/control_notification_target_type.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of notification destination. + class ControlNotificationTargetType + include BaseEnumModel + + EMAIL = "email".freeze + SLACK = "slack".freeze + AT_MENTION = "at_mention".freeze + CASE = "case".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_config_attributes.rb b/lib/datadog_api_client/v2/models/governance_config_attributes.rb new file mode 100644 index 000000000000..03409dae6f5f --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_config_attributes.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a Governance Console configuration. + class GovernanceConfigAttributes + include BaseGenericModel + + # Whether notifications are sent to users when detections are assigned to them. + attr_reader :assignment_notifications_enabled + + # Whether the Governance Console is enabled for the organization. + attr_reader :enabled + + # Whether usage attribution is configured for the organization. + attr_reader :usage_attribution_configured + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assignment_notifications_enabled' => :'assignment_notifications_enabled', + :'enabled' => :'enabled', + :'usage_attribution_configured' => :'usage_attribution_configured' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignment_notifications_enabled' => :'Boolean', + :'enabled' => :'Boolean', + :'usage_attribution_configured' => :'Boolean' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceConfigAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'assignment_notifications_enabled') + self.assignment_notifications_enabled = attributes[:'assignment_notifications_enabled'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'usage_attribution_configured') + self.usage_attribution_configured = attributes[:'usage_attribution_configured'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @assignment_notifications_enabled.nil? + return false if @enabled.nil? + return false if @usage_attribution_configured.nil? + true + end + + # Custom attribute writer method with validation + # @param assignment_notifications_enabled [Object] Object to be assigned + # @!visibility private + def assignment_notifications_enabled=(assignment_notifications_enabled) + if assignment_notifications_enabled.nil? + fail ArgumentError, 'invalid value for "assignment_notifications_enabled", assignment_notifications_enabled cannot be nil.' + end + @assignment_notifications_enabled = assignment_notifications_enabled + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param usage_attribution_configured [Object] Object to be assigned + # @!visibility private + def usage_attribution_configured=(usage_attribution_configured) + if usage_attribution_configured.nil? + fail ArgumentError, 'invalid value for "usage_attribution_configured", usage_attribution_configured cannot be nil.' + end + @usage_attribution_configured = usage_attribution_configured + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assignment_notifications_enabled == o.assignment_notifications_enabled && + enabled == o.enabled && + usage_attribution_configured == o.usage_attribution_configured && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assignment_notifications_enabled, enabled, usage_attribution_configured, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_config_data.rb b/lib/datadog_api_client/v2/models/governance_config_data.rb new file mode 100644 index 000000000000..c55746d3b955 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_config_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A Governance Console configuration resource. + class GovernanceConfigData + include BaseGenericModel + + # The attributes of a Governance Console configuration. + attr_reader :attributes + + # The unique identifier of the organization the Governance Console configuration applies to. + attr_reader :id + + # Governance console config resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceConfigAttributes', + :'id' => :'String', + :'type' => :'GovernanceConsoleConfigResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceConfigData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_config_response.rb b/lib/datadog_api_client/v2/models/governance_config_response.rb new file mode 100644 index 000000000000..38a0d46dd393 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_config_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The Governance Console configuration for an organization. + class GovernanceConfigResponse + include BaseGenericModel + + # A Governance Console configuration resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'GovernanceConfigData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceConfigResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_console_config_resource_type.rb b/lib/datadog_api_client/v2/models/governance_console_config_resource_type.rb new file mode 100644 index 000000000000..1899ac805614 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_console_config_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Governance console config resource type. + class GovernanceConsoleConfigResourceType + include BaseEnumModel + + GOVERNANCE_CONSOLE_CONFIG = "governance_console_config".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_assignment_source.rb b/lib/datadog_api_client/v2/models/governance_control_detection_assignment_source.rb new file mode 100644 index 000000000000..493e055c8006 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_assignment_source.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # How the detection's current assignment was determined. Possible values are `auto_resolved`, `manual`, `reassigned`, and `cleared`. + class GovernanceControlDetectionAssignmentSource + include BaseEnumModel + + AUTO_RESOLVED = "auto_resolved".freeze + MANUAL = "manual".freeze + REASSIGNED = "reassigned".freeze + CLEARED = "cleared".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_attributes.rb b/lib/datadog_api_client/v2/models/governance_control_detection_attributes.rb new file mode 100644 index 000000000000..f017fa2c39a0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_attributes.rb @@ -0,0 +1,361 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a governance control detection. + class GovernanceControlDetectionAttributes + include BaseGenericModel + + # The identifier of the team the detection is assigned to, if any. + attr_accessor :assigned_team + + # The identifier of the user the detection is assigned to, if any. + attr_accessor :assigned_to + + # How the detection's current assignment was determined. Possible values are `auto_resolved`, `manual`, `reassigned`, and `cleared`. + attr_reader :assignment_source + + # The unique identifier of the control that produced this detection. + attr_reader :control_id + + # The date and time when the detection was created. + attr_reader :created_at + + # The type of detection, which determines what condition was detected. + attr_reader :detection_type + + # The human-readable name of the detected resource. + attr_reader :display_name + + # The date and time when the detection was marked as an exception, if applicable. + attr_accessor :exception_at + + # The identifier of the user who marked the detection as an exception, if applicable. + attr_accessor :exception_by + + # Free-form metadata associated with the detection. + attr_accessor :metadata + + # The date and time after which the detection is scheduled to be mitigated, if applicable. + attr_accessor :mitigate_after + + # The date and time when the detection was mitigated, if applicable. + attr_accessor :mitigated_at + + # The priority of the detection, if set. + attr_reader :priority + + # The identifier of the resource the detection applies to. + attr_reader :resource_id + + # A link to the detected resource in Datadog. + attr_reader :resource_url + + # The current state of the detection. Possible values are `active`, `exception`, `mitigated`, `inactive`, `obsolete`, `resolved_externally`, and `mitigation_in_progress`. + attr_reader :state + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assigned_team' => :'assigned_team', + :'assigned_to' => :'assigned_to', + :'assignment_source' => :'assignment_source', + :'control_id' => :'control_id', + :'created_at' => :'created_at', + :'detection_type' => :'detection_type', + :'display_name' => :'display_name', + :'exception_at' => :'exception_at', + :'exception_by' => :'exception_by', + :'metadata' => :'metadata', + :'mitigate_after' => :'mitigate_after', + :'mitigated_at' => :'mitigated_at', + :'priority' => :'priority', + :'resource_id' => :'resource_id', + :'resource_url' => :'resource_url', + :'state' => :'state' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assigned_team' => :'String', + :'assigned_to' => :'String', + :'assignment_source' => :'GovernanceControlDetectionAssignmentSource', + :'control_id' => :'String', + :'created_at' => :'Time', + :'detection_type' => :'String', + :'display_name' => :'String', + :'exception_at' => :'Time', + :'exception_by' => :'String', + :'metadata' => :'Object', + :'mitigate_after' => :'Time', + :'mitigated_at' => :'Time', + :'priority' => :'Integer', + :'resource_id' => :'String', + :'resource_url' => :'String', + :'state' => :'GovernanceControlDetectionState' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceControlDetectionAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'assigned_team') + self.assigned_team = attributes[:'assigned_team'] + end + + if attributes.key?(:'assigned_to') + self.assigned_to = attributes[:'assigned_to'] + end + + if attributes.key?(:'assignment_source') + self.assignment_source = attributes[:'assignment_source'] + end + + if attributes.key?(:'control_id') + self.control_id = attributes[:'control_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'detection_type') + self.detection_type = attributes[:'detection_type'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'exception_at') + self.exception_at = attributes[:'exception_at'] + end + + if attributes.key?(:'exception_by') + self.exception_by = attributes[:'exception_by'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'mitigate_after') + self.mitigate_after = attributes[:'mitigate_after'] + end + + if attributes.key?(:'mitigated_at') + self.mitigated_at = attributes[:'mitigated_at'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'resource_id') + self.resource_id = attributes[:'resource_id'] + end + + if attributes.key?(:'resource_url') + self.resource_url = attributes[:'resource_url'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @assignment_source.nil? + return false if @control_id.nil? + return false if @created_at.nil? + return false if @detection_type.nil? + return false if @display_name.nil? + return false if @priority.nil? + return false if @resource_id.nil? + return false if @resource_url.nil? + return false if @state.nil? + true + end + + # Custom attribute writer method with validation + # @param assignment_source [Object] Object to be assigned + # @!visibility private + def assignment_source=(assignment_source) + if assignment_source.nil? + fail ArgumentError, 'invalid value for "assignment_source", assignment_source cannot be nil.' + end + @assignment_source = assignment_source + end + + # Custom attribute writer method with validation + # @param control_id [Object] Object to be assigned + # @!visibility private + def control_id=(control_id) + if control_id.nil? + fail ArgumentError, 'invalid value for "control_id", control_id cannot be nil.' + end + @control_id = control_id + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param detection_type [Object] Object to be assigned + # @!visibility private + def detection_type=(detection_type) + if detection_type.nil? + fail ArgumentError, 'invalid value for "detection_type", detection_type cannot be nil.' + end + @detection_type = detection_type + end + + # Custom attribute writer method with validation + # @param display_name [Object] Object to be assigned + # @!visibility private + def display_name=(display_name) + if display_name.nil? + fail ArgumentError, 'invalid value for "display_name", display_name cannot be nil.' + end + @display_name = display_name + end + + # Custom attribute writer method with validation + # @param priority [Object] Object to be assigned + # @!visibility private + def priority=(priority) + if priority.nil? + fail ArgumentError, 'invalid value for "priority", priority cannot be nil.' + end + @priority = priority + end + + # Custom attribute writer method with validation + # @param resource_id [Object] Object to be assigned + # @!visibility private + def resource_id=(resource_id) + if resource_id.nil? + fail ArgumentError, 'invalid value for "resource_id", resource_id cannot be nil.' + end + @resource_id = resource_id + end + + # Custom attribute writer method with validation + # @param resource_url [Object] Object to be assigned + # @!visibility private + def resource_url=(resource_url) + if resource_url.nil? + fail ArgumentError, 'invalid value for "resource_url", resource_url cannot be nil.' + end + @resource_url = resource_url + end + + # Custom attribute writer method with validation + # @param state [Object] Object to be assigned + # @!visibility private + def state=(state) + if state.nil? + fail ArgumentError, 'invalid value for "state", state cannot be nil.' + end + @state = state + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assigned_team == o.assigned_team && + assigned_to == o.assigned_to && + assignment_source == o.assignment_source && + control_id == o.control_id && + created_at == o.created_at && + detection_type == o.detection_type && + display_name == o.display_name && + exception_at == o.exception_at && + exception_by == o.exception_by && + metadata == o.metadata && + mitigate_after == o.mitigate_after && + mitigated_at == o.mitigated_at && + priority == o.priority && + resource_id == o.resource_id && + resource_url == o.resource_url && + state == o.state && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assigned_team, assigned_to, assignment_source, control_id, created_at, detection_type, display_name, exception_at, exception_by, metadata, mitigate_after, mitigated_at, priority, resource_id, resource_url, state, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_data.rb b/lib/datadog_api_client/v2/models/governance_control_detection_data.rb new file mode 100644 index 000000000000..ea3e00aec7aa --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A governance control detection resource. + class GovernanceControlDetectionData + include BaseGenericModel + + # The attributes of a governance control detection. + attr_reader :attributes + + # The unique identifier of the detection. + attr_reader :id + + # Governance control detection resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceControlDetectionAttributes', + :'id' => :'String', + :'type' => :'GovernanceControlDetectionResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceControlDetectionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_resource_type.rb b/lib/datadog_api_client/v2/models/governance_control_detection_resource_type.rb new file mode 100644 index 000000000000..100cbeb2c53c --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Governance control detection resource type. + class GovernanceControlDetectionResourceType + include BaseEnumModel + + GOVERNANCE_CONTROL_DETECTION = "governance_control_detection".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_response.rb b/lib/datadog_api_client/v2/models/governance_control_detection_response.rb new file mode 100644 index 000000000000..900d16c5c61d --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single governance control detection. + class GovernanceControlDetectionResponse + include BaseGenericModel + + # A governance control detection resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'GovernanceControlDetectionData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceControlDetectionResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_state.rb b/lib/datadog_api_client/v2/models/governance_control_detection_state.rb new file mode 100644 index 000000000000..b57ad4d7a184 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_state.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The current state of the detection. Possible values are `active`, `exception`, `mitigated`, `inactive`, `obsolete`, `resolved_externally`, and `mitigation_in_progress`. + class GovernanceControlDetectionState + include BaseEnumModel + + ACTIVE = "active".freeze + EXCEPTION = "exception".freeze + MITIGATED = "mitigated".freeze + INACTIVE = "inactive".freeze + OBSOLETE = "obsolete".freeze + RESOLVED_EXTERNALLY = "resolved_externally".freeze + MITIGATION_IN_PROGRESS = "mitigation_in_progress".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_update_attributes.rb b/lib/datadog_api_client/v2/models/governance_control_detection_update_attributes.rb new file mode 100644 index 000000000000..b57bee64469b --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_update_attributes.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a governance control detection that can be updated. Only the attributes present in the request are modified. + class GovernanceControlDetectionUpdateAttributes + include BaseGenericModel + + # The handle of the team the detection is assigned to. Set to an empty string to clear the assignment. + attr_accessor :assigned_team + + # The UUID of the user the detection is assigned to. Set to an empty string to clear the assignment. + attr_accessor :assigned_to + + # The timestamp after which the detection becomes eligible for mitigation. Used to defer mitigation to a later time. + attr_accessor :mitigate_after + + # 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. + attr_accessor :state + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assigned_team' => :'assigned_team', + :'assigned_to' => :'assigned_to', + :'mitigate_after' => :'mitigate_after', + :'state' => :'state' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assigned_team' => :'String', + :'assigned_to' => :'String', + :'mitigate_after' => :'Time', + :'state' => :'GovernanceControlDetectionUpdateState' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceControlDetectionUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'assigned_team') + self.assigned_team = attributes[:'assigned_team'] + end + + if attributes.key?(:'assigned_to') + self.assigned_to = attributes[:'assigned_to'] + end + + if attributes.key?(:'mitigate_after') + self.mitigate_after = attributes[:'mitigate_after'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assigned_team == o.assigned_team && + assigned_to == o.assigned_to && + mitigate_after == o.mitigate_after && + state == o.state && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assigned_team, assigned_to, mitigate_after, state, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_update_data.rb b/lib/datadog_api_client/v2/models/governance_control_detection_update_data.rb new file mode 100644 index 000000000000..a1bbe4605c79 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_update_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data of a governance control detection update request. + class GovernanceControlDetectionUpdateData + include BaseGenericModel + + # The attributes of a governance control detection that can be updated. Only the attributes present in the request are modified. + attr_accessor :attributes + + # Governance control detection resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceControlDetectionUpdateAttributes', + :'type' => :'GovernanceControlDetectionResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceControlDetectionUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_update_request.rb b/lib/datadog_api_client/v2/models/governance_control_detection_update_request.rb new file mode 100644 index 000000000000..d5a41d792d25 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to update a governance control detection. + class GovernanceControlDetectionUpdateRequest + include BaseGenericModel + + # The data of a governance control detection update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'GovernanceControlDetectionUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceControlDetectionUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detection_update_state.rb b/lib/datadog_api_client/v2/models/governance_control_detection_update_state.rb new file mode 100644 index 000000000000..1f237fc187c6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_update_state.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The 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. + class GovernanceControlDetectionUpdateState + include BaseEnumModel + + EXCEPTION = "exception".freeze + ACTIVE = "active".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_detections_response.rb b/lib/datadog_api_client/v2/models/governance_control_detections_response.rb new file mode 100644 index 000000000000..c948e89d3cf0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detections_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A list of governance control detections. + class GovernanceControlDetectionsResponse + include BaseGenericModel + + # An array of governance control detection resources. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceControlDetectionsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_insight_query_config.rb b/lib/datadog_api_client/v2/models/governance_insight_query_config.rb index 4f05b2434e59..9a0bd9a89d2e 100644 --- a/lib/datadog_api_client/v2/models/governance_insight_query_config.rb +++ b/lib/datadog_api_client/v2/models/governance_insight_query_config.rb @@ -24,7 +24,7 @@ class GovernanceInsightQueryConfig # The chart type the frontend should use to render the insight. attr_accessor :chart_type - # 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`. attr_reader :comparison_shift # The default value to display when no data is available. diff --git a/lib/datadog_api_client/v2/models/governance_limit_attributes.rb b/lib/datadog_api_client/v2/models/governance_limit_attributes.rb new file mode 100644 index 000000000000..8decef822281 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_limit_attributes.rb @@ -0,0 +1,312 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a governance limit. + class GovernanceLimitAttributes + include BaseGenericModel + + # A description of what the limit measures. + attr_reader :description + + # The human-readable name of the limit. + attr_reader :display_name + + # The type of limit, such as a rate limit or a usage limit. + attr_reader :limit_type + + # The Datadog product the limit belongs to. + attr_reader :product + + # A metric query used to compute usage against a limit. + attr_reader :query + + # The query execution context used to visualize a limit and its usage. + attr_reader :query_config + + # The time range over which usage against the limit is measured. + attr_reader :time_range + + # The number of times usage has reached the limit within the measured time range. + attr_reader :times_hit_limit + + # The unit in which the limit and its usage are measured. + attr_reader :unit_name + + # The current usage status of the limit relative to its threshold. + attr_reader :usage_status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'display_name' => :'display_name', + :'limit_type' => :'limit_type', + :'product' => :'product', + :'query' => :'query', + :'query_config' => :'query_config', + :'time_range' => :'time_range', + :'times_hit_limit' => :'times_hit_limit', + :'unit_name' => :'unit_name', + :'usage_status' => :'usage_status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'display_name' => :'String', + :'limit_type' => :'String', + :'product' => :'String', + :'query' => :'GovernanceLimitQuery', + :'query_config' => :'GovernanceLimitQueryConfig', + :'time_range' => :'String', + :'times_hit_limit' => :'Float', + :'unit_name' => :'String', + :'usage_status' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceLimitAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'limit_type') + self.limit_type = attributes[:'limit_type'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'query_config') + self.query_config = attributes[:'query_config'] + end + + if attributes.key?(:'time_range') + self.time_range = attributes[:'time_range'] + end + + if attributes.key?(:'times_hit_limit') + self.times_hit_limit = attributes[:'times_hit_limit'] + end + + if attributes.key?(:'unit_name') + self.unit_name = attributes[:'unit_name'] + end + + if attributes.key?(:'usage_status') + self.usage_status = attributes[:'usage_status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @display_name.nil? + return false if @limit_type.nil? + return false if @product.nil? + return false if @query.nil? + return false if @query_config.nil? + return false if @time_range.nil? + return false if @times_hit_limit.nil? + return false if @unit_name.nil? + return false if @usage_status.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param display_name [Object] Object to be assigned + # @!visibility private + def display_name=(display_name) + if display_name.nil? + fail ArgumentError, 'invalid value for "display_name", display_name cannot be nil.' + end + @display_name = display_name + end + + # Custom attribute writer method with validation + # @param limit_type [Object] Object to be assigned + # @!visibility private + def limit_type=(limit_type) + if limit_type.nil? + fail ArgumentError, 'invalid value for "limit_type", limit_type cannot be nil.' + end + @limit_type = limit_type + end + + # Custom attribute writer method with validation + # @param product [Object] Object to be assigned + # @!visibility private + def product=(product) + if product.nil? + fail ArgumentError, 'invalid value for "product", product cannot be nil.' + end + @product = product + end + + # Custom attribute writer method with validation + # @param query [Object] Object to be assigned + # @!visibility private + def query=(query) + if query.nil? + fail ArgumentError, 'invalid value for "query", query cannot be nil.' + end + @query = query + end + + # Custom attribute writer method with validation + # @param query_config [Object] Object to be assigned + # @!visibility private + def query_config=(query_config) + if query_config.nil? + fail ArgumentError, 'invalid value for "query_config", query_config cannot be nil.' + end + @query_config = query_config + end + + # Custom attribute writer method with validation + # @param time_range [Object] Object to be assigned + # @!visibility private + def time_range=(time_range) + if time_range.nil? + fail ArgumentError, 'invalid value for "time_range", time_range cannot be nil.' + end + @time_range = time_range + end + + # Custom attribute writer method with validation + # @param times_hit_limit [Object] Object to be assigned + # @!visibility private + def times_hit_limit=(times_hit_limit) + if times_hit_limit.nil? + fail ArgumentError, 'invalid value for "times_hit_limit", times_hit_limit cannot be nil.' + end + @times_hit_limit = times_hit_limit + end + + # Custom attribute writer method with validation + # @param unit_name [Object] Object to be assigned + # @!visibility private + def unit_name=(unit_name) + if unit_name.nil? + fail ArgumentError, 'invalid value for "unit_name", unit_name cannot be nil.' + end + @unit_name = unit_name + end + + # Custom attribute writer method with validation + # @param usage_status [Object] Object to be assigned + # @!visibility private + def usage_status=(usage_status) + if usage_status.nil? + fail ArgumentError, 'invalid value for "usage_status", usage_status cannot be nil.' + end + @usage_status = usage_status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + display_name == o.display_name && + limit_type == o.limit_type && + product == o.product && + query == o.query && + query_config == o.query_config && + time_range == o.time_range && + times_hit_limit == o.times_hit_limit && + unit_name == o.unit_name && + usage_status == o.usage_status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, display_name, limit_type, product, query, query_config, time_range, times_hit_limit, unit_name, usage_status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_limit_data.rb b/lib/datadog_api_client/v2/models/governance_limit_data.rb new file mode 100644 index 000000000000..3790e892d835 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_limit_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A governance limit resource. + class GovernanceLimitData + include BaseGenericModel + + # The attributes of a governance limit. + attr_reader :attributes + + # The unique identifier of the limit. + attr_reader :id + + # Limit resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceLimitAttributes', + :'id' => :'String', + :'type' => :'GovernanceLimitResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceLimitData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_limit_query.rb b/lib/datadog_api_client/v2/models/governance_limit_query.rb new file mode 100644 index 000000000000..9346912b9bfd --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_limit_query.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A metric query used to compute usage against a limit. + class GovernanceLimitQuery + include BaseGenericModel + + # The metric query expression used to compute the limit value. + attr_reader :query + + # How the query results are aggregated into a single value (for example, sum, max, or avg). + attr_reader :reducer + + # The data source used to evaluate the metric query (for example, the metrics or events backend). + attr_reader :source + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'query' => :'query', + :'reducer' => :'reducer', + :'source' => :'source' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'query' => :'String', + :'reducer' => :'String', + :'source' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceLimitQuery` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'reducer') + self.reducer = attributes[:'reducer'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @query.nil? + return false if @reducer.nil? + return false if @source.nil? + true + end + + # Custom attribute writer method with validation + # @param query [Object] Object to be assigned + # @!visibility private + def query=(query) + if query.nil? + fail ArgumentError, 'invalid value for "query", query cannot be nil.' + end + @query = query + end + + # Custom attribute writer method with validation + # @param reducer [Object] Object to be assigned + # @!visibility private + def reducer=(reducer) + if reducer.nil? + fail ArgumentError, 'invalid value for "reducer", reducer cannot be nil.' + end + @reducer = reducer + end + + # Custom attribute writer method with validation + # @param source [Object] Object to be assigned + # @!visibility private + def source=(source) + if source.nil? + fail ArgumentError, 'invalid value for "source", source cannot be nil.' + end + @source = source + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + query == o.query && + reducer == o.reducer && + source == o.source && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [query, reducer, source, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_limit_query_config.rb b/lib/datadog_api_client/v2/models/governance_limit_query_config.rb new file mode 100644 index 000000000000..64c79f42b02b --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_limit_query_config.rb @@ -0,0 +1,145 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The query execution context used to visualize a limit and its usage. + class GovernanceLimitQueryConfig + include BaseGenericModel + + # The chart type used to visualize the limit and its usage. + attr_accessor :chart_type + + # The time shift applied to compare current usage against a prior period. + attr_accessor :comparison_shift + + # The default value used for the limit when no explicit value is configured. + attr_accessor :default_value + + # The direction in which usage approaches the limit, indicating whether higher or lower values are closer to the limit. + attr_accessor :directionality + + # The number of days of data the limit query evaluates over. + attr_accessor :effective_time_window_days + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'chart_type' => :'chart_type', + :'comparison_shift' => :'comparison_shift', + :'default_value' => :'default_value', + :'directionality' => :'directionality', + :'effective_time_window_days' => :'effective_time_window_days' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'chart_type' => :'String', + :'comparison_shift' => :'String', + :'default_value' => :'Integer', + :'directionality' => :'String', + :'effective_time_window_days' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceLimitQueryConfig` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'chart_type') + self.chart_type = attributes[:'chart_type'] + end + + if attributes.key?(:'comparison_shift') + self.comparison_shift = attributes[:'comparison_shift'] + end + + if attributes.key?(:'default_value') + self.default_value = attributes[:'default_value'] + end + + if attributes.key?(:'directionality') + self.directionality = attributes[:'directionality'] + end + + if attributes.key?(:'effective_time_window_days') + self.effective_time_window_days = attributes[:'effective_time_window_days'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + chart_type == o.chart_type && + comparison_shift == o.comparison_shift && + default_value == o.default_value && + directionality == o.directionality && + effective_time_window_days == o.effective_time_window_days && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [chart_type, comparison_shift, default_value, directionality, effective_time_window_days, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_limit_resource_type.rb b/lib/datadog_api_client/v2/models/governance_limit_resource_type.rb new file mode 100644 index 000000000000..bfa0b851a9b3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_limit_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Limit resource type. + class GovernanceLimitResourceType + include BaseEnumModel + + LIMIT = "limit".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_limits_response.rb b/lib/datadog_api_client/v2/models/governance_limits_response.rb new file mode 100644 index 000000000000..a7541ee216c4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_limits_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A list of governance limits. + class GovernanceLimitsResponse + include BaseGenericModel + + # An array of governance limit resources. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceLimitsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_mitigation_request.rb b/lib/datadog_api_client/v2/models/governance_mitigation_request.rb new file mode 100644 index 000000000000..769c177c1946 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_mitigation_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to mitigate a set of governance detections. + class GovernanceMitigationRequest + include BaseGenericModel + + # The data of a governance mitigation request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'GovernanceMitigationRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceMitigationRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_mitigation_request_attributes.rb b/lib/datadog_api_client/v2/models/governance_mitigation_request_attributes.rb new file mode 100644 index 000000000000..601c242ce998 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_mitigation_request_attributes.rb @@ -0,0 +1,137 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a governance mitigation request. + class GovernanceMitigationRequestAttributes + include BaseGenericModel + + # The identifiers of the detections to mitigate in this request. + attr_accessor :detection_ids + + # The detection type whose detections should be mitigated. + attr_accessor :detection_type + + # A free-form map of parameter names to their configured values. + attr_accessor :mitigation_parameters + + # The mitigation to apply to the selected detections. Defaults to the control's configured mitigation when omitted. + attr_accessor :mitigation_type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'detection_ids' => :'detection_ids', + :'detection_type' => :'detection_type', + :'mitigation_parameters' => :'mitigation_parameters', + :'mitigation_type' => :'mitigation_type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'detection_ids' => :'Array', + :'detection_type' => :'String', + :'mitigation_parameters' => :'Hash', + :'mitigation_type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceMitigationRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'detection_ids') + if (value = attributes[:'detection_ids']).is_a?(Array) + self.detection_ids = value + end + end + + if attributes.key?(:'detection_type') + self.detection_type = attributes[:'detection_type'] + end + + if attributes.key?(:'mitigation_parameters') + self.mitigation_parameters = attributes[:'mitigation_parameters'] + end + + if attributes.key?(:'mitigation_type') + self.mitigation_type = attributes[:'mitigation_type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + detection_ids == o.detection_ids && + detection_type == o.detection_type && + mitigation_parameters == o.mitigation_parameters && + mitigation_type == o.mitigation_type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [detection_ids, detection_type, mitigation_parameters, mitigation_type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_mitigation_request_data.rb b/lib/datadog_api_client/v2/models/governance_mitigation_request_data.rb new file mode 100644 index 000000000000..a002d731cbb5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_mitigation_request_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data of a governance mitigation request. + class GovernanceMitigationRequestData + include BaseGenericModel + + # The attributes of a governance mitigation request. + attr_accessor :attributes + + # Governance control detection resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceMitigationRequestAttributes', + :'type' => :'GovernanceControlDetectionResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceMitigationRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_notification_settings_attributes.rb b/lib/datadog_api_client/v2/models/governance_notification_settings_attributes.rb new file mode 100644 index 000000000000..c8163765a655 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_notification_settings_attributes.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of the organization-wide governance notification settings. + class GovernanceNotificationSettingsAttributes + include BaseGenericModel + + # Whether notifications are sent to users when detections are assigned to them. + attr_reader :assignment_notifications_enabled + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assignment_notifications_enabled' => :'assignment_notifications_enabled' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignment_notifications_enabled' => :'Boolean' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceNotificationSettingsAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'assignment_notifications_enabled') + self.assignment_notifications_enabled = attributes[:'assignment_notifications_enabled'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @assignment_notifications_enabled.nil? + true + end + + # Custom attribute writer method with validation + # @param assignment_notifications_enabled [Object] Object to be assigned + # @!visibility private + def assignment_notifications_enabled=(assignment_notifications_enabled) + if assignment_notifications_enabled.nil? + fail ArgumentError, 'invalid value for "assignment_notifications_enabled", assignment_notifications_enabled cannot be nil.' + end + @assignment_notifications_enabled = assignment_notifications_enabled + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assignment_notifications_enabled == o.assignment_notifications_enabled && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assignment_notifications_enabled, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_notification_settings_data.rb b/lib/datadog_api_client/v2/models/governance_notification_settings_data.rb new file mode 100644 index 000000000000..d5d807db31e8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_notification_settings_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A governance notification settings resource. + class GovernanceNotificationSettingsData + include BaseGenericModel + + # The attributes of the organization-wide governance notification settings. + attr_reader :attributes + + # The unique identifier of the organization the notification settings apply to. + attr_reader :id + + # Governance notification settings resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceNotificationSettingsAttributes', + :'id' => :'String', + :'type' => :'GovernanceNotificationSettingsResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceNotificationSettingsData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_notification_settings_resource_type.rb b/lib/datadog_api_client/v2/models/governance_notification_settings_resource_type.rb new file mode 100644 index 000000000000..c946803dc8ba --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_notification_settings_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Governance notification settings resource type. + class GovernanceNotificationSettingsResourceType + include BaseEnumModel + + GOVERNANCE_NOTIFICATION_SETTINGS = "governance_notification_settings".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_notification_settings_response.rb b/lib/datadog_api_client/v2/models/governance_notification_settings_response.rb new file mode 100644 index 000000000000..bd2f143a75dc --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_notification_settings_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The organization-wide governance notification settings. + class GovernanceNotificationSettingsResponse + include BaseGenericModel + + # A governance notification settings resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'GovernanceNotificationSettingsData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceNotificationSettingsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_notification_settings_update_attributes.rb b/lib/datadog_api_client/v2/models/governance_notification_settings_update_attributes.rb new file mode 100644 index 000000000000..aec81f931b1e --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_notification_settings_update_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of the governance notification settings that can be updated. Only the attributes present in the request are modified. + class GovernanceNotificationSettingsUpdateAttributes + include BaseGenericModel + + # Whether notifications are sent to users when detections are assigned to them. + attr_accessor :assignment_notifications_enabled + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assignment_notifications_enabled' => :'assignment_notifications_enabled' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignment_notifications_enabled' => :'Boolean' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceNotificationSettingsUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'assignment_notifications_enabled') + self.assignment_notifications_enabled = attributes[:'assignment_notifications_enabled'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assignment_notifications_enabled == o.assignment_notifications_enabled && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assignment_notifications_enabled, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_notification_settings_update_data.rb b/lib/datadog_api_client/v2/models/governance_notification_settings_update_data.rb new file mode 100644 index 000000000000..76cff999dd42 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_notification_settings_update_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data of a governance notification settings update request. + class GovernanceNotificationSettingsUpdateData + include BaseGenericModel + + # The attributes of the governance notification settings that can be updated. Only the attributes present in the request are modified. + attr_accessor :attributes + + # Governance notification settings resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceNotificationSettingsUpdateAttributes', + :'type' => :'GovernanceNotificationSettingsResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceNotificationSettingsUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_notification_settings_update_request.rb b/lib/datadog_api_client/v2/models/governance_notification_settings_update_request.rb new file mode 100644 index 000000000000..10f35153f64d --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_notification_settings_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A request to update the organization-wide governance notification settings. + class GovernanceNotificationSettingsUpdateRequest + include BaseGenericModel + + # The data of a governance notification settings update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'GovernanceNotificationSettingsUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceNotificationSettingsUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_resource_limit_attributes.rb b/lib/datadog_api_client/v2/models/governance_resource_limit_attributes.rb new file mode 100644 index 000000000000..be3b3741dbf4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_resource_limit_attributes.rb @@ -0,0 +1,396 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a governance resource limit. + class GovernanceResourceLimitAttributes + include BaseGenericModel + + # The current limit configured for the resource. + attr_reader :current_limit + + # The current value of the resource. + attr_reader :current_value + + # A link to the Datadog page where the resource and its limit can be managed. + attr_reader :deep_link + + # The default current value used when the resource value cannot be computed from the query. + attr_reader :default_current_value + + # The default limit value used when the limit cannot be computed from the query. + attr_reader :default_limit_value + + # A description of what the resource limit measures. + attr_reader :description + + # The human-readable name of the resource limit. + attr_reader :display_name + + # A metric query used to compute usage against a limit. + attr_reader :limit_query + + # The Datadog product the resource limit belongs to. + attr_reader :product + + # A metric query used to compute usage against a limit. + attr_reader :query + + # The query execution context used to visualize a limit and its usage. + attr_reader :query_config + + # The time range over which the resource value is measured. + attr_reader :time_range + + # The unit in which the resource value and limit are measured. + attr_reader :unit_name + + # The current usage status of the resource relative to its limit. + attr_reader :usage_status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'current_limit' => :'current_limit', + :'current_value' => :'current_value', + :'deep_link' => :'deep_link', + :'default_current_value' => :'default_current_value', + :'default_limit_value' => :'default_limit_value', + :'description' => :'description', + :'display_name' => :'display_name', + :'limit_query' => :'limit_query', + :'product' => :'product', + :'query' => :'query', + :'query_config' => :'query_config', + :'time_range' => :'time_range', + :'unit_name' => :'unit_name', + :'usage_status' => :'usage_status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'current_limit' => :'Float', + :'current_value' => :'Float', + :'deep_link' => :'String', + :'default_current_value' => :'Float', + :'default_limit_value' => :'Float', + :'description' => :'String', + :'display_name' => :'String', + :'limit_query' => :'GovernanceLimitQuery', + :'product' => :'String', + :'query' => :'GovernanceLimitQuery', + :'query_config' => :'GovernanceLimitQueryConfig', + :'time_range' => :'String', + :'unit_name' => :'String', + :'usage_status' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceResourceLimitAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'current_limit') + self.current_limit = attributes[:'current_limit'] + end + + if attributes.key?(:'current_value') + self.current_value = attributes[:'current_value'] + end + + if attributes.key?(:'deep_link') + self.deep_link = attributes[:'deep_link'] + end + + if attributes.key?(:'default_current_value') + self.default_current_value = attributes[:'default_current_value'] + end + + if attributes.key?(:'default_limit_value') + self.default_limit_value = attributes[:'default_limit_value'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'limit_query') + self.limit_query = attributes[:'limit_query'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'query_config') + self.query_config = attributes[:'query_config'] + end + + if attributes.key?(:'time_range') + self.time_range = attributes[:'time_range'] + end + + if attributes.key?(:'unit_name') + self.unit_name = attributes[:'unit_name'] + end + + if attributes.key?(:'usage_status') + self.usage_status = attributes[:'usage_status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @current_limit.nil? + return false if @current_value.nil? + return false if @deep_link.nil? + return false if @default_current_value.nil? + return false if @default_limit_value.nil? + return false if @description.nil? + return false if @display_name.nil? + return false if @limit_query.nil? + return false if @product.nil? + return false if @query.nil? + return false if @query_config.nil? + return false if @time_range.nil? + return false if @unit_name.nil? + return false if @usage_status.nil? + true + end + + # Custom attribute writer method with validation + # @param current_limit [Object] Object to be assigned + # @!visibility private + def current_limit=(current_limit) + if current_limit.nil? + fail ArgumentError, 'invalid value for "current_limit", current_limit cannot be nil.' + end + @current_limit = current_limit + end + + # Custom attribute writer method with validation + # @param current_value [Object] Object to be assigned + # @!visibility private + def current_value=(current_value) + if current_value.nil? + fail ArgumentError, 'invalid value for "current_value", current_value cannot be nil.' + end + @current_value = current_value + end + + # Custom attribute writer method with validation + # @param deep_link [Object] Object to be assigned + # @!visibility private + def deep_link=(deep_link) + if deep_link.nil? + fail ArgumentError, 'invalid value for "deep_link", deep_link cannot be nil.' + end + @deep_link = deep_link + end + + # Custom attribute writer method with validation + # @param default_current_value [Object] Object to be assigned + # @!visibility private + def default_current_value=(default_current_value) + if default_current_value.nil? + fail ArgumentError, 'invalid value for "default_current_value", default_current_value cannot be nil.' + end + @default_current_value = default_current_value + end + + # Custom attribute writer method with validation + # @param default_limit_value [Object] Object to be assigned + # @!visibility private + def default_limit_value=(default_limit_value) + if default_limit_value.nil? + fail ArgumentError, 'invalid value for "default_limit_value", default_limit_value cannot be nil.' + end + @default_limit_value = default_limit_value + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param display_name [Object] Object to be assigned + # @!visibility private + def display_name=(display_name) + if display_name.nil? + fail ArgumentError, 'invalid value for "display_name", display_name cannot be nil.' + end + @display_name = display_name + end + + # Custom attribute writer method with validation + # @param limit_query [Object] Object to be assigned + # @!visibility private + def limit_query=(limit_query) + if limit_query.nil? + fail ArgumentError, 'invalid value for "limit_query", limit_query cannot be nil.' + end + @limit_query = limit_query + end + + # Custom attribute writer method with validation + # @param product [Object] Object to be assigned + # @!visibility private + def product=(product) + if product.nil? + fail ArgumentError, 'invalid value for "product", product cannot be nil.' + end + @product = product + end + + # Custom attribute writer method with validation + # @param query [Object] Object to be assigned + # @!visibility private + def query=(query) + if query.nil? + fail ArgumentError, 'invalid value for "query", query cannot be nil.' + end + @query = query + end + + # Custom attribute writer method with validation + # @param query_config [Object] Object to be assigned + # @!visibility private + def query_config=(query_config) + if query_config.nil? + fail ArgumentError, 'invalid value for "query_config", query_config cannot be nil.' + end + @query_config = query_config + end + + # Custom attribute writer method with validation + # @param time_range [Object] Object to be assigned + # @!visibility private + def time_range=(time_range) + if time_range.nil? + fail ArgumentError, 'invalid value for "time_range", time_range cannot be nil.' + end + @time_range = time_range + end + + # Custom attribute writer method with validation + # @param unit_name [Object] Object to be assigned + # @!visibility private + def unit_name=(unit_name) + if unit_name.nil? + fail ArgumentError, 'invalid value for "unit_name", unit_name cannot be nil.' + end + @unit_name = unit_name + end + + # Custom attribute writer method with validation + # @param usage_status [Object] Object to be assigned + # @!visibility private + def usage_status=(usage_status) + if usage_status.nil? + fail ArgumentError, 'invalid value for "usage_status", usage_status cannot be nil.' + end + @usage_status = usage_status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + current_limit == o.current_limit && + current_value == o.current_value && + deep_link == o.deep_link && + default_current_value == o.default_current_value && + default_limit_value == o.default_limit_value && + description == o.description && + display_name == o.display_name && + limit_query == o.limit_query && + product == o.product && + query == o.query && + query_config == o.query_config && + time_range == o.time_range && + unit_name == o.unit_name && + usage_status == o.usage_status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [current_limit, current_value, deep_link, default_current_value, default_limit_value, description, display_name, limit_query, product, query, query_config, time_range, unit_name, usage_status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_resource_limit_data.rb b/lib/datadog_api_client/v2/models/governance_resource_limit_data.rb new file mode 100644 index 000000000000..9832e553fad8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_resource_limit_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A governance resource limit resource. + class GovernanceResourceLimitData + include BaseGenericModel + + # The attributes of a governance resource limit. + attr_reader :attributes + + # The unique identifier of the resource limit. + attr_reader :id + + # Resource limit resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'GovernanceResourceLimitAttributes', + :'id' => :'String', + :'type' => :'GovernanceResourceLimitResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceResourceLimitData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_resource_limit_resource_type.rb b/lib/datadog_api_client/v2/models/governance_resource_limit_resource_type.rb new file mode 100644 index 000000000000..42d2f4079efe --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_resource_limit_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Resource limit resource type. + class GovernanceResourceLimitResourceType + include BaseEnumModel + + RESOURCE_LIMIT = "resource-limit".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_resource_limits_response.rb b/lib/datadog_api_client/v2/models/governance_resource_limits_response.rb new file mode 100644 index 000000000000..492f71c33428 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_resource_limits_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A list of governance resource limits. + class GovernanceResourceLimitsResponse + include BaseGenericModel + + # An array of governance resource limit resources. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GovernanceResourceLimitsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end