diff --git a/.apigentools-info b/.apigentools-info index c136e694749f..add410c72ef5 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-14 15:59:04.025656", - "spec_repo_commit": "0457044b" + "regenerated": "2025-01-14 20:10:50.478546", + "spec_repo_commit": "89d2bdc8" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-14 15:59:04.041492", - "spec_repo_commit": "0457044b" + "regenerated": "2025-01-14 20:10:50.494181", + "spec_repo_commit": "89d2bdc8" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 77866cbe38e3..81ffe33dc8e8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -297,6 +297,20 @@ components: required: false schema: $ref: '#/components/schemas/RelationType' + FrameworkHandle: + description: The framework handle + in: path + name: handle + required: true + schema: + type: string + FrameworkVersion: + description: The framework version + in: path + name: version + required: true + schema: + type: string GCPSTSServiceAccountID: description: Your GCP STS enabled service account's unique ID. in: path @@ -7145,6 +7159,10 @@ components: type: string x-enum-varnames: - APPDEFINITIONS + CreateCustomFrameworkRequest: + $ref: '#/components/schemas/FrameworkData' + description: Create a custom framework. + type: object CreateDataDeletionRequestBody: description: Object needed to create a data deletion request. properties: @@ -11936,6 +11954,72 @@ components: order: $ref: '#/components/schemas/QuerySortOrder' type: object + FrameworkControl: + description: Framework Control. + properties: + name: + description: Control Name. + example: '' + type: string + rule_ids: + description: Rule IDs. + example: + - '' + items: + type: string + type: array + required: + - name + - rule_ids + type: object + FrameworkData: + description: Framework Data. + properties: + description: + description: Framework Description + type: string + handle: + description: Framework Handle + example: '' + type: string + icon_url: + description: Framework Icon URL + type: string + name: + description: Framework Name + example: '' + type: string + requirements: + description: Framework Requirements + items: + $ref: '#/components/schemas/FrameworkRequirement' + type: array + version: + description: Framework Version + example: '' + type: string + required: + - handle + - version + - name + - requirements + type: object + FrameworkRequirement: + description: Framework Requirement. + properties: + controls: + description: Requirement Controls. + items: + $ref: '#/components/schemas/FrameworkControl' + type: array + name: + description: Requirement Name. + example: '' + type: string + required: + - name + - controls + type: object FullAPIKey: description: Datadog API key. properties: @@ -28953,6 +29037,10 @@ components: deployment: $ref: '#/components/schemas/DeploymentRelationship' type: object + UpdateCustomFrameworkRequest: + $ref: '#/components/schemas/FrameworkData' + description: Update a custom framework. + type: object UpdateOpenAPIResponse: description: Response for `UpdateOpenAPI`. properties: @@ -33028,6 +33116,77 @@ paths: operator: OR permissions: - ci_visibility_read + /api/v2/cloud_security_management/custom_frameworks: + post: + description: Create a custom framework. + operationId: CreateCustomFramework + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCustomFrameworkRequest' + required: true + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + $ref: '#/components/responses/BadRequestResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_rules_read + - security_monitoring_rules_write + summary: Create a custom framework + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - security_monitoring_rules_read + - security_monitoring_rules_write + /api/v2/cloud_security_management/custom_frameworks/{handle}/{version}: + put: + description: Update a custom framework. + operationId: UpdateCustomFramework + parameters: + - $ref: '#/components/parameters/FrameworkHandle' + - $ref: '#/components/parameters/FrameworkVersion' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateCustomFrameworkRequest' + required: true + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + $ref: '#/components/responses/BadRequestResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_rules_read + - security_monitoring_rules_write + summary: Update a custom framework + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - security_monitoring_rules_read + - security_monitoring_rules_write /api/v2/container_images: get: description: Get all Container Images for your organization. diff --git a/examples/v2/security-monitoring/CreateCustomFramework.rb b/examples/v2/security-monitoring/CreateCustomFramework.rb new file mode 100644 index 000000000000..7ed59e590fc3 --- /dev/null +++ b/examples/v2/security-monitoring/CreateCustomFramework.rb @@ -0,0 +1,24 @@ +# Create a custom framework returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::CreateCustomFrameworkRequest.new({ + handle: "", + name: "", + requirements: [ + DatadogAPIClient::V2::FrameworkRequirement.new({ + controls: [ + DatadogAPIClient::V2::FrameworkControl.new({ + name: "", + rule_ids: [ + "", + ], + }), + ], + name: "", + }), + ], + version: "", +}) +p api_instance.create_custom_framework(body) diff --git a/examples/v2/security-monitoring/UpdateCustomFramework.rb b/examples/v2/security-monitoring/UpdateCustomFramework.rb new file mode 100644 index 000000000000..091026ce30f1 --- /dev/null +++ b/examples/v2/security-monitoring/UpdateCustomFramework.rb @@ -0,0 +1,24 @@ +# Update a custom framework returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::UpdateCustomFrameworkRequest.new({ + handle: "", + name: "", + requirements: [ + DatadogAPIClient::V2::FrameworkRequirement.new({ + controls: [ + DatadogAPIClient::V2::FrameworkControl.new({ + name: "", + rule_ids: [ + "", + ], + }), + ], + name: "", + }), + ], + version: "", +}) +p api_instance.update_custom_framework("handle", "version", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 6cbd21d4f165..f05ec5ddd552 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1105,6 +1105,202 @@ "v2.SearchCIAppTestEvents" => { "body" => "CIAppTestEventsRequest", }, + "v2.CreateCustomFramework" => { + "body" => "CreateCustomFrameworkRequest", + }, + "v2.UpdateCustomFramework" => { + "handle" => "String", + "version" => "String", + "body" => "UpdateCustomFrameworkRequest", + }, + "v2.ListFindings" => { + "page_limit" => "Integer", + "snapshot_timestamp" => "Integer", + "page_cursor" => "String", + "filter_tags" => "String", + "filter_evaluation_changed_at" => "String", + "filter_muted" => "Boolean", + "filter_rule_id" => "String", + "filter_rule_name" => "String", + "filter_resource_type" => "String", + "filter_discovery_timestamp" => "String", + "filter_evaluation" => "FindingEvaluation", + "filter_status" => "FindingStatus", + "filter_vulnerability_type" => "Array", + }, + "v2.MuteFindings" => { + "body" => "BulkMuteFindingsRequest", + }, + "v2.GetFinding" => { + "finding_id" => "String", + "snapshot_timestamp" => "Integer", + }, + "v2.ListVulnerableAssets" => { + "page_token" => "String", + "page_number" => "Integer", + "filter_name" => "String", + "filter_type" => "AssetType", + "filter_version_first" => "String", + "filter_version_last" => "String", + "filter_repository_url" => "String", + "filter_risks_in_production" => "Boolean", + "filter_risks_under_attack" => "Boolean", + "filter_risks_is_publicly_accessible" => "Boolean", + "filter_risks_has_privileged_access" => "Boolean", + "filter_risks_has_access_to_sensitive_data" => "Boolean", + "filter_environments" => "String", + "filter_arch" => "String", + "filter_operating_system_name" => "String", + "filter_operating_system_version" => "String", + }, + "v2.ListVulnerabilities" => { + "page_token" => "String", + "page_number" => "Integer", + "filter_type" => "VulnerabilityType", + "filter_cvss_base_score_op" => "Float", + "filter_cvss_base_severity" => "VulnerabilitySeverity", + "filter_cvss_base_vector" => "String", + "filter_cvss_datadog_score_op" => "Float", + "filter_cvss_datadog_severity" => "VulnerabilitySeverity", + "filter_cvss_datadog_vector" => "String", + "filter_status" => "VulnerabilityStatus", + "filter_tool" => "VulnerabilityTool", + "filter_library_name" => "String", + "filter_library_version" => "String", + "filter_advisory_id" => "String", + "filter_risks_exploitation_probability" => "Boolean", + "filter_risks_poc_exploit_available" => "Boolean", + "filter_risks_exploit_available" => "Boolean", + "filter_risks_epss_score_op" => "Float", + "filter_risks_epss_severity" => "VulnerabilitySeverity", + "filter_language" => "String", + "filter_ecosystem" => "VulnerabilityEcosystem", + "filter_code_location_location" => "String", + "filter_code_location_file_path" => "String", + "filter_code_location_method" => "String", + "filter_fix_available" => "Boolean", + "filter_repo_digests" => "String", + "filter_asset_name" => "String", + "filter_asset_type" => "AssetType", + "filter_asset_version_first" => "String", + "filter_asset_version_last" => "String", + "filter_asset_repository_url" => "String", + "filter_asset_risks_in_production" => "Boolean", + "filter_asset_risks_under_attack" => "Boolean", + "filter_asset_risks_is_publicly_accessible" => "Boolean", + "filter_asset_risks_has_privileged_access" => "Boolean", + "filter_asset_risks_has_access_to_sensitive_data" => "Boolean", + "filter_asset_environments" => "String", + "filter_asset_arch" => "String", + "filter_asset_operating_system_name" => "String", + "filter_asset_operating_system_version" => "String", + }, + "v2.CreateSecurityFilter" => { + "body" => "SecurityFilterCreateRequest", + }, + "v2.DeleteSecurityFilter" => { + "security_filter_id" => "String", + }, + "v2.GetSecurityFilter" => { + "security_filter_id" => "String", + }, + "v2.UpdateSecurityFilter" => { + "security_filter_id" => "String", + "body" => "SecurityFilterUpdateRequest", + }, + "v2.CreateSecurityMonitoringSuppression" => { + "body" => "SecurityMonitoringSuppressionCreateRequest", + }, + "v2.DeleteSecurityMonitoringSuppression" => { + "suppression_id" => "String", + }, + "v2.GetSecurityMonitoringSuppression" => { + "suppression_id" => "String", + }, + "v2.UpdateSecurityMonitoringSuppression" => { + "suppression_id" => "String", + "body" => "SecurityMonitoringSuppressionUpdateRequest", + }, + "v2.ListSecurityMonitoringRules" => { + "page_size" => "Integer", + "page_number" => "Integer", + }, + "v2.CreateSecurityMonitoringRule" => { + "body" => "SecurityMonitoringRuleCreatePayload", + }, + "v2.ConvertSecurityMonitoringRuleFromJSONToTerraform" => { + "body" => "SecurityMonitoringRuleConvertPayload", + }, + "v2.TestSecurityMonitoringRule" => { + "body" => "SecurityMonitoringRuleTestRequest", + }, + "v2.ValidateSecurityMonitoringRule" => { + "body" => "SecurityMonitoringRuleValidatePayload", + }, + "v2.DeleteSecurityMonitoringRule" => { + "rule_id" => "String", + }, + "v2.GetSecurityMonitoringRule" => { + "rule_id" => "String", + }, + "v2.UpdateSecurityMonitoringRule" => { + "rule_id" => "String", + "body" => "SecurityMonitoringRuleUpdatePayload", + }, + "v2.ConvertExistingSecurityMonitoringRule" => { + "rule_id" => "String", + }, + "v2.TestExistingSecurityMonitoringRule" => { + "rule_id" => "String", + "body" => "SecurityMonitoringRuleTestRequest", + }, + "v2.ListSecurityMonitoringSignals" => { + "filter_query" => "String", + "filter_from" => "Time", + "filter_to" => "Time", + "sort" => "SecurityMonitoringSignalsSort", + "page_cursor" => "String", + "page_limit" => "Integer", + }, + "v2.SearchSecurityMonitoringSignals" => { + "body" => "SecurityMonitoringSignalListRequest", + }, + "v2.GetSecurityMonitoringSignal" => { + "signal_id" => "String", + }, + "v2.EditSecurityMonitoringSignalAssignee" => { + "signal_id" => "String", + "body" => "SecurityMonitoringSignalAssigneeUpdateRequest", + }, + "v2.EditSecurityMonitoringSignalIncidents" => { + "signal_id" => "String", + "body" => "SecurityMonitoringSignalIncidentsUpdateRequest", + }, + "v2.EditSecurityMonitoringSignalState" => { + "signal_id" => "String", + "body" => "SecurityMonitoringSignalStateUpdateRequest", + }, + "v2.ListHistoricalJobs" => { + "page_size" => "Integer", + "page_number" => "Integer", + "sort" => "String", + "filter_query" => "String", + }, + "v2.RunHistoricalJob" => { + "body" => "RunHistoricalJobRequest", + }, + "v2.ConvertJobResultToSignal" => { + "body" => "ConvertJobResultsToSignalsRequest", + }, + "v2.DeleteHistoricalJob" => { + "job_id" => "String", + }, + "v2.GetHistoricalJob" => { + "job_id" => "String", + }, + "v2.CancelHistoricalJob" => { + "job_id" => "String", + }, "v2.ListContainerImages" => { "filter_tags" => "String", "group_by" => "String", @@ -1776,194 +1972,6 @@ "role_id" => "String", "body" => "RelationshipToUser", }, - "v2.ListFindings" => { - "page_limit" => "Integer", - "snapshot_timestamp" => "Integer", - "page_cursor" => "String", - "filter_tags" => "String", - "filter_evaluation_changed_at" => "String", - "filter_muted" => "Boolean", - "filter_rule_id" => "String", - "filter_rule_name" => "String", - "filter_resource_type" => "String", - "filter_discovery_timestamp" => "String", - "filter_evaluation" => "FindingEvaluation", - "filter_status" => "FindingStatus", - "filter_vulnerability_type" => "Array", - }, - "v2.MuteFindings" => { - "body" => "BulkMuteFindingsRequest", - }, - "v2.GetFinding" => { - "finding_id" => "String", - "snapshot_timestamp" => "Integer", - }, - "v2.ListVulnerableAssets" => { - "page_token" => "String", - "page_number" => "Integer", - "filter_name" => "String", - "filter_type" => "AssetType", - "filter_version_first" => "String", - "filter_version_last" => "String", - "filter_repository_url" => "String", - "filter_risks_in_production" => "Boolean", - "filter_risks_under_attack" => "Boolean", - "filter_risks_is_publicly_accessible" => "Boolean", - "filter_risks_has_privileged_access" => "Boolean", - "filter_risks_has_access_to_sensitive_data" => "Boolean", - "filter_environments" => "String", - "filter_arch" => "String", - "filter_operating_system_name" => "String", - "filter_operating_system_version" => "String", - }, - "v2.ListVulnerabilities" => { - "page_token" => "String", - "page_number" => "Integer", - "filter_type" => "VulnerabilityType", - "filter_cvss_base_score_op" => "Float", - "filter_cvss_base_severity" => "VulnerabilitySeverity", - "filter_cvss_base_vector" => "String", - "filter_cvss_datadog_score_op" => "Float", - "filter_cvss_datadog_severity" => "VulnerabilitySeverity", - "filter_cvss_datadog_vector" => "String", - "filter_status" => "VulnerabilityStatus", - "filter_tool" => "VulnerabilityTool", - "filter_library_name" => "String", - "filter_library_version" => "String", - "filter_advisory_id" => "String", - "filter_risks_exploitation_probability" => "Boolean", - "filter_risks_poc_exploit_available" => "Boolean", - "filter_risks_exploit_available" => "Boolean", - "filter_risks_epss_score_op" => "Float", - "filter_risks_epss_severity" => "VulnerabilitySeverity", - "filter_language" => "String", - "filter_ecosystem" => "VulnerabilityEcosystem", - "filter_code_location_location" => "String", - "filter_code_location_file_path" => "String", - "filter_code_location_method" => "String", - "filter_fix_available" => "Boolean", - "filter_repo_digests" => "String", - "filter_asset_name" => "String", - "filter_asset_type" => "AssetType", - "filter_asset_version_first" => "String", - "filter_asset_version_last" => "String", - "filter_asset_repository_url" => "String", - "filter_asset_risks_in_production" => "Boolean", - "filter_asset_risks_under_attack" => "Boolean", - "filter_asset_risks_is_publicly_accessible" => "Boolean", - "filter_asset_risks_has_privileged_access" => "Boolean", - "filter_asset_risks_has_access_to_sensitive_data" => "Boolean", - "filter_asset_environments" => "String", - "filter_asset_arch" => "String", - "filter_asset_operating_system_name" => "String", - "filter_asset_operating_system_version" => "String", - }, - "v2.CreateSecurityFilter" => { - "body" => "SecurityFilterCreateRequest", - }, - "v2.DeleteSecurityFilter" => { - "security_filter_id" => "String", - }, - "v2.GetSecurityFilter" => { - "security_filter_id" => "String", - }, - "v2.UpdateSecurityFilter" => { - "security_filter_id" => "String", - "body" => "SecurityFilterUpdateRequest", - }, - "v2.CreateSecurityMonitoringSuppression" => { - "body" => "SecurityMonitoringSuppressionCreateRequest", - }, - "v2.DeleteSecurityMonitoringSuppression" => { - "suppression_id" => "String", - }, - "v2.GetSecurityMonitoringSuppression" => { - "suppression_id" => "String", - }, - "v2.UpdateSecurityMonitoringSuppression" => { - "suppression_id" => "String", - "body" => "SecurityMonitoringSuppressionUpdateRequest", - }, - "v2.ListSecurityMonitoringRules" => { - "page_size" => "Integer", - "page_number" => "Integer", - }, - "v2.CreateSecurityMonitoringRule" => { - "body" => "SecurityMonitoringRuleCreatePayload", - }, - "v2.ConvertSecurityMonitoringRuleFromJSONToTerraform" => { - "body" => "SecurityMonitoringRuleConvertPayload", - }, - "v2.TestSecurityMonitoringRule" => { - "body" => "SecurityMonitoringRuleTestRequest", - }, - "v2.ValidateSecurityMonitoringRule" => { - "body" => "SecurityMonitoringRuleValidatePayload", - }, - "v2.DeleteSecurityMonitoringRule" => { - "rule_id" => "String", - }, - "v2.GetSecurityMonitoringRule" => { - "rule_id" => "String", - }, - "v2.UpdateSecurityMonitoringRule" => { - "rule_id" => "String", - "body" => "SecurityMonitoringRuleUpdatePayload", - }, - "v2.ConvertExistingSecurityMonitoringRule" => { - "rule_id" => "String", - }, - "v2.TestExistingSecurityMonitoringRule" => { - "rule_id" => "String", - "body" => "SecurityMonitoringRuleTestRequest", - }, - "v2.ListSecurityMonitoringSignals" => { - "filter_query" => "String", - "filter_from" => "Time", - "filter_to" => "Time", - "sort" => "SecurityMonitoringSignalsSort", - "page_cursor" => "String", - "page_limit" => "Integer", - }, - "v2.SearchSecurityMonitoringSignals" => { - "body" => "SecurityMonitoringSignalListRequest", - }, - "v2.GetSecurityMonitoringSignal" => { - "signal_id" => "String", - }, - "v2.EditSecurityMonitoringSignalAssignee" => { - "signal_id" => "String", - "body" => "SecurityMonitoringSignalAssigneeUpdateRequest", - }, - "v2.EditSecurityMonitoringSignalIncidents" => { - "signal_id" => "String", - "body" => "SecurityMonitoringSignalIncidentsUpdateRequest", - }, - "v2.EditSecurityMonitoringSignalState" => { - "signal_id" => "String", - "body" => "SecurityMonitoringSignalStateUpdateRequest", - }, - "v2.ListHistoricalJobs" => { - "page_size" => "Integer", - "page_number" => "Integer", - "sort" => "String", - "filter_query" => "String", - }, - "v2.RunHistoricalJob" => { - "body" => "RunHistoricalJobRequest", - }, - "v2.ConvertJobResultToSignal" => { - "body" => "ConvertJobResultsToSignalsRequest", - }, - "v2.DeleteHistoricalJob" => { - "job_id" => "String", - }, - "v2.GetHistoricalJob" => { - "job_id" => "String", - }, - "v2.CancelHistoricalJob" => { - "job_id" => "String", - }, "v2.ListPowerpacks" => { "page_limit" => "Integer", "page_offset" => "Integer", diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 362378f63492..23dffe98a242 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -171,6 +171,20 @@ Feature: Security Monitoring And the response "message" is equal to "ddd" And the response "options.complianceRuleOptions.resourceType" is equal to "gcp_compute_disk" + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Create a custom framework returns "Bad Request" response + Given new "CreateCustomFramework" request + And body with value {"handle": "", "name": "", "requirements": [{"controls": [{"name": "", "rule_ids": [""]}], "name": ""}], "version": ""} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Create a custom framework returns "OK" response + Given new "CreateCustomFramework" request + And body with value {"handle": "", "name": "", "requirements": [{"controls": [{"name": "", "rule_ids": [""]}], "name": ""}], "version": ""} + When the request is sent + Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform Scenario: Create a detection rule returns "Bad Request" response Given new "CreateSecurityMonitoringRule" request @@ -827,6 +841,24 @@ Feature: Security Monitoring And the response "name" is equal to "{{ unique }}_cloud_updated" And the response "id" has the same value as "cloud_configuration_rule.id" + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Update a custom framework returns "Bad Request" response + Given new "UpdateCustomFramework" request + And request contains "handle" parameter from "REPLACE.ME" + And request contains "version" parameter from "REPLACE.ME" + And body with value {"handle": "", "name": "", "requirements": [{"controls": [{"name": "", "rule_ids": [""]}], "name": ""}], "version": ""} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Update a custom framework returns "OK" response + Given new "UpdateCustomFramework" request + And request contains "handle" parameter from "REPLACE.ME" + And request contains "version" parameter from "REPLACE.ME" + And body with value {"handle": "", "name": "", "requirements": [{"controls": [{"name": "", "rule_ids": [""]}], "name": ""}], "version": ""} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Update a security filter returns "Bad Request" response Given new "UpdateSecurityFilter" request diff --git a/features/v2/undo.json b/features/v2/undo.json index d6c6e9de87c6..154e3c46f158 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -439,6 +439,18 @@ "type": "safe" } }, + "CreateCustomFramework": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "UpdateCustomFramework": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "ListContainerImages": { "tag": "Container Images", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index cc4894593d02..37c7c7e8e14c 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -202,6 +202,17 @@ def initialize "v2.get_app": false, "v2.list_apps": false, "v2.update_app": false, + "v2.cancel_historical_job": false, + "v2.convert_job_result_to_signal": false, + "v2.delete_historical_job": false, + "v2.get_finding": false, + "v2.get_historical_job": false, + "v2.list_findings": false, + "v2.list_historical_jobs": false, + "v2.list_vulnerabilities": false, + "v2.list_vulnerable_assets": false, + "v2.mute_findings": false, + "v2.run_historical_job": false, "v2.get_active_billing_dimensions": false, "v2.get_billing_dimension_mapping": false, "v2.get_monthly_cost_attribution": false, @@ -241,17 +252,6 @@ def initialize "v2.list_aws_namespaces": false, "v2.update_aws_account": false, "v2.list_aws_logs_services": false, - "v2.cancel_historical_job": false, - "v2.convert_job_result_to_signal": false, - "v2.delete_historical_job": false, - "v2.get_finding": false, - "v2.get_historical_job": false, - "v2.list_findings": false, - "v2.list_historical_jobs": false, - "v2.list_vulnerabilities": false, - "v2.list_vulnerable_assets": false, - "v2.mute_findings": false, - "v2.run_historical_job": false, "v2.create_scorecard_outcomes_batch": false, "v2.create_scorecard_rule": false, "v2.delete_scorecard_rule": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 87bf19619568..7abbf48f66b9 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1292,6 +1292,7 @@ def overrides "v2.create_app_response" => "CreateAppResponse", "v2.create_app_response_data" => "CreateAppResponseData", "v2.create_app_response_data_type" => "CreateAppResponseDataType", + "v2.create_custom_framework_request" => "CreateCustomFrameworkRequest", "v2.create_data_deletion_request_body" => "CreateDataDeletionRequestBody", "v2.create_data_deletion_request_body_attributes" => "CreateDataDeletionRequestBodyAttributes", "v2.create_data_deletion_request_body_data" => "CreateDataDeletionRequestBodyData", @@ -1599,6 +1600,8 @@ def overrides "v2.finding_type" => "FindingType", "v2.finding_vulnerability_type" => "FindingVulnerabilityType", "v2.formula_limit" => "FormulaLimit", + "v2.framework_control" => "FrameworkControl", + "v2.framework_requirement" => "FrameworkRequirement", "v2.full_api_key" => "FullAPIKey", "v2.full_api_key_attributes" => "FullAPIKeyAttributes", "v2.full_application_key" => "FullApplicationKey", @@ -2706,6 +2709,7 @@ def overrides "v2.update_app_response_data_attributes" => "UpdateAppResponseDataAttributes", "v2.update_app_response_data_type" => "UpdateAppResponseDataType", "v2.update_app_response_relationship" => "UpdateAppResponseRelationship", + "v2.update_custom_framework_request" => "UpdateCustomFrameworkRequest", "v2.update_open_api_response" => "UpdateOpenAPIResponse", "v2.update_open_api_response_attributes" => "UpdateOpenAPIResponseAttributes", "v2.update_open_api_response_data" => "UpdateOpenAPIResponseData", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index 4751c01317bf..4f6ac96e73f3 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -301,6 +301,73 @@ def convert_security_monitoring_rule_from_json_to_terraform_with_http_info(body, return data, status_code, headers end + # Create a custom framework. + # + # @see #create_custom_framework_with_http_info + def create_custom_framework(body, opts = {}) + create_custom_framework_with_http_info(body, opts) + nil + end + + # Create a custom framework. + # + # Create a custom framework. + # + # @param body [CreateCustomFrameworkRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def create_custom_framework_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.create_custom_framework ...' + 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 SecurityMonitoringAPI.create_custom_framework" + end + # resource path + local_var_path = '/api/v2/cloud_security_management/custom_frameworks' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_custom_framework, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#create_custom_framework\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a security filter. # # @see #create_security_filter_with_http_info @@ -2688,6 +2755,83 @@ def test_security_monitoring_rule_with_http_info(body, opts = {}) return data, status_code, headers end + # Update a custom framework. + # + # @see #update_custom_framework_with_http_info + def update_custom_framework(handle, version, body, opts = {}) + update_custom_framework_with_http_info(handle, version, body, opts) + nil + end + + # Update a custom framework. + # + # Update a custom framework. + # + # @param handle [String] The framework handle + # @param version [String] The framework version + # @param body [UpdateCustomFrameworkRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_custom_framework_with_http_info(handle, version, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.update_custom_framework ...' + end + # verify the required parameter 'handle' is set + if @api_client.config.client_side_validation && handle.nil? + fail ArgumentError, "Missing the required parameter 'handle' when calling SecurityMonitoringAPI.update_custom_framework" + end + # verify the required parameter 'version' is set + if @api_client.config.client_side_validation && version.nil? + fail ArgumentError, "Missing the required parameter 'version' when calling SecurityMonitoringAPI.update_custom_framework" + 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 SecurityMonitoringAPI.update_custom_framework" + end + # resource path + local_var_path = '/api/v2/cloud_security_management/custom_frameworks/{handle}/{version}'.sub('{handle}', CGI.escape(handle.to_s).gsub('%2F', '/')).sub('{version}', CGI.escape(version.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(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_custom_framework, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#update_custom_framework\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a security filter. # # @see #update_security_filter_with_http_info diff --git a/lib/datadog_api_client/v2/models/create_custom_framework_request.rb b/lib/datadog_api_client/v2/models/create_custom_framework_request.rb new file mode 100644 index 000000000000..5c86e1ccc2ba --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_custom_framework_request.rb @@ -0,0 +1,208 @@ +=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 + # Framework Data. + class CreateCustomFrameworkRequest + include BaseGenericModel + + # Framework Description + attr_accessor :description + + # Framework Handle + attr_reader :handle + + # Framework Icon URL + attr_accessor :icon_url + + # Framework Name + attr_reader :name + + # Framework Requirements + attr_reader :requirements + + # Framework Version + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'handle' => :'handle', + :'icon_url' => :'icon_url', + :'name' => :'name', + :'requirements' => :'requirements', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'handle' => :'String', + :'icon_url' => :'String', + :'name' => :'String', + :'requirements' => :'Array', + :'version' => :'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::CreateCustomFrameworkRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'handle') + self.handle = attributes[:'handle'] + end + + if attributes.key?(:'icon_url') + self.icon_url = attributes[:'icon_url'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'requirements') + if (value = attributes[:'requirements']).is_a?(Array) + self.requirements = value + end + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @handle.nil? + return false if @name.nil? + return false if @requirements.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param handle [Object] Object to be assigned + # @!visibility private + def handle=(handle) + if handle.nil? + fail ArgumentError, 'invalid value for "handle", handle cannot be nil.' + end + @handle = handle + end + + # Custom attribute writer method with validation + # @param 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 requirements [Object] Object to be assigned + # @!visibility private + def requirements=(requirements) + if requirements.nil? + fail ArgumentError, 'invalid value for "requirements", requirements cannot be nil.' + end + @requirements = requirements + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + handle == o.handle && + icon_url == o.icon_url && + name == o.name && + requirements == o.requirements && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, handle, icon_url, name, requirements, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/framework_control.rb b/lib/datadog_api_client/v2/models/framework_control.rb new file mode 100644 index 000000000000..31a4a96c7f32 --- /dev/null +++ b/lib/datadog_api_client/v2/models/framework_control.rb @@ -0,0 +1,146 @@ +=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 + # Framework Control. + class FrameworkControl + include BaseGenericModel + + # Control Name. + attr_reader :name + + # Rule IDs. + attr_reader :rule_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'rule_ids' => :'rule_ids' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'rule_ids' => :'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::FrameworkControl` 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'rule_ids') + if (value = attributes[:'rule_ids']).is_a?(Array) + self.rule_ids = 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 @name.nil? + return false if @rule_ids.nil? + true + 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 rule_ids [Object] Object to be assigned + # @!visibility private + def rule_ids=(rule_ids) + if rule_ids.nil? + fail ArgumentError, 'invalid value for "rule_ids", rule_ids cannot be nil.' + end + @rule_ids = rule_ids + 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 && + name == o.name && + rule_ids == o.rule_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, rule_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/framework_requirement.rb b/lib/datadog_api_client/v2/models/framework_requirement.rb new file mode 100644 index 000000000000..f1c0a8691fb9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/framework_requirement.rb @@ -0,0 +1,146 @@ +=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 + # Framework Requirement. + class FrameworkRequirement + include BaseGenericModel + + # Requirement Controls. + attr_reader :controls + + # Requirement Name. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'controls' => :'controls', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'controls' => :'Array', + :'name' => :'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::FrameworkRequirement` 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?(:'controls') + if (value = attributes[:'controls']).is_a?(Array) + self.controls = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 @controls.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param controls [Object] Object to be assigned + # @!visibility private + def controls=(controls) + if controls.nil? + fail ArgumentError, 'invalid value for "controls", controls cannot be nil.' + end + @controls = controls + 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 + + # 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 && + controls == o.controls && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [controls, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_custom_framework_request.rb b/lib/datadog_api_client/v2/models/update_custom_framework_request.rb new file mode 100644 index 000000000000..f9698e72c0f5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_custom_framework_request.rb @@ -0,0 +1,208 @@ +=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 + # Framework Data. + class UpdateCustomFrameworkRequest + include BaseGenericModel + + # Framework Description + attr_accessor :description + + # Framework Handle + attr_reader :handle + + # Framework Icon URL + attr_accessor :icon_url + + # Framework Name + attr_reader :name + + # Framework Requirements + attr_reader :requirements + + # Framework Version + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'handle' => :'handle', + :'icon_url' => :'icon_url', + :'name' => :'name', + :'requirements' => :'requirements', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'handle' => :'String', + :'icon_url' => :'String', + :'name' => :'String', + :'requirements' => :'Array', + :'version' => :'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::UpdateCustomFrameworkRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'handle') + self.handle = attributes[:'handle'] + end + + if attributes.key?(:'icon_url') + self.icon_url = attributes[:'icon_url'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'requirements') + if (value = attributes[:'requirements']).is_a?(Array) + self.requirements = value + end + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @handle.nil? + return false if @name.nil? + return false if @requirements.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param handle [Object] Object to be assigned + # @!visibility private + def handle=(handle) + if handle.nil? + fail ArgumentError, 'invalid value for "handle", handle cannot be nil.' + end + @handle = handle + end + + # Custom attribute writer method with validation + # @param 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 requirements [Object] Object to be assigned + # @!visibility private + def requirements=(requirements) + if requirements.nil? + fail ArgumentError, 'invalid value for "requirements", requirements cannot be nil.' + end + @requirements = requirements + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + handle == o.handle && + icon_url == o.icon_url && + name == o.name && + requirements == o.requirements && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, handle, icon_url, name, requirements, version, additional_properties].hash + end + end +end