=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 SensitiveDataScannerAPI attr_accessor :api_client def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end # Create Scanning Group. # # @see #create_scanning_group_with_http_info def create_scanning_group(body, opts = {}) data, _status_code, _headers = create_scanning_group_with_http_info(body, opts) data end # Create Scanning Group. # # Create a scanning group. # The request MAY include a configuration relationship. # A rules relationship can be omitted entirely, but if it is included it MUST be # null or an empty array (rules cannot be created at the same time). # The new group will be ordered last within the configuration. # # @param body [SensitiveDataScannerGroupCreateRequest] # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerCreateGroupResponse, Integer, Hash)>] SensitiveDataScannerCreateGroupResponse data, response status code and response headers def create_scanning_group_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.create_scanning_group ...' 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 SensitiveDataScannerAPI.create_scanning_group" end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config/groups' # 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] || 'SensitiveDataScannerCreateGroupResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :create_scanning_group, :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: SensitiveDataScannerAPI#create_scanning_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create Scanning Rule. # # @see #create_scanning_rule_with_http_info def create_scanning_rule(body, opts = {}) data, _status_code, _headers = create_scanning_rule_with_http_info(body, opts) data end # Create Scanning Rule. # # Create a scanning rule in a sensitive data scanner group, ordered last. # The posted rule MUST include a group relationship. # It MUST include either a standard_pattern relationship or a regex attribute, but not both. # If included_attributes is empty or missing, we will scan all attributes except # excluded_attributes. If both are missing, we will scan the whole event. # # @param body [SensitiveDataScannerRuleCreateRequest] # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerCreateRuleResponse, Integer, Hash)>] SensitiveDataScannerCreateRuleResponse data, response status code and response headers def create_scanning_rule_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.create_scanning_rule ...' 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 SensitiveDataScannerAPI.create_scanning_rule" end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config/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']) # 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] || 'SensitiveDataScannerCreateRuleResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :create_scanning_rule, :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: SensitiveDataScannerAPI#create_scanning_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete Scanning Group. # # @see #delete_scanning_group_with_http_info def delete_scanning_group(group_id, body, opts = {}) data, _status_code, _headers = delete_scanning_group_with_http_info(group_id, body, opts) data end # Delete Scanning Group. # # Delete a given group. # # @param group_id [String] The ID of a group of rules. # @param body [SensitiveDataScannerGroupDeleteRequest] # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerGroupDeleteResponse, Integer, Hash)>] SensitiveDataScannerGroupDeleteResponse data, response status code and response headers def delete_scanning_group_with_http_info(group_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.delete_scanning_group ...' end # verify the required parameter 'group_id' is set if @api_client.config.client_side_validation && group_id.nil? fail ArgumentError, "Missing the required parameter 'group_id' when calling SensitiveDataScannerAPI.delete_scanning_group" 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 SensitiveDataScannerAPI.delete_scanning_group" end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config/groups/{group_id}'.sub('{group_id}', CGI.escape(group_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'SensitiveDataScannerGroupDeleteResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :delete_scanning_group, :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::Delete, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SensitiveDataScannerAPI#delete_scanning_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete Scanning Rule. # # @see #delete_scanning_rule_with_http_info def delete_scanning_rule(rule_id, body, opts = {}) data, _status_code, _headers = delete_scanning_rule_with_http_info(rule_id, body, opts) data end # Delete Scanning Rule. # # Delete a given rule. # # @param rule_id [String] The ID of the rule. # @param body [SensitiveDataScannerRuleDeleteRequest] # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerRuleDeleteResponse, Integer, Hash)>] SensitiveDataScannerRuleDeleteResponse data, response status code and response headers def delete_scanning_rule_with_http_info(rule_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.delete_scanning_rule ...' end # verify the required parameter 'rule_id' is set if @api_client.config.client_side_validation && rule_id.nil? fail ArgumentError, "Missing the required parameter 'rule_id' when calling SensitiveDataScannerAPI.delete_scanning_rule" 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 SensitiveDataScannerAPI.delete_scanning_rule" end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config/rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'SensitiveDataScannerRuleDeleteResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :delete_scanning_rule, :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::Delete, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SensitiveDataScannerAPI#delete_scanning_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Scanning Groups. # # @see #list_scanning_groups_with_http_info def list_scanning_groups(opts = {}) data, _status_code, _headers = list_scanning_groups_with_http_info(opts) data end # List Scanning Groups. # # List all the Scanning groups in your organization. # # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerGetConfigResponse, Integer, Hash)>] SensitiveDataScannerGetConfigResponse data, response status code and response headers def list_scanning_groups_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.list_scanning_groups ...' end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SensitiveDataScannerGetConfigResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :list_scanning_groups, :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: SensitiveDataScannerAPI#list_scanning_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List standard patterns. # # @see #list_standard_patterns_with_http_info def list_standard_patterns(opts = {}) data, _status_code, _headers = list_standard_patterns_with_http_info(opts) data end # List standard patterns. # # Returns all standard patterns. # # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerStandardPatternsResponseData, Integer, Hash)>] SensitiveDataScannerStandardPatternsResponseData data, response status code and response headers def list_standard_patterns_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.list_standard_patterns ...' end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config/standard-patterns' # 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] || 'SensitiveDataScannerStandardPatternsResponseData' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :list_standard_patterns, :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: SensitiveDataScannerAPI#list_standard_patterns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Reorder Groups. # # @see #reorder_scanning_groups_with_http_info def reorder_scanning_groups(body, opts = {}) data, _status_code, _headers = reorder_scanning_groups_with_http_info(body, opts) data end # Reorder Groups. # # Reorder the list of groups. # # @param body [SensitiveDataScannerConfigRequest] # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerReorderGroupsResponse, Integer, Hash)>] SensitiveDataScannerReorderGroupsResponse data, response status code and response headers def reorder_scanning_groups_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.reorder_scanning_groups ...' 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 SensitiveDataScannerAPI.reorder_scanning_groups" end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # 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] || 'SensitiveDataScannerReorderGroupsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :reorder_scanning_groups, :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: SensitiveDataScannerAPI#reorder_scanning_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update Scanning Group. # # @see #update_scanning_group_with_http_info def update_scanning_group(group_id, body, opts = {}) data, _status_code, _headers = update_scanning_group_with_http_info(group_id, body, opts) data end # Update Scanning Group. # # Update a group, including the order of the rules. # Rules within the group are reordered by including a rules relationship. If the rules # relationship is present, its data section MUST contain linkages for all of the rules # currently in the group, and MUST NOT contain any others. # # @param group_id [String] The ID of a group of rules. # @param body [SensitiveDataScannerGroupUpdateRequest] # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerGroupUpdateResponse, Integer, Hash)>] SensitiveDataScannerGroupUpdateResponse data, response status code and response headers def update_scanning_group_with_http_info(group_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.update_scanning_group ...' end # verify the required parameter 'group_id' is set if @api_client.config.client_side_validation && group_id.nil? fail ArgumentError, "Missing the required parameter 'group_id' when calling SensitiveDataScannerAPI.update_scanning_group" 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 SensitiveDataScannerAPI.update_scanning_group" end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config/groups/{group_id}'.sub('{group_id}', CGI.escape(group_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'SensitiveDataScannerGroupUpdateResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :update_scanning_group, :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: SensitiveDataScannerAPI#update_scanning_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update Scanning Rule. # # @see #update_scanning_rule_with_http_info def update_scanning_rule(rule_id, body, opts = {}) data, _status_code, _headers = update_scanning_rule_with_http_info(rule_id, body, opts) data end # Update Scanning Rule. # # Update a scanning rule. # The request body MUST NOT include a standard_pattern relationship, as that relationship # is non-editable. Trying to edit the regex attribute of a rule with a standard_pattern # relationship will also result in an error. # # @param rule_id [String] The ID of the rule. # @param body [SensitiveDataScannerRuleUpdateRequest] # @param opts [Hash] the optional parameters # @return [Array<(SensitiveDataScannerRuleUpdateResponse, Integer, Hash)>] SensitiveDataScannerRuleUpdateResponse data, response status code and response headers def update_scanning_rule_with_http_info(rule_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.update_scanning_rule ...' end # verify the required parameter 'rule_id' is set if @api_client.config.client_side_validation && rule_id.nil? fail ArgumentError, "Missing the required parameter 'rule_id' when calling SensitiveDataScannerAPI.update_scanning_rule" 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 SensitiveDataScannerAPI.update_scanning_rule" end # resource path local_var_path = '/api/v2/sensitive-data-scanner/config/rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'SensitiveDataScannerRuleUpdateResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :update_scanning_rule, :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: SensitiveDataScannerAPI#update_scanning_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end