Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reporting field selection to jira integration #1603

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 74 additions & 5 deletions deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5347,6 +5347,51 @@
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/fields": {
"get": {
"tags": ["Common"],
"summary": "Get Scan Report Fields",
"description": "Get all the fields available in all the scan reports",
"operationId": "getScanReportFields",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ModelScanReportFieldsResponse" }
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsBadRequestResponse" }
}
}
},
"401": { "description": "Unauthorized" },
"403": { "description": "Forbidden" },
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
}
},
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/malware": {
"post": {
"tags": ["Malware Scan"],
Expand Down Expand Up @@ -6245,7 +6290,7 @@
"requestBody": {
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ModelComplianceScanTriggerReq" }
"schema": { "$ref": "#/components/schemas/ModelStopScanRequest" }
}
}
},
Expand Down Expand Up @@ -6380,9 +6425,7 @@
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelVulnerabilityScanTriggerReq"
}
"schema": { "$ref": "#/components/schemas/ModelStopScanRequest" }
}
}
},
Expand Down Expand Up @@ -10467,12 +10510,16 @@
"bucket_policy_is_public": { "type": "boolean" },
"cidr_ipv4": { "type": "string" },
"cloud_provider": { "type": "string" },
"cluster_arn": { "type": "string" },
"cluster_name": { "type": "string" },
"connectivity": { "type": "string" },
"container_definitions": {},
"containers": {},
"create_date": { "type": "string" },
"db_cluster_identifier": { "type": "string" },
"description": { "type": "string" },
"event_notification_configuration": {},
"group": { "type": "string" },
"group_id": { "type": "string" },
"groups": {},
"host_name": { "type": "string" },
Expand All @@ -10489,6 +10536,7 @@
"instances": {},
"ip_configuration": {},
"is_egress": { "type": "boolean" },
"last_status": { "type": "string" },
"name": { "type": "string" },
"network_configuration": {},
"network_interfaces": {},
Expand Down Expand Up @@ -10518,6 +10566,7 @@
"tags": {},
"target_group_arn": { "type": "string" },
"target_health_descriptions": {},
"task_arn": { "type": "string" },
"task_definition": {},
"task_definition_arn": { "type": "string" },
"user-groups": {},
Expand Down Expand Up @@ -10961,7 +11010,8 @@
"type": "array",
"items": { "type": "string" },
"nullable": true
}
},
"stop_requested": { "type": "boolean" }
}
},
"ModelCloudComplianceScanResult": {
Expand Down Expand Up @@ -11443,6 +11493,7 @@
"ModelContainerImage": {
"required": [
"node_id",
"image_node_id",
"node_name",
"docker_image_name",
"docker_image_tag",
Expand Down Expand Up @@ -11480,6 +11531,7 @@
"nullable": true
},
"docker_image_virtual_size": { "type": "string" },
"image_node_id": { "type": "string" },
"malware_latest_scan_id": { "type": "string" },
"malware_scan_status": { "type": "string" },
"malwares_count": { "type": "integer" },
Expand Down Expand Up @@ -12342,6 +12394,23 @@
}
}
},
"ModelScanReportFieldsResponse": {
"type": "object",
"properties": {
"compliance": {
"type": "array",
"items": { "type": "string" },
"nullable": true
},
"malware": { "type": "array", "items": { "type": "string" }, "nullable": true },
"secret": { "type": "array", "items": { "type": "string" }, "nullable": true },
"vulnerability": {
"type": "array",
"items": { "type": "string" },
"nullable": true
}
}
},
"ModelScanResultBasicNode": {
"required": ["result_id", "basic_nodes"],
"type": "object",
Expand Down
1 change: 1 addition & 0 deletions deepfence_frontend/apps/dashboard/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export function getCommonApiClient() {
const commonApi = new CommonApi(configuration);
return {
getEula: commonApi.eula.bind(commonApi),
getScanReportFields: commonApi.getScanReportFields.bind(commonApi),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ models/ModelScanFilter.ts
models/ModelScanInfo.ts
models/ModelScanListReq.ts
models/ModelScanListResp.ts
models/ModelScanReportFieldsResponse.ts
models/ModelScanResultBasicNode.ts
models/ModelScanResultsActionRequest.ts
models/ModelScanResultsCommon.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
ApiDocsBadRequestResponse,
ApiDocsFailureResponse,
ModelMessageResponse,
ModelScanReportFieldsResponse,
} from '../models';
import {
ApiDocsBadRequestResponseFromJSON,
Expand All @@ -26,6 +27,8 @@ import {
ApiDocsFailureResponseToJSON,
ModelMessageResponseFromJSON,
ModelMessageResponseToJSON,
ModelScanReportFieldsResponseFromJSON,
ModelScanReportFieldsResponseToJSON,
} from '../models';

/**
Expand All @@ -50,6 +53,21 @@ export interface CommonApiInterface {
*/
eula(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelMessageResponse>;

/**
* Get all the fields available in all the scan reports
* @summary Get Scan Report Fields
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CommonApiInterface
*/
getScanReportFieldsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelScanReportFieldsResponse>>;

/**
* Get all the fields available in all the scan reports
* Get Scan Report Fields
*/
getScanReportFields(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelScanReportFieldsResponse>;

}

/**
Expand Down Expand Up @@ -85,4 +103,40 @@ export class CommonApi extends runtime.BaseAPI implements CommonApiInterface {
return await response.value();
}

/**
* Get all the fields available in all the scan reports
* Get Scan Report Fields
*/
async getScanReportFieldsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelScanReportFieldsResponse>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearer_token", []);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/deepfence/scan/results/fields`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ModelScanReportFieldsResponseFromJSON(jsonValue));
}

/**
* Get all the fields available in all the scan reports
* Get Scan Report Fields
*/
async getScanReportFields(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelScanReportFieldsResponse> {
const response = await this.getScanReportFieldsRaw(initOverrides);
return await response.value();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import type {
ModelScanStatusReq,
ModelScanStatusResp,
ModelScanTriggerResp,
ModelStopScanRequest,
SearchSearchCountResp,
} from '../models';
import {
Expand Down Expand Up @@ -54,6 +55,8 @@ import {
ModelScanStatusRespToJSON,
ModelScanTriggerRespFromJSON,
ModelScanTriggerRespToJSON,
ModelStopScanRequestFromJSON,
ModelStopScanRequestToJSON,
SearchSearchCountRespFromJSON,
SearchSearchCountRespToJSON,
} from '../models';
Expand Down Expand Up @@ -87,7 +90,7 @@ export interface StatusComplianceScanRequest {
}

export interface StopComplianceScanRequest {
modelComplianceScanTriggerReq?: ModelComplianceScanTriggerReq;
modelStopScanRequest?: ModelStopScanRequest;
}

/**
Expand Down Expand Up @@ -212,7 +215,7 @@ export interface ComplianceApiInterface {
/**
* Stop Compliance Scan on agent or registry
* @summary Stop Compliance Scan
* @param {ModelComplianceScanTriggerReq} [modelComplianceScanTriggerReq]
* @param {ModelStopScanRequest} [modelStopScanRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ComplianceApiInterface
Expand Down Expand Up @@ -527,7 +530,7 @@ export class ComplianceApi extends runtime.BaseAPI implements ComplianceApiInter
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ModelComplianceScanTriggerReqToJSON(requestParameters.modelComplianceScanTriggerReq),
body: ModelStopScanRequestToJSON(requestParameters.modelStopScanRequest),
}, initOverrides);

return new runtime.VoidApiResponse(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type {
ModelScanStatusReq,
ModelScanStatusResp,
ModelScanTriggerResp,
ModelStopScanRequest,
ModelVulnerabilityScanResult,
ModelVulnerabilityScanTriggerReq,
SearchSearchCountResp,
Expand Down Expand Up @@ -60,6 +61,8 @@ import {
ModelScanStatusRespToJSON,
ModelScanTriggerRespFromJSON,
ModelScanTriggerRespToJSON,
ModelStopScanRequestFromJSON,
ModelStopScanRequestToJSON,
ModelVulnerabilityScanResultFromJSON,
ModelVulnerabilityScanResultToJSON,
ModelVulnerabilityScanTriggerReqFromJSON,
Expand Down Expand Up @@ -111,7 +114,7 @@ export interface StatusVulnerabilityScanRequest {
}

export interface StopVulnerabilityScanRequest {
modelVulnerabilityScanTriggerReq?: ModelVulnerabilityScanTriggerReq;
modelStopScanRequest?: ModelStopScanRequest;
}

/**
Expand Down Expand Up @@ -284,7 +287,7 @@ export interface VulnerabilityApiInterface {
/**
* Stop Vulnerability Scan on agent or registry
* @summary Stop Vulnerability Scan
* @param {ModelVulnerabilityScanTriggerReq} [modelVulnerabilityScanTriggerReq]
* @param {ModelStopScanRequest} [modelStopScanRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof VulnerabilityApiInterface
Expand Down Expand Up @@ -715,7 +718,7 @@ export class VulnerabilityApi extends runtime.BaseAPI implements VulnerabilityAp
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ModelVulnerabilityScanTriggerReqToJSON(requestParameters.modelVulnerabilityScanTriggerReq),
body: ModelStopScanRequestToJSON(requestParameters.modelStopScanRequest),
}, initOverrides);

return new runtime.VoidApiResponse(response);
Expand Down
Loading