Class: SemgrepWebApp::ScansServiceApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/semgrep_web_app/apis/scans_service_api.rb

Overview

ScansServiceApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from SemgrepWebApp::BaseApi

Instance Method Details

#get_scan(deployment_id, scan_id) ⇒ ApiResponse

Request the details of a scan including the associated deployment, repository, and commit information. here

Parameters:

  • deployment_id (String)

    Required parameter: TODO: type description

  • scan_id (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/semgrep_web_app/apis/scans_service_api.rb', line 15

def get_scan(deployment_id,
             scan_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/deployments/{deploymentId}/scan/{scanId}',
                                 Server::SEMGREP)
               .template_param(new_parameter(deployment_id, key: 'deploymentId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(scan_id, key: 'scanId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('SemgrepWebToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ProtosOpenapiV1GetScanResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#search_scans(deployment_id, body) ⇒ ApiResponse

List the scans associated with a particular repository over the past 30 days. here description here

Parameters:

  • deployment_id (String)

    Required parameter: TODO: type description

  • body (SearchScansRequest)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/semgrep_web_app/apis/scans_service_api.rb', line 43

def search_scans(deployment_id,
                 body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/deployments/{deploymentId}/scans/search',
                                 Server::SEMGREP)
               .template_param(new_parameter(deployment_id, key: 'deploymentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('SemgrepWebToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ProtosOpenapiV1SearchScansResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end