|
| 1 | +=begin |
| 2 | +#Datadog API V2 Collection |
| 3 | +
|
| 4 | +#Collection of all Datadog Public endpoints. |
| 5 | +
|
| 6 | +The version of the OpenAPI document: 1.0 |
| 7 | + |
| 8 | +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator |
| 9 | +
|
| 10 | + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 11 | + This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 12 | + Copyright 2020-Present Datadog, Inc. |
| 13 | +
|
| 14 | +=end |
| 15 | + |
| 16 | +require 'cgi' |
| 17 | + |
| 18 | +module DatadogAPIClient::V2 |
| 19 | + class StaticAnalysisAPI |
| 20 | + attr_accessor :api_client |
| 21 | + |
| 22 | + def initialize(api_client = DatadogAPIClient::APIClient.default) |
| 23 | + @api_client = api_client |
| 24 | + end |
| 25 | + |
| 26 | + # POST request to resolve vulnerable symbols. |
| 27 | + # |
| 28 | + # @see #create_sca_resolve_vulnerable_symbols_with_http_info |
| 29 | + def create_sca_resolve_vulnerable_symbols(body, opts = {}) |
| 30 | + data, _status_code, _headers = create_sca_resolve_vulnerable_symbols_with_http_info(body, opts) |
| 31 | + data |
| 32 | + end |
| 33 | + |
| 34 | + # POST request to resolve vulnerable symbols. |
| 35 | + # |
| 36 | + # Post vulnerable symbols |
| 37 | + # |
| 38 | + # @param body [ResolveVulnerableSymbolsRequest] |
| 39 | + # @param opts [Hash] the optional parameters |
| 40 | + # @return [Array<(ResolveVulnerableSymbolsResponse, Integer, Hash)>] ResolveVulnerableSymbolsResponse data, response status code and response headers |
| 41 | + def create_sca_resolve_vulnerable_symbols_with_http_info(body, opts = {}) |
| 42 | + unstable_enabled = @api_client.config.unstable_operations["v2.create_sca_resolve_vulnerable_symbols".to_sym] |
| 43 | + if unstable_enabled |
| 44 | + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_sca_resolve_vulnerable_symbols") |
| 45 | + else |
| 46 | + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_sca_resolve_vulnerable_symbols")) |
| 47 | + end |
| 48 | + |
| 49 | + if @api_client.config.debugging |
| 50 | + @api_client.config.logger.debug 'Calling API: StaticAnalysisAPI.create_sca_resolve_vulnerable_symbols ...' |
| 51 | + end |
| 52 | + # verify the required parameter 'body' is set |
| 53 | + if @api_client.config.client_side_validation && body.nil? |
| 54 | + fail ArgumentError, "Missing the required parameter 'body' when calling StaticAnalysisAPI.create_sca_resolve_vulnerable_symbols" |
| 55 | + end |
| 56 | + # resource path |
| 57 | + local_var_path = '/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols' |
| 58 | + |
| 59 | + # query parameters |
| 60 | + query_params = opts[:query_params] || {} |
| 61 | + |
| 62 | + # header parameters |
| 63 | + header_params = opts[:header_params] || {} |
| 64 | + # HTTP header 'Accept' (if needed) |
| 65 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 66 | + # HTTP header 'Content-Type' |
| 67 | + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) |
| 68 | + |
| 69 | + # form parameters |
| 70 | + form_params = opts[:form_params] || {} |
| 71 | + |
| 72 | + # http body (model) |
| 73 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) |
| 74 | + |
| 75 | + # return_type |
| 76 | + return_type = opts[:debug_return_type] || 'ResolveVulnerableSymbolsResponse' |
| 77 | + |
| 78 | + # auth_names |
| 79 | + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] |
| 80 | + |
| 81 | + new_options = opts.merge( |
| 82 | + :operation => :create_sca_resolve_vulnerable_symbols, |
| 83 | + :header_params => header_params, |
| 84 | + :query_params => query_params, |
| 85 | + :form_params => form_params, |
| 86 | + :body => post_body, |
| 87 | + :auth_names => auth_names, |
| 88 | + :return_type => return_type, |
| 89 | + :api_version => "V2" |
| 90 | + ) |
| 91 | + |
| 92 | + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) |
| 93 | + if @api_client.config.debugging |
| 94 | + @api_client.config.logger.debug "API called: StaticAnalysisAPI#create_sca_resolve_vulnerable_symbols\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 95 | + end |
| 96 | + return data, status_code, headers |
| 97 | + end |
| 98 | + |
| 99 | + # Post dependencies for analysis. |
| 100 | + # |
| 101 | + # @see #create_sca_result_with_http_info |
| 102 | + def create_sca_result(body, opts = {}) |
| 103 | + create_sca_result_with_http_info(body, opts) |
| 104 | + nil |
| 105 | + end |
| 106 | + |
| 107 | + # Post dependencies for analysis. |
| 108 | + # |
| 109 | + # Post dependencies for analysis |
| 110 | + # |
| 111 | + # @param body [ScaRequest] |
| 112 | + # @param opts [Hash] the optional parameters |
| 113 | + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers |
| 114 | + def create_sca_result_with_http_info(body, opts = {}) |
| 115 | + unstable_enabled = @api_client.config.unstable_operations["v2.create_sca_result".to_sym] |
| 116 | + if unstable_enabled |
| 117 | + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_sca_result") |
| 118 | + else |
| 119 | + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_sca_result")) |
| 120 | + end |
| 121 | + |
| 122 | + if @api_client.config.debugging |
| 123 | + @api_client.config.logger.debug 'Calling API: StaticAnalysisAPI.create_sca_result ...' |
| 124 | + end |
| 125 | + # verify the required parameter 'body' is set |
| 126 | + if @api_client.config.client_side_validation && body.nil? |
| 127 | + fail ArgumentError, "Missing the required parameter 'body' when calling StaticAnalysisAPI.create_sca_result" |
| 128 | + end |
| 129 | + # resource path |
| 130 | + local_var_path = '/api/v2/static-analysis-sca/dependencies' |
| 131 | + |
| 132 | + # query parameters |
| 133 | + query_params = opts[:query_params] || {} |
| 134 | + |
| 135 | + # header parameters |
| 136 | + header_params = opts[:header_params] || {} |
| 137 | + # HTTP header 'Accept' (if needed) |
| 138 | + header_params['Accept'] = @api_client.select_header_accept(['*/*']) |
| 139 | + # HTTP header 'Content-Type' |
| 140 | + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) |
| 141 | + |
| 142 | + # form parameters |
| 143 | + form_params = opts[:form_params] || {} |
| 144 | + |
| 145 | + # http body (model) |
| 146 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) |
| 147 | + |
| 148 | + # return_type |
| 149 | + return_type = opts[:debug_return_type] |
| 150 | + |
| 151 | + # auth_names |
| 152 | + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] |
| 153 | + |
| 154 | + new_options = opts.merge( |
| 155 | + :operation => :create_sca_result, |
| 156 | + :header_params => header_params, |
| 157 | + :query_params => query_params, |
| 158 | + :form_params => form_params, |
| 159 | + :body => post_body, |
| 160 | + :auth_names => auth_names, |
| 161 | + :return_type => return_type, |
| 162 | + :api_version => "V2" |
| 163 | + ) |
| 164 | + |
| 165 | + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) |
| 166 | + if @api_client.config.debugging |
| 167 | + @api_client.config.logger.debug "API called: StaticAnalysisAPI#create_sca_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 168 | + end |
| 169 | + return data, status_code, headers |
| 170 | + end |
| 171 | + end |
| 172 | +end |
0 commit comments