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

[v2][UI]Add k8s listing in my connectors #871

Merged
merged 1 commit into from
Feb 7, 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
75 changes: 70 additions & 5 deletions deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,53 @@
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/cloud-node/providers/list": {
"post": {
"tags": ["Cloud Nodes"],
"summary": "List Cloud Node Providers",
"description": "List Cloud Node Providers registered with the console",
"operationId": "listCloudProviders",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelCloudNodeProvidersListResp"
}
}
}
},
"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/controls/agent": {
"post": {
"tags": ["Controls"],
Expand Down Expand Up @@ -4185,6 +4232,17 @@
"trail_name": { "type": "string" }
}
},
"ModelCloudNodeProvidersListResp": {
"required": ["providers"],
"type": "object",
"properties": {
"providers": {
"type": "array",
"items": { "type": "string" },
"nullable": true
}
}
},
"ModelCompliance": {
"required": [
"test_category",
Expand Down Expand Up @@ -4451,7 +4509,8 @@
"node_name",
"node_type",
"scan_id",
"malwares"
"malwares",
"severity_counts"
],
"type": "object",
"properties": {
Expand All @@ -4467,7 +4526,12 @@
"node_id": { "type": "string" },
"node_name": { "type": "string" },
"node_type": { "type": "string" },
"scan_id": { "type": "string" }
"scan_id": { "type": "string" },
"severity_counts": {
"type": "object",
"additionalProperties": { "type": "integer" },
"nullable": true
}
}
},
"ModelMalwareScanTriggerReq": {
Expand Down Expand Up @@ -4616,9 +4680,11 @@
}
},
"ModelScanInfo": {
"required": ["scan_id", "status", "updated_at"],
"required": ["scan_id", "status", "updated_at", "node_id", "node_type"],
"type": "object",
"properties": {
"node_id": { "type": "string" },
"node_type": { "type": "string" },
"scan_id": { "type": "string" },
"status": { "type": "string" },
"updated_at": { "type": "integer", "format": "int64" }
Expand Down Expand Up @@ -4652,14 +4718,13 @@
"window": { "$ref": "#/components/schemas/ModelFetchWindow" }
}
},
"ModelScanStatus": { "type": "string" },
"ModelScanStatusResp": {
"required": ["statuses"],
"type": "object",
"properties": {
"statuses": {
"type": "object",
"additionalProperties": { "$ref": "#/components/schemas/ModelScanStatus" },
"additionalProperties": { "$ref": "#/components/schemas/ModelScanInfo" },
"nullable": true
}
}
Expand Down
2 changes: 1 addition & 1 deletion deepfence_frontend/apps/dashboard/openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.2.1",
"version": "6.3.0",
"generators": {
"deepfence-server": {
"generatorName": "typescript-fetch",
Expand Down
23 changes: 13 additions & 10 deletions deepfence_frontend/apps/dashboard/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,18 @@ export function getTopologyApiClient() {
const topologyApi = new TopologyApi(configuration);
return {
getHostsTopologyGraph: topologyApi.getHostsTopologyGraph.bind(topologyApi),
getKubernetesTopologyGraph: topologyApi.getKubernetesTopologyGraph.bind(topologyApi),
};
}

export function getCloudNodesApi() {
export function getCloudNodesApiClient() {
const cloudNodesApi = new CloudNodesApi(configuration);
return {
listCloudNodeAccount: cloudNodesApi.listCloudNodeAccount.bind(cloudNodesApi),
};
}
export function getRegistriesApi() {
const registriesApi = new RegistryApi(configuration);
return {
addRegistry: registriesApi.addRegistry.bind(registriesApi),
};
}

export function vulnerabilityScanApiClient() {
export function getVulnerabilityApiClient() {
const vulnerabilityApi = new VulnerabilityApi(configuration);
return {
startVulnerabilityScan:
Expand All @@ -68,7 +63,7 @@ export function vulnerabilityScanApiClient() {
};
}

export function secretScanApiClient() {
export function getSecretApiClient() {
const secretApi = new SecretScanApi(configuration);
return {
startSecretScan: secretApi.startSecretScan.bind(secretApi),
Expand All @@ -77,11 +72,19 @@ export function secretScanApiClient() {
};
}

export function complianceScanApiClient() {
export function getComplianceApiClient() {
const complianceApi = new ComplianceApi(configuration);
return {
startComplianceScan: complianceApi.startComplianceScan.bind(complianceApi),
statusComplianceScan: complianceApi.statusComplianceScan.bind(complianceApi),
resultComplianceScan: complianceApi.resultsComplianceScan.bind(complianceApi),
};
}

export function getRegistriesApiClient() {
const registriesApi = new RegistryApi(configuration);
return {
listRegistries: registriesApi.listRegistry.bind(registriesApi),
addRegistry: registriesApi.addRegistry.bind(registriesApi),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ models/ModelCloudNodeAccountRegisterRespData.ts
models/ModelCloudNodeAccountsListReq.ts
models/ModelCloudNodeAccountsListResp.ts
models/ModelCloudNodeCloudtrailTrail.ts
models/ModelCloudNodeProvidersListResp.ts
models/ModelCompliance.ts
models/ModelComplianceScanResult.ts
models/ModelComplianceScanTriggerReq.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.1
6.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
ModelCloudNodeAccountRegisterResp,
ModelCloudNodeAccountsListReq,
ModelCloudNodeAccountsListResp,
ModelCloudNodeProvidersListResp,
} from '../models';
import {
ApiDocsBadRequestResponseFromJSON,
Expand All @@ -35,6 +36,8 @@ import {
ModelCloudNodeAccountsListReqToJSON,
ModelCloudNodeAccountsListRespFromJSON,
ModelCloudNodeAccountsListRespToJSON,
ModelCloudNodeProvidersListRespFromJSON,
ModelCloudNodeProvidersListRespToJSON,
} from '../models';

export interface ListCloudNodeAccountRequest {
Expand Down Expand Up @@ -68,6 +71,21 @@ export interface CloudNodesApiInterface {
*/
listCloudNodeAccount(requestParameters: ListCloudNodeAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelCloudNodeAccountsListResp>;

/**
* List Cloud Node Providers registered with the console
* @summary List Cloud Node Providers
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CloudNodesApiInterface
*/
listCloudProvidersRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelCloudNodeProvidersListResp>>;

/**
* List Cloud Node Providers registered with the console
* List Cloud Node Providers
*/
listCloudProviders(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelCloudNodeProvidersListResp>;

/**
* Register Cloud Node Account and return any pending compliance scans from console
* @summary Register Cloud Node Account
Expand Down Expand Up @@ -130,6 +148,42 @@ export class CloudNodesApi extends runtime.BaseAPI implements CloudNodesApiInter
return await response.value();
}

/**
* List Cloud Node Providers registered with the console
* List Cloud Node Providers
*/
async listCloudProvidersRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelCloudNodeProvidersListResp>> {
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/cloud-node/providers/list`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

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

/**
* List Cloud Node Providers registered with the console
* List Cloud Node Providers
*/
async listCloudProviders(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelCloudNodeProvidersListResp> {
const response = await this.listCloudProvidersRaw(initOverrides);
return await response.value();
}

/**
* Register Cloud Node Account and return any pending compliance scans from console
* Register Cloud Node Account
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* tslint:disable */
/* eslint-disable */
/**
* Deepfence ThreatMapper
* Deepfence Runtime API provides programmatic control over Deepfence microservice securing your container, kubernetes and cloud deployments. The API abstracts away underlying infrastructure details like cloud provider, container distros, container orchestrator and type of deployment. This is one uniform API to manage and control security alerts, policies and response to alerts for microservices running anywhere i.e. managed pure greenfield container deployments or a mix of containers, VMs and serverless paradigms like AWS Fargate.
*
* The version of the OpenAPI document: 2.0.0
* Contact: community@deepfence.io
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ModelCloudNodeProvidersListResp
*/
export interface ModelCloudNodeProvidersListResp {
/**
*
* @type {Array<string>}
* @memberof ModelCloudNodeProvidersListResp
*/
providers: Array<string> | null;
}

/**
* Check if a given object implements the ModelCloudNodeProvidersListResp interface.
*/
export function instanceOfModelCloudNodeProvidersListResp(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "providers" in value;

return isInstance;
}

export function ModelCloudNodeProvidersListRespFromJSON(json: any): ModelCloudNodeProvidersListResp {
return ModelCloudNodeProvidersListRespFromJSONTyped(json, false);
}

export function ModelCloudNodeProvidersListRespFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelCloudNodeProvidersListResp {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'providers': json['providers'],
};
}

export function ModelCloudNodeProvidersListRespToJSON(value?: ModelCloudNodeProvidersListResp | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'providers': value.providers,
};
}

Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ export interface ModelMalwareScanResult {
* @memberof ModelMalwareScanResult
*/
scan_id: string;
/**
*
* @type {{ [key: string]: number; }}
* @memberof ModelMalwareScanResult
*/
severity_counts: { [key: string]: number; } | null;
}

/**
Expand All @@ -96,6 +102,7 @@ export function instanceOfModelMalwareScanResult(value: object): boolean {
isInstance = isInstance && "node_name" in value;
isInstance = isInstance && "node_type" in value;
isInstance = isInstance && "scan_id" in value;
isInstance = isInstance && "severity_counts" in value;

return isInstance;
}
Expand All @@ -119,6 +126,7 @@ export function ModelMalwareScanResultFromJSONTyped(json: any, ignoreDiscriminat
'node_name': json['node_name'],
'node_type': json['node_type'],
'scan_id': json['scan_id'],
'severity_counts': json['severity_counts'],
};
}

Expand All @@ -140,6 +148,7 @@ export function ModelMalwareScanResultToJSON(value?: ModelMalwareScanResult | nu
'node_name': value.node_name,
'node_type': value.node_type,
'scan_id': value.scan_id,
'severity_counts': value.severity_counts,
};
}

Loading