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

Diagnostic logs for cloud scanner #1689

Merged
merged 2 commits into from
Oct 26, 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
121 changes: 120 additions & 1 deletion deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,106 @@
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/diagnosis/cloud-scanner-logs": {
"post": {
"tags": ["Diagnosis"],
"summary": "Generate Cloud Scanner Diagnostic Logs",
"description": "Generate Cloud Scanner Diagnostic Logs",
"operationId": "generateCloudScannerDiagnosticLogs",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DiagnosisGenerateCloudScannerDiagnosticLogsRequest"
}
}
}
},
"responses": {
"202": { "description": "Accepted" },
"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/diagnosis/cloud-scanner-logs/status/{node_id}": {
"put": {
"tags": ["Diagnosis"],
"summary": "Update Cloud Scanner Diagnostic Logs Status",
"description": "Update cloud scanner diagnostic logs status",
"operationId": "updateCloudScannerDiagnosticLogsStatus",
"parameters": [
{
"name": "node_id",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"requestBody": {
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/DiagnosisDiagnosticLogsStatus" }
}
}
},
"responses": {
"204": { "description": "No Content" },
"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/diagnosis/console-logs": {
"post": {
"tags": ["Diagnosis"],
Expand Down Expand Up @@ -10490,6 +10590,18 @@
"tail": { "type": "integer" }
}
},
"DiagnosisGenerateCloudScannerDiagnosticLogsRequest": {
"required": ["node_ids", "tail"],
"type": "object",
"properties": {
"node_ids": {
"type": "array",
"items": { "$ref": "#/components/schemas/DiagnosisNodeIdentifier" },
"nullable": true
},
"tail": { "type": "integer" }
}
},
"DiagnosisGenerateConsoleDiagnosticLogsRequest": {
"required": ["tail"],
"type": "object",
Expand All @@ -10503,6 +10615,11 @@
"items": { "$ref": "#/components/schemas/DiagnosisDiagnosticLogsLink" },
"nullable": true
},
"cloud_scanner_logs": {
"type": "array",
"items": { "$ref": "#/components/schemas/DiagnosisDiagnosticLogsLink" },
"nullable": true
},
"console_logs": {
"type": "array",
"items": { "$ref": "#/components/schemas/DiagnosisDiagnosticLogsLink" },
Expand All @@ -10515,7 +10632,7 @@
"type": "object",
"properties": {
"node_id": { "type": "string" },
"node_type": { "enum": ["host", "cluster"], "type": "string" }
"node_type": { "enum": ["host", "cluster", "cloud_account"], "type": "string" }
}
},
"FormDataModelRegistryGCRAddReq": {
Expand Down Expand Up @@ -11394,6 +11511,7 @@
"items": { "$ref": "#/components/schemas/ModelCloudNodeCloudtrailTrail" },
"nullable": true
},
"log_action": { "$ref": "#/components/schemas/ControlsAction" },
"refresh": { "type": "string" },
"scans": {
"type": "object",
Expand Down Expand Up @@ -12789,6 +12907,7 @@
"properties": {
"mask_across_hosts_and_images": { "type": "boolean" },
"mask_in_this_host_or_image_tags": { "type": "boolean" },
"mask_in_this_image_tag": { "type": "boolean" },
"result_ids": {
"type": "array",
"items": { "type": "string" },
Expand Down
2 changes: 2 additions & 0 deletions deepfence_frontend/apps/dashboard/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ export function getDiagnosisApiClient() {
return {
generateAgentDiagnosticLogs:
diagnosisApi.generateAgentDiagnosticLogs.bind(diagnosisApi),
generateCloudScannerDiagnosticLogs:
diagnosisApi.generateCloudScannerDiagnosticLogs.bind(diagnosisApi),
generateConsoleDiagnosticLogs:
diagnosisApi.generateConsoleDiagnosticLogs.bind(diagnosisApi),
getDiagnosticLogs: diagnosisApi.getDiagnosticLogs.bind(diagnosisApi),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ models/DiagnosisDiagnosticLogsLink.ts
models/DiagnosisDiagnosticLogsStatus.ts
models/DiagnosisDiagnosticNotification.ts
models/DiagnosisGenerateAgentDiagnosticLogsRequest.ts
models/DiagnosisGenerateCloudScannerDiagnosticLogsRequest.ts
models/DiagnosisGenerateConsoleDiagnosticLogsRequest.ts
models/DiagnosisGetDiagnosticLogsResponse.ts
models/DiagnosisNodeIdentifier.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
DiagnosisDiagnosticLogsStatus,
DiagnosisDiagnosticNotification,
DiagnosisGenerateAgentDiagnosticLogsRequest,
DiagnosisGenerateCloudScannerDiagnosticLogsRequest,
DiagnosisGenerateConsoleDiagnosticLogsRequest,
DiagnosisGetDiagnosticLogsResponse,
} from '../models';
Expand All @@ -34,6 +35,8 @@ import {
DiagnosisDiagnosticNotificationToJSON,
DiagnosisGenerateAgentDiagnosticLogsRequestFromJSON,
DiagnosisGenerateAgentDiagnosticLogsRequestToJSON,
DiagnosisGenerateCloudScannerDiagnosticLogsRequestFromJSON,
DiagnosisGenerateCloudScannerDiagnosticLogsRequestToJSON,
DiagnosisGenerateConsoleDiagnosticLogsRequestFromJSON,
DiagnosisGenerateConsoleDiagnosticLogsRequestToJSON,
DiagnosisGetDiagnosticLogsResponseFromJSON,
Expand All @@ -44,6 +47,10 @@ export interface GenerateAgentDiagnosticLogsRequest {
diagnosisGenerateAgentDiagnosticLogsRequest?: DiagnosisGenerateAgentDiagnosticLogsRequest;
}

export interface GenerateCloudScannerDiagnosticLogsRequest {
diagnosisGenerateCloudScannerDiagnosticLogsRequest?: DiagnosisGenerateCloudScannerDiagnosticLogsRequest;
}

export interface GenerateConsoleDiagnosticLogsRequest {
diagnosisGenerateConsoleDiagnosticLogsRequest?: DiagnosisGenerateConsoleDiagnosticLogsRequest;
}
Expand All @@ -53,6 +60,11 @@ export interface UpdateAgentDiagnosticLogsStatusRequest {
diagnosisDiagnosticLogsStatus?: DiagnosisDiagnosticLogsStatus;
}

export interface UpdateCloudScannerDiagnosticLogsStatusRequest {
nodeId: string;
diagnosisDiagnosticLogsStatus?: DiagnosisDiagnosticLogsStatus;
}

/**
* DiagnosisApi - interface
*
Expand Down Expand Up @@ -91,6 +103,22 @@ export interface DiagnosisApiInterface {
*/
generateAgentDiagnosticLogs(requestParameters: GenerateAgentDiagnosticLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;

/**
* Generate Cloud Scanner Diagnostic Logs
* @summary Generate Cloud Scanner Diagnostic Logs
* @param {DiagnosisGenerateCloudScannerDiagnosticLogsRequest} [diagnosisGenerateCloudScannerDiagnosticLogsRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DiagnosisApiInterface
*/
generateCloudScannerDiagnosticLogsRaw(requestParameters: GenerateCloudScannerDiagnosticLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;

/**
* Generate Cloud Scanner Diagnostic Logs
* Generate Cloud Scanner Diagnostic Logs
*/
generateCloudScannerDiagnosticLogs(requestParameters: GenerateCloudScannerDiagnosticLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;

/**
* Generate Console Diagnostic Logs
* @summary Generate Console Diagnostic Logs
Expand Down Expand Up @@ -139,6 +167,23 @@ export interface DiagnosisApiInterface {
*/
updateAgentDiagnosticLogsStatus(requestParameters: UpdateAgentDiagnosticLogsStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;

/**
* Update cloud scanner diagnostic logs status
* @summary Update Cloud Scanner Diagnostic Logs Status
* @param {string} nodeId
* @param {DiagnosisDiagnosticLogsStatus} [diagnosisDiagnosticLogsStatus]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DiagnosisApiInterface
*/
updateCloudScannerDiagnosticLogsStatusRaw(requestParameters: UpdateCloudScannerDiagnosticLogsStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;

/**
* Update cloud scanner diagnostic logs status
* Update Cloud Scanner Diagnostic Logs Status
*/
updateCloudScannerDiagnosticLogsStatus(requestParameters: UpdateCloudScannerDiagnosticLogsStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;

}

/**
Expand Down Expand Up @@ -220,6 +265,44 @@ export class DiagnosisApi extends runtime.BaseAPI implements DiagnosisApiInterfa
await this.generateAgentDiagnosticLogsRaw(requestParameters, initOverrides);
}

/**
* Generate Cloud Scanner Diagnostic Logs
* Generate Cloud Scanner Diagnostic Logs
*/
async generateCloudScannerDiagnosticLogsRaw(requestParameters: GenerateCloudScannerDiagnosticLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

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/diagnosis/cloud-scanner-logs`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: DiagnosisGenerateCloudScannerDiagnosticLogsRequestToJSON(requestParameters.diagnosisGenerateCloudScannerDiagnosticLogsRequest),
}, initOverrides);

return new runtime.VoidApiResponse(response);
}

/**
* Generate Cloud Scanner Diagnostic Logs
* Generate Cloud Scanner Diagnostic Logs
*/
async generateCloudScannerDiagnosticLogs(requestParameters: GenerateCloudScannerDiagnosticLogsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.generateCloudScannerDiagnosticLogsRaw(requestParameters, initOverrides);
}

/**
* Generate Console Diagnostic Logs
* Generate Console Diagnostic Logs
Expand Down Expand Up @@ -336,4 +419,46 @@ export class DiagnosisApi extends runtime.BaseAPI implements DiagnosisApiInterfa
await this.updateAgentDiagnosticLogsStatusRaw(requestParameters, initOverrides);
}

/**
* Update cloud scanner diagnostic logs status
* Update Cloud Scanner Diagnostic Logs Status
*/
async updateCloudScannerDiagnosticLogsStatusRaw(requestParameters: UpdateCloudScannerDiagnosticLogsStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.nodeId === null || requestParameters.nodeId === undefined) {
throw new runtime.RequiredError('nodeId','Required parameter requestParameters.nodeId was null or undefined when calling updateCloudScannerDiagnosticLogsStatus.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

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/diagnosis/cloud-scanner-logs/status/{node_id}`.replace(`{${"node_id"}}`, encodeURIComponent(String(requestParameters.nodeId))),
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: DiagnosisDiagnosticLogsStatusToJSON(requestParameters.diagnosisDiagnosticLogsStatus),
}, initOverrides);

return new runtime.VoidApiResponse(response);
}

/**
* Update cloud scanner diagnostic logs status
* Update Cloud Scanner Diagnostic Logs Status
*/
async updateCloudScannerDiagnosticLogsStatus(requestParameters: UpdateCloudScannerDiagnosticLogsStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.updateCloudScannerDiagnosticLogsStatusRaw(requestParameters, initOverrides);
}

}
Loading
Loading