lib/oci/vulnerability_scanning/vulnerability_scanning_client.rb
# Exports a list of HostVulnerabilitySummary objects in a compartment in CSV format.
#
# @param [OCI::VulnerabilityScanning::Models::ExportHostVulnerabilityCsvDetails] export_host_vulnerability_csv_details Information on which scan results to export to CSV
# @param [Hash] opts the optional parameters
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
#   retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
# @option opts [String] :opc_request_id The client request ID for tracing.
# @option opts [String, IO] :response_target Streaming http body into a file (specified by file name or File object) or IO object if the block is not given
# @option [Block] &block Streaming http body to the block
# @return [Response] A Response object with data of type String if response_target and block are not given, otherwise with nil data
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/vulnerabilityscanning/export_host_vulnerability_csv.rb.html) to see an example of how to use export_host_vulnerability_csv API.
Exports a list of HostVulnerabilitySummary objects in a compartment in CSV format.
Exports a list of HostVulnerabilitySummary objects in a compartment in CSV format .
def export_host_vulnerability_csv(export_host_vulnerability_csv_details, opts = {}, &block)
      logger.debug 'Calling operation VulnerabilityScanningClient#export_host_vulnerability_csv.' if logger
      raise "Missing the required parameter 'export_host_vulnerability_csv_details' when calling export_host_vulnerability_csv." if export_host_vulnerability_csv_details.nil?
      path = '/hostVulnerabilities/actions/exportCsv'
      operation_signing_strategy = :standard
      query_params = {}
      header_params = {}
      header_params[:accept] = opts[:accept] if opts[:accept]
      header_params[:accept] ||= 'text/csv'
      header_params[:'accept-encoding'] = opts[:accept_encoding] if opts[:accept_encoding]
      header_params[:'content-type'] = 'application/json'
      header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
      post_body = @api_client.object_to_http_body(export_host_vulnerability_csv_details)
      OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'VulnerabilityScanningClient#export_host_vulnerability_csv') do
        if !block.nil?
          @api_client.call_api(
            :POST,
            path,
            endpoint,
            header_params: header_params,
            query_params: query_params,
            operation_signing_strategy: operation_signing_strategy,
            body: post_body,
            return_type: 'Stream',
            &block
          )
        elsif opts[:response_target]
          if opts[:response_target].respond_to? :write
            @api_client.call_api(
              :POST,
              path,
              endpoint,
              header_params: header_params,
              query_params: query_params,
              operation_signing_strategy: operation_signing_strategy,
              body: post_body,
              return_type: 'Stream',
              &proc { |chunk, _response| opts[:response_target].write(chunk) }
            )
          elsif opts[:response_target].is_a?(String)
            File.open(opts[:response_target], 'wb') do |output|
              return @api_client.call_api(
                :POST,
                path,
                endpoint,
                header_params: header_params,
                query_params: query_params,
                operation_signing_strategy: operation_signing_strategy,
                body: post_body,
                return_type: 'Stream',
                &proc { |chunk, _response| output.write(chunk) }
              )
            end
          end
        else
          @api_client.call_api(
            :POST,
            path,
            endpoint,
            header_params: header_params,
            query_params: query_params,
            operation_signing_strategy: operation_signing_strategy,
            body: post_body,
            return_type: 'String'
          )
        end
      end
    end
def export_host_vulnerability_csv ( export_host_vulnerability_csv_details , opts = { } , & block ) logger . debug 'Calling operation VulnerabilityScanningClient#export_host_vulnerability_csv.' if logger raise "Missing the required parameter 'export_host_vulnerability_csv_details' when calling export_host_vulnerability_csv." if export_host_vulnerability_csv_details . nil? path = '/hostVulnerabilities/actions/exportCsv' operation_signing_strategy = :standard query_params = { } header_params = { } header_params [ :accept ] = opts [ :accept ] if opts [ :accept ] header_params [ :accept ] ||= 'text/csv' header_params [ :' accept-encoding ' ] = opts [ :accept_encoding ] if opts [ :accept_encoding ] header_params [ :' content-type ' ] = 'application/json' header_params [ :' opc-request-id ' ] = opts [ :opc_request_id ] if opts [ :opc_request_id ] post_body = @api_client . object_to_http_body ( export_host_vulnerability_csv_details ) OCI :: Retry . make_retrying_call ( applicable_retry_config ( opts ) , call_name : 'VulnerabilityScanningClient#export_host_vulnerability_csv' ) do if ! block . nil? @api_client . call_api ( :POST , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'Stream' , & block ) elsif opts [ :response_target ] if opts [ :response_target ] . respond_to? :write @api_client . call_api ( :POST , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'Stream' , & proc { | chunk , _response | opts [ :response_target ] . write ( chunk ) } ) elsif opts [ :response_target ] . is_a? ( String ) File . open ( opts [ :response_target ] , 'wb' ) do | output | return @api_client . call_api ( :POST , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'Stream' , & proc { | chunk , _response | output . write ( chunk ) } ) end end else @api_client . call_api ( :POST , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'String' ) end end end
Exports a list of HostVulnerabilitySummary objects in a compartment in CSV format.
Exports a list of HostVulnerabilitySummary objects in a compartment in CSV format .
# rubocop:disable Style/NegatedIf # Query Params # Header Params # rubocop:enable Style/NegatedIf # rubocop:disable Metrics/BlockLength # rubocop:enable Metrics/BlockLength
A Response object with data of type String if response_target and block are not given, otherwise with nil data
A Response object with data of type String if response_target and block are not given otherwise with nil data
Response
export_host_vulnerability_csv_details
opts
:response_target Streaming http body into a file (specified by file name or File object) or IO object if the block is not given
: response_target Streaming http body into a file ( specified by file name or File object ) or IO object if the block is not given
block
█ Streaming http body to the block
█ Streaming http body to the block
note
Click [here] to see an example of how to use export_host_vulnerability_csv API.
Click [ here ] to see an example of how to use export_host_vulnerability_csv API .