Class: SemgrepWebApp::ProjectsServiceApi
- Defined in:
- lib/semgrep_web_app/apis/projects_service_api.rb
Overview
ProjectsServiceApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#add_project_tags(deployment_slug, project_name, body) ⇒ ApiResponse
Add tags to a project for a deployment you have access to.
-
#delete_project(deployment_slug, project_name) ⇒ ApiResponse
Delete a project for a deployment you have access to.
-
#delete_project_tags(deployment_slug, project_name, tags: nil) ⇒ ApiResponse
Remove tags from a project for a deployment you have access to.
-
#get_project(deployment_slug, project_name) ⇒ ApiResponse
Retrieve details for a single project associated with a deployment that you have access to.
-
#list_projects(deployment_slug, page: nil, page_size: 100) ⇒ ApiResponse
Request the list of projects that have been scanned or onboarded to Managed Scans.
-
#toggle_project_managed_scan(deployment_slug, project_name, body) ⇒ ApiResponse
Enable or disable Semgrep Managed Scans for a project.
-
#update_project(deployment_slug, project_name, body) ⇒ ApiResponse
Update attributes for the project using the value passed in to the request body.
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
#add_project_tags(deployment_slug, project_name, body) ⇒ ApiResponse
Add tags to a project for a deployment you have access to. Any project tags that do not already exist for the deployment will be created automatically and associated with the project. here here description here
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/semgrep_web_app/apis/projects_service_api.rb', line 212 def (deployment_slug, project_name, body) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/v1/deployments/{deploymentSlug}/projects/{projectName}/tags', Server::SEMGREP) .template_param(new_parameter(deployment_slug, key: 'deploymentSlug') .is_required(true) .should_encode(true)) .template_param(new_parameter(project_name, key: 'projectName') .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(AddProjectTagsResponse.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_project(deployment_slug, project_name) ⇒ ApiResponse
Delete a project for a deployment you have access to. This will also delete all of the associated findings. here here
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/semgrep_web_app/apis/projects_service_api.rb', line 45 def delete_project(deployment_slug, project_name) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/v1/deployments/{deploymentSlug}/projects/{projectName}', Server::SEMGREP) .template_param(new_parameter(deployment_slug, key: 'deploymentSlug') .is_required(true) .should_encode(true)) .template_param(new_parameter(project_name, key: 'projectName') .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(DeleteProjectResponse.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_project_tags(deployment_slug, project_name, tags: nil) ⇒ ApiResponse
Remove tags from a project for a deployment you have access to. This request will not delete project tags from the deployment and will only remove them from the requested project. Any other projects associated with the requested tag will remain unaffected. here here here
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/semgrep_web_app/apis/projects_service_api.rb', line 179 def (deployment_slug, project_name, tags: nil) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/v1/deployments/{deploymentSlug}/projects/{projectName}/tags', Server::SEMGREP) .template_param(new_parameter(deployment_slug, key: 'deploymentSlug') .is_required(true) .should_encode(true)) .template_param(new_parameter(project_name, key: 'projectName') .is_required(true) .should_encode(true)) .query_param(new_parameter(, key: 'tags')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('SemgrepWebToken'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DeleteProjectTagsResponse.method(:from_hash)) .is_api_response(true)) .execute end |
#get_project(deployment_slug, project_name) ⇒ ApiResponse
Retrieve details for a single project associated with a deployment that you have access to. here here
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/semgrep_web_app/apis/projects_service_api.rb', line 73 def get_project(deployment_slug, project_name) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/deployments/{deploymentSlug}/projects/{projectName}', Server::SEMGREP) .template_param(new_parameter(deployment_slug, key: 'deploymentSlug') .is_required(true) .should_encode(true)) .template_param(new_parameter(project_name, key: 'projectName') .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(GetProjectResponse.method(:from_hash)) .is_api_response(true)) .execute end |
#list_projects(deployment_slug, page: nil, page_size: 100) ⇒ ApiResponse
Request the list of projects that have been scanned or onboarded to Managed Scans. Does not return archived repositories. Returns 100 projects per page by default. here
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/semgrep_web_app/apis/projects_service_api.rb', line 17 def list_projects(deployment_slug, page: nil, page_size: 100) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/deployments/{deploymentSlug}/projects', Server::SEMGREP) .template_param(new_parameter(deployment_slug, key: 'deploymentSlug') .is_required(true) .should_encode(true)) .query_param(new_parameter(page, key: 'page')) .query_param(new_parameter(page_size, key: 'page_size')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('SemgrepWebToken'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ListProjectsResponse.method(:from_hash)) .is_api_response(true)) .execute end |
#toggle_project_managed_scan(deployment_slug, project_name, body) ⇒ ApiResponse
Enable or disable Semgrep Managed Scans for a project. here here type description here
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/semgrep_web_app/apis/projects_service_api.rb', line 140 def toggle_project_managed_scan(deployment_slug, project_name, body) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/api/v1/deployments/{deploymentSlug}/projects/{projectName}/managed-scan', Server::SEMGREP) .template_param(new_parameter(deployment_slug, key: 'deploymentSlug') .is_required(true) .should_encode(true)) .template_param(new_parameter(project_name, key: 'projectName') .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(ToggleProjectManagedScanResponse.method(:from_hash)) .is_api_response(true)) .execute end |
#update_project(deployment_slug, project_name, body) ⇒ ApiResponse
Update attributes for the project using the value passed in to the request
body.
Note: The only attribute that is supported as of January 2023 is tags.
here
here
description here
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/semgrep_web_app/apis/projects_service_api.rb', line 104 def update_project(deployment_slug, project_name, body) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/api/v1/deployments/{deploymentSlug}/projects/{projectName}', Server::SEMGREP) .template_param(new_parameter(deployment_slug, key: 'deploymentSlug') .is_required(true) .should_encode(true)) .template_param(new_parameter(project_name, key: 'projectName') .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(UpdateProjectResponse.method(:from_hash)) .is_api_response(true)) .execute end |