{ "swagger": "2.0", "info": { "contact": {} }, "paths": { "/endpoints": { "get": { "description": "List all registered endpoints in the router", "consumes": [ "text/plain" ], "produces": [ "text/plain" ], "tags": [ "debug" ], "summary": "List all available endpoints", "responses": { "200": { "description": "Endpoints listed successfully", "schema": { "type": "string" } } } } }, "/rest-api/v1/cluster/config/file": { "post": { "description": "Uploads a KubeConfig file for cluster, with a maximum size of 2MB, and the valid file extension is \"\", \".yaml\", \".yml\", \".json\", \".kubeconfig\", \".kubeconf\".", "consumes": [ "multipart/form-data" ], "produces": [ "text/plain" ], "tags": [ "cluster" ], "summary": "Upload kubeConfig file for cluster", "parameters": [ { "type": "file", "description": "Upload file with field name 'file'", "name": "file", "in": "formData", "required": true }, { "type": "string", "description": "cluster name", "name": "name", "in": "formData", "required": true }, { "type": "string", "description": "cluster display name", "name": "displayName", "in": "formData", "required": true }, { "type": "string", "description": "cluster description", "name": "description", "in": "formData", "required": true } ], "responses": { "200": { "description": "Returns the content of the uploaded KubeConfig file.", "schema": { "$ref": "#/definitions/cluster.UploadData" } }, "400": { "description": "The uploaded file is too large or the request is invalid.", "schema": { "type": "string" } }, "500": { "description": "Internal server error.", "schema": { "type": "string" } } } } }, "/rest-api/v1/cluster/config/validate": { "post": { "description": "Validates the provided KubeConfig using cluster manager methods.", "consumes": [ "text/plain", "application/json" ], "produces": [ "application/json" ], "tags": [ "cluster" ], "summary": "Validate KubeConfig", "parameters": [ { "description": "KubeConfig payload to validate", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/cluster.ValidatePayload" } } ], "responses": { "200": { "description": "Verification passed server version", "schema": { "type": "string" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/cluster/{clusterName}": { "get": { "description": "This endpoint returns a cluster resource by name.", "produces": [ "application/json" ], "tags": [ "cluster" ], "summary": "Get returns a cluster resource by name.", "parameters": [ { "type": "string", "description": "The format of the response. Either in json or yaml", "name": "format", "in": "query" } ], "responses": { "200": { "description": "Unstructured object", "schema": { "$ref": "#/definitions/unstructured.Unstructured" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } }, "put": { "description": "This endpoint updates the display name and description of an existing cluster resource.", "consumes": [ "text/plain", "application/json" ], "produces": [ "application/json" ], "tags": [ "cluster" ], "summary": "Update updates the cluster metadata by name.", "parameters": [ { "description": "cluster to update (either plain text or JSON format)", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/cluster.ClusterPayload" } } ], "responses": { "200": { "description": "Unstructured object", "schema": { "$ref": "#/definitions/unstructured.Unstructured" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } }, "post": { "description": "This endpoint creates a new cluster resource using the payload.", "consumes": [ "text/plain", "application/json" ], "produces": [ "application/json" ], "tags": [ "cluster" ], "summary": "Create creates a cluster resource.", "parameters": [ { "description": "cluster to create (either plain text or JSON format)", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/cluster.ClusterPayload" } } ], "responses": { "200": { "description": "Unstructured object", "schema": { "$ref": "#/definitions/unstructured.Unstructured" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } }, "delete": { "description": "This endpoint deletes the cluster resource by name.", "produces": [ "application/json" ], "tags": [ "cluster" ], "summary": "Delete removes a cluster resource by name.", "responses": { "200": { "description": "Operation status", "schema": { "type": "string" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/clusters": { "get": { "description": "This endpoint lists all cluster resources.", "produces": [ "application/json" ], "tags": [ "cluster" ], "summary": "List lists all cluster resources.", "parameters": [ { "type": "boolean", "description": "Whether to display summary or not. Default to false", "name": "summary", "in": "query" }, { "type": "string", "description": "The order to list the cluster. Default to order by name", "name": "orderBy", "in": "query" }, { "type": "boolean", "description": "Whether to sort the list in descending order. Default to false", "name": "descending", "in": "query" } ], "responses": { "200": { "description": "List of cluster objects", "schema": { "type": "array", "items": { "$ref": "#/definitions/unstructured.Unstructured" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/insight/audit": { "get": { "description": "This endpoint audits based on the specified locator.", "produces": [ "application/json" ], "tags": [ "insight" ], "summary": "Audit based on locator.", "parameters": [ { "type": "string", "description": "The specified cluster name, such as 'example-cluster'", "name": "cluster", "in": "query" }, { "type": "string", "description": "The specified apiVersion, such as 'apps/v1'", "name": "apiVersion", "in": "query" }, { "type": "string", "description": "The specified kind, such as 'Deployment'", "name": "kind", "in": "query" }, { "type": "string", "description": "The specified namespace, such as 'default'", "name": "namespace", "in": "query" }, { "type": "string", "description": "The specified resource name, such as 'foo'", "name": "name", "in": "query" }, { "type": "boolean", "description": "Switch for forced scanning, default is 'false'", "name": "forceNew", "in": "query" } ], "responses": { "200": { "description": "Audit results", "schema": { "$ref": "#/definitions/scanner.AuditData" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/insight/detail": { "get": { "description": "This endpoint returns a Kubernetes resource by name, namespace, cluster, apiVersion and kind.", "produces": [ "application/json" ], "tags": [ "insight" ], "summary": "GetDetail returns a Kubernetes resource by name, namespace, cluster, apiVersion and kind.", "parameters": [ { "type": "string", "description": "The format of the response. Either in json or yaml. Default to json", "name": "format", "in": "query" }, { "type": "string", "description": "The specified cluster name, such as 'example-cluster'", "name": "cluster", "in": "query" }, { "type": "string", "description": "The specified apiVersion, such as 'apps/v1'. Should be percent-encoded", "name": "apiVersion", "in": "query" }, { "type": "string", "description": "The specified kind, such as 'Deployment'", "name": "kind", "in": "query" }, { "type": "string", "description": "The specified namespace, such as 'default'", "name": "namespace", "in": "query" }, { "type": "string", "description": "The specified resource name, such as 'foo'", "name": "name", "in": "query" } ], "responses": { "200": { "description": "Unstructured object", "schema": { "$ref": "#/definitions/unstructured.Unstructured" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/insight/events": { "get": { "description": "This endpoint returns events for a Kubernetes resource YAML by name, namespace, cluster, apiVersion and kind.", "produces": [ "application/json" ], "tags": [ "insight" ], "summary": "GetEvents returns events for a Kubernetes resource by name, namespace, cluster, apiVersion and kind.", "parameters": [ { "type": "string", "description": "The specified cluster name, such as 'example-cluster'", "name": "cluster", "in": "query" }, { "type": "string", "description": "The specified apiVersion, such as 'apps/v1'. Should be percent-encoded", "name": "apiVersion", "in": "query" }, { "type": "string", "description": "The specified kind, such as 'Deployment'", "name": "kind", "in": "query" }, { "type": "string", "description": "The specified namespace, such as 'default'", "name": "namespace", "in": "query" }, { "type": "string", "description": "The specified resource name, such as 'foo'", "name": "name", "in": "query" } ], "responses": { "200": { "description": "List of events", "schema": { "type": "array", "items": { "$ref": "#/definitions/unstructured.Unstructured" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/insight/score": { "get": { "description": "This endpoint calculates a score for the provided manifest based on the number and severity of issues detected during the audit.", "produces": [ "application/json" ], "tags": [ "insight" ], "summary": "ScoreHandler calculates a score for the audited manifest.", "parameters": [ { "type": "string", "description": "The specified cluster name, such as 'example-cluster'", "name": "cluster", "in": "query" }, { "type": "string", "description": "The specified apiVersion, such as 'apps/v1'", "name": "apiVersion", "in": "query" }, { "type": "string", "description": "The specified kind, such as 'Deployment'", "name": "kind", "in": "query" }, { "type": "string", "description": "The specified namespace, such as 'default'", "name": "namespace", "in": "query" }, { "type": "string", "description": "The specified resource name, such as 'foo'", "name": "name", "in": "query" }, { "type": "boolean", "description": "Switch for forced compute score, default is 'false'", "name": "forceNew", "in": "query" } ], "responses": { "200": { "description": "Score calculation result", "schema": { "$ref": "#/definitions/insight.ScoreData" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/insight/summary": { "get": { "description": "This endpoint returns a Kubernetes resource summary by name, namespace, cluster, apiVersion and kind.", "produces": [ "application/json" ], "tags": [ "insight" ], "summary": "Get returns a Kubernetes resource summary by name, namespace, cluster, apiVersion and kind.", "parameters": [ { "type": "string", "description": "The specified cluster name, such as 'example-cluster'", "name": "cluster", "in": "query" }, { "type": "string", "description": "The specified apiVersion, such as 'apps/v1'. Should be percent-encoded", "name": "apiVersion", "in": "query" }, { "type": "string", "description": "The specified kind, such as 'Deployment'", "name": "kind", "in": "query" }, { "type": "string", "description": "The specified namespace, such as 'default'", "name": "namespace", "in": "query" }, { "type": "string", "description": "The specified resource name, such as 'foo'", "name": "name", "in": "query" } ], "responses": { "200": { "description": "Resource Summary", "schema": { "$ref": "#/definitions/insight.ResourceSummary" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/insight/topology": { "get": { "description": "This endpoint returns a topology map for a Kubernetes resource by name, namespace, cluster, apiVersion and kind.", "produces": [ "application/json" ], "tags": [ "insight" ], "summary": "GetTopology returns a topology map for a Kubernetes resource by name, namespace, cluster, apiVersion and kind.", "parameters": [ { "type": "string", "description": "The specified cluster name, such as 'example-cluster'", "name": "cluster", "in": "query" }, { "type": "string", "description": "The specified apiVersion, such as 'apps/v1'. Should be percent-encoded", "name": "apiVersion", "in": "query" }, { "type": "string", "description": "The specified kind, such as 'Deployment'", "name": "kind", "in": "query" }, { "type": "string", "description": "The specified namespace, such as 'default'", "name": "namespace", "in": "query" }, { "type": "string", "description": "The specified resource name, such as 'foo'", "name": "name", "in": "query" } ], "responses": { "200": { "description": "map from string to resource.ResourceTopology", "schema": { "type": "object", "additionalProperties": { "$ref": "#/definitions/insight.ResourceTopology" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/rest-api/v1/search": { "get": { "description": "This endpoint returns an array of Kubernetes runtime Object matched using the query from context.", "produces": [ "application/json" ], "tags": [ "search" ], "summary": "SearchForResource returns an array of Kubernetes runtime Object matched using the query from context.", "parameters": [ { "type": "string", "description": "The query to use for search. Required", "name": "query", "in": "query", "required": true }, { "type": "string", "description": "The search pattern. Can be either sql or dsl. Required", "name": "pattern", "in": "query", "required": true }, { "type": "string", "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" }, { "type": "string", "description": "The current page to fetch. Default to 1", "name": "page", "in": "query" } ], "responses": { "200": { "description": "Array of runtime.Object", "schema": { "type": "array", "items": {} } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "405": { "description": "Method Not Allowed", "schema": { "type": "string" } }, "429": { "description": "Too Many Requests", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } } }, "definitions": { "cluster.ClusterPayload": { "type": "object", "properties": { "description": { "description": "ClusterDescription is the description of cluster to be created", "type": "string" }, "displayName": { "description": "ClusterDisplayName is the display name of cluster to be created", "type": "string" }, "kubeconfig": { "description": "ClusterKubeConfig is the kubeconfig of cluster to be created", "type": "string" } } }, "cluster.UploadData": { "type": "object", "properties": { "content": { "type": "string" }, "fileName": { "type": "string" }, "fileSize": { "type": "integer" }, "sanitizedClusterContent": { "type": "string" } } }, "cluster.ValidatePayload": { "type": "object", "properties": { "kubeConfig": { "type": "string" } } }, "core.Locator": { "type": "object", "properties": { "apiVersion": { "type": "string" }, "cluster": { "type": "string" }, "kind": { "type": "string" }, "name": { "type": "string" }, "namespace": { "type": "string" } } }, "insight.ResourceSummary": { "type": "object", "properties": { "creationTimestamp": { "type": "string" }, "resource": { "$ref": "#/definitions/core.Locator" }, "resourceVersion": { "type": "string" }, "uid": { "type": "string" } } }, "insight.ResourceTopology": { "type": "object", "properties": { "children": { "type": "array", "items": { "type": "string" } }, "identifier": { "type": "string" }, "parents": { "type": "array", "items": { "type": "string" } } } }, "insight.ScoreData": { "type": "object", "properties": { "issuesTotal": { "description": "IssuesTotal is the total count of all issues found during the audit.\nThis count can be used to understand the overall number of problems\nthat need to be addressed.", "type": "integer" }, "resourceTotal": { "description": "ResourceTotal is the count of unique resources audited during the scan.", "type": "integer" }, "score": { "description": "Score represents the calculated score of the audited manifest based on\nthe number and severity of issues. It provides a quantitative measure\nof the security posture of the resources in the manifest.", "type": "number" }, "severityStatistic": { "description": "SeverityStatistic is a mapping of severity levels to their respective\nnumber of occurrences. It allows for a quick overview of the distribution\nof issues across different severity categories.", "type": "object", "additionalProperties": { "type": "integer" } } } }, "scanner.AuditData": { "type": "object", "properties": { "bySeverity": { "type": "object", "additionalProperties": { "type": "integer" } }, "issueGroups": { "type": "array", "items": { "$ref": "#/definitions/scanner.IssueGroup" } }, "issueTotal": { "type": "integer" }, "resourceTotal": { "type": "integer" } } }, "scanner.Issue": { "type": "object", "properties": { "message": { "description": "Message provides a detailed human-readable description of the issue.", "type": "string" }, "scanner": { "description": "Scanner is the name of the scanner that discovered the issue.", "type": "string" }, "severity": { "description": "Severity indicates how critical the issue is, using the IssueSeverityLevel constants.", "type": "integer" }, "title": { "description": "Title is a brief summary of the issue.", "type": "string" } } }, "scanner.IssueGroup": { "type": "object", "properties": { "issue": { "$ref": "#/definitions/scanner.Issue" }, "locators": { "type": "array", "items": { "$ref": "#/definitions/core.Locator" } } } }, "unstructured.Unstructured": { "type": "object", "properties": { "object": { "description": "Object is a JSON compatible map with string, float, int, bool, []interface{}, or\nmap[string]interface{}\nchildren.", "type": "object", "additionalProperties": true } } } } }