Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
451 changes: 451 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions examples/v2/security-monitoring/GetSecretsRules.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Returns list of Secrets rules returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_secrets_rules".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
p api_instance.get_secrets_rules()
17 changes: 17 additions & 0 deletions examples/v2/security-monitoring/ListMultipleRulesets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ruleset get multiple returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.list_multiple_rulesets".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new

body = DatadogAPIClient::V2::GetMultipleRulesetsRequest.new({
data: DatadogAPIClient::V2::GetMultipleRulesetsRequestData.new({
attributes: DatadogAPIClient::V2::GetMultipleRulesetsRequestDataAttributes.new({
rulesets: [],
}),
type: DatadogAPIClient::V2::GetMultipleRulesetsRequestDataType::GET_MULTIPLE_RULESETS_REQUEST,
}),
})
p api_instance.list_multiple_rulesets(body)
3 changes: 3 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,9 @@
"page_cursor" => "String",
"page_limit" => "Integer",
},
"v2.ListMultipleRulesets" => {
"body" => "GetMultipleRulesetsRequest",
},
"v2.ListContainerImages" => {
"filter_tags" => "String",
"group_by" => "String",
Expand Down
759 changes: 571 additions & 188 deletions features/v2/security_monitoring.feature

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3780,6 +3780,20 @@
"type": "safe"
}
},
"ListMultipleRulesets": {
"tag": "Security Monitoring",
"undo": {
"operationId": "TODO",
"parameters": [],
"type": "unsafe"
}
},
"GetSecretsRules": {
"tag": "Security Monitoring",
"undo": {
"type": "safe"
}
},
"GetOnDemandConcurrencyCap": {
"tag": "Synthetics",
"undo": {
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ def initialize
"v2.get_historical_job": false,
"v2.get_rule_version_history": false,
"v2.get_sbom": false,
"v2.get_secrets_rules": false,
"v2.get_security_monitoring_histsignal": false,
"v2.get_security_monitoring_histsignals_by_job_id": false,
"v2.list_assets_sbo_ms": false,
"v2.list_findings": false,
"v2.list_historical_jobs": false,
"v2.list_multiple_rulesets": false,
"v2.list_security_monitoring_histsignals": false,
"v2.list_vulnerabilities": false,
"v2.list_vulnerable_assets": false,
Expand Down
23 changes: 23 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,22 @@ def overrides
"v2.get_interfaces_data" => "GetInterfacesData",
"v2.get_interfaces_response" => "GetInterfacesResponse",
"v2.get_issue_include_query_parameter_item" => "GetIssueIncludeQueryParameterItem",
"v2.get_multiple_rulesets_request" => "GetMultipleRulesetsRequest",
"v2.get_multiple_rulesets_request_data" => "GetMultipleRulesetsRequestData",
"v2.get_multiple_rulesets_request_data_attributes" => "GetMultipleRulesetsRequestDataAttributes",
"v2.get_multiple_rulesets_request_data_type" => "GetMultipleRulesetsRequestDataType",
"v2.get_multiple_rulesets_response" => "GetMultipleRulesetsResponse",
"v2.get_multiple_rulesets_response_data" => "GetMultipleRulesetsResponseData",
"v2.get_multiple_rulesets_response_data_attributes" => "GetMultipleRulesetsResponseDataAttributes",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items" => "GetMultipleRulesetsResponseDataAttributesRulesetsItems",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items_data" => "GetMultipleRulesetsResponseDataAttributesRulesetsItemsData",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items_data_type" => "GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items" => "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items" => "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data" => "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type" => "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType",
"v2.get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items" => "GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems",
"v2.get_multiple_rulesets_response_data_type" => "GetMultipleRulesetsResponseDataType",
"v2.get_resource_evaluation_filters_response" => "GetResourceEvaluationFiltersResponse",
"v2.get_resource_evaluation_filters_response_data" => "GetResourceEvaluationFiltersResponseData",
"v2.get_rule_version_history_data" => "GetRuleVersionHistoryData",
Expand Down Expand Up @@ -3518,6 +3534,13 @@ def overrides
"v2.schedule_user_type" => "ScheduleUserType",
"v2.scorecard_type" => "ScorecardType",
"v2.search_issues_include_query_parameter_item" => "SearchIssuesIncludeQueryParameterItem",
"v2.secret_rule_array" => "SecretRuleArray",
"v2.secret_rule_data" => "SecretRuleData",
"v2.secret_rule_data_attributes" => "SecretRuleDataAttributes",
"v2.secret_rule_data_attributes_match_validation" => "SecretRuleDataAttributesMatchValidation",
"v2.secret_rule_data_attributes_match_validation_invalid_http_status_code_items" => "SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems",
"v2.secret_rule_data_attributes_match_validation_valid_http_status_code_items" => "SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems",
"v2.secret_rule_data_type" => "SecretRuleDataType",
"v2.security_filter" => "SecurityFilter",
"v2.security_filter_attributes" => "SecurityFilterAttributes",
"v2.security_filter_create_attributes" => "SecurityFilterCreateAttributes",
Expand Down
139 changes: 139 additions & 0 deletions lib/datadog_api_client/v2/api/security_monitoring_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,72 @@ def get_sbom_with_http_info(asset_type, filter_asset_name, opts = {})
return data, status_code, headers
end

# Returns list of Secrets rules.
#
# @see #get_secrets_rules_with_http_info
def get_secrets_rules(opts = {})
data, _status_code, _headers = get_secrets_rules_with_http_info(opts)
data
end

# Returns list of Secrets rules.
#
# Returns list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID
#
# @param opts [Hash] the optional parameters
# @return [Array<(SecretRuleArray, Integer, Hash)>] SecretRuleArray data, response status code and response headers
def get_secrets_rules_with_http_info(opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.get_secrets_rules".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_secrets_rules")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_secrets_rules"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.get_secrets_rules ...'
end
# resource path
local_var_path = '/api/v2/static-analysis/secrets/rules'

# 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] || 'SecretRuleArray'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

new_options = opts.merge(
:operation => :get_secrets_rules,
: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: SecurityMonitoringAPI#get_secrets_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get a security filter.
#
# @see #get_security_filter_with_http_info
Expand Down Expand Up @@ -2993,6 +3059,79 @@ def list_historical_jobs_with_http_info(opts = {})
return data, status_code, headers
end

# Ruleset get multiple.
#
# @see #list_multiple_rulesets_with_http_info
def list_multiple_rulesets(body, opts = {})
data, _status_code, _headers = list_multiple_rulesets_with_http_info(body, opts)
data
end

# Ruleset get multiple.
#
# Get rules for multiple rulesets in batch.
#
# @param body [GetMultipleRulesetsRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(GetMultipleRulesetsResponse, Integer, Hash)>] GetMultipleRulesetsResponse data, response status code and response headers
def list_multiple_rulesets_with_http_info(body, opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.list_multiple_rulesets".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_multiple_rulesets")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_multiple_rulesets"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.list_multiple_rulesets ...'
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.list_multiple_rulesets"
end
# resource path
local_var_path = '/api/v2/static-analysis/rulesets'

# 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] || 'GetMultipleRulesetsResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

new_options = opts.merge(
:operation => :list_multiple_rulesets,
: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#list_multiple_rulesets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get all security filters.
#
# @see #list_security_filters_with_http_info
Expand Down
105 changes: 105 additions & 0 deletions lib/datadog_api_client/v2/models/get_multiple_rulesets_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
=begin
#Datadog API V2 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: [email protected]
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 `GetMultipleRulesetsRequest` object.
class GetMultipleRulesetsRequest
include BaseGenericModel

# The definition of `GetMultipleRulesetsRequestData` object.
attr_accessor :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' => :'GetMultipleRulesetsRequestData'
}
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::GetMultipleRulesetsRequest` 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

# 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
Loading
Loading