diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 99b25f0ac87f..f7df9e107575 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -41606,6 +41606,404 @@ components: - impact_hint - status type: object + GovernanceControlAttributes: + description: The attributes of a governance control. + properties: + active_detections_count: + description: The number of active detections for the control. + example: 12 + format: int64 + type: integer + category: + description: The value driver the control is grouped under, such as `security` or `cost`. + example: "security" + type: string + created_at: + description: The time the control configuration was created. + example: "2024-01-15T09:30:00Z" + format: date-time + type: string + created_by: + description: The UUID of the user who created the control configuration. + example: "11111111-2222-3333-4444-555555555555" + type: string + description: + description: A human-readable description of what the control detects. + example: "Identifies API keys that have not been used within your specified time threshold, helping reduce security risks from dormant credentials." + type: string + detection_frequency: + description: How often detections are evaluated for the control. + example: "daily" + type: string + 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: [] + items: + description: An insight slug associated with the control. + type: string + type: array + last_detection_at: + description: The time of the most recent detection for the control. `null` when there are no detections. + example: "2024-03-01T12:00:00Z" + format: date-time + nullable: true + type: string + mitigated_detections_count: + description: The number of mitigated detections for the control. + example: 3 + format: int64 + type: integer + mitigation_parameters: + $ref: "#/components/schemas/GovernanceControlParametersMap" + nullable: true + mitigation_type: + description: The configured mitigation type for the control. Empty when not configured. + example: "revoke_api_key" + type: string + mitigations: + $ref: "#/components/schemas/GovernanceControlMitigationDefinitionArray" + name: + 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" + type: string + product: + 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" + type: string + resource_type_display_name: + description: The human-readable name of the resource type. + example: "API Key" + 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 + - created_by + - active_detections_count + - mitigated_detections_count + - last_detection_at + type: object + GovernanceControlData: + description: A governance control resource. + properties: + attributes: + $ref: "#/components/schemas/GovernanceControlAttributes" + id: + description: The unique identifier of the control. + example: "0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a" + type: string + type: + $ref: "#/components/schemas/GovernanceControlResourceType" + required: + - id + - type + - attributes + 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." + type: string + execution_modes: + description: The execution modes the mitigation supports, such as `manual` or `automatic`. + example: + - "manual" + - "automatic" + items: + 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 will go through this flow again." + type: string + permissions: + description: The permissions required to apply the mitigation. + example: + - "api_keys_write" + - "api_keys_delete" + items: + 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: + description: A short, human-readable name for the mitigation. + example: "Revoke Unused API Keys" + type: string + required: + - id + - title + - description + - action_verb + - supported_parameters + - permissions + - manual_mitigation_warning + - feature_flags + - requires_ai + type: object + GovernanceControlMitigationDefinitionArray: + description: The mitigations available for a control. + items: + $ref: "#/components/schemas/GovernanceControlMitigationDefinition" + type: array + GovernanceControlParameterDefinition: + description: The definition of a configurable parameter on a control or mitigation. + properties: + default_value: + description: The default value of the parameter. The JSON type depends on the parameter's `type`. + example: 30 + description: + description: A human-readable description of the parameter. + example: "Number of days of inactivity before an API key is considered unused." + type: string + display_name: + 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" + type: string + required: + description: Whether the parameter must be provided. + example: false + type: boolean + supported_values: + $ref: "#/components/schemas/GovernanceControlSupportedValueArray" + type: + description: The type of the parameter, such as `integer`, `string`, `boolean`, `enum`, or `pattern_list`. + example: "integer" + type: string + required: + - name + - display_name + - description + - type + - required + - hidden + - supported_values + - default_value + type: object + GovernanceControlParameterDefinitionArray: + description: An array of parameter definitions. + items: + $ref: "#/components/schemas/GovernanceControlParameterDefinition" + type: array + GovernanceControlParametersMap: + additionalProperties: {} + description: A free-form map of parameter names to their configured values. + type: object + GovernanceControlResourceType: + description: JSON:API resource type for a governance control. + enum: + - governance_control + example: "governance_control" + type: string + x-enum-varnames: + - GOVERNANCE_CONTROL + GovernanceControlResponse: + description: A single governance control. + properties: + data: + $ref: "#/components/schemas/GovernanceControlData" + required: + - data + type: object + GovernanceControlSupportedValue: + description: A supported value for an enumerated parameter. + properties: + label: + description: The human-readable label for the value. + example: "30 days" + type: string + value: + description: The machine-readable value. + example: "thirty" + type: string + required: + - value + - label + type: object + GovernanceControlSupportedValueArray: + description: The supported values for an enumerated parameter. + items: + $ref: "#/components/schemas/GovernanceControlSupportedValue" + type: array + GovernanceControlUpdateAttributes: + description: The attributes of a governance control that can be updated. Only the attributes present in the request are modified. + properties: + detection_frequency: + description: How often detections should be evaluated for the control. + example: "daily" + type: string + detection_parameters: + $ref: "#/components/schemas/GovernanceControlParametersMap" + nullable: true + mitigation_parameters: + $ref: "#/components/schemas/GovernanceControlParametersMap" + nullable: true + mitigation_type: + 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: + - type + type: object + GovernanceControlUpdateRequest: + description: A request to update a governance control. + properties: + data: + $ref: "#/components/schemas/GovernanceControlUpdateData" + required: + - data + type: object + GovernanceControlsDataArray: + description: An array of governance control resources. + items: + $ref: "#/components/schemas/GovernanceControlData" + type: array + GovernanceControlsResponse: + description: A list of governance controls. + properties: + data: + $ref: "#/components/schemas/GovernanceControlsDataArray" + required: + - data + type: object GovernanceInsightAttributes: description: The attributes of a governance insight. properties: @@ -133746,6 +134144,319 @@ paths: operator: OR permissions: - user_access_read + /api/v2/governance/control: + get: + description: |- + 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. + operationId: ListGovernanceControls + 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 + 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." + 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 will 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" + type: "governance_control" + schema: + $ref: "#/components/schemas/GovernanceControlsResponse" + 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" + summary: List governance controls + tags: + - Governance Controls + 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 + 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" + 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" + summary: Get a governance control + tags: + - Governance Controls + 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 + 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" + 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" + summary: Update a governance control + tags: + - Governance Controls + 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: |- @@ -193621,6 +194332,12 @@ tags: description: For more information about the Datadog Google Chat integration, see the integration page. 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, diff --git a/examples/v2/governance-controls/GetGovernanceControl.rb b/examples/v2/governance-controls/GetGovernanceControl.rb new file mode 100644 index 000000000000..807a0ffbd232 --- /dev/null +++ b/examples/v2/governance-controls/GetGovernanceControl.rb @@ -0,0 +1,8 @@ +# Get a governance 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 +p api_instance.get_governance_control("detection_type") diff --git a/examples/v2/governance-controls/ListGovernanceControls.rb b/examples/v2/governance-controls/ListGovernanceControls.rb new file mode 100644 index 000000000000..a97ecadd6092 --- /dev/null +++ b/examples/v2/governance-controls/ListGovernanceControls.rb @@ -0,0 +1,8 @@ +# List governance 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 +p api_instance.list_governance_controls() diff --git a/examples/v2/governance-controls/UpdateGovernanceControl.rb b/examples/v2/governance-controls/UpdateGovernanceControl.rb new file mode 100644 index 000000000000..5dca6d0fb1c8 --- /dev/null +++ b/examples/v2/governance-controls/UpdateGovernanceControl.rb @@ -0,0 +1,22 @@ +# Update a governance 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 + +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, + }), +}) +p api_instance.update_governance_control("detection_type", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8d27a626e6cf..b3213556e639 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3353,6 +3353,13 @@ "saml_config_uuid" => "String", "body" => "SAMLConfigurationUpdateRequest", }, + "v2.GetGovernanceControl" => { + "detection_type" => "String", + }, + "v2.UpdateGovernanceControl" => { + "detection_type" => "String", + "body" => "GovernanceControlUpdateRequest", + }, "v2.ListGovernanceInsights" => { "with_values" => "Boolean", "org_uuid" => "String", diff --git a/features/v2/governance_controls.feature b/features/v2/governance_controls.feature new file mode 100644 index 000000000000..1207f5cf507f --- /dev/null +++ b/features/v2/governance_controls.feature @@ -0,0 +1,77 @@ +@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/undo.json b/features/v2/undo.json index a5c43f6c0f2c..c45de176e3cd 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2762,6 +2762,24 @@ "type": "safe" } }, + "ListGovernanceControls": { + "tag": "Governance Controls", + "undo": { + "type": "safe" + } + }, + "GetGovernanceControl": { + "tag": "Governance Controls", + "undo": { + "type": "safe" + } + }, + "UpdateGovernanceControl": { + "tag": "Governance Controls", + "undo": { + "type": "idempotent" + } + }, "ListGovernanceInsights": { "tag": "Governance Insights", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index c21dc889eb38..f0582100c5a9 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -486,6 +486,9 @@ def initialize "v2.upsert_and_publish_form_version": false, "v2.upsert_form_version": false, "v2.update_org_saml_configurations": false, + "v2.get_governance_control": false, + "v2.list_governance_controls": false, + "v2.update_governance_control": false, "v2.list_governance_insights": false, "v2.create_hamr_org_connection": false, "v2.get_hamr_org_connection": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1912c3a1f419..8b94f5d4d3a3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3540,6 +3540,17 @@ def overrides "v2.google_meet_configuration_reference" => "GoogleMeetConfigurationReference", "v2.google_meet_configuration_reference_data" => "GoogleMeetConfigurationReferenceData", "v2.governance_best_practice_definition" => "GovernanceBestPracticeDefinition", + "v2.governance_control_attributes" => "GovernanceControlAttributes", + "v2.governance_control_data" => "GovernanceControlData", + "v2.governance_control_mitigation_definition" => "GovernanceControlMitigationDefinition", + "v2.governance_control_parameter_definition" => "GovernanceControlParameterDefinition", + "v2.governance_control_resource_type" => "GovernanceControlResourceType", + "v2.governance_control_response" => "GovernanceControlResponse", + "v2.governance_controls_response" => "GovernanceControlsResponse", + "v2.governance_control_supported_value" => "GovernanceControlSupportedValue", + "v2.governance_control_update_attributes" => "GovernanceControlUpdateAttributes", + "v2.governance_control_update_data" => "GovernanceControlUpdateData", + "v2.governance_control_update_request" => "GovernanceControlUpdateRequest", "v2.governance_insight_attributes" => "GovernanceInsightAttributes", "v2.governance_insight_audit_compute" => "GovernanceInsightAuditCompute", "v2.governance_insight_audit_query" => "GovernanceInsightAuditQuery", @@ -7868,6 +7879,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.high_availability_multi_region_api" => "HighAvailabilityMultiRegionAPI", "v2.incidents_api" => "IncidentsAPI", diff --git a/lib/datadog_api_client/v2/api/governance_controls_api.rb b/lib/datadog_api_client/v2/api/governance_controls_api.rb new file mode 100644 index 000000000000..a5267c68fbf5 --- /dev/null +++ b/lib/datadog_api_client/v2/api/governance_controls_api.rb @@ -0,0 +1,246 @@ +=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/models/governance_control_attributes.rb b/lib/datadog_api_client/v2/models/governance_control_attributes.rb new file mode 100644 index 000000000000..5c3501041bc4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_attributes.rb @@ -0,0 +1,739 @@ +=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. + class GovernanceControlAttributes + include BaseGenericModel + + # The number of active detections for the control. + attr_reader :active_detections_count + + # The value driver the control is grouped under, such as `security` or `cost`. + attr_reader :category + + # The time the control configuration was created. + attr_reader :created_at + + # The UUID of the user who created the control configuration. + attr_reader :created_by + + # A human-readable description of what the control detects. + attr_reader :description + + # How often detections are evaluated for the control. + attr_reader :detection_frequency + + # 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 + + # The time of the most recent detection for the control. `null` when there are no detections. + attr_accessor :last_detection_at + + # The number of mitigated detections for the control. + attr_reader :mitigated_detections_count + + # A free-form map of parameter names to their configured values. + attr_reader :mitigation_parameters + + # The configured mitigation type for the control. Empty when not configured. + attr_reader :mitigation_type + + # The mitigations available for a control. + attr_reader :mitigations + + # 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 + + # The human-readable name of the resource type. + attr_reader :resource_type_display_name + + # 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. + # @!visibility private + def self.attribute_map + { + :'active_detections_count' => :'active_detections_count', + :'category' => :'category', + :'created_at' => :'created_at', + :'created_by' => :'created_by', + :'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', + :'mitigation_parameters' => :'mitigation_parameters', + :'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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'active_detections_count' => :'Integer', + :'category' => :'String', + :'created_at' => :'Time', + :'created_by' => :'String', + :'description' => :'String', + :'detection_frequency' => :'String', + :'detection_parameters' => :'Hash', + :'detection_type' => :'String', + :'feature_flags' => :'Array', + :'insights' => :'Array', + :'last_detection_at' => :'Time', + :'mitigated_detections_count' => :'Integer', + :'mitigation_parameters' => :'Hash', + :'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' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'last_detection_at', + ]) + 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::GovernanceControlAttributes` 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?(:'active_detections_count') + self.active_detections_count = attributes[:'active_detections_count'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'detection_frequency') + self.detection_frequency = attributes[:'detection_frequency'] + end + + if attributes.key?(:'detection_parameters') + 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 + end + end + + if attributes.key?(:'last_detection_at') + self.last_detection_at = attributes[:'last_detection_at'] + end + + if attributes.key?(:'mitigated_detections_count') + self.mitigated_detections_count = attributes[:'mitigated_detections_count'] + 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 + + if attributes.key?(:'mitigations') + if (value = attributes[:'mitigations']).is_a?(Array) + self.mitigations = value + end + end + + if attributes.key?(:'name') + 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 + + if attributes.key?(:'product') + 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 + + if attributes.key?(:'resource_type_display_name') + self.resource_type_display_name = attributes[:'resource_type_display_name'] + end + + if attributes.key?(:'supported_detection_parameters') + if (value = attributes[:'supported_detection_parameters']).is_a?(Array) + self.supported_detection_parameters = value + 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 + # @return true if the model is valid + # @!visibility private + def valid? + return false if @active_detections_count.nil? + return false if @category.nil? + return false if @created_at.nil? + return false if @created_by.nil? + 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 + + # Custom attribute writer method with validation + # @param active_detections_count [Object] Object to be assigned + # @!visibility private + def active_detections_count=(active_detections_count) + if active_detections_count.nil? + fail ArgumentError, 'invalid value for "active_detections_count", active_detections_count cannot be nil.' + end + @active_detections_count = active_detections_count + 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 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 created_by [Object] Object to be assigned + # @!visibility private + def created_by=(created_by) + if created_by.nil? + fail ArgumentError, 'invalid value for "created_by", created_by cannot be nil.' + end + @created_by = created_by + 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 detection_frequency [Object] Object to be assigned + # @!visibility private + def detection_frequency=(detection_frequency) + if detection_frequency.nil? + fail ArgumentError, 'invalid value for "detection_frequency", detection_frequency cannot be nil.' + end + @detection_frequency = detection_frequency + end + + # Custom attribute writer method with validation + # @param detection_parameters [Object] Object to be assigned + # @!visibility private + def detection_parameters=(detection_parameters) + if detection_parameters.nil? + fail ArgumentError, 'invalid value for "detection_parameters", detection_parameters cannot be nil.' + end + @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 + def insights=(insights) + if insights.nil? + fail ArgumentError, 'invalid value for "insights", insights cannot be nil.' + end + @insights = insights + end + + # Custom attribute writer method with validation + # @param mitigated_detections_count [Object] Object to be assigned + # @!visibility private + def mitigated_detections_count=(mitigated_detections_count) + if mitigated_detections_count.nil? + fail ArgumentError, 'invalid value for "mitigated_detections_count", mitigated_detections_count cannot be nil.' + end + @mitigated_detections_count = mitigated_detections_count + end + + # Custom attribute writer method with validation + # @param mitigation_parameters [Object] Object to be assigned + # @!visibility private + def mitigation_parameters=(mitigation_parameters) + if mitigation_parameters.nil? + fail ArgumentError, 'invalid value for "mitigation_parameters", mitigation_parameters cannot be nil.' + end + @mitigation_parameters = mitigation_parameters + end + + # Custom attribute writer method with validation + # @param mitigation_type [Object] Object to be assigned + # @!visibility private + def mitigation_type=(mitigation_type) + if mitigation_type.nil? + fail ArgumentError, 'invalid value for "mitigation_type", mitigation_type cannot be nil.' + end + @mitigation_type = mitigation_type + end + + # Custom attribute writer method with validation + # @param mitigations [Object] Object to be assigned + # @!visibility private + def mitigations=(mitigations) + if mitigations.nil? + fail ArgumentError, 'invalid value for "mitigations", mitigations cannot be nil.' + end + @mitigations = mitigations + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @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 + 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 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 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 + 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 resource_type_display_name [Object] Object to be assigned + # @!visibility private + def resource_type_display_name=(resource_type_display_name) + if resource_type_display_name.nil? + fail ArgumentError, 'invalid value for "resource_type_display_name", resource_type_display_name cannot be nil.' + end + @resource_type_display_name = resource_type_display_name + end + + # Custom attribute writer method with validation + # @param supported_detection_parameters [Object] Object to be assigned + # @!visibility private + def supported_detection_parameters=(supported_detection_parameters) + if supported_detection_parameters.nil? + fail ArgumentError, 'invalid value for "supported_detection_parameters", supported_detection_parameters cannot be nil.' + end + @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 + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @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 + 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 && + active_detections_count == o.active_detections_count && + category == o.category && + created_at == o.created_at && + created_by == o.created_by && + 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 && + mitigation_parameters == o.mitigation_parameters && + 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 + + # Calculates hash code according to all attributes. + # @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 + 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 new file mode 100644 index 000000000000..a6a482264b5c --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_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 resource. + class GovernanceControlData + include BaseGenericModel + + # The attributes of a governance control. + attr_reader :attributes + + # The unique identifier of the control. + attr_reader :id + + # JSON:API resource type for a governance control. + 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' => :'GovernanceControlAttributes', + :'id' => :'String', + :'type' => :'GovernanceControlResourceType' + } + 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::GovernanceControlData` 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_mitigation_definition.rb b/lib/datadog_api_client/v2/models/governance_control_mitigation_definition.rb new file mode 100644 index 000000000000..2c7693fd18c5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_mitigation_definition.rb @@ -0,0 +1,309 @@ +=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 definition of a mitigation available for a control. + 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 + + # 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 + + # A short, human-readable name for the mitigation. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!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' + } + end + + # Attribute type mapping. + # @!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' + } + 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::GovernanceControlMitigationDefinition` 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?(:'action_verb') + self.action_verb = attributes[:'action_verb'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'execution_modes') + if (value = attributes[:'execution_modes']).is_a?(Array) + self.execution_modes = value + 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 + end + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + 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 @action_verb.nil? + return false if @description.nil? + return false if @feature_flags.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 + 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 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 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 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 + 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 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 + def supported_parameters=(supported_parameters) + if supported_parameters.nil? + fail ArgumentError, 'invalid value for "supported_parameters", supported_parameters cannot be nil.' + end + @supported_parameters = supported_parameters + 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 + + # 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 && + 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 + end + + # Calculates hash code according to all attributes. + # @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 + 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 new file mode 100644 index 000000000000..4f052e0ae374 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_parameter_definition.rb @@ -0,0 +1,272 @@ +=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 definition of a configurable parameter on a control or mitigation. + class GovernanceControlParameterDefinition + include BaseGenericModel + + # The default value of the parameter. The JSON type depends on the parameter's `type`. + attr_reader :default_value + + # A human-readable description of the parameter. + attr_reader :description + + # 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 + + # Whether the parameter must be provided. + attr_reader :required + + # The supported values for an enumerated parameter. + attr_reader :supported_values + + # The type of the parameter, such as `integer`, `string`, `boolean`, `enum`, or `pattern_list`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'default_value' => :'default_value', + :'description' => :'description', + :'display_name' => :'display_name', + :'hidden' => :'hidden', + :'name' => :'name', + :'required' => :'required', + :'supported_values' => :'supported_values', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'default_value' => :'Object', + :'description' => :'String', + :'display_name' => :'String', + :'hidden' => :'Boolean', + :'name' => :'String', + :'required' => :'Boolean', + :'supported_values' => :'Array', + :'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::GovernanceControlParameterDefinition` 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?(:'default_value') + self.default_value = attributes[:'default_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?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'supported_values') + if (value = attributes[:'supported_values']).is_a?(Array) + self.supported_values = value + end + 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 @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? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param default_value [Object] Object to be assigned + # @!visibility private + def default_value=(default_value) + if default_value.nil? + fail ArgumentError, 'invalid value for "default_value", default_value cannot be nil.' + end + @default_value = default_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 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 + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param required [Object] Object to be assigned + # @!visibility private + def required=(required) + if required.nil? + fail ArgumentError, 'invalid value for "required", required cannot be nil.' + end + @required = required + end + + # Custom attribute writer method with validation + # @param supported_values [Object] Object to be assigned + # @!visibility private + def supported_values=(supported_values) + if supported_values.nil? + fail ArgumentError, 'invalid value for "supported_values", supported_values cannot be nil.' + end + @supported_values = supported_values + 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 && + 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 && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [default_value, description, display_name, hidden, name, required, supported_values, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_resource_type.rb b/lib/datadog_api_client/v2/models/governance_control_resource_type.rb new file mode 100644 index 000000000000..a9e8539b0d0d --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_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 + # JSON:API resource type for a governance control. + class GovernanceControlResourceType + include BaseEnumModel + + GOVERNANCE_CONTROL = "governance_control".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/governance_control_response.rb b/lib/datadog_api_client/v2/models/governance_control_response.rb new file mode 100644 index 000000000000..4c0cde6d581a --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_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. + class GovernanceControlResponse + include BaseGenericModel + + # A governance control 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' => :'GovernanceControlData' + } + 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::GovernanceControlResponse` 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_supported_value.rb b/lib/datadog_api_client/v2/models/governance_control_supported_value.rb new file mode 100644 index 000000000000..c1c3f696ba68 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_supported_value.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 supported value for an enumerated parameter. + class GovernanceControlSupportedValue + include BaseGenericModel + + # The human-readable label for the value. + attr_reader :label + + # The machine-readable value. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'label' => :'label', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'label' => :'String', + :'value' => :'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::GovernanceControlSupportedValue` 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?(:'label') + self.label = attributes[:'label'] + 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 @label.nil? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param label [Object] Object to be assigned + # @!visibility private + def label=(label) + if label.nil? + fail ArgumentError, 'invalid value for "label", label cannot be nil.' + end + @label = label + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + 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 && + label == o.label && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [label, value, 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 new file mode 100644 index 000000000000..2e0dfaa8f624 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_update_attributes.rb @@ -0,0 +1,175 @@ +=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 that can be updated. Only the attributes present in the request are modified. + class GovernanceControlUpdateAttributes + include BaseGenericModel + + # How often detections should be evaluated for the control. + attr_accessor :detection_frequency + + # A free-form map of parameter names to their configured values. + attr_accessor :detection_parameters + + # A free-form map of parameter names to their configured values. + attr_accessor :mitigation_parameters + + # 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. + # @!visibility private + 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' + } + end + + # Attribute type mapping. + # @!visibility private + 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' + } + 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::GovernanceControlUpdateAttributes` 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_frequency') + self.detection_frequency = attributes[:'detection_frequency'] + end + + if attributes.key?(:'detection_parameters') + self.detection_parameters = attributes[:'detection_parameters'] + 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 + + 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. + # @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_frequency == o.detection_frequency && + 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 + + # Calculates hash code according to all attributes. + # @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 + 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 new file mode 100644 index 000000000000..d951f4fc4d9d --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_update_data.rb @@ -0,0 +1,143 @@ +=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 update request. + class GovernanceControlUpdateData + include BaseGenericModel + + # 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 + + 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' => :'GovernanceControlUpdateAttributes', + :'id' => :'String', + :'type' => :'GovernanceControlResourceType' + } + 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::GovernanceControlUpdateData` 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 @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 && + 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_update_request.rb b/lib/datadog_api_client/v2/models/governance_control_update_request.rb new file mode 100644 index 000000000000..63254414bb3b --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_control_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. + class GovernanceControlUpdateRequest + include BaseGenericModel + + # The data of a governance control 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' => :'GovernanceControlUpdateData' + } + 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::GovernanceControlUpdateRequest` 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_controls_response.rb b/lib/datadog_api_client/v2/models/governance_controls_response.rb new file mode 100644 index 000000000000..92da26bbcf68 --- /dev/null +++ b/lib/datadog_api_client/v2/models/governance_controls_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 controls. + class GovernanceControlsResponse + include BaseGenericModel + + # An array of governance control 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::GovernanceControlsResponse` 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