diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d8f50ea93052..e6fe89fd129a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21956,6 +21956,125 @@ components: - IDENTITY - GZIP - DEFLATE + ControlNotificationEventSetting: + description: The notification settings for a single event type on a control. + properties: + enabled: + description: Whether notifications are enabled for this event type. + example: true + type: boolean + event_type: + description: The event type the notification settings apply to, such as `new_detection`. + example: "new_detection" + type: string + targets: + $ref: "#/components/schemas/ControlNotificationTargetArray" + required: + - event_type + - enabled + - targets + type: object + ControlNotificationEventSettingsArray: + description: The notification settings for each supported event type on the control. + items: + $ref: "#/components/schemas/ControlNotificationEventSetting" + type: array + ControlNotificationSettingsAttributes: + description: The attributes of a governance control's notification settings. + properties: + event_settings: + $ref: "#/components/schemas/ControlNotificationEventSettingsArray" + required: + - event_settings + type: object + ControlNotificationSettingsData: + description: A control notification settings resource. + properties: + attributes: + $ref: "#/components/schemas/ControlNotificationSettingsAttributes" + id: + description: The detection type the notification settings apply to. + example: "unused_api_keys" + type: string + type: + $ref: "#/components/schemas/ControlNotificationSettingsResourceType" + required: + - id + - type + - attributes + type: object + ControlNotificationSettingsResourceType: + description: Control notification settings resource type. + enum: + - control_notification_settings + example: "control_notification_settings" + type: string + x-enum-varnames: + - CONTROL_NOTIFICATION_SETTINGS + ControlNotificationSettingsResponse: + description: The notification settings for a governance control. + properties: + data: + $ref: "#/components/schemas/ControlNotificationSettingsData" + required: + - data + type: object + ControlNotificationSettingsUpdateAttributes: + description: The attributes of a governance control's notification settings that can be updated. + properties: + event_settings: + $ref: "#/components/schemas/ControlNotificationEventSettingsArray" + type: object + ControlNotificationSettingsUpdateData: + description: The data of a control notification settings update request. + properties: + attributes: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateAttributes" + type: + $ref: "#/components/schemas/ControlNotificationSettingsResourceType" + required: + - type + type: object + ControlNotificationSettingsUpdateRequest: + description: A request to update the notification settings for a governance control. + properties: + data: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateData" + required: + - data + type: object + ControlNotificationTarget: + description: A destination that receives notifications for an event type. + properties: + handle: + description: The destination handle, such as an email address, Slack channel, or user handle. + example: "#governance-alerts" + type: string + type: + $ref: "#/components/schemas/ControlNotificationTargetType" + required: + - type + - handle + type: object + ControlNotificationTargetArray: + description: The destinations that receive notifications for an event type. + items: + $ref: "#/components/schemas/ControlNotificationTarget" + type: array + ControlNotificationTargetType: + description: The type of notification destination. + enum: + - email + - slack + - at_mention + - case + example: "slack" + type: string + x-enum-varnames: + - EMAIL + - SLACK + - AT_MENTION + - CASE ConvertJobResultsToSignalsAttributes: description: Attributes for converting historical job results to signals. properties: @@ -44130,91 +44249,68 @@ components: - id - type type: object - GovernanceBestPracticeDefinition: - description: |- - The best practice associated with an insight. Populated with the first active best practice - matched to the insight; `null` when no best practice is attached. + GovernanceConfigAttributes: + description: The attributes of a Governance Console configuration. properties: - category: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + enabled: + description: Whether the Governance Console is enabled for the organization. + example: true + type: boolean + usage_attribution_configured: + description: Whether usage attribution is configured for the organization. + example: true + type: boolean + xorg_insights_enabled: description: |- - The value driver the best practice is grouped under, such as `access_governance`, - `security`, `compliance`, or `operational_hygiene`. - example: "access_governance" - type: string - deep_link: - description: A relative link to the configuration page where the best practice can be acted upon. - example: "/organization-settings/users?status=inactive" - type: string - description: - description: The full rationale and guidance for the best practice. - example: "Review and deactivate users who have not logged in within the last 90 days." - type: string - detection_type: - description: An optional association to a control's detection type. `null` when not associated with a control. - example: - nullable: true - type: string + Whether the organization has opted in to sharing governance data with a managing org + for cross-org insights. + example: true + type: boolean + required: + - enabled + - assignment_notifications_enabled + - usage_attribution_configured + - xorg_insights_enabled + type: object + GovernanceConfigData: + description: A Governance Console configuration resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceConfigAttributes" id: - description: The unique identifier of the best practice. - example: "bp_monitor_inactive_users" - type: string - impact: - description: The expected impact of following the best practice. - example: "Reduces unauthorized access risk." - type: string - impact_hint: - description: |- - A priority hint for ordering best practices by expected impact. Lower values indicate - higher priority. - example: 1 - format: int64 - type: integer - permissions: - description: The permissions required for the user to act on the best practice. - example: - - "user_access_manage" - items: - description: A permission required to act on the best practice. - type: string - type: array - status: - description: Whether the best practice is currently `active` or `deprecated`. - example: "active" - type: string - summary: - description: A one-line explanation of why this best practice matters. - example: "Inactive users with access increase your security surface area." - type: string - title: - description: A short, human-readable name for the best practice. - example: "Monitor inactive users" - type: string - trigger_condition: description: |- - The condition that surfaces the best practice. For an `insight` trigger, the insight - slug; for a `static` trigger, a descriptive condition key. - example: "active_users" - type: string - trigger_type: - description: |- - How the best practice is surfaced. `insight` ties it to an insight; `static` surfaces it - unless its condition is met. - example: "insight" + The unique identifier of the organization the Governance Console configuration applies + to. May be the nil UUID (`00000000-0000-0000-0000-000000000000`) when the configuration + is not tied to a specific organization record. + example: "00000000-0000-0000-0000-000000000000" type: string + type: + $ref: "#/components/schemas/GovernanceConsoleConfigResourceType" required: - id - - title - - summary - - description - - category - - impact - - trigger_type - - trigger_condition - - deep_link - - permissions - - impact_hint - - status + - type + - attributes + type: object + GovernanceConfigResponse: + description: The Governance Console configuration for an organization. + properties: + data: + $ref: "#/components/schemas/GovernanceConfigData" + required: + - data type: object + GovernanceConsoleConfigResourceType: + description: Governance console config resource type. + enum: + - governance_console_config + example: "governance_console_config" + type: string + x-enum-varnames: + - GOVERNANCE_CONSOLE_CONFIG GovernanceControlAttributes: description: The attributes of a governance control. properties: @@ -44247,17 +44343,6 @@ components: detection_parameters: $ref: "#/components/schemas/GovernanceControlParametersMap" nullable: true - detection_type: - description: The detection type that uniquely identifies the control. - example: "unused_api_keys" - type: string - feature_flags: - description: The feature flags that gate the control. - example: [] - items: - description: A feature flag that gates the control. - type: string - type: array insights: description: The insight slugs associated with the control. example: [] @@ -44289,21 +44374,6 @@ components: description: Human-readable name of the control. example: "Unused API Keys" type: string - next_steps: - description: Guidance on the next steps to remediate detections for the control. - example: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - type: string - notification_frequency: - description: The configured notification frequency for the control. Empty when not configured. - example: "" - type: string - notification_parameters: - $ref: "#/components/schemas/GovernanceControlParametersMap" - nullable: true - notification_type: - description: The configured notification type for the control. Empty when not configured. - example: "" - type: string priority: description: The priority of the control, such as `High`. example: "High" @@ -44312,10 +44382,6 @@ components: description: The product the control belongs to. example: "api_keys" type: string - release_status: - description: The release status of the control, such as `prod` or `beta`. - example: "prod" - type: string resource_type: description: The type of resource the control evaluates. example: "api_key" @@ -44326,44 +44392,24 @@ components: type: string supported_detection_parameters: $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" - supported_notification_parameters: - $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" - task: - description: A short description of the remediation task for the control. - example: "Review and revoke unused API keys." - type: string type: description: The control type, such as `Proactive` or `Detection`. example: "Proactive" type: string - usage_concern: - description: The usage concern the control addresses, such as `Security` or `Cost Optimization`. - example: "Security" - type: string required: - name - description - - detection_type - supported_detection_parameters - - supported_notification_parameters - resource_type - resource_type_display_name - product - category - insights - mitigations - - task - - next_steps - - release_status - - feature_flags - type - priority - - usage_concern - detection_parameters - detection_frequency - - notification_type - - notification_parameters - - notification_frequency - mitigation_type - mitigation_parameters - created_at @@ -44378,8 +44424,8 @@ components: attributes: $ref: "#/components/schemas/GovernanceControlAttributes" id: - description: The unique identifier of the control. - example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + description: The detection type that uniquely identifies the control. + example: "unused_api_keys" type: string type: $ref: "#/components/schemas/GovernanceControlResourceType" @@ -44388,13 +44434,217 @@ components: - type - attributes type: object + GovernanceControlDetectionAssignmentSource: + description: How the detection's current assignment was determined. Possible values are `auto_resolved`, `manual`, `reassigned`, and `cleared`. + enum: + - auto_resolved + - manual + - reassigned + - cleared + example: "manual" + type: string + x-enum-varnames: + - AUTO_RESOLVED + - MANUAL + - REASSIGNED + - CLEARED + GovernanceControlDetectionAttributes: + description: The attributes of a governance control detection. + properties: + assigned_team: + description: The identifier of the team the detection is assigned to, if any. + example: "platform-security" + type: string + assigned_to: + description: The identifier of the user the detection is assigned to, if any. + example: "11111111-2222-3333-4444-555555555555" + type: string + assignment_source: + $ref: "#/components/schemas/GovernanceControlDetectionAssignmentSource" + control_id: + deprecated: true + description: |- + DEPRECATED: mirrors `detection_type` for backward compatibility; use `detection_type` + instead. + example: "unused_api_keys" + type: string + created_at: + description: The date and time when the detection was created. + example: "2024-03-01T12:00:00Z" + format: date-time + type: string + detection_type: + description: The type of detection, which determines what condition was detected. + example: "unused_api_keys" + type: string + display_name: + description: The human-readable name of the detected resource. + example: "CI Deploy Key" + type: string + exception_at: + description: The date and time when the detection was marked as an exception, if applicable. + example: "2024-03-05T09:00:00Z" + format: date-time + type: string + exception_by: + description: The identifier of the user who marked the detection as an exception, if applicable. + example: "11111111-2222-3333-4444-555555555555" + type: string + metadata: + description: Free-form metadata associated with the detection. + example: + region: "us-east-1" + mitigate_after: + description: The date and time after which the detection is scheduled to be mitigated, if applicable. + example: "2024-03-15T00:00:00Z" + format: date-time + type: string + mitigated_at: + description: The date and time when the detection was mitigated, if applicable. + example: "2024-03-10T15:30:00Z" + format: date-time + type: string + priority: + description: The priority of the detection, if set. + example: 1 + format: int64 + type: integer + resource_id: + description: The identifier of the resource the detection applies to. + example: "api-key-12345" + type: string + resource_type: + description: The type of resource the detection applies to, for example `api_key` or `dashboard`. + example: "api_key" + type: string + state: + $ref: "#/components/schemas/GovernanceControlDetectionState" + required: + - state + - control_id + - resource_id + - detection_type + - resource_type + - display_name + - created_at + - assignment_source + - priority + type: object + GovernanceControlDetectionData: + description: A governance control detection resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceControlDetectionAttributes" + id: + description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: string + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - id + - type + - attributes + type: object + GovernanceControlDetectionResourceType: + description: Governance control detection resource type. + enum: + - governance_control_detection + example: "governance_control_detection" + type: string + x-enum-varnames: + - GOVERNANCE_CONTROL_DETECTION + GovernanceControlDetectionResponse: + description: A single governance control detection. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionData" + required: + - data + type: object + GovernanceControlDetectionState: + description: The current state of the detection. Possible values are `active`, `exception`, `mitigated`, `inactive`, `obsolete`, `resolved_externally`, and `mitigation_in_progress`. + enum: + - active + - exception + - mitigated + - inactive + - obsolete + - resolved_externally + - mitigation_in_progress + example: "active" + type: string + x-enum-varnames: + - ACTIVE + - EXCEPTION + - MITIGATED + - INACTIVE + - OBSOLETE + - RESOLVED_EXTERNALLY + - MITIGATION_IN_PROGRESS + GovernanceControlDetectionUpdateAttributes: + description: The attributes of a governance control detection that can be updated. Only the attributes present in the request are modified. + properties: + assigned_team: + description: The handle of the team the detection is assigned to. Set to an empty string to clear the assignment. + example: "platform-security" + type: string + assigned_to: + description: The UUID of the user the detection is assigned to. Set to an empty string to clear the assignment. + example: "11111111-2222-3333-4444-555555555555" + type: string + mitigate_after: + description: The timestamp after which the detection becomes eligible for mitigation. Used to defer mitigation to a later time. + example: "2024-03-15T00:00:00Z" + format: date-time + type: string + state: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateState" + type: object + GovernanceControlDetectionUpdateData: + description: The data of a governance control detection update request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateAttributes" + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - type + type: object + GovernanceControlDetectionUpdateRequest: + description: A request to update a governance control detection. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateData" + required: + - data + type: object + GovernanceControlDetectionUpdateState: + description: The new state to set for the detection. Set to `exception` to acknowledge the detection and exclude it from active counts, or `active` to reopen it. + enum: + - exception + - active + example: "exception" + type: string + x-enum-varnames: + - EXCEPTION + - ACTIVE + GovernanceControlDetectionsDataArray: + description: An array of governance control detection resources. + items: + $ref: "#/components/schemas/GovernanceControlDetectionData" + type: array + GovernanceControlDetectionsResponse: + description: A list of governance control detections. + properties: + data: + $ref: "#/components/schemas/GovernanceControlDetectionsDataArray" + required: + - data + type: object GovernanceControlMitigationDefinition: description: The definition of a mitigation available for a control. properties: - action_verb: - description: The verb describing the mitigation action, such as `revoke` or `delete`. - example: "revoke" - type: string description: description: A human-readable description of the mitigation. example: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." @@ -44408,21 +44658,10 @@ components: description: An execution mode the mitigation supports. type: string type: array - feature_flags: - description: The feature flags that gate the mitigation. - example: [] - items: - description: A feature flag that gates the mitigation. - type: string - type: array id: description: The unique identifier of the mitigation. example: "revoke_api_key" type: string - manual_mitigation_warning: - description: A warning shown to the user before applying the mitigation manually. - example: "These API keys will be revoked immediately upon confirmation. To revoke future API keys, you must go through this flow again." - type: string permissions: description: The permissions required to apply the mitigation. example: @@ -44432,10 +44671,6 @@ components: description: A permission required to apply the mitigation. type: string type: array - requires_ai: - description: Whether the mitigation requires AI to be enabled. - example: false - type: boolean supported_parameters: $ref: "#/components/schemas/GovernanceControlParameterDefinitionArray" title: @@ -44446,12 +44681,9 @@ components: - id - title - description - - action_verb - supported_parameters - permissions - - manual_mitigation_warning - - feature_flags - - requires_ai + - execution_modes type: object GovernanceControlMitigationDefinitionArray: description: The mitigations available for a control. @@ -44472,10 +44704,6 @@ components: description: The human-readable name of the parameter. example: "Unused API Key Threshold" type: string - hidden: - description: Whether the parameter is hidden from the UI. - example: false - type: boolean name: description: The machine-readable name of the parameter. example: "api_key_threshold" @@ -44496,7 +44724,6 @@ components: - description - type - required - - hidden - supported_values - default_value type: object @@ -44562,31 +44789,12 @@ components: description: The mitigation type to configure for the control. example: "revoke_api_key" type: string - name: - description: A new human-readable name for the control. - example: "Unused API Keys" - type: string - notification_frequency: - description: The notification frequency to configure for the control. - example: "daily" - type: string - notification_parameters: - $ref: "#/components/schemas/GovernanceControlParametersMap" - nullable: true - notification_type: - description: The notification type to configure for the control. - example: "slack" - type: string type: object GovernanceControlUpdateData: description: The data of a governance control update request. properties: attributes: $ref: "#/components/schemas/GovernanceControlUpdateAttributes" - id: - description: The unique identifier of the control. - example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: string type: $ref: "#/components/schemas/GovernanceControlResourceType" required: @@ -44614,18 +44822,14 @@ components: - data type: object GovernanceInsightAttributes: - description: The attributes of a governance insight. + description: |- + The attributes of a governance insight. Exactly one of `metric_query`, `event_query`, + `usage_query`, `audit_query`, or `percentage_query` is populated, depending on the data + source the insight is computed from; the rest are `null`. properties: audit_query: $ref: "#/components/schemas/GovernanceInsightAuditQuery" nullable: true - best_practice: - $ref: "#/components/schemas/GovernanceBestPracticeDefinition" - nullable: true - deep_link: - description: A relative link to the product surface where the insight can be acted upon. - example: "" - type: string description: description: A human-readable description of what the insight measures. example: "Number of users who have used the Dashboard in the last 30 days" @@ -44640,14 +44844,6 @@ components: metric_query: $ref: "#/components/schemas/GovernanceInsightMetricQuery" nullable: true - old_value: - description: |- - The value of the insight over the previous comparison window. `null` when values were - not requested or could not be computed. - example: 3274 - format: double - nullable: true - type: number percentage_query: $ref: "#/components/schemas/GovernanceInsightPercentageQuery" nullable: true @@ -44658,17 +44854,6 @@ components: query_config: $ref: "#/components/schemas/GovernanceInsightQueryConfig" nullable: true - sort_order: - description: The relative order in which the insight should be displayed. - example: 1 - format: int64 - type: integer - state: - description: |- - The state of the insight. A `critical` insight receives extra UI treatment to draw - attention to it. - example: "critical" - type: string sub_product: description: The sub-product the insight belongs to, if any. example: "Indexes" @@ -44684,29 +44869,13 @@ components: usage_query: $ref: "#/components/schemas/GovernanceInsightUsageQuery" nullable: true - value: - description: The current value of the insight. `null` when values were not requested or could not be computed. - example: 3601 - format: double - nullable: true - type: number required: - display_name - product - - best_practice - sub_product - unit_name - description - time_range - - state - - deep_link - - value - - old_value - - metric_query - - event_query - - usage_query - - audit_query - - percentage_query type: object GovernanceInsightAuditCompute: description: The aggregation applied to an audit log query. @@ -44776,6 +44945,18 @@ components: - type - attributes type: object + GovernanceInsightDirectionality: + description: Whether an increase in the insight's value is good, bad, or neutral. + enum: + - neutral + - increase_better + - decrease_better + example: "neutral" + type: string + x-enum-varnames: + - NEUTRAL + - INCREASE_BETTER + - DECREASE_BETTER GovernanceInsightEventCompute: description: The aggregation applied to an event query. properties: @@ -44846,14 +45027,14 @@ components: - denominator_query type: object GovernanceInsightQueryConfig: - description: Query execution context that allows the frontend to execute insight queries directly. + description: Query execution context for running insight queries directly. properties: chart_type: - description: The chart type the frontend should use to render the insight. + description: The chart type used to render the insight. 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: @@ -44862,11 +45043,7 @@ components: format: int64 type: integer directionality: - description: |- - Whether an increase in the value is good, bad, or neutral. One of `neutral`, - `increase_better`, or `decrease_better`. - example: "neutral" - type: string + $ref: "#/components/schemas/GovernanceInsightDirectionality" effective_time_window_days: description: The number of days the insight value is computed over. example: 30 @@ -44912,6 +45089,355 @@ components: required: - data type: object + GovernanceLimitAttributes: + description: The attributes of a usage limit. + properties: + description: + description: A description of what the limit measures. + example: "The number of log events indexed in the last 30 days." + type: string + display_name: + description: The human-readable name of the limit. + example: "Indexed Logs" + type: string + limit_type: + description: The type of limit, such as a rate limit or a usage limit. + example: "usage" + type: string + product: + description: The Datadog product the limit belongs to. + example: "logs" + type: string + query: + $ref: "#/components/schemas/GovernanceLimitQuery" + query_config: + $ref: "#/components/schemas/GovernanceLimitQueryConfig" + time_range: + description: The time range over which usage against the limit is measured. + example: "month" + type: string + times_hit_limit: + description: The number of times usage has reached the limit within the measured time range. + example: 2 + format: double + type: number + unit_name: + description: The unit in which the limit and its usage are measured. + example: "events" + type: string + usage_status: + description: The current usage status of the limit relative to its threshold. + example: "approaching" + type: string + required: + - display_name + - description + - product + - limit_type + - unit_name + - time_range + - query + - times_hit_limit + - usage_status + - query_config + type: object + GovernanceLimitData: + description: A usage limit resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceLimitAttributes" + id: + description: The unique identifier of the limit. + example: "logs_indexed_events" + type: string + type: + $ref: "#/components/schemas/GovernanceLimitResourceType" + required: + - id + - type + - attributes + type: object + GovernanceLimitQuery: + description: A metric query used to compute usage against a limit. + properties: + query: + description: The metric query expression used to compute the limit value. + example: "sum:datadog.estimated_usage.logs.ingested_events{*}" + type: string + reducer: + description: How the query results are aggregated into a single value (for example, sum, max, or avg). + example: "sum" + type: string + source: + description: The data source used to evaluate the metric query, such as metrics or events. + example: "metrics" + type: string + required: + - source + - query + - reducer + type: object + GovernanceLimitQueryConfig: + description: The query execution context used to visualize a limit and its usage. + properties: + chart_type: + description: The chart type used to visualize the limit and its usage. + example: "line" + type: string + comparison_shift: + description: The time shift applied to compare current usage against a prior period. + example: "month" + type: string + default_value: + description: The default value used for the limit when no explicit value is configured. + example: 0 + format: int64 + type: integer + directionality: + description: The direction in which usage approaches the limit, indicating whether higher or lower values are closer to the limit. + example: "increase_better" + type: string + effective_time_window_days: + description: The number of days of data the limit query evaluates over. + example: 30 + format: int64 + type: integer + type: object + GovernanceLimitResourceType: + description: Limit resource type. + enum: + - limit + example: "limit" + type: string + x-enum-varnames: + - LIMIT + GovernanceLimitsDataArray: + description: An array of usage limit resources. + items: + $ref: "#/components/schemas/GovernanceLimitData" + type: array + GovernanceLimitsResponse: + description: A list of usage limits. + properties: + data: + $ref: "#/components/schemas/GovernanceLimitsDataArray" + required: + - data + type: object + GovernanceMitigationRequest: + description: A request to mitigate a set of governance detections. + properties: + data: + $ref: "#/components/schemas/GovernanceMitigationRequestData" + required: + - data + type: object + GovernanceMitigationRequestAttributes: + description: The attributes of a governance mitigation request. + properties: + detection_ids: + description: The identifiers of the detections to mitigate in this request. + example: + - "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + items: + description: The identifier of a detection to mitigate in this request. + type: string + type: array + detection_type: + description: The detection type whose detections should be mitigated. + example: "unused_api_keys" + type: string + mitigation_parameters: + $ref: "#/components/schemas/GovernanceControlParametersMap" + nullable: true + mitigation_type: + description: The mitigation to apply to the selected detections. Defaults to the control's configured mitigation when omitted. + example: "revoke_api_key" + type: string + type: object + GovernanceMitigationRequestData: + description: The data of a governance mitigation request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceMitigationRequestAttributes" + type: + $ref: "#/components/schemas/GovernanceControlDetectionResourceType" + required: + - type + type: object + GovernanceNotificationSettingsAttributes: + description: The attributes of the organization-wide governance notification settings. + properties: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + required: + - assignment_notifications_enabled + type: object + GovernanceNotificationSettingsData: + description: A governance notification settings resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceNotificationSettingsAttributes" + id: + description: The unique identifier of the organization the notification settings apply to. + example: "11111111-2222-3333-4444-555555555555" + type: string + type: + $ref: "#/components/schemas/GovernanceNotificationSettingsResourceType" + required: + - id + - type + - attributes + type: object + GovernanceNotificationSettingsResourceType: + description: Governance notification settings resource type. + enum: + - governance_notification_settings + example: "governance_notification_settings" + type: string + x-enum-varnames: + - GOVERNANCE_NOTIFICATION_SETTINGS + GovernanceNotificationSettingsResponse: + description: The organization-wide governance notification settings. + properties: + data: + $ref: "#/components/schemas/GovernanceNotificationSettingsData" + required: + - data + type: object + GovernanceNotificationSettingsUpdateAttributes: + description: The attributes of the governance notification settings that can be updated. Only the attributes present in the request are modified. + properties: + assignment_notifications_enabled: + description: Whether notifications are sent to users when detections are assigned to them. + example: true + type: boolean + type: object + GovernanceNotificationSettingsUpdateData: + description: The data of a governance notification settings update request. + properties: + attributes: + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateAttributes" + type: + $ref: "#/components/schemas/GovernanceNotificationSettingsResourceType" + required: + - type + type: object + GovernanceNotificationSettingsUpdateRequest: + description: A request to update the organization-wide governance notification settings. + properties: + data: + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateData" + required: + - data + type: object + GovernanceResourceLimitAttributes: + description: The attributes of a governance resource limit. + properties: + current_limit: + description: The current limit configured for the resource. + example: 10000 + format: double + type: number + current_value: + description: The current value of the resource. + example: 8200 + format: double + type: number + default_current_value: + description: The default current value used when the resource value cannot be computed from the query. + example: 0 + format: double + type: number + default_limit_value: + description: The default limit value used when the limit cannot be computed from the query. + example: 0 + format: double + type: number + description: + description: A description of what the resource limit measures. + example: "The number of custom metrics in use against your contracted limit." + type: string + display_name: + description: The human-readable name of the resource limit. + example: "Custom Metrics" + type: string + limit_query: + $ref: "#/components/schemas/GovernanceLimitQuery" + product: + description: The Datadog product the resource limit belongs to. + example: "metrics" + type: string + query: + $ref: "#/components/schemas/GovernanceLimitQuery" + query_config: + $ref: "#/components/schemas/GovernanceLimitQueryConfig" + time_range: + description: The time range over which the resource value is measured. + example: "month" + type: string + unit_name: + description: The unit in which the resource value and limit are measured. + example: "metrics" + type: string + usage_status: + description: The current usage status of the resource relative to its limit. + example: "approaching" + type: string + required: + - display_name + - description + - product + - unit_name + - time_range + - current_value + - current_limit + - default_current_value + - default_limit_value + - query + - limit_query + - query_config + - usage_status + type: object + GovernanceResourceLimitData: + description: A governance resource limit resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceResourceLimitAttributes" + id: + description: The unique identifier of the resource limit. + example: "custom_metrics" + type: string + type: + $ref: "#/components/schemas/GovernanceResourceLimitResourceType" + required: + - id + - type + - attributes + type: object + GovernanceResourceLimitResourceType: + description: Resource limit resource type. + enum: + - resource-limit + example: "resource-limit" + type: string + x-enum-varnames: + - RESOURCE_LIMIT + GovernanceResourceLimitsDataArray: + description: An array of governance resource limit resources. + items: + $ref: "#/components/schemas/GovernanceResourceLimitData" + type: array + GovernanceResourceLimitsResponse: + description: A list of governance resource limits. + properties: + data: + $ref: "#/components/schemas/GovernanceResourceLimitsDataArray" + required: + - data + type: object GreyNoiseAPIKey: description: The definition of the `GreyNoiseAPIKey` object. properties: @@ -144178,6 +144704,61 @@ paths: operator: OR permissions: - user_access_read + /api/v2/governance/config: + get: + description: |- + Retrieve the Governance Console configuration for the organization, including whether the + Console is enabled, whether assignment notifications are enabled, and whether usage + attribution is configured. + operationId: GetGovernanceConfig + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_notifications_enabled: true + enabled: true + usage_attribution_configured: true + xorg_insights_enabled: true + id: "00000000-0000-0000-0000-000000000000" + type: "governance_console_config" + schema: + $ref: "#/components/schemas/GovernanceConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get the Governance Console configuration + tags: + - Governance Console + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/governance/control: get: description: |- @@ -144202,60 +144783,37 @@ paths: detection_frequency: "daily" detection_parameters: api_key_threshold: 30 - detection_type: "unused_api_keys" - feature_flags: [] insights: [] last_detection_at: "2024-03-01T12:00:00Z" mitigated_detections_count: 3 mitigation_parameters: {} mitigation_type: "" mitigations: - - action_verb: "revoke" - description: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." + - description: "Automatically identifies and revokes inactive API keys to improve security and reduce potential attack surface." execution_modes: - "manual" - "automatic" - feature_flags: [] id: "revoke_api_key" - manual_mitigation_warning: "These API keys will be revoked immediately upon confirmation. To revoke future API keys, you must go through this flow again." permissions: - "api_keys_write" - "api_keys_delete" - requires_ai: false supported_parameters: [] title: "Revoke Unused API Keys" name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" priority: "High" product: "api_keys" - release_status: "prod" resource_type: "api_key" resource_type_display_name: "API Key" supported_detection_parameters: - default_value: 30 description: "Number of days of inactivity before an API key is considered unused." display_name: "Unused API Key Threshold" - hidden: false name: "api_key_threshold" required: false supported_values: [] type: "integer" - supported_notification_parameters: - - default_value: false - description: "Enables the Governance Console to automatically assign ownership of detections based off of tagging and other internal heuristics." - display_name: "Automatic Ownership Assignment" - hidden: false - name: "governance_auto_assignment" - required: false - supported_values: [] - type: "boolean" - task: "Review and revoke unused API keys." type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + id: "unused_api_keys" type: "governance_control" schema: $ref: "#/components/schemas/GovernanceControlsResponse" @@ -144280,26 +144838,858 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: List governance controls + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List controls + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/control/{detection_type}: + get: + description: |- + Retrieve a single governance control by its detection type, including the organization's current + detection, notification, and mitigation configuration and detection counts. + operationId: GetGovernanceControl + parameters: + - description: The detection type that identifies the control, for example `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active_detections_count: 12 + category: "security" + created_at: "2024-01-15T09:30:00Z" + created_by: "11111111-2222-3333-4444-555555555555" + description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." + detection_frequency: "daily" + detection_parameters: + api_key_threshold: 30 + insights: [] + last_detection_at: "2024-03-01T12:00:00Z" + mitigated_detections_count: 3 + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + mitigations: [] + name: "Unused API Keys" + priority: "High" + product: "api_keys" + resource_type: "api_key" + resource_type_display_name: "API Key" + supported_detection_parameters: + - default_value: 30 + description: "Number of days of inactivity before an API key is considered unused." + display_name: "Unused API Key Threshold" + name: "api_key_threshold" + required: false + supported_values: [] + type: "integer" + type: "Proactive" + id: "unused_api_keys" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a control + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: |- + Update the detection, notification, and mitigation configuration of a governance control. Only + the attributes present in the request are modified. Changing the mitigation type or its + parameters may require additional permissions. + operationId: UpdateGovernanceControl + parameters: + - description: The detection type that identifies the control, for example `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + detection_parameters: + api_key_threshold: 60 + mitigation_type: "revoke_api_key" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active_detections_count: 12 + category: "security" + created_at: "2024-01-15T09:30:00Z" + created_by: "11111111-2222-3333-4444-555555555555" + description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." + detection_frequency: "daily" + detection_parameters: + api_key_threshold: 60 + insights: [] + last_detection_at: "2024-03-01T12:00:00Z" + mitigated_detections_count: 3 + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + mitigations: [] + name: "Unused API Keys" + priority: "High" + product: "api_keys" + resource_type: "api_key" + resource_type_display_name: "API Key" + supported_detection_parameters: [] + type: "Proactive" + id: "unused_api_keys" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update a control + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/control/{detection_type}/detections: + get: + description: |- + Retrieve the detections produced by the governance control with the given detection type. + Results can be filtered by state and free-text query, sorted, and paginated. + operationId: ListGovernanceControlDetections + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + - description: Restrict the results to detections in the given state. + example: "active" + in: query + name: filter[state] + required: false + schema: + type: string + - description: Restrict the results to detections matching the given free-text query. + example: "production" + in: query + name: filter[query] + required: false + schema: + type: string + - description: |- + A comma-separated list of attributes to sort detections by. Prefix an attribute with + `-` for descending order. + + The attributes available for sorting are `id`, `created_at`, `assigned_to`, + `detection_type`, `display_name`, `exception_at`, `mitigate_after`, `mitigated_at`, + `priority`, `resource_id`, and `state`. Defaults to `created_at,-id`. + example: "-created_at,-id" + in: query + name: sort + required: false + schema: + type: string + - description: "The zero-based index of the page to return; the first page is 0." + example: 0 + in: query + name: page[number] + required: false + schema: + default: 0 + format: int64 + type: integer + - description: The number of detections to return per page. + example: 50 + in: query + name: page[size] + required: false + schema: + format: int64 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List control detections + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/control/{detection_type}/notification_settings: + get: + description: |- + Retrieve the notification settings for the governance control with the given detection type, + including, for each supported event type, whether notifications are enabled and which + destinations receive them. + operationId: GetGovernanceControlNotificationSettings + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + id: "unused_api_keys" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get control notification settings + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + put: + description: |- + Replace the notification settings for the governance control with the given detection type, + setting, for each supported event type, whether notifications are enabled and which + destinations receive them. + operationId: UpdateGovernanceControlNotificationSettings + parameters: + - description: The detection type that identifies the control; for example, `unused_api_keys`. + example: "unused_api_keys" + in: path + name: detection_type + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + event_settings: + - enabled: true + event_type: "new_detection" + targets: + - handle: "#governance-alerts" + type: "slack" + id: "unused_api_keys" + type: "control_notification_settings" + schema: + $ref: "#/components/schemas/ControlNotificationSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update control notification settings + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/detections/mitigate: + post: + description: |- + Apply a mitigation to a set of governance detections of a given detection type. When the + mitigation type is omitted, the control's configured mitigation is used. The request is + accepted for asynchronous processing. + operationId: MitigateGovernanceDetections + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + detection_ids: + - "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + detection_type: "unused_api_keys" + mitigation_parameters: {} + mitigation_type: "revoke_api_key" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceMitigationRequest" + required: true + responses: + "202": + description: Accepted + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Mitigate detections + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/detections/{detection_id}: + get: + description: Retrieve a single governance detection by its unique identifier. + operationId: GetGovernanceDetection + parameters: + - description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + in: path + name: detection_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a detection + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: |- + Update a governance detection by its unique identifier. Only the attributes present in the + request are modified, allowing a detection to be acknowledged as an exception, reopened, + reassigned, or deferred for mitigation. + operationId: UpdateGovernanceDetection + parameters: + - description: The unique identifier of the detection. + example: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + in: path + name: detection_id + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_to: "11111111-2222-3333-4444-555555555555" + state: "exception" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assigned_team: "platform-security" + assigned_to: "11111111-2222-3333-4444-555555555555" + assignment_source: "manual" + control_id: "unused_api_keys" + created_at: "2024-03-01T12:00:00Z" + detection_type: "unused_api_keys" + display_name: "CI Deploy Key" + metadata: + region: "us-east-1" + priority: 1 + resource_id: "api-key-12345" + resource_type: "api_key" + state: "active" + id: "3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d" + type: "governance_control_detection" + schema: + $ref: "#/components/schemas/GovernanceControlDetectionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update a detection + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/insights: + get: + description: |- + Retrieve the list of governance insights available to the organization. Each insight + reports the query used to compute it, so that the value can be computed client-side. + Insights can be filtered by product. + operationId: ListGovernanceInsights + parameters: + - description: |- + Restrict the results to insights belonging to the given products. May be repeated to + filter by multiple products. Matching is case-insensitive. + example: + - "Usage" + - "Logs Settings" + in: query + name: filter[product] + required: false + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + audit_query: + description: "Number of custom metrics submitted by the organization." + display_name: "Custom Metrics" + event_query: + metric_query: + query: "sum:datadog.estimated_usage.metrics.custom{*}" + reducer: "sum" + source: "metrics" + percentage_query: + product: "Usage" + query_config: + chart_type: "line" + comparison_shift: "month" + directionality: "decrease_better" + effective_time_window_days: 30 + sub_product: "" + time_range: "month" + unit_name: "custom metrics" + usage_query: + id: "498ee21f-8037-48b8-a961-a488692902f4" + type: "insight" + - attributes: + audit_query: + compute: + aggregation: "cardinality" + interval: 86400000 + metric: "@usr.id" + indexes: + - "main" + query: "@evt.name:Dashboard" + source: "audit" + description: "Number of users who have used the Dashboard in the last 30 days" + display_name: "Active Users" + event_query: + metric_query: + percentage_query: + product: "Usage" + query_config: + chart_type: "line" + comparison_shift: "month" + directionality: "neutral" + effective_time_window_days: 30 + sub_product: "" + time_range: "month" + unit_name: "active users" + usage_query: + id: "a3248d1b-5578-4345-a34e-fe9657300f22" + type: "insight" + schema: + $ref: "#/components/schemas/GovernanceInsightsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - events_read + - metrics_read + summary: List insights tags: - - Governance Controls + - Governance Console + "x-permission": + operator: OR + permissions: + - metrics_read + - events_read + - audit_logs_read + - governance_console_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/governance/control/{detection_type}: + /api/v2/governance/limits: get: description: |- - Retrieve a single governance control by its detection type, including the organization's current - detection, notification, and mitigation configuration and detection counts. - operationId: GetGovernanceControl - parameters: - - description: The detection type that identifies the control, for example `unused_api_keys`. - example: "unused_api_keys" - in: path - name: detection_type - required: true - schema: - type: string + Retrieve the list of usage limits tracked for the organization in the Governance Console. + Each limit reports the query used to compute current usage, the unit and time range it is + measured over, and its current usage status. + operationId: ListGovernanceLimits responses: "200": content: @@ -144308,50 +145698,29 @@ paths: default: value: data: - attributes: - active_detections_count: 12 - category: "security" - created_at: "2024-01-15T09:30:00Z" - created_by: "11111111-2222-3333-4444-555555555555" - description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." - detection_frequency: "daily" - detection_parameters: - api_key_threshold: 30 - detection_type: "unused_api_keys" - feature_flags: [] - insights: [] - last_detection_at: "2024-03-01T12:00:00Z" - mitigated_detections_count: 3 - mitigation_parameters: {} - mitigation_type: "revoke_api_key" - mitigations: [] - name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" - priority: "High" - product: "api_keys" - release_status: "prod" - resource_type: "api_key" - resource_type_display_name: "API Key" - supported_detection_parameters: - - default_value: 30 - description: "Number of days of inactivity before an API key is considered unused." - display_name: "Unused API Key Threshold" - hidden: false - name: "api_key_threshold" - required: false - supported_values: [] - type: "integer" - supported_notification_parameters: [] - task: "Review and revoke unused API keys." - type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: "governance_control" + - attributes: + description: "The number of log events indexed in the last 30 days." + display_name: "Indexed Logs" + limit_type: "usage" + product: "logs" + query: + query: "sum:datadog.estimated_usage.logs.ingested_events{*}" + reducer: "sum" + source: "metrics" + query_config: + chart_type: "line" + comparison_shift: "month" + default_value: 0 + directionality: "increase_better" + effective_time_window_days: 30 + time_range: "month" + times_hit_limit: 2 + unit_name: "events" + usage_status: "approaching" + id: "logs_indexed_events" + type: "limit" schema: - $ref: "#/components/schemas/GovernanceControlResponse" + $ref: "#/components/schemas/GovernanceLimitsResponse" description: OK "400": content: @@ -144371,34 +145740,82 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden - "404": + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List usage limits + tags: + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/governance/notification_settings: + get: + description: |- + Retrieve the organization-wide governance notification settings, including whether users are + notified when detections are assigned to them. + operationId: GetGovernanceNotificationSettings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_notifications_enabled: true + id: "11111111-2222-3333-4444-555555555555" + type: "governance_notification_settings" + schema: + $ref: "#/components/schemas/GovernanceNotificationSettingsResponse" + description: OK + "400": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: Get a governance control + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get notification settings tags: - - Governance Controls + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: description: |- - Update the detection, notification, and mitigation configuration of a governance control. Only - the attributes present in the request are modified. Changing the mitigation type or its - parameters may require additional permissions. - operationId: UpdateGovernanceControl - parameters: - - description: The detection type that identifies the control, for example `unused_api_keys`. - example: "unused_api_keys" - in: path - name: detection_type - required: true - schema: - type: string + Update the organization-wide governance notification settings. Only the attributes present in + the request are modified. + operationId: UpdateGovernanceNotificationSettings requestBody: content: application/json: @@ -144407,12 +145824,10 @@ paths: value: data: attributes: - detection_parameters: - api_key_threshold: 60 - mitigation_type: "revoke_api_key" - type: "governance_control" + assignment_notifications_enabled: true + type: "governance_notification_settings" schema: - $ref: "#/components/schemas/GovernanceControlUpdateRequest" + $ref: "#/components/schemas/GovernanceNotificationSettingsUpdateRequest" required: true responses: "200": @@ -144423,41 +145838,11 @@ paths: value: data: attributes: - active_detections_count: 12 - category: "security" - created_at: "2024-01-15T09:30:00Z" - created_by: "11111111-2222-3333-4444-555555555555" - description: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." - detection_frequency: "daily" - detection_parameters: - api_key_threshold: 60 - detection_type: "unused_api_keys" - feature_flags: [] - insights: [] - last_detection_at: "2024-03-01T12:00:00Z" - mitigated_detections_count: 3 - mitigation_parameters: {} - mitigation_type: "revoke_api_key" - mitigations: [] - name: "Unused API Keys" - next_steps: "Review and revoke API keys that are no longer in use to maintain a secure authentication posture." - notification_frequency: "" - notification_parameters: {} - notification_type: "" - priority: "High" - product: "api_keys" - release_status: "prod" - resource_type: "api_key" - resource_type_display_name: "API Key" - supported_detection_parameters: [] - supported_notification_parameters: [] - task: "Review and revoke unused API keys." - type: "Proactive" - usage_concern: "Security" - id: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" - type: "governance_control" + assignment_notifications_enabled: true + id: "11111111-2222-3333-4444-555555555555" + type: "governance_notification_settings" schema: - $ref: "#/components/schemas/GovernanceControlResponse" + $ref: "#/components/schemas/GovernanceNotificationSettingsResponse" description: OK "400": content: @@ -144477,60 +145862,30 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: Update a governance control + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update notification settings tags: - - Governance Controls + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read + - governance_console_write x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/governance/insights: + /api/v2/governance/resource_limits: get: description: |- - Retrieve the list of governance insights available to the organization. By default, only - insight metadata is returned; pass `withValues=true` to also compute and include each - insight's current and previous values. Insights can be filtered by product. - operationId: ListGovernanceInsights - parameters: - - description: |- - Whether to compute and include the current and previous value of each insight. - Defaults to `false`, in which case only insight metadata is returned. - example: true - in: query - name: withValues - required: false - schema: - type: boolean - - description: |- - The UUID of the organization to compute insights for. Defaults to the organization of - the authenticated user. Used to retrieve insights for a child organization from a - parent organization. - example: "11111111-2222-3333-4444-555555555555" - in: query - name: orgUuid - required: false - schema: - type: string - - description: |- - Restrict the results to insights belonging to the given products. May be repeated to - filter by multiple products. Matching is case-insensitive. - example: - - "Usage" - - "Logs Settings" - in: query - name: filter[product] - required: false - schema: - items: - type: string - type: array + Retrieve the list of resource limits tracked for the organization in the Governance Console. + Each resource limit reports its current value and configured limit, the queries used to + compute them, and its current usage status. + operationId: ListGovernanceResourceLimits responses: "200": content: @@ -144540,59 +145895,34 @@ paths: value: data: - attributes: - audit_query: - best_practice: - deep_link: "" - description: "" - display_name: "Active Dashboards" - event_query: - metric_query: - old_value: 3274 - percentage_query: - product: "Usage" - state: "" - sub_product: "" - time_range: "" - unit_name: "active dashboards" - usage_query: - value: 3601 - id: "498ee21f-8037-48b8-a961-a488692902f4" - type: "insight" - - attributes: - audit_query: - best_practice: - category: "access_governance" - deep_link: "/organization-settings/users?status=inactive" - description: "Review and deactivate users who have not logged in within the last 90 days." - detection_type: - id: "bp_monitor_inactive_users" - impact: "Reduces unauthorized access risk." - impact_hint: 1 - permissions: - - "user_access_manage" - status: "active" - summary: "Inactive users with access increase your security surface area." - title: "Monitor inactive users" - trigger_condition: "active_users" - trigger_type: "insight" - deep_link: "" - description: "Number of users who have used the Dashboard in the last 30 days" - display_name: "Active Users" - event_query: - metric_query: - old_value: 1173 - percentage_query: - product: "Usage" - state: "" - sub_product: "" + current_limit: 10000 + current_value: 8200 + default_current_value: 0 + default_limit_value: 0 + description: "The number of custom metrics in use against your contracted limit." + display_name: "Custom Metrics" + limit_query: + query: "sum:datadog.contract.metrics.custom{*}" + reducer: "max" + source: "metrics" + product: "metrics" + query: + query: "sum:datadog.estimated_usage.metrics.custom{*}" + reducer: "sum" + source: "metrics" + query_config: + chart_type: "line" + comparison_shift: "month" + default_value: 0 + directionality: "decrease_better" + effective_time_window_days: 30 time_range: "month" - unit_name: "active users" - usage_query: - value: 1291 - id: "a3248d1b-5578-4345-a34e-fe9657300f22" - type: "insight" + unit_name: "metrics" + usage_status: "approaching" + id: "custom_metrics" + type: "resource-limit" schema: - $ref: "#/components/schemas/GovernanceInsightsResponse" + $ref: "#/components/schemas/GovernanceResourceLimitsResponse" description: OK "400": content: @@ -144614,9 +145944,17 @@ paths: description: Forbidden "429": $ref: "#/components/responses/TooManyRequestsResponse" - summary: List governance insights + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List resource limits tags: - - Governance Insights + - Governance Console + "x-permission": + operator: AND + permissions: + - governance_console_read x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). @@ -204276,9 +205614,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/). @@ -204367,9 +205713,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/). @@ -204424,9 +205777,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/). @@ -204536,9 +205896,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/). @@ -204627,9 +205995,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/). @@ -204709,9 +206084,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/). @@ -210810,17 +212193,20 @@ tags: url: https://docs.datadoghq.com/integrations/google-hangouts-chat/ name: Google Chat Integration - description: |- - Governance Controls pair a detection definition with an organization's detection, notification, - and mitigation configuration within the Governance Console. Each control reports how a class of - governance issue (such as unused API keys or unqueried metrics) is detected and remediated, along - with counts of active and mitigated detections. - name: Governance Controls - - description: |- - Governance Insights surface key usage, configuration, and best-practice signals for an - organization within the Governance Console. Each insight reports a current value (and, - optionally, a previous value for comparison) along with the query used to compute it, so - that the Console can render trends and highlight areas that need attention. - name: Governance Insights + The Governance Console finds issues that build up across a Datadog organization over time, + such as API keys nobody uses, users who no longer need access, or custom metrics that are + never queried, and tracks them through to a fix. + + These endpoints allow you to: + + - Read insights: measures of how your organization uses Datadog, each with the query behind it. + - Configure controls: the rules deciding how one kind of issue is found and what is done about it. + - Act on detections: the issues a control found. Assign, defer, accept as an exception, or fix. + - Manage settings: organization-wide configuration, usage and resource limits, and notifications. + + See the [Governance Console page](https://docs.datadoghq.com/account_management/governance_console/) + for more information. + name: Governance Console - description: |- Configure High Availability Multi-Region (HAMR) connections between Datadog organizations. HAMR provides disaster recovery capabilities by maintaining synchronized data between primary diff --git a/examples/v2/governance-console/GetGovernanceConfig.rb b/examples/v2/governance-console/GetGovernanceConfig.rb new file mode 100644 index 000000000000..30b780c19930 --- /dev/null +++ b/examples/v2/governance-console/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::GovernanceConsoleAPI.new +p api_instance.get_governance_config() diff --git a/examples/v2/governance-controls/GetGovernanceControl.rb b/examples/v2/governance-console/GetGovernanceControl.rb similarity index 64% rename from examples/v2/governance-controls/GetGovernanceControl.rb rename to examples/v2/governance-console/GetGovernanceControl.rb index 807a0ffbd232..b771cd6041f2 100644 --- a/examples/v2/governance-controls/GetGovernanceControl.rb +++ b/examples/v2/governance-console/GetGovernanceControl.rb @@ -1,8 +1,8 @@ -# Get a governance control returns "OK" response +# Get a control returns "OK" response require "datadog_api_client" DatadogAPIClient.configure do |config| config.unstable_operations["v2.get_governance_control".to_sym] = true end -api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new +api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.new p api_instance.get_governance_control("detection_type") diff --git a/examples/v2/governance-console/GetGovernanceControlNotificationSettings.rb b/examples/v2/governance-console/GetGovernanceControlNotificationSettings.rb new file mode 100644 index 000000000000..67a0a8bcbceb --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceControlNotificationSettings.rb @@ -0,0 +1,8 @@ +# Get 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::GovernanceConsoleAPI.new +p api_instance.get_governance_control_notification_settings("detection_type") diff --git a/examples/v2/governance-console/GetGovernanceDetection.rb b/examples/v2/governance-console/GetGovernanceDetection.rb new file mode 100644 index 000000000000..258bb4f00826 --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceDetection.rb @@ -0,0 +1,8 @@ +# Get a detection returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_governance_detection".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.new +p api_instance.get_governance_detection("detection_id") diff --git a/examples/v2/governance-console/GetGovernanceNotificationSettings.rb b/examples/v2/governance-console/GetGovernanceNotificationSettings.rb new file mode 100644 index 000000000000..38256d6c696b --- /dev/null +++ b/examples/v2/governance-console/GetGovernanceNotificationSettings.rb @@ -0,0 +1,8 @@ +# Get 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::GovernanceConsoleAPI.new +p api_instance.get_governance_notification_settings() diff --git a/examples/v2/governance-console/ListGovernanceControlDetections.rb b/examples/v2/governance-console/ListGovernanceControlDetections.rb new file mode 100644 index 000000000000..e7f9f3b5033d --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceControlDetections.rb @@ -0,0 +1,8 @@ +# List 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::GovernanceConsoleAPI.new +p api_instance.list_governance_control_detections("detection_type") diff --git a/examples/v2/governance-controls/ListGovernanceControls.rb b/examples/v2/governance-console/ListGovernanceControls.rb similarity index 62% rename from examples/v2/governance-controls/ListGovernanceControls.rb rename to examples/v2/governance-console/ListGovernanceControls.rb index a97ecadd6092..f590a4dab7ac 100644 --- a/examples/v2/governance-controls/ListGovernanceControls.rb +++ b/examples/v2/governance-console/ListGovernanceControls.rb @@ -1,8 +1,8 @@ -# List governance controls returns "OK" response +# List controls returns "OK" response require "datadog_api_client" DatadogAPIClient.configure do |config| config.unstable_operations["v2.list_governance_controls".to_sym] = true end -api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new +api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.new p api_instance.list_governance_controls() diff --git a/examples/v2/governance-insights/ListGovernanceInsights.rb b/examples/v2/governance-console/ListGovernanceInsights.rb similarity index 62% rename from examples/v2/governance-insights/ListGovernanceInsights.rb rename to examples/v2/governance-console/ListGovernanceInsights.rb index aeab3d10fb1e..a9a0c695e450 100644 --- a/examples/v2/governance-insights/ListGovernanceInsights.rb +++ b/examples/v2/governance-console/ListGovernanceInsights.rb @@ -1,8 +1,8 @@ -# List governance insights returns "OK" response +# List insights returns "OK" response require "datadog_api_client" DatadogAPIClient.configure do |config| config.unstable_operations["v2.list_governance_insights".to_sym] = true end -api_instance = DatadogAPIClient::V2::GovernanceInsightsAPI.new +api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.new p api_instance.list_governance_insights() diff --git a/examples/v2/governance-console/ListGovernanceLimits.rb b/examples/v2/governance-console/ListGovernanceLimits.rb new file mode 100644 index 000000000000..1467ef068cc3 --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceLimits.rb @@ -0,0 +1,8 @@ +# List usage 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::GovernanceConsoleAPI.new +p api_instance.list_governance_limits() diff --git a/examples/v2/governance-console/ListGovernanceResourceLimits.rb b/examples/v2/governance-console/ListGovernanceResourceLimits.rb new file mode 100644 index 000000000000..21e93d25fea6 --- /dev/null +++ b/examples/v2/governance-console/ListGovernanceResourceLimits.rb @@ -0,0 +1,8 @@ +# List 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::GovernanceConsoleAPI.new +p api_instance.list_governance_resource_limits() diff --git a/examples/v2/governance-console/MitigateGovernanceDetections.rb b/examples/v2/governance-console/MitigateGovernanceDetections.rb new file mode 100644 index 000000000000..3012ee095d89 --- /dev/null +++ b/examples/v2/governance-console/MitigateGovernanceDetections.rb @@ -0,0 +1,21 @@ +# Mitigate detections returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.mitigate_governance_detections".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.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.mitigate_governance_detections(body) diff --git a/examples/v2/governance-controls/UpdateGovernanceControl.rb b/examples/v2/governance-console/UpdateGovernanceControl.rb similarity index 69% rename from examples/v2/governance-controls/UpdateGovernanceControl.rb rename to examples/v2/governance-console/UpdateGovernanceControl.rb index 5dca6d0fb1c8..a3b1594161cd 100644 --- a/examples/v2/governance-controls/UpdateGovernanceControl.rb +++ b/examples/v2/governance-console/UpdateGovernanceControl.rb @@ -1,21 +1,17 @@ -# Update a governance control returns "OK" response +# Update a control returns "OK" response require "datadog_api_client" DatadogAPIClient.configure do |config| config.unstable_operations["v2.update_governance_control".to_sym] = true end -api_instance = DatadogAPIClient::V2::GovernanceControlsAPI.new +api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.new body = DatadogAPIClient::V2::GovernanceControlUpdateRequest.new({ data: DatadogAPIClient::V2::GovernanceControlUpdateData.new({ attributes: DatadogAPIClient::V2::GovernanceControlUpdateAttributes.new({ 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: DatadogAPIClient::V2::GovernanceControlResourceType::GOVERNANCE_CONTROL, }), }) diff --git a/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.rb b/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.rb new file mode 100644 index 000000000000..e1c2b5a07ea4 --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceControlNotificationSettings.rb @@ -0,0 +1,28 @@ +# Update 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::GovernanceConsoleAPI.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-console/UpdateGovernanceDetection.rb b/examples/v2/governance-console/UpdateGovernanceDetection.rb new file mode 100644 index 000000000000..db36e044175b --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceDetection.rb @@ -0,0 +1,20 @@ +# Update a detection returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_governance_detection".to_sym] = true +end +api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.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_detection("detection_id", body) diff --git a/examples/v2/governance-console/UpdateGovernanceNotificationSettings.rb b/examples/v2/governance-console/UpdateGovernanceNotificationSettings.rb new file mode 100644 index 000000000000..9f317097064c --- /dev/null +++ b/examples/v2/governance-console/UpdateGovernanceNotificationSettings.rb @@ -0,0 +1,17 @@ +# Update 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::GovernanceConsoleAPI.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 c4bfa9ae1080..70968a4bc122 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3461,11 +3461,37 @@ "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.GetGovernanceControlNotificationSettings" => { + "detection_type" => "String", + }, + "v2.UpdateGovernanceControlNotificationSettings" => { + "detection_type" => "String", + "body" => "ControlNotificationSettingsUpdateRequest", + }, + "v2.MitigateGovernanceDetections" => { + "body" => "GovernanceMitigationRequest", + }, + "v2.GetGovernanceDetection" => { + "detection_id" => "String", + }, + "v2.UpdateGovernanceDetection" => { + "detection_id" => "String", + "body" => "GovernanceControlDetectionUpdateRequest", + }, "v2.ListGovernanceInsights" => { - "with_values" => "Boolean", - "org_uuid" => "String", "filter_product" => "Array", }, + "v2.UpdateGovernanceNotificationSettings" => { + "body" => "GovernanceNotificationSettingsUpdateRequest", + }, "v2.CreateHamrOrgConnection" => { "body" => "HamrOrgConnectionRequest", }, diff --git a/features/v2/governance_console.feature b/features/v2/governance_console.feature new file mode 100644 index 000000000000..07f6d64b5143 --- /dev/null +++ b/features/v2/governance_console.feature @@ -0,0 +1,287 @@ +@endpoint(governance-console) @endpoint(governance-console-v2) +Feature: Governance Console + The Governance Console finds issues that build up across a Datadog + organization over time, such as API keys nobody uses, users who no longer + need access, or custom metrics that are never queried, and tracks them + through to a fix. These endpoints allow you to: - Read insights: + measures of how your organization uses Datadog, each with the query behind + it. - Configure controls: the rules deciding how one kind of issue is + found and what is done about it. - Act on detections: the issues a control + found. Assign, defer, accept as an exception, or fix. - Manage settings: + organization-wide configuration, usage and resource limits, and + notifications. See the [Governance Console + page](https://docs.datadoghq.com/account_management/governance_console/) + for more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "GovernanceConsole" API + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "Bad Request" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "Not Found" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a control returns "OK" response + Given operation "GetGovernanceControl" enabled + And new "GetGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "Bad Request" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "Not Found" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get a detection returns "OK" response + Given operation "GetGovernanceDetection" enabled + And new "GetGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get control notification settings returns "Bad Request" response + Given operation "GetGovernanceControlNotificationSettings" enabled + And new "GetGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get control notification settings returns "OK" response + Given operation "GetGovernanceControlNotificationSettings" enabled + And new "GetGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get notification settings returns "Bad Request" response + Given operation "GetGovernanceNotificationSettings" enabled + And new "GetGovernanceNotificationSettings" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get notification settings returns "OK" response + Given operation "GetGovernanceNotificationSettings" enabled + And new "GetGovernanceNotificationSettings" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get the Governance Console configuration returns "Bad Request" response + Given operation "GetGovernanceConfig" enabled + And new "GetGovernanceConfig" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Get the Governance Console configuration returns "OK" response + Given operation "GetGovernanceConfig" enabled + And new "GetGovernanceConfig" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List control detections returns "Bad Request" response + Given operation "ListGovernanceControlDetections" enabled + And new "ListGovernanceControlDetections" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List control detections returns "OK" response + Given operation "ListGovernanceControlDetections" enabled + And new "ListGovernanceControlDetections" request + And request contains "detection_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List controls returns "Bad Request" response + Given operation "ListGovernanceControls" enabled + And new "ListGovernanceControls" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List controls returns "OK" response + Given operation "ListGovernanceControls" enabled + And new "ListGovernanceControls" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List insights returns "Bad Request" response + Given operation "ListGovernanceInsights" enabled + And new "ListGovernanceInsights" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List insights returns "OK" response + Given operation "ListGovernanceInsights" enabled + And new "ListGovernanceInsights" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List resource limits returns "Bad Request" response + Given operation "ListGovernanceResourceLimits" enabled + And new "ListGovernanceResourceLimits" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List resource limits returns "OK" response + Given operation "ListGovernanceResourceLimits" enabled + And new "ListGovernanceResourceLimits" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List usage limits returns "Bad Request" response + Given operation "ListGovernanceLimits" enabled + And new "ListGovernanceLimits" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: List usage limits returns "OK" response + Given operation "ListGovernanceLimits" enabled + And new "ListGovernanceLimits" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Mitigate detections returns "Accepted" response + Given operation "MitigateGovernanceDetections" enabled + And new "MitigateGovernanceDetections" request + And body with value {"data": {"attributes": {"detection_ids": ["3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"], "detection_type": "unused_api_keys", "mitigation_type": "revoke_api_key"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Mitigate detections returns "Bad Request" response + Given operation "MitigateGovernanceDetections" enabled + And new "MitigateGovernanceDetections" request + And body with value {"data": {"attributes": {"detection_ids": ["3f9b2c1a-8d4e-4a6b-9c2f-1e7d5a0b3c4d"], "detection_type": "unused_api_keys", "mitigation_type": "revoke_api_key"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "Bad Request" response + Given operation "UpdateGovernanceControl" enabled + And new "UpdateGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "Not Found" response + Given operation "UpdateGovernanceControl" enabled + And new "UpdateGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a control returns "OK" response + Given operation "UpdateGovernanceControl" enabled + And new "UpdateGovernanceControl" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key"}, "type": "governance_control"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "Bad Request" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "Not Found" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update a detection returns "OK" response + Given operation "UpdateGovernanceDetection" enabled + And new "UpdateGovernanceDetection" request + And request contains "detection_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assigned_team": "platform-security", "assigned_to": "11111111-2222-3333-4444-555555555555", "mitigate_after": "2024-03-15T00:00:00Z", "state": "exception"}, "type": "governance_control_detection"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update control notification settings returns "Bad Request" response + Given operation "UpdateGovernanceControlNotificationSettings" enabled + And new "UpdateGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"event_settings": [{"enabled": true, "event_type": "new_detection", "targets": [{"handle": "#governance-alerts", "type": "slack"}]}]}, "type": "control_notification_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update control notification settings returns "OK" response + Given operation "UpdateGovernanceControlNotificationSettings" enabled + And new "UpdateGovernanceControlNotificationSettings" request + And request contains "detection_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"event_settings": [{"enabled": true, "event_type": "new_detection", "targets": [{"handle": "#governance-alerts", "type": "slack"}]}]}, "type": "control_notification_settings"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update notification settings returns "Bad Request" response + Given operation "UpdateGovernanceNotificationSettings" enabled + And new "UpdateGovernanceNotificationSettings" request + And body with value {"data": {"attributes": {"assignment_notifications_enabled": true}, "type": "governance_notification_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-governance-console + Scenario: Update notification settings returns "OK" response + Given operation "UpdateGovernanceNotificationSettings" enabled + And new "UpdateGovernanceNotificationSettings" request + And body with value {"data": {"attributes": {"assignment_notifications_enabled": true}, "type": "governance_notification_settings"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/governance_controls.feature b/features/v2/governance_controls.feature deleted file mode 100644 index 1207f5cf507f..000000000000 --- a/features/v2/governance_controls.feature +++ /dev/null @@ -1,77 +0,0 @@ -@endpoint(governance-controls) @endpoint(governance-controls-v2) -Feature: Governance Controls - Governance Controls pair a detection definition with an organization's - detection, notification, and mitigation configuration within the - Governance Console. Each control reports how a class of governance issue - (such as unused API keys or unqueried metrics) is detected and remediated, - along with counts of active and mitigated detections. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "GovernanceControls" API - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "Bad Request" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "Not Found" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Get a governance control returns "OK" response - Given operation "GetGovernanceControl" enabled - And new "GetGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance controls returns "Bad Request" response - Given operation "ListGovernanceControls" enabled - And new "ListGovernanceControls" request - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance controls returns "OK" response - Given operation "ListGovernanceControls" enabled - And new "ListGovernanceControls" request - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "Bad Request" response - Given operation "UpdateGovernanceControl" enabled - And new "UpdateGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "Not Found" response - Given operation "UpdateGovernanceControl" enabled - And new "UpdateGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: Update a governance control returns "OK" response - Given operation "UpdateGovernanceControl" enabled - And new "UpdateGovernanceControl" request - And request contains "detection_type" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"detection_frequency": "daily", "mitigation_type": "revoke_api_key", "name": "Unused API Keys", "notification_frequency": "daily", "notification_type": "slack"}, "id": "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "type": "governance_control"}} - When the request is sent - Then the response status is 200 OK diff --git a/features/v2/governance_insights.feature b/features/v2/governance_insights.feature deleted file mode 100644 index 0327e119c540..000000000000 --- a/features/v2/governance_insights.feature +++ /dev/null @@ -1,24 +0,0 @@ -@endpoint(governance-insights) @endpoint(governance-insights-v2) -Feature: Governance Insights - Governance Insights surface key usage, configuration, and best-practice - signals for an organization within the Governance Console. Each insight - reports a current value (and, optionally, a previous value for comparison) - along with the query used to compute it, so that the Console can render - trends and highlight areas that need attention. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "GovernanceInsights" API - And operation "ListGovernanceInsights" enabled - And new "ListGovernanceInsights" request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance insights returns "Bad Request" response - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-governance-console - Scenario: List governance insights returns "OK" response - When the request is sent - Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 133ab9ade47d..d2c9763403d9 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2834,26 +2834,92 @@ "type": "safe" } }, + "GetGovernanceConfig": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, "ListGovernanceControls": { - "tag": "Governance Controls", + "tag": "Governance Console", "undo": { "type": "safe" } }, "GetGovernanceControl": { - "tag": "Governance Controls", + "tag": "Governance Console", "undo": { "type": "safe" } }, "UpdateGovernanceControl": { - "tag": "Governance Controls", + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "ListGovernanceControlDetections": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "GetGovernanceControlNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceControlNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "MitigateGovernanceDetections": { + "tag": "Governance Console", + "undo": { + "type": "unsafe" + } + }, + "GetGovernanceDetection": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceDetection": { + "tag": "Governance Console", "undo": { "type": "idempotent" } }, "ListGovernanceInsights": { - "tag": "Governance Insights", + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "ListGovernanceLimits": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "GetGovernanceNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceNotificationSettings": { + "tag": "Governance Console", + "undo": { + "type": "idempotent" + } + }, + "ListGovernanceResourceLimits": { + "tag": "Governance Console", "undo": { "type": "safe" } diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5a416e62be64..cd67e2112ada 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -448,10 +448,21 @@ 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_control": false, + "v2.get_governance_control_notification_settings": false, + "v2.get_governance_detection": false, + "v2.get_governance_notification_settings": false, + "v2.list_governance_control_detections": false, "v2.list_governance_controls": false, - "v2.update_governance_control": false, "v2.list_governance_insights": false, + "v2.list_governance_limits": false, + "v2.list_governance_resource_limits": false, + "v2.mitigate_governance_detections": false, + "v2.update_governance_control": false, + "v2.update_governance_control_notification_settings": false, + "v2.update_governance_detection": false, + "v2.update_governance_notification_settings": false, "v2.create_hamr_org_connection": false, "v2.get_hamr_org_connection": false, "v2.delete_entity_integration_config": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1bc8cbc8c62f..d4d426b1e596 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2341,6 +2341,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", @@ -3697,9 +3707,23 @@ def overrides "v2.google_docs_postmortem_settings" => "GoogleDocsPostmortemSettings", "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", @@ -3713,6 +3737,7 @@ def overrides "v2.governance_insight_audit_compute" => "GovernanceInsightAuditCompute", "v2.governance_insight_audit_query" => "GovernanceInsightAuditQuery", "v2.governance_insight_data" => "GovernanceInsightData", + "v2.governance_insight_directionality" => "GovernanceInsightDirectionality", "v2.governance_insight_event_compute" => "GovernanceInsightEventCompute", "v2.governance_insight_event_query" => "GovernanceInsightEventQuery", "v2.governance_insight_metric_query" => "GovernanceInsightMetricQuery", @@ -3721,6 +3746,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", @@ -8469,8 +8514,7 @@ def overrides "v2.forms_api" => "FormsAPI", "v2.gcp_integration_api" => "GCPIntegrationAPI", "v2.google_chat_integration_api" => "GoogleChatIntegrationAPI", - "v2.governance_controls_api" => "GovernanceControlsAPI", - "v2.governance_insights_api" => "GovernanceInsightsAPI", + "v2.governance_console_api" => "GovernanceConsoleAPI", "v2.high_availability_multi_region_api" => "HighAvailabilityMultiRegionAPI", "v2.identity_providers_api" => "IdentityProvidersAPI", "v2.incidents_api" => "IncidentsAPI", diff --git a/lib/datadog_api_client/v2/api/governance_console_api.rb b/lib/datadog_api_client/v2/api/governance_console_api.rb new file mode 100644 index 000000000000..f19bed899f70 --- /dev/null +++ b/lib/datadog_api_client/v2/api/governance_console_api.rb @@ -0,0 +1,1123 @@ +=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 GovernanceConsoleAPI + 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: GovernanceConsoleAPI.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: GovernanceConsoleAPI#get_governance_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a control. + # + # @see #get_governance_control_with_http_info + def get_governance_control(detection_type, opts = {}) + data, _status_code, _headers = get_governance_control_with_http_info(detection_type, opts) + data + end + + # Get a control. + # + # Retrieve a single governance control by its detection type, including the organization's current + # detection, notification, and mitigation configuration and detection counts. + # + # @param detection_type [String] The detection type that identifies the control, for example `unused_api_keys`. + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceControlResponse, Integer, Hash)>] GovernanceControlResponse data, response status code and response headers + def get_governance_control_with_http_info(detection_type, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_governance_control".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_governance_control") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_governance_control")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceConsoleAPI.get_governance_control ...' + 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 GovernanceConsoleAPI.get_governance_control" + end + # resource path + local_var_path = '/api/v2/governance/control/{detection_type}'.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] || 'GovernanceControlResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_governance_control, + :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: GovernanceConsoleAPI#get_governance_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get 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 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: GovernanceConsoleAPI.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 GovernanceConsoleAPI.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: GovernanceConsoleAPI#get_governance_control_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a detection. + # + # @see #get_governance_detection_with_http_info + def get_governance_detection(detection_id, opts = {}) + data, _status_code, _headers = get_governance_detection_with_http_info(detection_id, opts) + data + end + + # Get a detection. + # + # Retrieve a single governance detection by its unique identifier. + # + # @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_detection_with_http_info(detection_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_governance_detection".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_governance_detection") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_governance_detection")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceConsoleAPI.get_governance_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 GovernanceConsoleAPI.get_governance_detection" + end + # resource path + local_var_path = '/api/v2/governance/detections/{detection_id}'.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_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: GovernanceConsoleAPI#get_governance_detection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get 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 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: GovernanceConsoleAPI.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: GovernanceConsoleAPI#get_governance_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List 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 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 A comma-separated list of attributes to sort detections by. Prefix an attribute with `-` for descending order. The attributes available for sorting are `id`, `created_at`, `assigned_to`, `detection_type`, `display_name`, `exception_at`, `mitigate_after`, `mitigated_at`, `priority`, `resource_id`, and `state`. Defaults to `created_at,-id`. + # @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: GovernanceConsoleAPI.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 GovernanceConsoleAPI.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: GovernanceConsoleAPI#list_governance_control_detections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List controls. + # + # @see #list_governance_controls_with_http_info + def list_governance_controls(opts = {}) + data, _status_code, _headers = list_governance_controls_with_http_info(opts) + data + end + + # List controls. + # + # Retrieve the list of governance controls configured for the organization. Each control pairs a + # detection definition with the organization's current detection, notification, and mitigation + # configuration, along with counts of active and mitigated detections. + # + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceControlsResponse, Integer, Hash)>] GovernanceControlsResponse data, response status code and response headers + def list_governance_controls_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_controls".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_controls") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_controls")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceConsoleAPI.list_governance_controls ...' + end + # resource path + local_var_path = '/api/v2/governance/control' + + # 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] || 'GovernanceControlsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_governance_controls, + :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: GovernanceConsoleAPI#list_governance_controls\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List insights. + # + # @see #list_governance_insights_with_http_info + def list_governance_insights(opts = {}) + data, _status_code, _headers = list_governance_insights_with_http_info(opts) + data + end + + # List insights. + # + # Retrieve the list of governance insights available to the organization. Each insight + # reports the query used to compute it, so that the value can be computed client-side. + # Insights can be filtered by product. + # + # @param opts [Hash] the optional parameters + # @option opts [Array] :filter_product Restrict the results to insights belonging to the given products. May be repeated to filter by multiple products. Matching is case-insensitive. + # @return [Array<(GovernanceInsightsResponse, Integer, Hash)>] GovernanceInsightsResponse data, response status code and response headers + def list_governance_insights_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_insights".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_insights") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_insights")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceConsoleAPI.list_governance_insights ...' + end + # resource path + local_var_path = '/api/v2/governance/insights' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[product]'] = @api_client.build_collection_param(opts[:'filter_product'], :multi) if !opts[:'filter_product'].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] || 'GovernanceInsightsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_governance_insights, + :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" + ) + new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER + + 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: GovernanceConsoleAPI#list_governance_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List usage 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 usage 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: GovernanceConsoleAPI.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: GovernanceConsoleAPI#list_governance_limits\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List 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 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: GovernanceConsoleAPI.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: GovernanceConsoleAPI#list_governance_resource_limits\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Mitigate detections. + # + # @see #mitigate_governance_detections_with_http_info + def mitigate_governance_detections(body, opts = {}) + mitigate_governance_detections_with_http_info(body, opts) + nil + end + + # Mitigate 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 mitigate_governance_detections_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.mitigate_governance_detections".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.mitigate_governance_detections") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.mitigate_governance_detections")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceConsoleAPI.mitigate_governance_detections ...' + 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 GovernanceConsoleAPI.mitigate_governance_detections" + end + # resource path + local_var_path = '/api/v2/governance/detections/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 => :mitigate_governance_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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GovernanceConsoleAPI#mitigate_governance_detections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a control. + # + # @see #update_governance_control_with_http_info + def update_governance_control(detection_type, body, opts = {}) + data, _status_code, _headers = update_governance_control_with_http_info(detection_type, body, opts) + data + end + + # Update a control. + # + # Update the detection, notification, and mitigation configuration of a governance control. Only + # the attributes present in the request are modified. Changing the mitigation type or its + # parameters may require additional permissions. + # + # @param detection_type [String] The detection type that identifies the control, for example `unused_api_keys`. + # @param body [GovernanceControlUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(GovernanceControlResponse, Integer, Hash)>] GovernanceControlResponse data, response status code and response headers + def update_governance_control_with_http_info(detection_type, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_governance_control".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_governance_control") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_governance_control")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceConsoleAPI.update_governance_control ...' + 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 GovernanceConsoleAPI.update_governance_control" + 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 GovernanceConsoleAPI.update_governance_control" + end + # resource path + local_var_path = '/api/v2/governance/control/{detection_type}'.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] || 'GovernanceControlResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_governance_control, + :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: GovernanceConsoleAPI#update_governance_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update 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 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: GovernanceConsoleAPI.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 GovernanceConsoleAPI.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 GovernanceConsoleAPI.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: GovernanceConsoleAPI#update_governance_control_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a detection. + # + # @see #update_governance_detection_with_http_info + def update_governance_detection(detection_id, body, opts = {}) + data, _status_code, _headers = update_governance_detection_with_http_info(detection_id, body, opts) + data + end + + # Update a detection. + # + # Update a governance detection by its unique identifier. Only the attributes present in the + # request are modified, allowing a detection to be acknowledged as an exception, reopened, + # reassigned, or deferred for mitigation. + # + # @param 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_detection_with_http_info(detection_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_governance_detection".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_governance_detection") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_governance_detection")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GovernanceConsoleAPI.update_governance_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 GovernanceConsoleAPI.update_governance_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 GovernanceConsoleAPI.update_governance_detection" + end + # resource path + local_var_path = '/api/v2/governance/detections/{detection_id}'.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_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: GovernanceConsoleAPI#update_governance_detection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update 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 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: GovernanceConsoleAPI.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 GovernanceConsoleAPI.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: GovernanceConsoleAPI#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/api/governance_controls_api.rb b/lib/datadog_api_client/v2/api/governance_controls_api.rb deleted file mode 100644 index a5267c68fbf5..000000000000 --- a/lib/datadog_api_client/v2/api/governance_controls_api.rb +++ /dev/null @@ -1,246 +0,0 @@ -=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 GovernanceControlsAPI - attr_accessor :api_client - - def initialize(api_client = DatadogAPIClient::APIClient.default) - @api_client = api_client - end - - # Get a governance control. - # - # @see #get_governance_control_with_http_info - def get_governance_control(detection_type, opts = {}) - data, _status_code, _headers = get_governance_control_with_http_info(detection_type, opts) - data - end - - # Get a governance control. - # - # Retrieve a single governance control by its detection type, including the organization's current - # detection, notification, and mitigation configuration and detection counts. - # - # @param detection_type [String] The detection type that identifies the control, for example `unused_api_keys`. - # @param opts [Hash] the optional parameters - # @return [Array<(GovernanceControlResponse, Integer, Hash)>] GovernanceControlResponse data, response status code and response headers - def get_governance_control_with_http_info(detection_type, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.get_governance_control".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_governance_control") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_governance_control")) - end - - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.get_governance_control ...' - 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" - end - # resource path - local_var_path = '/api/v2/governance/control/{detection_type}'.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] || 'GovernanceControlResponse' - - # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] - - new_options = opts.merge( - :operation => :get_governance_control, - :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\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 - def list_governance_controls(opts = {}) - data, _status_code, _headers = list_governance_controls_with_http_info(opts) - data - end - - # List governance controls. - # - # Retrieve the list of governance controls configured for the organization. Each control pairs a - # detection definition with the organization's current detection, notification, and mitigation - # configuration, along with counts of active and mitigated detections. - # - # @param opts [Hash] the optional parameters - # @return [Array<(GovernanceControlsResponse, Integer, Hash)>] GovernanceControlsResponse data, response status code and response headers - def list_governance_controls_with_http_info(opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_controls".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_controls") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_controls")) - end - - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.list_governance_controls ...' - end - # resource path - local_var_path = '/api/v2/governance/control' - - # 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] || 'GovernanceControlsResponse' - - # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] - - new_options = opts.merge( - :operation => :list_governance_controls, - :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_controls\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - - # Update a governance control. - # - # @see #update_governance_control_with_http_info - def update_governance_control(detection_type, body, opts = {}) - data, _status_code, _headers = update_governance_control_with_http_info(detection_type, body, opts) - data - end - - # Update a governance control. - # - # Update the detection, notification, and mitigation configuration of a governance control. Only - # the attributes present in the request are modified. Changing the mitigation type or its - # parameters may require additional permissions. - # - # @param detection_type [String] The detection type that identifies the control, for example `unused_api_keys`. - # @param body [GovernanceControlUpdateRequest] - # @param opts [Hash] the optional parameters - # @return [Array<(GovernanceControlResponse, Integer, Hash)>] GovernanceControlResponse data, response status code and response headers - def update_governance_control_with_http_info(detection_type, body, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.update_governance_control".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_governance_control") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_governance_control")) - end - - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: GovernanceControlsAPI.update_governance_control ...' - 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" - 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" - end - # resource path - local_var_path = '/api/v2/governance/control/{detection_type}'.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] || 'GovernanceControlResponse' - - # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] - - new_options = opts.merge( - :operation => :update_governance_control, - :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\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 deleted file mode 100644 index 3c95d8cc2004..000000000000 --- a/lib/datadog_api_client/v2/api/governance_insights_api.rb +++ /dev/null @@ -1,101 +0,0 @@ -=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 GovernanceInsightsAPI - attr_accessor :api_client - - def initialize(api_client = DatadogAPIClient::APIClient.default) - @api_client = api_client - end - - # List governance insights. - # - # @see #list_governance_insights_with_http_info - def list_governance_insights(opts = {}) - data, _status_code, _headers = list_governance_insights_with_http_info(opts) - data - end - - # List governance insights. - # - # Retrieve the list of governance insights available to the organization. By default, only - # insight metadata is returned; pass `withValues=true` to also compute and include each - # insight's current and previous values. Insights can be filtered by product. - # - # @param opts [Hash] the optional parameters - # @option opts [Boolean] :with_values Whether to compute and include the current and previous value of each insight. Defaults to `false`, in which case only insight metadata is returned. - # @option opts [String] :org_uuid The UUID of the organization to compute insights for. Defaults to the organization of the authenticated user. Used to retrieve insights for a child organization from a parent organization. - # @option opts [Array] :filter_product Restrict the results to insights belonging to the given products. May be repeated to filter by multiple products. Matching is case-insensitive. - # @return [Array<(GovernanceInsightsResponse, Integer, Hash)>] GovernanceInsightsResponse data, response status code and response headers - def list_governance_insights_with_http_info(opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_insights".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_insights") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_insights")) - end - - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: GovernanceInsightsAPI.list_governance_insights ...' - end - # resource path - local_var_path = '/api/v2/governance/insights' - - # query parameters - query_params = opts[:query_params] || {} - query_params[:'withValues'] = opts[:'with_values'] if !opts[:'with_values'].nil? - query_params[:'orgUuid'] = opts[:'org_uuid'] if !opts[:'org_uuid'].nil? - query_params[:'filter[product]'] = @api_client.build_collection_param(opts[:'filter_product'], :multi) if !opts[:'filter_product'].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] || 'GovernanceInsightsResponse' - - # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] - - new_options = opts.merge( - :operation => :list_governance_insights, - :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" - ) - new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER - - 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: GovernanceInsightsAPI#list_governance_insights\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_best_practice_definition.rb b/lib/datadog_api_client/v2/models/governance_best_practice_definition.rb deleted file mode 100644 index f6d4c411b31e..000000000000 --- a/lib/datadog_api_client/v2/models/governance_best_practice_definition.rb +++ /dev/null @@ -1,379 +0,0 @@ -=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 best practice associated with an insight. Populated with the first active best practice - # matched to the insight; `null` when no best practice is attached. - class GovernanceBestPracticeDefinition - include BaseGenericModel - - # The value driver the best practice is grouped under, such as `access_governance`, - # `security`, `compliance`, or `operational_hygiene`. - attr_reader :category - - # A relative link to the configuration page where the best practice can be acted upon. - attr_reader :deep_link - - # The full rationale and guidance for the best practice. - attr_reader :description - - # An optional association to a control's detection type. `null` when not associated with a control. - attr_accessor :detection_type - - # The unique identifier of the best practice. - attr_reader :id - - # The expected impact of following the best practice. - attr_reader :impact - - # A priority hint for ordering best practices by expected impact. Lower values indicate - # higher priority. - attr_reader :impact_hint - - # The permissions required for the user to act on the best practice. - attr_reader :permissions - - # Whether the best practice is currently `active` or `deprecated`. - attr_reader :status - - # A one-line explanation of why this best practice matters. - attr_reader :summary - - # A short, human-readable name for the best practice. - attr_reader :title - - # The condition that surfaces the best practice. For an `insight` trigger, the insight - # slug; for a `static` trigger, a descriptive condition key. - attr_reader :trigger_condition - - # How the best practice is surfaced. `insight` ties it to an insight; `static` surfaces it - # unless its condition is met. - attr_reader :trigger_type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'category' => :'category', - :'deep_link' => :'deep_link', - :'description' => :'description', - :'detection_type' => :'detection_type', - :'id' => :'id', - :'impact' => :'impact', - :'impact_hint' => :'impact_hint', - :'permissions' => :'permissions', - :'status' => :'status', - :'summary' => :'summary', - :'title' => :'title', - :'trigger_condition' => :'trigger_condition', - :'trigger_type' => :'trigger_type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'category' => :'String', - :'deep_link' => :'String', - :'description' => :'String', - :'detection_type' => :'String', - :'id' => :'String', - :'impact' => :'String', - :'impact_hint' => :'Integer', - :'permissions' => :'Array', - :'status' => :'String', - :'summary' => :'String', - :'title' => :'String', - :'trigger_condition' => :'String', - :'trigger_type' => :'String' - } - end - - # List of attributes with nullable: true - # @!visibility private - def self.openapi_nullable - Set.new([ - :'detection_type', - ]) - 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::GovernanceBestPracticeDefinition` 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?(:'category') - self.category = attributes[:'category'] - end - - if attributes.key?(:'deep_link') - self.deep_link = attributes[:'deep_link'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'detection_type') - self.detection_type = attributes[:'detection_type'] - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'impact') - self.impact = attributes[:'impact'] - end - - if attributes.key?(:'impact_hint') - self.impact_hint = attributes[:'impact_hint'] - end - - if attributes.key?(:'permissions') - if (value = attributes[:'permissions']).is_a?(Array) - self.permissions = value - end - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'summary') - self.summary = attributes[:'summary'] - end - - if attributes.key?(:'title') - self.title = attributes[:'title'] - end - - if attributes.key?(:'trigger_condition') - self.trigger_condition = attributes[:'trigger_condition'] - end - - if attributes.key?(:'trigger_type') - self.trigger_type = attributes[:'trigger_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 @category.nil? - return false if @deep_link.nil? - return false if @description.nil? - return false if @id.nil? - return false if @impact.nil? - return false if @impact_hint.nil? - return false if @permissions.nil? - return false if @status.nil? - return false if @summary.nil? - return false if @title.nil? - return false if @trigger_condition.nil? - return false if @trigger_type.nil? - true - end - - # Custom attribute writer method with validation - # @param category [Object] Object to be assigned - # @!visibility private - def category=(category) - if category.nil? - fail ArgumentError, 'invalid value for "category", category cannot be nil.' - end - @category = category - 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 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 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 impact [Object] Object to be assigned - # @!visibility private - def impact=(impact) - if impact.nil? - fail ArgumentError, 'invalid value for "impact", impact cannot be nil.' - end - @impact = impact - end - - # Custom attribute writer method with validation - # @param impact_hint [Object] Object to be assigned - # @!visibility private - def impact_hint=(impact_hint) - if impact_hint.nil? - fail ArgumentError, 'invalid value for "impact_hint", impact_hint cannot be nil.' - end - @impact_hint = impact_hint - end - - # Custom attribute writer method with validation - # @param permissions [Object] Object to be assigned - # @!visibility private - def permissions=(permissions) - if permissions.nil? - fail ArgumentError, 'invalid value for "permissions", permissions cannot be nil.' - end - @permissions = permissions - end - - # Custom attribute writer method with validation - # @param status [Object] Object to be assigned - # @!visibility private - def status=(status) - if status.nil? - fail ArgumentError, 'invalid value for "status", status cannot be nil.' - end - @status = status - end - - # Custom attribute writer method with validation - # @param summary [Object] Object to be assigned - # @!visibility private - def summary=(summary) - if summary.nil? - fail ArgumentError, 'invalid value for "summary", summary cannot be nil.' - end - @summary = summary - end - - # Custom attribute writer method with validation - # @param title [Object] Object to be assigned - # @!visibility private - def title=(title) - if title.nil? - fail ArgumentError, 'invalid value for "title", title cannot be nil.' - end - @title = title - end - - # Custom attribute writer method with validation - # @param trigger_condition [Object] Object to be assigned - # @!visibility private - def trigger_condition=(trigger_condition) - if trigger_condition.nil? - fail ArgumentError, 'invalid value for "trigger_condition", trigger_condition cannot be nil.' - end - @trigger_condition = trigger_condition - end - - # Custom attribute writer method with validation - # @param trigger_type [Object] Object to be assigned - # @!visibility private - def trigger_type=(trigger_type) - if trigger_type.nil? - fail ArgumentError, 'invalid value for "trigger_type", trigger_type cannot be nil.' - end - @trigger_type = trigger_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 && - category == o.category && - deep_link == o.deep_link && - description == o.description && - detection_type == o.detection_type && - id == o.id && - impact == o.impact && - impact_hint == o.impact_hint && - permissions == o.permissions && - status == o.status && - summary == o.summary && - title == o.title && - trigger_condition == o.trigger_condition && - trigger_type == o.trigger_type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [category, deep_link, description, detection_type, id, impact, impact_hint, permissions, status, summary, title, trigger_condition, trigger_type, additional_properties].hash - end - 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..b95181998a8b --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_config_attributes.rb @@ -0,0 +1,187 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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 + + # Whether the organization has opted in to sharing governance data with a managing org + # for cross-org insights. + attr_reader :xorg_insights_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', + :'enabled' => :'enabled', + :'usage_attribution_configured' => :'usage_attribution_configured', + :'xorg_insights_enabled' => :'xorg_insights_enabled' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignment_notifications_enabled' => :'Boolean', + :'enabled' => :'Boolean', + :'usage_attribution_configured' => :'Boolean', + :'xorg_insights_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::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 + + if attributes.key?(:'xorg_insights_enabled') + self.xorg_insights_enabled = attributes[:'xorg_insights_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? + return false if @enabled.nil? + return false if @usage_attribution_configured.nil? + return false if @xorg_insights_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 + + # 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 + + # Custom attribute writer method with validation + # @param xorg_insights_enabled [Object] Object to be assigned + # @!visibility private + def xorg_insights_enabled=(xorg_insights_enabled) + if xorg_insights_enabled.nil? + fail ArgumentError, 'invalid value for "xorg_insights_enabled", xorg_insights_enabled cannot be nil.' + end + @xorg_insights_enabled = xorg_insights_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 && + enabled == o.enabled && + usage_attribution_configured == o.usage_attribution_configured && + xorg_insights_enabled == o.xorg_insights_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, enabled, usage_attribution_configured, xorg_insights_enabled, 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..9e7b46872695 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_config_data.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A 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. May be the nil UUID (`00000000-0000-0000-0000-000000000000`) when the configuration + # is not tied to a specific organization record. + 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_attributes.rb b/lib/datadog_api_client/v2/models/governance_control_attributes.rb index 5c3501041bc4..3def91138a69 100644 --- a/lib/datadog_api_client/v2/models/governance_control_attributes.rb +++ b/lib/datadog_api_client/v2/models/governance_control_attributes.rb @@ -42,12 +42,6 @@ class GovernanceControlAttributes # A free-form map of parameter names to their configured values. attr_reader :detection_parameters - # The detection type that uniquely identifies the control. - attr_reader :detection_type - - # The feature flags that gate the control. - attr_reader :feature_flags - # The insight slugs associated with the control. attr_reader :insights @@ -69,27 +63,12 @@ class GovernanceControlAttributes # Human-readable name of the control. attr_reader :name - # Guidance on the next steps to remediate detections for the control. - attr_reader :next_steps - - # The configured notification frequency for the control. Empty when not configured. - attr_reader :notification_frequency - - # A free-form map of parameter names to their configured values. - attr_reader :notification_parameters - - # The configured notification type for the control. Empty when not configured. - attr_reader :notification_type - # The priority of the control, such as `High`. attr_reader :priority # The product the control belongs to. attr_reader :product - # The release status of the control, such as `prod` or `beta`. - attr_reader :release_status - # The type of resource the control evaluates. attr_reader :resource_type @@ -99,18 +78,9 @@ class GovernanceControlAttributes # An array of parameter definitions. attr_reader :supported_detection_parameters - # An array of parameter definitions. - attr_reader :supported_notification_parameters - - # A short description of the remediation task for the control. - attr_reader :task - # The control type, such as `Proactive` or `Detection`. attr_reader :type - # The usage concern the control addresses, such as `Security` or `Cost Optimization`. - attr_reader :usage_concern - attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. @@ -124,8 +94,6 @@ def self.attribute_map :'description' => :'description', :'detection_frequency' => :'detection_frequency', :'detection_parameters' => :'detection_parameters', - :'detection_type' => :'detection_type', - :'feature_flags' => :'feature_flags', :'insights' => :'insights', :'last_detection_at' => :'last_detection_at', :'mitigated_detections_count' => :'mitigated_detections_count', @@ -133,20 +101,12 @@ def self.attribute_map :'mitigation_type' => :'mitigation_type', :'mitigations' => :'mitigations', :'name' => :'name', - :'next_steps' => :'next_steps', - :'notification_frequency' => :'notification_frequency', - :'notification_parameters' => :'notification_parameters', - :'notification_type' => :'notification_type', :'priority' => :'priority', :'product' => :'product', - :'release_status' => :'release_status', :'resource_type' => :'resource_type', :'resource_type_display_name' => :'resource_type_display_name', :'supported_detection_parameters' => :'supported_detection_parameters', - :'supported_notification_parameters' => :'supported_notification_parameters', - :'task' => :'task', - :'type' => :'type', - :'usage_concern' => :'usage_concern' + :'type' => :'type' } end @@ -161,8 +121,6 @@ def self.openapi_types :'description' => :'String', :'detection_frequency' => :'String', :'detection_parameters' => :'Hash', - :'detection_type' => :'String', - :'feature_flags' => :'Array', :'insights' => :'Array', :'last_detection_at' => :'Time', :'mitigated_detections_count' => :'Integer', @@ -170,20 +128,12 @@ def self.openapi_types :'mitigation_type' => :'String', :'mitigations' => :'Array', :'name' => :'String', - :'next_steps' => :'String', - :'notification_frequency' => :'String', - :'notification_parameters' => :'Hash', - :'notification_type' => :'String', :'priority' => :'String', :'product' => :'String', - :'release_status' => :'String', :'resource_type' => :'String', :'resource_type_display_name' => :'String', :'supported_detection_parameters' => :'Array', - :'supported_notification_parameters' => :'Array', - :'task' => :'String', - :'type' => :'String', - :'usage_concern' => :'String' + :'type' => :'String' } end @@ -241,16 +191,6 @@ def initialize(attributes = {}) self.detection_parameters = attributes[:'detection_parameters'] end - if attributes.key?(:'detection_type') - self.detection_type = attributes[:'detection_type'] - end - - if attributes.key?(:'feature_flags') - if (value = attributes[:'feature_flags']).is_a?(Array) - self.feature_flags = value - end - end - if attributes.key?(:'insights') if (value = attributes[:'insights']).is_a?(Array) self.insights = value @@ -283,22 +223,6 @@ def initialize(attributes = {}) self.name = attributes[:'name'] end - if attributes.key?(:'next_steps') - self.next_steps = attributes[:'next_steps'] - end - - if attributes.key?(:'notification_frequency') - self.notification_frequency = attributes[:'notification_frequency'] - end - - if attributes.key?(:'notification_parameters') - self.notification_parameters = attributes[:'notification_parameters'] - end - - if attributes.key?(:'notification_type') - self.notification_type = attributes[:'notification_type'] - end - if attributes.key?(:'priority') self.priority = attributes[:'priority'] end @@ -307,10 +231,6 @@ def initialize(attributes = {}) self.product = attributes[:'product'] end - if attributes.key?(:'release_status') - self.release_status = attributes[:'release_status'] - end - if attributes.key?(:'resource_type') self.resource_type = attributes[:'resource_type'] end @@ -325,23 +245,9 @@ def initialize(attributes = {}) end end - if attributes.key?(:'supported_notification_parameters') - if (value = attributes[:'supported_notification_parameters']).is_a?(Array) - self.supported_notification_parameters = value - end - end - - if attributes.key?(:'task') - self.task = attributes[:'task'] - end - if attributes.key?(:'type') self.type = attributes[:'type'] end - - if attributes.key?(:'usage_concern') - self.usage_concern = attributes[:'usage_concern'] - end end # Check to see if the all the properties in the model are valid @@ -355,28 +261,18 @@ def valid? return false if @description.nil? return false if @detection_frequency.nil? return false if @detection_parameters.nil? - return false if @detection_type.nil? - return false if @feature_flags.nil? return false if @insights.nil? return false if @mitigated_detections_count.nil? return false if @mitigation_parameters.nil? return false if @mitigation_type.nil? return false if @mitigations.nil? return false if @name.nil? - return false if @next_steps.nil? - return false if @notification_frequency.nil? - return false if @notification_parameters.nil? - return false if @notification_type.nil? return false if @priority.nil? return false if @product.nil? - return false if @release_status.nil? return false if @resource_type.nil? return false if @resource_type_display_name.nil? return false if @supported_detection_parameters.nil? - return false if @supported_notification_parameters.nil? - return false if @task.nil? return false if @type.nil? - return false if @usage_concern.nil? true end @@ -450,26 +346,6 @@ def detection_parameters=(detection_parameters) @detection_parameters = detection_parameters 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 feature_flags [Object] Object to be assigned - # @!visibility private - def feature_flags=(feature_flags) - if feature_flags.nil? - fail ArgumentError, 'invalid value for "feature_flags", feature_flags cannot be nil.' - end - @feature_flags = feature_flags - end - # Custom attribute writer method with validation # @param insights [Object] Object to be assigned # @!visibility private @@ -530,46 +406,6 @@ def name=(name) @name = name end - # Custom attribute writer method with validation - # @param next_steps [Object] Object to be assigned - # @!visibility private - def next_steps=(next_steps) - if next_steps.nil? - fail ArgumentError, 'invalid value for "next_steps", next_steps cannot be nil.' - end - @next_steps = next_steps - end - - # Custom attribute writer method with validation - # @param notification_frequency [Object] Object to be assigned - # @!visibility private - def notification_frequency=(notification_frequency) - if notification_frequency.nil? - fail ArgumentError, 'invalid value for "notification_frequency", notification_frequency cannot be nil.' - end - @notification_frequency = notification_frequency - end - - # Custom attribute writer method with validation - # @param notification_parameters [Object] Object to be assigned - # @!visibility private - def notification_parameters=(notification_parameters) - if notification_parameters.nil? - fail ArgumentError, 'invalid value for "notification_parameters", notification_parameters cannot be nil.' - end - @notification_parameters = notification_parameters - end - - # Custom attribute writer method with validation - # @param notification_type [Object] Object to be assigned - # @!visibility private - def notification_type=(notification_type) - if notification_type.nil? - fail ArgumentError, 'invalid value for "notification_type", notification_type cannot be nil.' - end - @notification_type = notification_type - end - # Custom attribute writer method with validation # @param priority [Object] Object to be assigned # @!visibility private @@ -590,16 +426,6 @@ def product=(product) @product = product end - # Custom attribute writer method with validation - # @param release_status [Object] Object to be assigned - # @!visibility private - def release_status=(release_status) - if release_status.nil? - fail ArgumentError, 'invalid value for "release_status", release_status cannot be nil.' - end - @release_status = release_status - end - # Custom attribute writer method with validation # @param resource_type [Object] Object to be assigned # @!visibility private @@ -630,26 +456,6 @@ def supported_detection_parameters=(supported_detection_parameters) @supported_detection_parameters = supported_detection_parameters end - # Custom attribute writer method with validation - # @param supported_notification_parameters [Object] Object to be assigned - # @!visibility private - def supported_notification_parameters=(supported_notification_parameters) - if supported_notification_parameters.nil? - fail ArgumentError, 'invalid value for "supported_notification_parameters", supported_notification_parameters cannot be nil.' - end - @supported_notification_parameters = supported_notification_parameters - end - - # Custom attribute writer method with validation - # @param task [Object] Object to be assigned - # @!visibility private - def task=(task) - if task.nil? - fail ArgumentError, 'invalid value for "task", task cannot be nil.' - end - @task = task - end - # Custom attribute writer method with validation # @param type [Object] Object to be assigned # @!visibility private @@ -660,16 +466,6 @@ def type=(type) @type = type end - # Custom attribute writer method with validation - # @param usage_concern [Object] Object to be assigned - # @!visibility private - def usage_concern=(usage_concern) - if usage_concern.nil? - fail ArgumentError, 'invalid value for "usage_concern", usage_concern cannot be nil.' - end - @usage_concern = usage_concern - end - # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private @@ -703,8 +499,6 @@ def ==(o) description == o.description && detection_frequency == o.detection_frequency && detection_parameters == o.detection_parameters && - detection_type == o.detection_type && - feature_flags == o.feature_flags && insights == o.insights && last_detection_at == o.last_detection_at && mitigated_detections_count == o.mitigated_detections_count && @@ -712,20 +506,12 @@ def ==(o) mitigation_type == o.mitigation_type && mitigations == o.mitigations && name == o.name && - next_steps == o.next_steps && - notification_frequency == o.notification_frequency && - notification_parameters == o.notification_parameters && - notification_type == o.notification_type && priority == o.priority && product == o.product && - release_status == o.release_status && resource_type == o.resource_type && resource_type_display_name == o.resource_type_display_name && supported_detection_parameters == o.supported_detection_parameters && - supported_notification_parameters == o.supported_notification_parameters && - task == o.task && type == o.type && - usage_concern == o.usage_concern && additional_properties == o.additional_properties end @@ -733,7 +519,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [active_detections_count, category, created_at, created_by, description, detection_frequency, detection_parameters, detection_type, feature_flags, insights, last_detection_at, mitigated_detections_count, mitigation_parameters, mitigation_type, mitigations, name, next_steps, notification_frequency, notification_parameters, notification_type, priority, product, release_status, resource_type, resource_type_display_name, supported_detection_parameters, supported_notification_parameters, task, type, usage_concern, additional_properties].hash + [active_detections_count, category, created_at, created_by, description, detection_frequency, detection_parameters, insights, last_detection_at, mitigated_detections_count, mitigation_parameters, mitigation_type, mitigations, name, priority, product, resource_type, resource_type_display_name, supported_detection_parameters, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/governance_control_data.rb b/lib/datadog_api_client/v2/models/governance_control_data.rb index a6a482264b5c..328116c100f8 100644 --- a/lib/datadog_api_client/v2/models/governance_control_data.rb +++ b/lib/datadog_api_client/v2/models/governance_control_data.rb @@ -24,7 +24,7 @@ class GovernanceControlData # The attributes of a governance control. attr_reader :attributes - # The unique identifier of the control. + # The detection type that uniquely identifies the control. attr_reader :id # JSON:API resource type for a governance control. 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..3ca303cf0f8f --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_detection_attributes.rb @@ -0,0 +1,362 @@ +=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 + + # DEPRECATED: mirrors `detection_type` for backward compatibility; use `detection_type` + # instead. + 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 + + # The type of resource the detection applies to, for example `api_key` or `dashboard`. + attr_reader :resource_type + + # 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_type' => :'resource_type', + :'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_type' => :'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_type') + self.resource_type = attributes[:'resource_type'] + 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_type.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_type [Object] Object to be assigned + # @!visibility private + def resource_type=(resource_type) + if resource_type.nil? + fail ArgumentError, 'invalid value for "resource_type", resource_type cannot be nil.' + end + @resource_type = resource_type + 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_type == o.resource_type && + 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_type, 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_control_mitigation_definition.rb b/lib/datadog_api_client/v2/models/governance_control_mitigation_definition.rb index 2c7693fd18c5..b32d2c6cf71e 100644 --- a/lib/datadog_api_client/v2/models/governance_control_mitigation_definition.rb +++ b/lib/datadog_api_client/v2/models/governance_control_mitigation_definition.rb @@ -21,30 +21,18 @@ module DatadogAPIClient::V2 class GovernanceControlMitigationDefinition include BaseGenericModel - # The verb describing the mitigation action, such as `revoke` or `delete`. - attr_reader :action_verb - # A human-readable description of the mitigation. attr_reader :description # The execution modes the mitigation supports, such as `manual` or `automatic`. - attr_accessor :execution_modes - - # The feature flags that gate the mitigation. - attr_reader :feature_flags + attr_reader :execution_modes # The unique identifier of the mitigation. attr_reader :id - # A warning shown to the user before applying the mitigation manually. - attr_reader :manual_mitigation_warning - # The permissions required to apply the mitigation. attr_reader :permissions - # Whether the mitigation requires AI to be enabled. - attr_reader :requires_ai - # An array of parameter definitions. attr_reader :supported_parameters @@ -57,14 +45,10 @@ class GovernanceControlMitigationDefinition # @!visibility private def self.attribute_map { - :'action_verb' => :'action_verb', :'description' => :'description', :'execution_modes' => :'execution_modes', - :'feature_flags' => :'feature_flags', :'id' => :'id', - :'manual_mitigation_warning' => :'manual_mitigation_warning', :'permissions' => :'permissions', - :'requires_ai' => :'requires_ai', :'supported_parameters' => :'supported_parameters', :'title' => :'title' } @@ -74,14 +58,10 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'action_verb' => :'String', :'description' => :'String', :'execution_modes' => :'Array', - :'feature_flags' => :'Array', :'id' => :'String', - :'manual_mitigation_warning' => :'String', :'permissions' => :'Array', - :'requires_ai' => :'Boolean', :'supported_parameters' => :'Array', :'title' => :'String' } @@ -105,10 +85,6 @@ def initialize(attributes = {}) end } - if attributes.key?(:'action_verb') - self.action_verb = attributes[:'action_verb'] - end - if attributes.key?(:'description') self.description = attributes[:'description'] end @@ -119,30 +95,16 @@ def initialize(attributes = {}) end end - if attributes.key?(:'feature_flags') - if (value = attributes[:'feature_flags']).is_a?(Array) - self.feature_flags = value - end - end - if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.key?(:'manual_mitigation_warning') - self.manual_mitigation_warning = attributes[:'manual_mitigation_warning'] - end - if attributes.key?(:'permissions') if (value = attributes[:'permissions']).is_a?(Array) self.permissions = value end end - if attributes.key?(:'requires_ai') - self.requires_ai = attributes[:'requires_ai'] - end - if attributes.key?(:'supported_parameters') if (value = attributes[:'supported_parameters']).is_a?(Array) self.supported_parameters = value @@ -158,28 +120,15 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? - return false if @action_verb.nil? return false if @description.nil? - return false if @feature_flags.nil? + return false if @execution_modes.nil? return false if @id.nil? - return false if @manual_mitigation_warning.nil? return false if @permissions.nil? - return false if @requires_ai.nil? return false if @supported_parameters.nil? return false if @title.nil? true end - # Custom attribute writer method with validation - # @param action_verb [Object] Object to be assigned - # @!visibility private - def action_verb=(action_verb) - if action_verb.nil? - fail ArgumentError, 'invalid value for "action_verb", action_verb cannot be nil.' - end - @action_verb = action_verb - end - # Custom attribute writer method with validation # @param description [Object] Object to be assigned # @!visibility private @@ -191,13 +140,13 @@ def description=(description) end # Custom attribute writer method with validation - # @param feature_flags [Object] Object to be assigned + # @param execution_modes [Object] Object to be assigned # @!visibility private - def feature_flags=(feature_flags) - if feature_flags.nil? - fail ArgumentError, 'invalid value for "feature_flags", feature_flags cannot be nil.' + def execution_modes=(execution_modes) + if execution_modes.nil? + fail ArgumentError, 'invalid value for "execution_modes", execution_modes cannot be nil.' end - @feature_flags = feature_flags + @execution_modes = execution_modes end # Custom attribute writer method with validation @@ -210,16 +159,6 @@ def id=(id) @id = id end - # Custom attribute writer method with validation - # @param manual_mitigation_warning [Object] Object to be assigned - # @!visibility private - def manual_mitigation_warning=(manual_mitigation_warning) - if manual_mitigation_warning.nil? - fail ArgumentError, 'invalid value for "manual_mitigation_warning", manual_mitigation_warning cannot be nil.' - end - @manual_mitigation_warning = manual_mitigation_warning - end - # Custom attribute writer method with validation # @param permissions [Object] Object to be assigned # @!visibility private @@ -230,16 +169,6 @@ def permissions=(permissions) @permissions = permissions end - # Custom attribute writer method with validation - # @param requires_ai [Object] Object to be assigned - # @!visibility private - def requires_ai=(requires_ai) - if requires_ai.nil? - fail ArgumentError, 'invalid value for "requires_ai", requires_ai cannot be nil.' - end - @requires_ai = requires_ai - end - # Custom attribute writer method with validation # @param supported_parameters [Object] Object to be assigned # @!visibility private @@ -286,14 +215,10 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - action_verb == o.action_verb && description == o.description && execution_modes == o.execution_modes && - feature_flags == o.feature_flags && id == o.id && - manual_mitigation_warning == o.manual_mitigation_warning && permissions == o.permissions && - requires_ai == o.requires_ai && supported_parameters == o.supported_parameters && title == o.title && additional_properties == o.additional_properties @@ -303,7 +228,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [action_verb, description, execution_modes, feature_flags, id, manual_mitigation_warning, permissions, requires_ai, supported_parameters, title, additional_properties].hash + [description, execution_modes, id, permissions, supported_parameters, title, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/governance_control_parameter_definition.rb b/lib/datadog_api_client/v2/models/governance_control_parameter_definition.rb index 4f052e0ae374..8b1d22c2f931 100644 --- a/lib/datadog_api_client/v2/models/governance_control_parameter_definition.rb +++ b/lib/datadog_api_client/v2/models/governance_control_parameter_definition.rb @@ -30,9 +30,6 @@ class GovernanceControlParameterDefinition # The human-readable name of the parameter. attr_reader :display_name - # Whether the parameter is hidden from the UI. - attr_reader :hidden - # The machine-readable name of the parameter. attr_reader :name @@ -54,7 +51,6 @@ def self.attribute_map :'default_value' => :'default_value', :'description' => :'description', :'display_name' => :'display_name', - :'hidden' => :'hidden', :'name' => :'name', :'required' => :'required', :'supported_values' => :'supported_values', @@ -69,7 +65,6 @@ def self.openapi_types :'default_value' => :'Object', :'description' => :'String', :'display_name' => :'String', - :'hidden' => :'Boolean', :'name' => :'String', :'required' => :'Boolean', :'supported_values' => :'Array', @@ -107,10 +102,6 @@ def initialize(attributes = {}) self.display_name = attributes[:'display_name'] end - if attributes.key?(:'hidden') - self.hidden = attributes[:'hidden'] - end - if attributes.key?(:'name') self.name = attributes[:'name'] end @@ -137,7 +128,6 @@ def valid? return false if @default_value.nil? return false if @description.nil? return false if @display_name.nil? - return false if @hidden.nil? return false if @name.nil? return false if @required.nil? return false if @supported_values.nil? @@ -175,16 +165,6 @@ def display_name=(display_name) @display_name = display_name end - # Custom attribute writer method with validation - # @param hidden [Object] Object to be assigned - # @!visibility private - def hidden=(hidden) - if hidden.nil? - fail ArgumentError, 'invalid value for "hidden", hidden cannot be nil.' - end - @hidden = hidden - end - # Custom attribute writer method with validation # @param name [Object] Object to be assigned # @!visibility private @@ -254,7 +234,6 @@ def ==(o) default_value == o.default_value && description == o.description && display_name == o.display_name && - hidden == o.hidden && name == o.name && required == o.required && supported_values == o.supported_values && @@ -266,7 +245,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [default_value, description, display_name, hidden, name, required, supported_values, type, additional_properties].hash + [default_value, description, display_name, name, required, supported_values, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/governance_control_update_attributes.rb b/lib/datadog_api_client/v2/models/governance_control_update_attributes.rb index 2e0dfaa8f624..b3644cd23629 100644 --- a/lib/datadog_api_client/v2/models/governance_control_update_attributes.rb +++ b/lib/datadog_api_client/v2/models/governance_control_update_attributes.rb @@ -33,18 +33,6 @@ class GovernanceControlUpdateAttributes # The mitigation type to configure for the control. attr_accessor :mitigation_type - # A new human-readable name for the control. - attr_accessor :name - - # The notification frequency to configure for the control. - attr_accessor :notification_frequency - - # A free-form map of parameter names to their configured values. - attr_accessor :notification_parameters - - # The notification type to configure for the control. - attr_accessor :notification_type - attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. @@ -54,11 +42,7 @@ def self.attribute_map :'detection_frequency' => :'detection_frequency', :'detection_parameters' => :'detection_parameters', :'mitigation_parameters' => :'mitigation_parameters', - :'mitigation_type' => :'mitigation_type', - :'name' => :'name', - :'notification_frequency' => :'notification_frequency', - :'notification_parameters' => :'notification_parameters', - :'notification_type' => :'notification_type' + :'mitigation_type' => :'mitigation_type' } end @@ -69,11 +53,7 @@ def self.openapi_types :'detection_frequency' => :'String', :'detection_parameters' => :'Hash', :'mitigation_parameters' => :'Hash', - :'mitigation_type' => :'String', - :'name' => :'String', - :'notification_frequency' => :'String', - :'notification_parameters' => :'Hash', - :'notification_type' => :'String' + :'mitigation_type' => :'String' } end @@ -110,22 +90,6 @@ def initialize(attributes = {}) if attributes.key?(:'mitigation_type') self.mitigation_type = attributes[:'mitigation_type'] end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'notification_frequency') - self.notification_frequency = attributes[:'notification_frequency'] - end - - if attributes.key?(:'notification_parameters') - self.notification_parameters = attributes[:'notification_parameters'] - end - - if attributes.key?(:'notification_type') - self.notification_type = attributes[:'notification_type'] - end end # Returns the object in the form of hash, with additionalProperties support. @@ -158,10 +122,6 @@ def ==(o) detection_parameters == o.detection_parameters && mitigation_parameters == o.mitigation_parameters && mitigation_type == o.mitigation_type && - name == o.name && - notification_frequency == o.notification_frequency && - notification_parameters == o.notification_parameters && - notification_type == o.notification_type && additional_properties == o.additional_properties end @@ -169,7 +129,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [detection_frequency, detection_parameters, mitigation_parameters, mitigation_type, name, notification_frequency, notification_parameters, notification_type, additional_properties].hash + [detection_frequency, detection_parameters, mitigation_parameters, mitigation_type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/governance_control_update_data.rb b/lib/datadog_api_client/v2/models/governance_control_update_data.rb index d951f4fc4d9d..504aa0bfb3e0 100644 --- a/lib/datadog_api_client/v2/models/governance_control_update_data.rb +++ b/lib/datadog_api_client/v2/models/governance_control_update_data.rb @@ -24,9 +24,6 @@ class GovernanceControlUpdateData # The attributes of a governance control that can be updated. Only the attributes present in the request are modified. attr_accessor :attributes - # The unique identifier of the control. - attr_accessor :id - # JSON:API resource type for a governance control. attr_reader :type @@ -37,7 +34,6 @@ class GovernanceControlUpdateData def self.attribute_map { :'attributes' => :'attributes', - :'id' => :'id', :'type' => :'type' } end @@ -47,7 +43,6 @@ def self.attribute_map def self.openapi_types { :'attributes' => :'GovernanceControlUpdateAttributes', - :'id' => :'String', :'type' => :'GovernanceControlResourceType' } end @@ -74,10 +69,6 @@ def initialize(attributes = {}) self.attributes = attributes[:'attributes'] end - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -128,7 +119,6 @@ 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 @@ -137,7 +127,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [attributes, id, type, additional_properties].hash + [attributes, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/governance_insight_attributes.rb b/lib/datadog_api_client/v2/models/governance_insight_attributes.rb index e178bf83e78e..9d4a2fc10dc3 100644 --- a/lib/datadog_api_client/v2/models/governance_insight_attributes.rb +++ b/lib/datadog_api_client/v2/models/governance_insight_attributes.rb @@ -17,19 +17,14 @@ require 'time' module DatadogAPIClient::V2 - # The attributes of a governance insight. + # The attributes of a governance insight. Exactly one of `metric_query`, `event_query`, + # `usage_query`, `audit_query`, or `percentage_query` is populated, depending on the data + # source the insight is computed from; the rest are `null`. class GovernanceInsightAttributes include BaseGenericModel # An audit log query used to compute an insight value. - attr_reader :audit_query - - # The best practice associated with an insight. Populated with the first active best practice - # matched to the insight; `null` when no best practice is attached. - attr_reader :best_practice - - # A relative link to the product surface where the insight can be acted upon. - attr_reader :deep_link + attr_accessor :audit_query # A human-readable description of what the insight measures. attr_reader :description @@ -38,31 +33,20 @@ class GovernanceInsightAttributes attr_reader :display_name # An event query used to compute an insight value. - attr_reader :event_query + attr_accessor :event_query # A metric query used to compute an insight value. - attr_reader :metric_query - - # The value of the insight over the previous comparison window. `null` when values were - # not requested or could not be computed. - attr_accessor :old_value + attr_accessor :metric_query # A percentage query that computes an insight value as a ratio of two metric queries. - attr_reader :percentage_query + attr_accessor :percentage_query # The product the insight belongs to. attr_reader :product - # Query execution context that allows the frontend to execute insight queries directly. + # Query execution context for running insight queries directly. attr_accessor :query_config - # The relative order in which the insight should be displayed. - attr_accessor :sort_order - - # The state of the insight. A `critical` insight receives extra UI treatment to draw - # attention to it. - attr_reader :state - # The sub-product the insight belongs to, if any. attr_reader :sub_product @@ -73,10 +57,7 @@ class GovernanceInsightAttributes attr_reader :unit_name # A usage query used to compute an insight value. - attr_reader :usage_query - - # The current value of the insight. `null` when values were not requested or could not be computed. - attr_accessor :value + attr_accessor :usage_query attr_accessor :additional_properties @@ -85,23 +66,17 @@ class GovernanceInsightAttributes def self.attribute_map { :'audit_query' => :'audit_query', - :'best_practice' => :'best_practice', - :'deep_link' => :'deep_link', :'description' => :'description', :'display_name' => :'display_name', :'event_query' => :'event_query', :'metric_query' => :'metric_query', - :'old_value' => :'old_value', :'percentage_query' => :'percentage_query', :'product' => :'product', :'query_config' => :'query_config', - :'sort_order' => :'sort_order', - :'state' => :'state', :'sub_product' => :'sub_product', :'time_range' => :'time_range', :'unit_name' => :'unit_name', - :'usage_query' => :'usage_query', - :'value' => :'value' + :'usage_query' => :'usage_query' } end @@ -110,35 +85,20 @@ def self.attribute_map def self.openapi_types { :'audit_query' => :'GovernanceInsightAuditQuery', - :'best_practice' => :'GovernanceBestPracticeDefinition', - :'deep_link' => :'String', :'description' => :'String', :'display_name' => :'String', :'event_query' => :'GovernanceInsightEventQuery', :'metric_query' => :'GovernanceInsightMetricQuery', - :'old_value' => :'Float', :'percentage_query' => :'GovernanceInsightPercentageQuery', :'product' => :'String', :'query_config' => :'GovernanceInsightQueryConfig', - :'sort_order' => :'Integer', - :'state' => :'String', :'sub_product' => :'String', :'time_range' => :'String', :'unit_name' => :'String', - :'usage_query' => :'GovernanceInsightUsageQuery', - :'value' => :'Float' + :'usage_query' => :'GovernanceInsightUsageQuery' } end - # List of attributes with nullable: true - # @!visibility private - def self.openapi_nullable - Set.new([ - :'old_value', - :'value', - ]) - end - # Initializes the object # @param attributes [Hash] Model attributes in the form of hash # @!visibility private @@ -161,14 +121,6 @@ def initialize(attributes = {}) self.audit_query = attributes[:'audit_query'] end - if attributes.key?(:'best_practice') - self.best_practice = attributes[:'best_practice'] - end - - if attributes.key?(:'deep_link') - self.deep_link = attributes[:'deep_link'] - end - if attributes.key?(:'description') self.description = attributes[:'description'] end @@ -185,10 +137,6 @@ def initialize(attributes = {}) self.metric_query = attributes[:'metric_query'] end - if attributes.key?(:'old_value') - self.old_value = attributes[:'old_value'] - end - if attributes.key?(:'percentage_query') self.percentage_query = attributes[:'percentage_query'] end @@ -201,14 +149,6 @@ def initialize(attributes = {}) self.query_config = attributes[:'query_config'] end - if attributes.key?(:'sort_order') - self.sort_order = attributes[:'sort_order'] - end - - if attributes.key?(:'state') - self.state = attributes[:'state'] - end - if attributes.key?(:'sub_product') self.sub_product = attributes[:'sub_product'] end @@ -224,63 +164,21 @@ def initialize(attributes = {}) if attributes.key?(:'usage_query') self.usage_query = attributes[:'usage_query'] end - - if attributes.key?(:'value') - self.value = attributes[:'value'] - 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 @audit_query.nil? - return false if @best_practice.nil? - return false if @deep_link.nil? return false if @description.nil? return false if @display_name.nil? - return false if @event_query.nil? - return false if @metric_query.nil? - return false if @percentage_query.nil? return false if @product.nil? - return false if @state.nil? return false if @sub_product.nil? return false if @time_range.nil? return false if @unit_name.nil? - return false if @usage_query.nil? true end - # Custom attribute writer method with validation - # @param audit_query [Object] Object to be assigned - # @!visibility private - def audit_query=(audit_query) - if audit_query.nil? - fail ArgumentError, 'invalid value for "audit_query", audit_query cannot be nil.' - end - @audit_query = audit_query - end - - # Custom attribute writer method with validation - # @param best_practice [Object] Object to be assigned - # @!visibility private - def best_practice=(best_practice) - if best_practice.nil? - fail ArgumentError, 'invalid value for "best_practice", best_practice cannot be nil.' - end - @best_practice = best_practice - 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 description [Object] Object to be assigned # @!visibility private @@ -301,36 +199,6 @@ def display_name=(display_name) @display_name = display_name end - # Custom attribute writer method with validation - # @param event_query [Object] Object to be assigned - # @!visibility private - def event_query=(event_query) - if event_query.nil? - fail ArgumentError, 'invalid value for "event_query", event_query cannot be nil.' - end - @event_query = event_query - end - - # Custom attribute writer method with validation - # @param metric_query [Object] Object to be assigned - # @!visibility private - def metric_query=(metric_query) - if metric_query.nil? - fail ArgumentError, 'invalid value for "metric_query", metric_query cannot be nil.' - end - @metric_query = metric_query - end - - # Custom attribute writer method with validation - # @param percentage_query [Object] Object to be assigned - # @!visibility private - def percentage_query=(percentage_query) - if percentage_query.nil? - fail ArgumentError, 'invalid value for "percentage_query", percentage_query cannot be nil.' - end - @percentage_query = percentage_query - end - # Custom attribute writer method with validation # @param product [Object] Object to be assigned # @!visibility private @@ -341,16 +209,6 @@ def product=(product) @product = product 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 - # Custom attribute writer method with validation # @param sub_product [Object] Object to be assigned # @!visibility private @@ -381,16 +239,6 @@ def unit_name=(unit_name) @unit_name = unit_name end - # Custom attribute writer method with validation - # @param usage_query [Object] Object to be assigned - # @!visibility private - def usage_query=(usage_query) - if usage_query.nil? - fail ArgumentError, 'invalid value for "usage_query", usage_query cannot be nil.' - end - @usage_query = usage_query - end - # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private @@ -418,23 +266,17 @@ def ==(o) return true if self.equal?(o) self.class == o.class && audit_query == o.audit_query && - best_practice == o.best_practice && - deep_link == o.deep_link && description == o.description && display_name == o.display_name && event_query == o.event_query && metric_query == o.metric_query && - old_value == o.old_value && percentage_query == o.percentage_query && product == o.product && query_config == o.query_config && - sort_order == o.sort_order && - state == o.state && sub_product == o.sub_product && time_range == o.time_range && unit_name == o.unit_name && usage_query == o.usage_query && - value == o.value && additional_properties == o.additional_properties end @@ -442,7 +284,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [audit_query, best_practice, deep_link, description, display_name, event_query, metric_query, old_value, percentage_query, product, query_config, sort_order, state, sub_product, time_range, unit_name, usage_query, value, additional_properties].hash + [audit_query, description, display_name, event_query, metric_query, percentage_query, product, query_config, sub_product, time_range, unit_name, usage_query, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/governance_insight_data.rb b/lib/datadog_api_client/v2/models/governance_insight_data.rb index c4a5dd49b268..947e5a306742 100644 --- a/lib/datadog_api_client/v2/models/governance_insight_data.rb +++ b/lib/datadog_api_client/v2/models/governance_insight_data.rb @@ -21,7 +21,9 @@ module DatadogAPIClient::V2 class GovernanceInsightData include BaseGenericModel - # The attributes of a governance insight. + # The attributes of a governance insight. Exactly one of `metric_query`, `event_query`, + # `usage_query`, `audit_query`, or `percentage_query` is populated, depending on the data + # source the insight is computed from; the rest are `null`. attr_reader :attributes # The unique identifier of the insight. diff --git a/lib/datadog_api_client/v2/models/governance_insight_directionality.rb b/lib/datadog_api_client/v2/models/governance_insight_directionality.rb new file mode 100644 index 000000000000..2caaf52d92be --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_insight_directionality.rb @@ -0,0 +1,28 @@ +=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 + # Whether an increase in the insight's value is good, bad, or neutral. + class GovernanceInsightDirectionality + include BaseEnumModel + + NEUTRAL = "neutral".freeze + INCREASE_BETTER = "increase_better".freeze + DECREASE_BETTER = "decrease_better".freeze + 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..ce7f6ec60733 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 @@ -17,21 +17,20 @@ require 'time' module DatadogAPIClient::V2 - # Query execution context that allows the frontend to execute insight queries directly. + # Query execution context for running insight queries directly. class GovernanceInsightQueryConfig include BaseGenericModel - # The chart type the frontend should use to render the insight. + # The chart type used 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. attr_accessor :default_value - # Whether an increase in the value is good, bad, or neutral. One of `neutral`, - # `increase_better`, or `decrease_better`. + # Whether an increase in the insight's value is good, bad, or neutral. attr_accessor :directionality # The number of days the insight value is computed over. @@ -58,7 +57,7 @@ def self.openapi_types :'chart_type' => :'String', :'comparison_shift' => :'String', :'default_value' => :'Integer', - :'directionality' => :'String', + :'directionality' => :'GovernanceInsightDirectionality', :'effective_time_window_days' => :'Integer' } end 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..5c7ef4be80ec --- /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 usage 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..0d471f5e7556 --- /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 usage limit resource. + class GovernanceLimitData + include BaseGenericModel + + # The attributes of a usage 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..2d501bdda0e7 --- /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, such as metrics or events. + 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..1288f6af77b7 --- /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 usage limits. + class GovernanceLimitsResponse + include BaseGenericModel + + # An array of usage 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..f69a32098fc4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_resource_limit_attributes.rb @@ -0,0 +1,375 @@ +=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 + + # 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', + :'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', + :'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?(:'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 @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 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 && + 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, 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