@rad-security/mcp-server 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.js +102 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +480 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/audit.d.ts +31 -0
- package/dist/operations/audit.js +55 -0
- package/dist/operations/audit.js.map +1 -0
- package/dist/operations/cloud-inventory.d.ts +70 -0
- package/dist/operations/cloud-inventory.js +61 -0
- package/dist/operations/cloud-inventory.js.map +1 -0
- package/dist/operations/clusters.d.ts +21 -0
- package/dist/operations/clusters.js +20 -0
- package/dist/operations/clusters.js.map +1 -0
- package/dist/operations/containers.d.ts +27 -0
- package/dist/operations/containers.js +33 -0
- package/dist/operations/containers.js.map +1 -0
- package/dist/operations/findings.d.ts +52 -0
- package/dist/operations/findings.js +76 -0
- package/dist/operations/findings.js.map +1 -0
- package/dist/operations/identities.d.ts +33 -0
- package/dist/operations/identities.js +30 -0
- package/dist/operations/identities.js.map +1 -0
- package/dist/operations/images.d.ts +46 -0
- package/dist/operations/images.js +58 -0
- package/dist/operations/images.js.map +1 -0
- package/dist/operations/kubeobject.d.ts +33 -0
- package/dist/operations/kubeobject.js +38 -0
- package/dist/operations/kubeobject.js.map +1 -0
- package/dist/operations/misconfigs.d.ts +21 -0
- package/dist/operations/misconfigs.js +36 -0
- package/dist/operations/misconfigs.js.map +1 -0
- package/dist/operations/runtime.d.ts +26 -0
- package/dist/operations/runtime.js +68 -0
- package/dist/operations/runtime.js.map +1 -0
- package/dist/operations/runtime_network.d.ts +53 -0
- package/dist/operations/runtime_network.js +41 -0
- package/dist/operations/runtime_network.js.map +1 -0
- package/dist/operations/threats.d.ts +22 -0
- package/dist/operations/threats.js +24 -0
- package/dist/operations/threats.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { RadSecurityClient } from "../client.js";
|
|
3
|
+
declare const ProviderTypeEnum: z.ZodEnum<["aws", "gcp", "azure"]>;
|
|
4
|
+
type ProviderType = z.infer<typeof ProviderTypeEnum>;
|
|
5
|
+
export declare const ListCloudResourcesSchema: z.ZodObject<{
|
|
6
|
+
provider: z.ZodEnum<["aws", "gcp", "azure"]>;
|
|
7
|
+
filters: z.ZodOptional<z.ZodString>;
|
|
8
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10
|
+
q: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
limit: number;
|
|
13
|
+
provider: "aws" | "gcp" | "azure";
|
|
14
|
+
filters?: string | undefined;
|
|
15
|
+
offset?: number | undefined;
|
|
16
|
+
q?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
provider: "aws" | "gcp" | "azure";
|
|
19
|
+
filters?: string | undefined;
|
|
20
|
+
offset?: number | undefined;
|
|
21
|
+
limit?: number | undefined;
|
|
22
|
+
q?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const GetCloudResourceDetailsSchema: z.ZodObject<{
|
|
25
|
+
provider: z.ZodEnum<["aws", "gcp", "azure"]>;
|
|
26
|
+
resource_type: z.ZodString;
|
|
27
|
+
resource_id: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
provider: "aws" | "gcp" | "azure";
|
|
30
|
+
resource_type: string;
|
|
31
|
+
resource_id: string;
|
|
32
|
+
}, {
|
|
33
|
+
provider: "aws" | "gcp" | "azure";
|
|
34
|
+
resource_type: string;
|
|
35
|
+
resource_id: string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const GetCloudResourceFacetsSchema: z.ZodObject<{
|
|
38
|
+
provider: z.ZodEnum<["aws", "gcp", "azure"]>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
provider: "aws" | "gcp" | "azure";
|
|
41
|
+
}, {
|
|
42
|
+
provider: "aws" | "gcp" | "azure";
|
|
43
|
+
}>;
|
|
44
|
+
export declare const GetCloudResourceFacetValuesSchema: z.ZodObject<{
|
|
45
|
+
provider: z.ZodEnum<["aws", "gcp", "azure"]>;
|
|
46
|
+
facet_id: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
provider: "aws" | "gcp" | "azure";
|
|
49
|
+
facet_id: string;
|
|
50
|
+
}, {
|
|
51
|
+
provider: "aws" | "gcp" | "azure";
|
|
52
|
+
facet_id: string;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* List cloud resources for a specific provider.
|
|
56
|
+
*/
|
|
57
|
+
export declare function listCloudResources(client: RadSecurityClient, provider: ProviderType, filters?: string, offset?: number, limit?: number, q?: string): Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Get details for a specific cloud resource.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getCloudResourceDetails(client: RadSecurityClient, provider: ProviderType, resource_type: string, resource_id: string): Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Get available facets for a provider.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getCloudResourceFacets(client: RadSecurityClient, provider: ProviderType): Promise<any>;
|
|
66
|
+
/**
|
|
67
|
+
* Get values for a specific facet.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getCloudResourceFacetValues(client: RadSecurityClient, provider: ProviderType, facet_id: string): Promise<any>;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Define provider type using Zod enum
|
|
3
|
+
const ProviderTypeEnum = z.enum(["aws", "gcp", "azure"]);
|
|
4
|
+
// Schema for list_cloud_resources
|
|
5
|
+
export const ListCloudResourcesSchema = z.object({
|
|
6
|
+
provider: ProviderTypeEnum.describe("Cloud provider (aws, gcp, azure)"),
|
|
7
|
+
filters: z.string().optional().describe("Filter string (e.g., 'resource_type:EC2NetworkInterface,resource_type:SQSQueue,aws_account:123456789012,compliance:not_compliant')"),
|
|
8
|
+
offset: z.number().optional().describe("Pagination offset. Default: 0"),
|
|
9
|
+
limit: z.number().optional().default(20).describe("Maximum number of results to return"),
|
|
10
|
+
q: z.string().optional().describe("Free text search query"),
|
|
11
|
+
});
|
|
12
|
+
// Schema for get_resource_details
|
|
13
|
+
export const GetCloudResourceDetailsSchema = z.object({
|
|
14
|
+
provider: ProviderTypeEnum.describe("Cloud provider (aws, gcp, azure)"),
|
|
15
|
+
resource_type: z.string().describe("Type of cloud resource (to be fetched from get_cloud_resource_facet_values or from list_cloud_resources)"),
|
|
16
|
+
resource_id: z.string().describe("ID of the cloud resource"),
|
|
17
|
+
});
|
|
18
|
+
// Schema for get_facets
|
|
19
|
+
export const GetCloudResourceFacetsSchema = z.object({
|
|
20
|
+
provider: ProviderTypeEnum.describe("Cloud provider (aws, gcp, azure)"),
|
|
21
|
+
});
|
|
22
|
+
// Schema for get_cloud_resource_facet_values
|
|
23
|
+
export const GetCloudResourceFacetValuesSchema = z.object({
|
|
24
|
+
provider: ProviderTypeEnum.describe("Cloud provider (aws, gcp, azure)"),
|
|
25
|
+
facet_id: z.string().describe("ID of the facet"),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* List cloud resources for a specific provider.
|
|
29
|
+
*/
|
|
30
|
+
export async function listCloudResources(client, provider, filters, offset, limit = 20, q) {
|
|
31
|
+
const params = { limit };
|
|
32
|
+
if (filters) {
|
|
33
|
+
params.filter = filters;
|
|
34
|
+
}
|
|
35
|
+
if (offset !== undefined) {
|
|
36
|
+
params.offset = offset;
|
|
37
|
+
}
|
|
38
|
+
if (q) {
|
|
39
|
+
params.q = q;
|
|
40
|
+
}
|
|
41
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/cloud-inventory/v1/${provider}`, params);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get details for a specific cloud resource.
|
|
45
|
+
*/
|
|
46
|
+
export async function getCloudResourceDetails(client, provider, resource_type, resource_id) {
|
|
47
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/cloud-inventory/v1/${provider}/${resource_type}/${resource_id}`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get available facets for a provider.
|
|
51
|
+
*/
|
|
52
|
+
export async function getCloudResourceFacets(client, provider) {
|
|
53
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/cloud-inventory/v1/${provider}/facets`);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get values for a specific facet.
|
|
57
|
+
*/
|
|
58
|
+
export async function getCloudResourceFacetValues(client, provider, facet_id) {
|
|
59
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/cloud-inventory/v1/${provider}/facets/${facet_id}`);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=cloud-inventory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-inventory.js","sourceRoot":"","sources":["../../src/operations/cloud-inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,sCAAsC;AACtC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAGzD,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IACvE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oIAAoI,CAAC;IAC7K,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CA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G,OAAO,CAAC;IAC1B,CAAC;IACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,EAAE,CAAC;QACN,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CACvB,aAAa,MAAM,CAAC,YAAY,EAAE,uBAAuB,QAAQ,EAAE,EACnE,MAAM,CACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAyB,EACzB,QAAsB,EACtB,aAAqB,EACrB,WAAmB;IAEnB,OAAO,MAAM,CAAC,WAAW,CACvB,aAAa,MAAM,CAAC,YAAY,EAAE,uBAAuB,QAAQ,IAAI,aAAa,IAAI,WAAW,EAAE,CACpG,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAAyB,EACzB,QAAsB;IAEtB,OAAO,MAAM,CAAC,WAAW,CACvB,aAAa,MAAM,CAAC,YAAY,EAAE,uBAAuB,QAAQ,SAAS,CAC3E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,MAAyB,EACzB,QAAsB,EACtB,QAAgB;IAEhB,OAAO,MAAM,CAAC,WAAW,CACvB,aAAa,MAAM,CAAC,YAAY,EAAE,uBAAuB,QAAQ,WAAW,QAAQ,EAAE,CACvF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { RadSecurityClient } from "../client.js";
|
|
3
|
+
export declare const ListClustersSchema: z.ZodObject<{
|
|
4
|
+
page_size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
page: number;
|
|
8
|
+
page_size: number;
|
|
9
|
+
}, {
|
|
10
|
+
page?: number | undefined;
|
|
11
|
+
page_size?: number | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const GetClusterDetailsSchema: z.ZodObject<{
|
|
14
|
+
cluster_id: z.ZodString;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
cluster_id: string;
|
|
17
|
+
}, {
|
|
18
|
+
cluster_id: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function listClusters(client: RadSecurityClient, page_size?: number, page?: number): Promise<any>;
|
|
21
|
+
export declare function getClusterDetails(client: RadSecurityClient, clusterId: string): Promise<any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ListClustersSchema = z.object({
|
|
3
|
+
page_size: z.number().optional().default(50).describe("Number of clusters per page for list_clusters (default: 50)"),
|
|
4
|
+
page: z.number().optional().default(1).describe("Page number to retrieve for list_clusters (default: 1)"),
|
|
5
|
+
});
|
|
6
|
+
export const GetClusterDetailsSchema = z.object({
|
|
7
|
+
cluster_id: z.string().describe("ID of the cluster to get details for"),
|
|
8
|
+
});
|
|
9
|
+
export async function listClusters(client, page_size = 50, page = 1) {
|
|
10
|
+
const params = { page_size, page };
|
|
11
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/clusters`, params);
|
|
12
|
+
}
|
|
13
|
+
export async function getClusterDetails(client, clusterId) {
|
|
14
|
+
const response = await client.makeRequest(`/accounts/${client.getAccountId()}/clusters/${clusterId}`);
|
|
15
|
+
if (!response) {
|
|
16
|
+
throw new Error(`No cluster found with ID: ${clusterId}`);
|
|
17
|
+
}
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=clusters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clusters.js","sourceRoot":"","sources":["../../src/operations/clusters.ts"],"names":[],"mappings":"AAAA,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chema: z.ZodObject<{
|
|
4
|
+
filters: z.ZodOptional<z.ZodString>;
|
|
5
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
q: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
filters?: string | undefined;
|
|
10
|
+
offset?: number | undefined;
|
|
11
|
+
limit?: number | undefined;
|
|
12
|
+
q?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
filters?: string | undefined;
|
|
15
|
+
offset?: number | undefined;
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
q?: string | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const GetContainerDetailsSchema: z.ZodObject<{
|
|
20
|
+
container_id: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
container_id: string;
|
|
23
|
+
}, {
|
|
24
|
+
container_id: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function listContainers(client: RadSecurityClient, offset?: number, limit?: number, filters?: string, q?: string): Promise<any>;
|
|
27
|
+
export declare function getContainerDetails(client: RadSecurityClient, containerId: string): Promise<any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ListContainersSchema = z.object({
|
|
3
|
+
filters: z.string().optional().describe("Filter string (e.g., 'image_name:nginx' or 'image_digest:sha256:...' or 'owner_namespace:namespace' or 'cluster_id:cluster_id'). Multiple filters can be combined with commas."),
|
|
4
|
+
offset: z.number().optional().describe("Pagination offset. Default: 0"),
|
|
5
|
+
limit: z.number().optional().describe("Maximum number of results to return. Default: 20"),
|
|
6
|
+
q: z.string().optional().describe("Free text search query"),
|
|
7
|
+
});
|
|
8
|
+
export const GetContainerDetailsSchema = z.object({
|
|
9
|
+
container_id: z.string().describe("ID of the container to get details for"),
|
|
10
|
+
});
|
|
11
|
+
export async function listContainers(client, offset = 0, limit = 20, filters, q) {
|
|
12
|
+
const params = { limit, offset, filters, q };
|
|
13
|
+
const response = await client.makeRequest(`/accounts/${client.getAccountId()}/inventory_containers`, params);
|
|
14
|
+
// Remove "id" from each container to avoid confusion
|
|
15
|
+
response.entries.forEach((container) => {
|
|
16
|
+
delete container.id;
|
|
17
|
+
});
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
20
|
+
export async function getContainerDetails(client, containerId) {
|
|
21
|
+
const response = await client.makeRequest(`/accounts/${client.getAccountId()}/inventory_containers`, { filters: `container_id:${containerId}` });
|
|
22
|
+
if (!response || !response.entries || response.entries.length === 0) {
|
|
23
|
+
throw new Error(`No container found with ID: ${containerId}`);
|
|
24
|
+
}
|
|
25
|
+
if (response.entries.length > 1) {
|
|
26
|
+
throw new Error(`Found multiple containers with ID: ${containerId}. Please provide a more specific container ID.`);
|
|
27
|
+
}
|
|
28
|
+
// Remove "id" from the response to avoid confusion
|
|
29
|
+
const result = response.entries[0];
|
|
30
|
+
delete result.id;
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=containers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../src/operations/containers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gLAAgL,CAAC;IACzN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IACvE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IACzF,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EA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AAW,gDAAgD,CAClG,CAAC;IACJ,CAAC;IAED,mDAAmD;IACnD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,EAAE,CAAC;IAEjB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { RadSecurityClient } from "../client.js";
|
|
3
|
+
export declare const statuses: readonly ["open", "closed", "ignored"];
|
|
4
|
+
export declare const types: readonly ["k8s_misconfiguration", "threat_vector", "runtime_alert", "k8s_audit_logs_anomaly"];
|
|
5
|
+
export declare const source_types: readonly ["kubeobject", "k8s_audit_log", "container"];
|
|
6
|
+
export declare const severities: readonly ["negligible", "low", "medium", "high", "critical"];
|
|
7
|
+
export declare const listFindingsSchema: z.ZodObject<{
|
|
8
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
types: z.ZodOptional<z.ZodArray<z.ZodEnum<["k8s_misconfiguration", "threat_vector", "runtime_alert", "k8s_audit_logs_anomaly"]>, "many">>;
|
|
10
|
+
severities: z.ZodOptional<z.ZodArray<z.ZodEnum<["negligible", "low", "medium", "high", "critical"]>, "many">>;
|
|
11
|
+
source_kinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
source_types: z.ZodOptional<z.ZodArray<z.ZodEnum<["kubeobject", "k8s_audit_log", "container"]>, "many">>;
|
|
13
|
+
source_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
source_namespaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["open", "closed", "ignored"]>>>;
|
|
16
|
+
from_time: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
17
|
+
to_time: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
limit: number;
|
|
20
|
+
status: "open" | "closed" | "ignored";
|
|
21
|
+
from_time: string;
|
|
22
|
+
to_time?: string | undefined;
|
|
23
|
+
types?: ("k8s_audit_logs_anomaly" | "k8s_misconfiguration" | "threat_vector" | "runtime_alert")[] | undefined;
|
|
24
|
+
severities?: ("negligible" | "low" | "medium" | "high" | "critical")[] | undefined;
|
|
25
|
+
source_kinds?: string[] | undefined;
|
|
26
|
+
source_types?: ("kubeobject" | "k8s_audit_log" | "container")[] | undefined;
|
|
27
|
+
source_names?: string[] | undefined;
|
|
28
|
+
source_namespaces?: string[] | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
limit?: number | undefined;
|
|
31
|
+
status?: "open" | "closed" | "ignored" | undefined;
|
|
32
|
+
from_time?: string | undefined;
|
|
33
|
+
to_time?: string | undefined;
|
|
34
|
+
types?: ("k8s_audit_logs_anomaly" | "k8s_misconfiguration" | "threat_vector" | "runtime_alert")[] | undefined;
|
|
35
|
+
severities?: ("negligible" | "low" | "medium" | "high" | "critical")[] | undefined;
|
|
36
|
+
source_kinds?: string[] | undefined;
|
|
37
|
+
source_types?: ("kubeobject" | "k8s_audit_log" | "container")[] | undefined;
|
|
38
|
+
source_names?: string[] | undefined;
|
|
39
|
+
source_namespaces?: string[] | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const updateFindingStatusSchema: z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
status: z.ZodEnum<["open", "closed", "ignored"]>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
status: "open" | "closed" | "ignored";
|
|
46
|
+
id: string;
|
|
47
|
+
}, {
|
|
48
|
+
status: "open" | "closed" | "ignored";
|
|
49
|
+
id: string;
|
|
50
|
+
}>;
|
|
51
|
+
export declare function listFindings(client: RadSecurityClient, limit?: number, types?: string[], severities?: string[], source_types?: string[], source_kinds?: string[], source_names?: string[], source_namespaces?: string[], status?: string, from_time?: string, to_time?: string): Promise<any>;
|
|
52
|
+
export declare function updateFindingGroupStatus(client: RadSecurityClient, id: string, status: string): Promise<void>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// enum statuses
|
|
3
|
+
export const statuses = ["open", "closed", "ignored"];
|
|
4
|
+
export const types = ["k8s_misconfiguration", "threat_vector", "runtime_alert", "k8s_audit_logs_anomaly"];
|
|
5
|
+
export const source_types = ["kubeobject", "k8s_audit_log", "container"];
|
|
6
|
+
export const severities = ["negligible", "low", "medium", "high", "critical"];
|
|
7
|
+
// Input schemas
|
|
8
|
+
export const listFindingsSchema = z.object({
|
|
9
|
+
limit: z.number().optional().default(20).describe("Number of findings to return"),
|
|
10
|
+
types: z.array(z.enum(types)).optional().describe("List of finding types to filter by"),
|
|
11
|
+
severities: z.array(z.enum(severities)).optional().describe("List of severity levels to filter by"),
|
|
12
|
+
source_kinds: z.array(z.string()).optional().describe("List of source kinds to filter by. i.e. Deployment,Pod,Container,Node,etc."),
|
|
13
|
+
source_types: z.array(z.enum(source_types)).optional().describe("List of source types to filter by"),
|
|
14
|
+
source_names: z.array(z.string()).optional().describe("List of source names to filter by"),
|
|
15
|
+
source_namespaces: z.array(z.string()).optional().describe("List of source namespaces to filter by"),
|
|
16
|
+
status: z.enum(statuses).optional().default("open").describe("Status of the findings to filter by"),
|
|
17
|
+
from_time: z.string().optional().default("now-7d").describe("From time in RFC3339 or relative format, i.e. now-7d"),
|
|
18
|
+
to_time: z.string().optional().describe("To time in RFC3339 or relative format, i.e. now-7d"),
|
|
19
|
+
});
|
|
20
|
+
export const updateFindingStatusSchema = z.object({
|
|
21
|
+
id: z.string().describe("Finding ID to update"),
|
|
22
|
+
status: z.enum(statuses).describe("New status for the finding"),
|
|
23
|
+
});
|
|
24
|
+
// Helper function to create filter params from multiple arrays
|
|
25
|
+
function makeFilter(filterObj) {
|
|
26
|
+
const filters = [];
|
|
27
|
+
for (const [key, value] of Object.entries(filterObj)) {
|
|
28
|
+
if (!value)
|
|
29
|
+
continue;
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
for (const item of value) {
|
|
32
|
+
if (item) {
|
|
33
|
+
filters.push(`${key}:${item}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
filters.push(`${key}:${value}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return filters.join(",");
|
|
42
|
+
}
|
|
43
|
+
// Main functions
|
|
44
|
+
export async function listFindings(client, limit = 20, types, severities, source_types, source_kinds, source_names, source_namespaces, status = "open", from_time = "now-7d", to_time) {
|
|
45
|
+
const filterParam = makeFilter({
|
|
46
|
+
type: types,
|
|
47
|
+
severity: severities,
|
|
48
|
+
source_type: source_types,
|
|
49
|
+
source_kind: source_kinds,
|
|
50
|
+
source_name: source_names,
|
|
51
|
+
source_namespace: source_namespaces,
|
|
52
|
+
status: status,
|
|
53
|
+
});
|
|
54
|
+
const params = {
|
|
55
|
+
limit,
|
|
56
|
+
filters: filterParam,
|
|
57
|
+
from: from_time,
|
|
58
|
+
};
|
|
59
|
+
if (to_time) {
|
|
60
|
+
params.to = to_time;
|
|
61
|
+
}
|
|
62
|
+
const response = await client.makeRequest(`/accounts/${client.getAccountId()}/unified_findings/groups`, params);
|
|
63
|
+
return {
|
|
64
|
+
size: response.length,
|
|
65
|
+
entries: response,
|
|
66
|
+
has_more: response.length === limit,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export async function updateFindingGroupStatus(client, id, status) {
|
|
70
|
+
const data = { status };
|
|
71
|
+
await client.makeRequest(`/accounts/${client.getAccountId()}/unified_findings/groups/${id}/status`, {}, {
|
|
72
|
+
method: "PUT",
|
|
73
|
+
body: data,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.js","sourceRoot":"","sources":["../../src/operations/findings.ts"],"names":[],"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I,GAAG,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,MAAM,CAAC,WAAW,CACtB,aAAa,MAAM,CAAC,YAAY,EAAE,4BAA4B,EAAE,SAAS,EACzE,EAAE,EACF;QACE,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,IAAI;KACX,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { RadSecurityClient } from "../client.js";
|
|
3
|
+
declare const IdentityTypeEnum: z.ZodEnum<["k8s_service_account", "k8s_user", "k8s_group"]>;
|
|
4
|
+
type IdentityType = z.infer<typeof IdentityTypeEnum>;
|
|
5
|
+
export declare const ListIdentitiesSchema: z.ZodObject<{
|
|
6
|
+
identity_types: z.ZodOptional<z.ZodArray<z.ZodEnum<["k8s_service_account", "k8s_user", "k8s_group"]>, "many">>;
|
|
7
|
+
cluster_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
page_size: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
q: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
q?: string | undefined;
|
|
13
|
+
page?: number | undefined;
|
|
14
|
+
page_size?: number | undefined;
|
|
15
|
+
cluster_ids?: string[] | undefined;
|
|
16
|
+
identity_types?: ("k8s_service_account" | "k8s_user" | "k8s_group")[] | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
q?: string | undefined;
|
|
19
|
+
page?: number | undefined;
|
|
20
|
+
page_size?: number | undefined;
|
|
21
|
+
cluster_ids?: string[] | undefined;
|
|
22
|
+
identity_types?: ("k8s_service_account" | "k8s_user" | "k8s_group")[] | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const GetIdentityDetailsSchema: z.ZodObject<{
|
|
25
|
+
identity_id: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
identity_id: string;
|
|
28
|
+
}, {
|
|
29
|
+
identity_id: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function listIdentities(client: RadSecurityClient, identityTypes?: IdentityType[], clusterIds?: string[], page?: number, page_size?: number, q?: string): Promise<any>;
|
|
32
|
+
export declare function getIdentityDetails(client: RadSecurityClient, identityId: string): Promise<any>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const IdentityTypeEnum = z.enum(["k8s_service_account", "k8s_user", "k8s_group"]);
|
|
3
|
+
export const ListIdentitiesSchema = z.object({
|
|
4
|
+
identity_types: z.array(IdentityTypeEnum).optional().describe("Identity types to get"),
|
|
5
|
+
cluster_ids: z.array(z.string()).optional().describe("Cluster IDs to get identities for"),
|
|
6
|
+
page: z.number().optional().describe("Page number to get. Default: 1"),
|
|
7
|
+
page_size: z.number().optional().describe("Page size to get. Default: 10"),
|
|
8
|
+
q: z.string().optional().describe("Query to filter identities"),
|
|
9
|
+
});
|
|
10
|
+
export const GetIdentityDetailsSchema = z.object({
|
|
11
|
+
identity_id: z.string().describe("Identity ID to get details for"),
|
|
12
|
+
});
|
|
13
|
+
export async function listIdentities(client, identityTypes = [], clusterIds = [], page = 1, page_size = 10, q = "") {
|
|
14
|
+
const identities = await client.makeRequest(`/accounts/${client.getAccountId()}/identities`, {
|
|
15
|
+
identity_types: identityTypes.join(","),
|
|
16
|
+
identity_sources: clusterIds.join(","),
|
|
17
|
+
page,
|
|
18
|
+
page_size,
|
|
19
|
+
q,
|
|
20
|
+
});
|
|
21
|
+
return identities;
|
|
22
|
+
}
|
|
23
|
+
export async function getIdentityDetails(client, identityId) {
|
|
24
|
+
const identity = await client.makeRequest(`/accounts/${client.getAccountId()}/identities/${identityId}`);
|
|
25
|
+
if (!identity) {
|
|
26
|
+
throw new Error(`No identity found with ID: ${identityId}`);
|
|
27
|
+
}
|
|
28
|
+
return identity;
|
|
29
|
+
}
|
|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C,WAAW,CACzC,aAAa,MAAM,CAAC,YAAY,EAAE,aAAa,EAC/C;QACE,cAAc,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;QACvC,gBAAgB,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;QACtC,IAAI;QACJ,SAAS;QACT,CAAC;KACF,CACF,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACpC,MAAyB,EACzB,UAAkB;IAElB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CACvC,aAAa,MAAM,CAAC,YAAY,EAAE,eAAe,UAAU,EAAE,CAC9D,CAAC;IAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,UAAU,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { RadSecurityClient } from "../client.js";
|
|
3
|
+
export declare const ListImagesSchema: z.ZodObject<{
|
|
4
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
page_size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
sort: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
7
|
+
search: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
sort: string;
|
|
10
|
+
page: number;
|
|
11
|
+
page_size: number;
|
|
12
|
+
search?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
sort?: string | undefined;
|
|
15
|
+
page?: number | undefined;
|
|
16
|
+
page_size?: number | undefined;
|
|
17
|
+
search?: string | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const ListImageVulnerabilitiesSchema: z.ZodObject<{
|
|
20
|
+
digest: z.ZodString;
|
|
21
|
+
severities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
22
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
23
|
+
page_size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
page: number;
|
|
26
|
+
page_size: number;
|
|
27
|
+
digest: string;
|
|
28
|
+
severities?: string[] | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
digest: string;
|
|
31
|
+
page?: number | undefined;
|
|
32
|
+
page_size?: number | undefined;
|
|
33
|
+
severities?: string[] | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const GetImageSBOMSchema: z.ZodObject<{
|
|
36
|
+
digest: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
digest: string;
|
|
39
|
+
}, {
|
|
40
|
+
digest: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function listImages(client: RadSecurityClient, page?: number, page_size?: number, sort?: string, search?: string): Promise<any>;
|
|
43
|
+
export declare function listImageScans(client: RadSecurityClient, digest: string, page?: number, page_size?: number): Promise<any>;
|
|
44
|
+
export declare function listImageVulnerabilities(client: RadSecurityClient, digest: string, severities?: string[], page?: number, page_size?: number): Promise<any>;
|
|
45
|
+
export declare function getTopVulnerableImages(client: RadSecurityClient): Promise<any>;
|
|
46
|
+
export declare function getImageSBOM(client: RadSecurityClient, digest: string): Promise<any>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ListImagesSchema = z.object({
|
|
3
|
+
page: z.number().optional().default(1).describe("Page number for pagination"),
|
|
4
|
+
page_size: z.number().optional().default(20).describe("Number of items per page"),
|
|
5
|
+
sort: z.string().optional().default("name:asc").describe("Sort order"),
|
|
6
|
+
search: z.string().optional().describe("Search query"),
|
|
7
|
+
});
|
|
8
|
+
export const ListImageVulnerabilitiesSchema = z.object({
|
|
9
|
+
digest: z.string().describe("Image digest (required for vulnerabilities)"),
|
|
10
|
+
severities: z.array(z.string()).optional().describe("List of severity levels to filter"),
|
|
11
|
+
page: z.number().optional().default(1).describe("Page number for pagination"),
|
|
12
|
+
page_size: z.number().optional().default(100).describe("Number of items per page"),
|
|
13
|
+
});
|
|
14
|
+
export const GetImageSBOMSchema = z.object({
|
|
15
|
+
digest: z.string().describe("Image digest (required for SBOM)"),
|
|
16
|
+
});
|
|
17
|
+
export async function listImages(client, page = 1, page_size = 20, sort = "name:asc", search) {
|
|
18
|
+
const params = { page, page_size, sort };
|
|
19
|
+
if (search) {
|
|
20
|
+
params.q = search;
|
|
21
|
+
}
|
|
22
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/images`, params);
|
|
23
|
+
}
|
|
24
|
+
export async function listImageScans(client, digest, page = 1, page_size = 3) {
|
|
25
|
+
const params = { page, page_size };
|
|
26
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/images/${digest}/scans`, params);
|
|
27
|
+
}
|
|
28
|
+
export async function listImageVulnerabilities(client, digest, severities, page = 1, page_size = 20) {
|
|
29
|
+
const params = { page, page_size, sort: "severity:desc" };
|
|
30
|
+
if (severities && severities.length > 0) {
|
|
31
|
+
params.severities = severities.join(",");
|
|
32
|
+
}
|
|
33
|
+
const scans = await listImageScans(client, digest);
|
|
34
|
+
if (!scans || !scans.entries || scans.entries.length === 0) {
|
|
35
|
+
throw new Error(`Image with digest: ${digest} hasn't been scanned yet`);
|
|
36
|
+
}
|
|
37
|
+
// Get the latest scan
|
|
38
|
+
const scanId = scans.entries[0].id;
|
|
39
|
+
const vulns = await client.makeRequest(`/accounts/${client.getAccountId()}/images/${digest}/scans/${scanId}/vulnerabilities`, params);
|
|
40
|
+
// Remove CPEs to reduce context window size when used with LLMs
|
|
41
|
+
vulns.entries.forEach((vuln) => {
|
|
42
|
+
if (vuln.cpes) {
|
|
43
|
+
delete vuln.cpes;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return vulns;
|
|
47
|
+
}
|
|
48
|
+
export async function getTopVulnerableImages(client) {
|
|
49
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/reports/top_vulnerable_images`, {}, {
|
|
50
|
+
headers: {
|
|
51
|
+
"Accept": "application/json",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export async function getImageSBOM(client, digest) {
|
|
56
|
+
return client.makeRequest(`/accounts/${client.getAccountId()}/sboms/${digest}/download`);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.js","sourceRoot":"","sources":["../../src/operations/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAC7E,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IACjF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC;IACtE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;CACvD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IAC1E,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE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,KAAK,UAAU,YAAY,CAChC,MAAyB,EACzB,MAAc;IAEd,OAAO,MAAM,CAAC,WAAW,CACvB,aAAa,MAAM,CAAC,YAAY,EAAE,UAAU,MAAM,WAAW,CAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { RadSecurityClient } from "../client.js";
|
|
3
|
+
export declare const GetKubernetesResourceDetailsSchema: z.ZodObject<{
|
|
4
|
+
cluster_id: z.ZodString;
|
|
5
|
+
resource_uid: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
cluster_id: string;
|
|
8
|
+
resource_uid: string;
|
|
9
|
+
}, {
|
|
10
|
+
cluster_id: string;
|
|
11
|
+
resource_uid: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const ListKubernetesResourcesSchema: z.ZodObject<{
|
|
14
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
15
|
+
kinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
+
cluster_id: z.ZodOptional<z.ZodString>;
|
|
17
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
18
|
+
page_size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
page: number;
|
|
21
|
+
page_size: number;
|
|
22
|
+
namespace?: string | undefined;
|
|
23
|
+
cluster_id?: string | undefined;
|
|
24
|
+
kinds?: string[] | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
namespace?: string | undefined;
|
|
27
|
+
cluster_id?: string | undefined;
|
|
28
|
+
page?: number | undefined;
|
|
29
|
+
page_size?: number | undefined;
|
|
30
|
+
kinds?: string[] | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
export declare function getKubernetesResourceDetails(client: RadSecurityClient, clusterId: string, resourceUid: string): Promise<any>;
|
|
33
|
+
export declare function listKubernetesResources(client: RadSecurityClient, kinds: string[] | undefined, namespace?: string, clusterId?: string, page?: number, pageSize?: number): Promise<any>;
|