Class: SemgrepWebApp::MiscServiceApi

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

Overview

MiscServiceApi

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_bootstrap_sms_vpcApiResponse

VPC support for Managed Scans is in private beta. Returns the Managed Scans VPC Bootstrap CloudFormation template in JSON format for setting up cross-account infrastructure. This template creates IAM roles and policies needed for Semgrep Managed Scanning (SMS) VPC infrastructure automation, including the semgrep-sms-vpc-automation role and EC2 Image Builder distribution roles for gVisor container runtime. See the original AWS cloudformation template format at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-fo rmats.html

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/semgrep_web_app/apis/misc_service_api.rb', line 20

def get_bootstrap_sms_vpc
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/bootstrap-sms-vpc',
                                 Server::SEMGREP)
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ProtosOpenapiV1GetBootstrapSmsVpcResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#pingApiResponse

Use to ping the server and assert liveness.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/semgrep_web_app/apis/misc_service_api.rb', line 35

def ping
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/ping',
                                 Server::SEMGREP)
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true))
    .execute
end