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

Replace posture string status with enum status #2188

Merged
merged 2 commits into from
Jun 7, 2024
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: 17 additions & 104 deletions deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
"post": {
"tags": ["Cloud Nodes"],
"summary": "Register Cloud Node Account",
"description": "Register Cloud Node Account and return any pending compliance scans from console",
"description": "Register Cloud Account",
"operationId": "registerCloudNodeAccount",
"requestBody": {
"content": {
Expand All @@ -284,16 +284,7 @@
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelCloudNodeAccountRegisterResp"
}
}
}
},
"204": { "description": "No Content" },
"400": {
"description": "Bad Request",
"content": {
Expand Down Expand Up @@ -1759,59 +1750,6 @@
"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 @@ -12504,11 +12442,6 @@
"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 Down Expand Up @@ -13258,7 +13191,6 @@
"type": "string"
},
"benchmark_types": {
"enum": ["hipaa", "gdpr", "pci", "nist", "cis", "soc_2", "nsa-cisa"],
"type": "array",
"items": { "$ref": "#/components/schemas/ModelBenchmarkType" },
"nullable": true
Expand Down Expand Up @@ -13423,7 +13355,10 @@
},
"service": { "type": "string" },
"severity": { "type": "string" },
"status": { "enum": ["alarm", "skip", "ok", "info"], "type": "string" },
"status": {
"enum": ["alarm", "info", "ok", "skip", "delete"],
"type": "string"
},
"title": { "type": "string" },
"type": { "type": "string" },
"updated_at": { "type": "integer" }
Expand Down Expand Up @@ -13498,40 +13433,29 @@
}
},
"ModelCloudNodeAccountRegisterReq": {
"required": ["node_id", "cloud_account", "cloud_provider"],
"required": [
"node_id",
"host_node_id",
"account_id",
"cloud_provider",
"version"
],
"type": "object",
"properties": {
"cloud_account": { "type": "string" },
"account_id": { "type": "string" },
"cloud_provider": { "enum": ["aws", "gcp", "azure"], "type": "string" },
"host_node_id": { "type": "string" },
"is_organization_deployment": { "type": "boolean" },
"monitored_account_ids": {
"type": "object",
"additionalProperties": { "type": "string" },
"nullable": true
},
"node_id": { "type": "string" },
"org_acc_id": { "type": "string" },
"organization_account_id": { "type": "string" },
"version": { "type": "string" }
}
},
"ModelCloudNodeAccountRegisterResp": {
"type": "object",
"properties": {
"data": { "$ref": "#/components/schemas/ModelCloudNodeAccountRegisterRespData" }
}
},
"ModelCloudNodeAccountRegisterRespData": {
"type": "object",
"properties": {
"cloudtrail_trails": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelCloudNodeCloudtrailTrail" },
"nullable": true
},
"log_action": { "$ref": "#/components/schemas/ControlsAction" },
"refresh": { "type": "string" }
}
},
"ModelCloudNodeAccountsListReq": {
"required": ["cloud_provider", "window"],
"type": "object",
Expand All @@ -13555,13 +13479,6 @@
"total": { "type": "integer" }
}
},
"ModelCloudNodeCloudtrailTrail": {
"type": "object",
"properties": {
"account_id": { "type": "string" },
"trail_name": { "type": "string" }
}
},
"ModelCloudNodeComplianceControl": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -13691,10 +13608,7 @@
"nullable": true
},
"rule_id": { "type": "string" },
"status": {
"enum": ["pass", "fail", "warn", "info", "note"],
"type": "string"
},
"status": { "enum": ["pass", "warn", "info", "note"], "type": "string" },
"test_category": { "type": "string" },
"test_desc": { "type": "string" },
"test_number": { "type": "string" },
Expand Down Expand Up @@ -13840,7 +13754,6 @@
"type": "object",
"properties": {
"benchmark_types": {
"enum": ["hipaa", "gdpr", "pci", "nist", "cis", "soc_2", "nsa-cisa"],
"type": "array",
"items": { "$ref": "#/components/schemas/ModelBenchmarkType" },
"nullable": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,8 @@ models/ModelCloudCompliance.ts
models/ModelCloudComplianceScanResult.ts
models/ModelCloudNodeAccountInfo.ts
models/ModelCloudNodeAccountRegisterReq.ts
models/ModelCloudNodeAccountRegisterResp.ts
models/ModelCloudNodeAccountRegisterRespData.ts
models/ModelCloudNodeAccountsListReq.ts
models/ModelCloudNodeAccountsListResp.ts
models/ModelCloudNodeCloudtrailTrail.ts
models/ModelCloudNodeComplianceControl.ts
models/ModelCloudNodeControlReq.ts
models/ModelCloudNodeControlResp.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import type {
ModelCloudAccountDeleteReq,
ModelCloudAccountRefreshReq,
ModelCloudNodeAccountRegisterReq,
ModelCloudNodeAccountRegisterResp,
ModelCloudNodeAccountsListReq,
ModelCloudNodeAccountsListResp,
ModelCloudNodeProvidersListResp,
Expand All @@ -36,8 +35,6 @@ import {
ModelCloudAccountRefreshReqToJSON,
ModelCloudNodeAccountRegisterReqFromJSON,
ModelCloudNodeAccountRegisterReqToJSON,
ModelCloudNodeAccountRegisterRespFromJSON,
ModelCloudNodeAccountRegisterRespToJSON,
ModelCloudNodeAccountsListReqFromJSON,
ModelCloudNodeAccountsListReqToJSON,
ModelCloudNodeAccountsListRespFromJSON,
Expand Down Expand Up @@ -133,20 +130,20 @@ export interface CloudNodesApiInterface {
refreshCloudNodeAccount(requestParameters: RefreshCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;

/**
* Register Cloud Node Account and return any pending compliance scans from console
* Register Cloud Account
* @summary Register Cloud Node Account
* @param {ModelCloudNodeAccountRegisterReq} [modelCloudNodeAccountRegisterReq]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CloudNodesApiInterface
*/
registerCloudNodeAccountRaw(requestParameters: RegisterCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelCloudNodeAccountRegisterResp>>;
registerCloudNodeAccountRaw(requestParameters: RegisterCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;

/**
* Register Cloud Node Account and return any pending compliance scans from console
* Register Cloud Account
* Register Cloud Node Account
*/
registerCloudNodeAccount(requestParameters: RegisterCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelCloudNodeAccountRegisterResp>;
registerCloudNodeAccount(requestParameters: RegisterCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;

}

Expand Down Expand Up @@ -307,10 +304,10 @@ export class CloudNodesApi extends runtime.BaseAPI implements CloudNodesApiInter
}

/**
* Register Cloud Node Account and return any pending compliance scans from console
* Register Cloud Account
* Register Cloud Node Account
*/
async registerCloudNodeAccountRaw(requestParameters: RegisterCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelCloudNodeAccountRegisterResp>> {
async registerCloudNodeAccountRaw(requestParameters: RegisterCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};
Expand All @@ -333,16 +330,15 @@ export class CloudNodesApi extends runtime.BaseAPI implements CloudNodesApiInter
body: ModelCloudNodeAccountRegisterReqToJSON(requestParameters.modelCloudNodeAccountRegisterReq),
}, initOverrides);

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

/**
* Register Cloud Node Account and return any pending compliance scans from console
* Register Cloud Account
* Register Cloud Node Account
*/
async registerCloudNodeAccount(requestParameters: RegisterCloudNodeAccountRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelCloudNodeAccountRegisterResp> {
const response = await this.registerCloudNodeAccountRaw(requestParameters, initOverrides);
return await response.value();
async registerCloudNodeAccount(requestParameters: RegisterCloudNodeAccountRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.registerCloudNodeAccountRaw(requestParameters, initOverrides);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ export interface UpdateAgentDiagnosticLogsStatusRequest {
diagnosisDiagnosticLogsStatus?: DiagnosisDiagnosticLogsStatus;
}

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

/**
* DiagnosisApi - interface
*
Expand Down Expand Up @@ -167,23 +162,6 @@ 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 @@ -419,46 +397,4 @@ 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