diff --git a/deepfence_ctl/cmd/auth.go b/deepfence_ctl/cmd/auth.go index 81e2be3617..ece58892a0 100644 --- a/deepfence_ctl/cmd/auth.go +++ b/deepfence_ctl/cmd/auth.go @@ -7,6 +7,7 @@ import ( "github.com/spf13/cobra" + "github.com/deepfence/ThreatMapper/deepfence_ctl/output" oahttp "github.com/deepfence/ThreatMapper/deepfence_utils/http" "github.com/deepfence/ThreatMapper/deepfence_utils/log" ) @@ -56,7 +57,7 @@ var authCmd = &cobra.Command{ log.Fatal().Msgf("Failed to authenticate %v\n", err) } - log.Info().Msgf("Successful login") + output.Out(map[string]string{"login": "successful"}) }, } diff --git a/deepfence_ctl/cmd/scan.go b/deepfence_ctl/cmd/scan.go index df830ab5ac..2f89bf8d7f 100644 --- a/deepfence_ctl/cmd/scan.go +++ b/deepfence_ctl/cmd/scan.go @@ -5,6 +5,7 @@ import ( "github.com/spf13/cobra" + "github.com/deepfence/ThreatMapper/deepfence_ctl/output" "github.com/deepfence/ThreatMapper/deepfence_server_client" ctl "github.com/deepfence/ThreatMapper/deepfence_utils/controls" oahttp "github.com/deepfence/ThreatMapper/deepfence_utils/http" @@ -74,7 +75,7 @@ var scanStartSubCmd = &cobra.Command{ if err != nil { log.Fatal().Msgf("Fail to execute: %v", err) } - log.Info().Msgf("Scan Id: %s", res.ScanId) + output.Out(res) }, } @@ -109,7 +110,7 @@ var scanStatusSubCmd = &cobra.Command{ if err != nil { log.Fatal().Msgf("Fail to execute: %v", err) } - log.Info().Msgf("Scan Id: %s, Status: %s", scan_id, res.GetStatus()) + output.Out(res) }, } @@ -135,10 +136,12 @@ var scanListSubCmd = &cobra.Command{ switch scan_type { case "secret": req := https_client.Client().SecretScanApi.ListSecretScan(context.Background()) - req = req.NodeId(node_id) - req = req.Window(deepfence_server_client.ModelFetchWindow{ - Offset: 0, - Size: 20, + req = req.ModelScanListReq(deepfence_server_client.ModelScanListReq{ + NodeId: node_id, + Window: deepfence_server_client.ModelFetchWindow{ + Offset: 0, + Size: 20, + }, }) res, _, err = https_client.Client().SecretScanApi.ListSecretScanExecute(req) default: @@ -148,7 +151,7 @@ var scanListSubCmd = &cobra.Command{ if err != nil { log.Fatal().Msgf("Fail to execute: %v", err) } - log.Info().Msgf("%v", node_id, res.ScansInfo) + output.Out(res) }, } @@ -174,10 +177,12 @@ var scanResultsSubCmd = &cobra.Command{ switch scan_type { case "secret": req := https_client.Client().SecretScanApi.ResultsSecretScan(context.Background()) - req = req.ScanId(scan_id) - req = req.Window(deepfence_server_client.ModelFetchWindow{ - Offset: 0, - Size: 20, + req = req.ModelScanResultsReq(deepfence_server_client.ModelScanResultsReq{ + ScanId: scan_id, + Window: deepfence_server_client.ModelFetchWindow{ + Offset: 0, + Size: 20, + }, }) res, _, err = https_client.Client().SecretScanApi.ResultsSecretScanExecute(req) default: @@ -187,7 +192,7 @@ var scanResultsSubCmd = &cobra.Command{ if err != nil { log.Fatal().Msgf("Fail to execute: %v", err) } - log.Info().Msgf("%v", res) + output.Out(res) }, } diff --git a/deepfence_ctl/output/common.go b/deepfence_ctl/output/common.go new file mode 100644 index 0000000000..cc8160caef --- /dev/null +++ b/deepfence_ctl/output/common.go @@ -0,0 +1,30 @@ +package output + +import ( + "os" + + "github.com/deepfence/ThreatMapper/deepfence_utils/log" +) + +var format string + +func Out[T any](t T) { + var err error + switch format { + case "json": + err = out_json(t) + default: + log.Error().Msgf("Output format %s not supported", format) + } + if err != nil { + log.Error().Msgf("Could not marshal %v into %v format: %v", t, format, err) + } +} + +func init() { + format = os.Getenv("DEEPFENCE_CTL_OUT_FORMAT") + if format == "" { + format = "json" + log.Warn().Msgf("Using default output format %s", format) + } +} diff --git a/deepfence_ctl/output/json.go b/deepfence_ctl/output/json.go new file mode 100644 index 0000000000..354b7e1b86 --- /dev/null +++ b/deepfence_ctl/output/json.go @@ -0,0 +1,15 @@ +package output + +import ( + "encoding/json" + "fmt" +) + +func out_json[T any](t T) error { + b, err := json.Marshal(t) + if err != nil { + return err + } + fmt.Printf("%s\n", string(b)) + return nil +} diff --git a/deepfence_server/apiDocs/operation.go b/deepfence_server/apiDocs/operation.go index 37281e3a4e..05e3b9bb65 100644 --- a/deepfence_server/apiDocs/operation.go +++ b/deepfence_server/apiDocs/operation.go @@ -141,30 +141,30 @@ func (d *OpenApiDocs) AddScansOperations() { http.StatusOK, []string{tagMalwareScan}, bearerToken, new(model.ScanStatusReq), new(model.ScanStatusResp)) // List scans - d.AddOperation("listVulnerabilityScans", http.MethodGet, "/deepfence/scan/list/vulnerability", + d.AddOperation("listVulnerabilityScans", http.MethodPost, "/deepfence/scan/list/vulnerability", "Get Vulnerability Scans List", "Get Vulnerability Scan list on agent or registry", http.StatusOK, []string{tagVulnerability}, bearerToken, new(model.ScanListReq), new(model.ScanListResp)) - d.AddOperation("listSecretScan", http.MethodGet, "/deepfence/scan/list/secret", + d.AddOperation("listSecretScan", http.MethodPost, "/deepfence/scan/list/secret", "Get Secret Scans List", "Get Secret Scans list on agent or registry", http.StatusOK, []string{tagSecretScan}, bearerToken, new(model.ScanListReq), new(model.ScanListResp)) - d.AddOperation("listComplianceScan", http.MethodGet, "/deepfence/scan/list/compliance", + d.AddOperation("listComplianceScan", http.MethodPost, "/deepfence/scan/list/compliance", "Get Compliance Scans List", "Get Compliance Scans list on agent or registry", http.StatusOK, []string{tagCompliance}, bearerToken, new(model.ScanListReq), new(model.ScanListResp)) - d.AddOperation("listMalwareScan", http.MethodGet, "/deepfence/scan/list/malware", + d.AddOperation("listMalwareScan", http.MethodPost, "/deepfence/scan/list/malware", "Get Malware Scans List", "Get Malware Scans list on agent or registry", http.StatusOK, []string{tagMalwareScan}, bearerToken, new(model.ScanListReq), new(model.ScanListResp)) // Scans' Results - d.AddOperation("resultsVulnerabilityScans", http.MethodGet, "/deepfence/scan/results/vulnerability", + d.AddOperation("resultsVulnerabilityScans", http.MethodPost, "/deepfence/scan/results/vulnerability", "Get Vulnerability Scans Results", "Get Vulnerability Scan results on agent or registry", http.StatusOK, []string{tagVulnerability}, bearerToken, new(model.ScanResultsReq), new(model.ScanResultsResp)) - d.AddOperation("resultsSecretScan", http.MethodGet, "/deepfence/scan/results/secret", + d.AddOperation("resultsSecretScan", http.MethodPost, "/deepfence/scan/results/secret", "Get Secret Scans Results", "Get Secret Scans results on agent or registry", http.StatusOK, []string{tagSecretScan}, bearerToken, new(model.ScanResultsReq), new(model.ScanResultsResp)) - d.AddOperation("resultsComplianceScan", http.MethodGet, "/deepfence/scan/results/compliance", + d.AddOperation("resultsComplianceScan", http.MethodPost, "/deepfence/scan/results/compliance", "Get Compliance Scans Results", "Get Compliance Scans results on agent or registry", http.StatusOK, []string{tagCompliance}, bearerToken, new(model.ScanResultsReq), new(model.ScanResultsResp)) - d.AddOperation("resultsMalwareScan", http.MethodGet, "/deepfence/scan/results/malware", + d.AddOperation("resultsMalwareScan", http.MethodPost, "/deepfence/scan/results/malware", "Get Malware Scans Results", "Get Malware Scans results on agent or registry", http.StatusOK, []string{tagMalwareScan}, bearerToken, new(model.ScanResultsReq), new(model.ScanResultsResp)) } diff --git a/deepfence_server/handler/scan_reports.go b/deepfence_server/handler/scan_reports.go index 8fd3de6a24..0fc39a5234 100644 --- a/deepfence_server/handler/scan_reports.go +++ b/deepfence_server/handler/scan_reports.go @@ -405,7 +405,7 @@ func (h *Handler) ListMalwareScansHandler(w http.ResponseWriter, r *http.Request func listScansHandler(w http.ResponseWriter, r *http.Request, scan_type utils.Neo4jScanType) { defer r.Body.Close() var req model.ScanListReq - err := httpext.DecodeQueryParams(r, &req) + err := httpext.DecodeJSON(r, httpext.NoQueryParams, MaxPostRequestSize, &req) if err != nil { log.Error().Msgf("%v", err) httpext.JSON(w, http.StatusBadRequest, model.Response{Success: false}) @@ -441,7 +441,7 @@ func (h *Handler) ListMalwareScanResultsHandler(w http.ResponseWriter, r *http.R func listScanResultsHandler(w http.ResponseWriter, r *http.Request, scan_type utils.Neo4jScanType) { defer r.Body.Close() var req model.ScanResultsReq - err := httpext.DecodeQueryParams(r, &req) + err := httpext.DecodeJSON(r, httpext.NoQueryParams, MaxPostRequestSize, &req) if err != nil { log.Error().Msgf("%v", err) httpext.JSON(w, http.StatusBadRequest, model.Response{Success: false}) diff --git a/deepfence_server/model/scans.go b/deepfence_server/model/scans.go index a06cbd68fd..1c209ae2db 100644 --- a/deepfence_server/model/scans.go +++ b/deepfence_server/model/scans.go @@ -15,7 +15,7 @@ type ScanStatus string type ScanInfo struct { ScanId string `json:"scan_id" required:"true"` Status string `json:"status" required:"true"` - UpdatedAt int64 `json:"updated_at" required:"true"` + UpdatedAt int64 `json:"updated_at" required:"true" format:"int64"` } const ( @@ -37,8 +37,8 @@ type ScanStatusResp struct { } type ScanListReq struct { - NodeId string `query:"node_id" form:"node_id" required:"true"` - Window FetchWindow `query:"window" form:"window" required:"true"` + NodeId string `json:"node_id" required:"true"` + Window FetchWindow `json:"window" required:"true"` } type ScanListResp struct { @@ -46,8 +46,8 @@ type ScanListResp struct { } type ScanResultsReq struct { - ScanId string `query:"scan_id" form:"scan_id" required:"true"` - Window FetchWindow `query:"window" form:"window" required:"true"` + ScanId string `json:"scan_id" required:"true"` + Window FetchWindow `json:"window" required:"true"` } type ScanResultsResp struct { diff --git a/deepfence_server/router/router.go b/deepfence_server/router/router.go index 44e9a95976..1c78ee49ea 100644 --- a/deepfence_server/router/router.go +++ b/deepfence_server/router/router.go @@ -168,16 +168,16 @@ func SetupRoutes(r *chi.Mux, serverPort string, jwtSecret []byte, serveOpenapiDo r.Get("/malware", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.StatusMalwareScanHandler)) }) r.Route("/scan/list", func(r chi.Router) { - r.Get("/vulnerability", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListVulnerabilityScansHandler)) - r.Get("/secret", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListSecretScansHandler)) - r.Get("/compliance", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListComplianceScansHandler)) - r.Get("/malware", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListMalwareScansHandler)) + r.Post("/vulnerability", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListVulnerabilityScansHandler)) + r.Post("/secret", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListSecretScansHandler)) + r.Post("/compliance", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListComplianceScansHandler)) + r.Post("/malware", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListMalwareScansHandler)) }) r.Route("/scan/results", func(r chi.Router) { - r.Get("/vulnerability", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListVulnerabilityScanResultsHandler)) - r.Get("/secret", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListSecretScanResultsHandler)) - r.Get("/compliance", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListComplianceScanResultsHandler)) - r.Get("/malware", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListMalwareScanResultsHandler)) + r.Post("/vulnerability", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListVulnerabilityScanResultsHandler)) + r.Post("/secret", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListSecretScanResultsHandler)) + r.Post("/compliance", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListComplianceScanResultsHandler)) + r.Post("/malware", dfHandler.AuthHandler(ResourceScan, PermissionStop, dfHandler.ListMalwareScanResultsHandler)) }) openApiDocs.AddDiagnosisOperations() diff --git a/deepfence_server_client/.openapi-generator/FILES b/deepfence_server_client/.openapi-generator/FILES index 421f839473..73ba9c456f 100644 --- a/deepfence_server_client/.openapi-generator/FILES +++ b/deepfence_server_client/.openapi-generator/FILES @@ -45,7 +45,9 @@ docs/ModelRawReport.md docs/ModelResponse.md docs/ModelResponseAccessToken.md docs/ModelScanInfo.md +docs/ModelScanListReq.md docs/ModelScanListResp.md +docs/ModelScanResultsReq.md docs/ModelScanResultsResp.md docs/ModelScanStatusResp.md docs/ModelScanTriggerReq.md @@ -88,7 +90,9 @@ model_model_raw_report.go model_model_response.go model_model_response_access_token.go model_model_scan_info.go +model_model_scan_list_req.go model_model_scan_list_resp.go +model_model_scan_results_req.go model_model_scan_results_resp.go model_model_scan_status_resp.go model_model_scan_trigger_req.go diff --git a/deepfence_server_client/README.md b/deepfence_server_client/README.md index 6f514acff7..6820553f28 100644 --- a/deepfence_server_client/README.md +++ b/deepfence_server_client/README.md @@ -86,8 +86,8 @@ Class | Method | HTTP request | Description *CloudComplianceApi* | [**IngestCloudCompliances**](docs/CloudComplianceApi.md#ingestcloudcompliances) | **Post** /deepfence/ingest/cloud-compliance | Ingest Cloud Compliances *CloudResourcesApi* | [**IngestCloudResources**](docs/CloudResourcesApi.md#ingestcloudresources) | **Post** /deepfence/ingest/cloud-resources | Ingest Cloud resources *ComplianceApi* | [**IngestCompliances**](docs/ComplianceApi.md#ingestcompliances) | **Post** /deepfence/ingest/compliance | Ingest Compliances -*ComplianceApi* | [**ListComplianceScan**](docs/ComplianceApi.md#listcompliancescan) | **Get** /deepfence/scan/list/compliance | Get Compliance Scans List -*ComplianceApi* | [**ResultsComplianceScan**](docs/ComplianceApi.md#resultscompliancescan) | **Get** /deepfence/scan/results/compliance | Get Compliance Scans Results +*ComplianceApi* | [**ListComplianceScan**](docs/ComplianceApi.md#listcompliancescan) | **Post** /deepfence/scan/list/compliance | Get Compliance Scans List +*ComplianceApi* | [**ResultsComplianceScan**](docs/ComplianceApi.md#resultscompliancescan) | **Post** /deepfence/scan/results/compliance | Get Compliance Scans Results *ComplianceApi* | [**StartComplianceScan**](docs/ComplianceApi.md#startcompliancescan) | **Post** /deepfence/scan/start/compliance | Start Compliance Scan *ComplianceApi* | [**StatusComplianceScan**](docs/ComplianceApi.md#statuscompliancescan) | **Get** /deepfence/scan/status/compliance | Get Compliance Scan Status *ComplianceApi* | [**StopComplianceScan**](docs/ComplianceApi.md#stopcompliancescan) | **Post** /deepfence/scan/stop/compliance | Stop Compliance Scan @@ -98,15 +98,15 @@ Class | Method | HTTP request | Description *DiagnosisApi* | [**DiagnosticNotification**](docs/DiagnosisApi.md#diagnosticnotification) | **Get** /deepfence/diagnosis/notification | Get Diagnostic Notification *DiagnosisApi* | [**GenerateAgentDiagnosticLogs**](docs/DiagnosisApi.md#generateagentdiagnosticlogs) | **Post** /deepfence/diagnosis/agent-logs | Generate Agent Diagnostic Logs *DiagnosisApi* | [**GenerateConsoleDiagnosticLogs**](docs/DiagnosisApi.md#generateconsolediagnosticlogs) | **Post** /deepfence/diagnosis/console-logs | Generate Console Diagnostic Logs -*MalwareScanApi* | [**ListMalwareScan**](docs/MalwareScanApi.md#listmalwarescan) | **Get** /deepfence/scan/list/malware | Get Malware Scans List -*MalwareScanApi* | [**ResultsMalwareScan**](docs/MalwareScanApi.md#resultsmalwarescan) | **Get** /deepfence/scan/results/malware | Get Malware Scans Results +*MalwareScanApi* | [**ListMalwareScan**](docs/MalwareScanApi.md#listmalwarescan) | **Post** /deepfence/scan/list/malware | Get Malware Scans List +*MalwareScanApi* | [**ResultsMalwareScan**](docs/MalwareScanApi.md#resultsmalwarescan) | **Post** /deepfence/scan/results/malware | Get Malware Scans Results *MalwareScanApi* | [**StartMalwareScan**](docs/MalwareScanApi.md#startmalwarescan) | **Post** /deepfence/scan/start/malware | Start Malware Scan *MalwareScanApi* | [**StatusMalwareScan**](docs/MalwareScanApi.md#statusmalwarescan) | **Get** /deepfence/scan/status/malware | Get Malware Scan Status *MalwareScanApi* | [**StopMalwareScan**](docs/MalwareScanApi.md#stopmalwarescan) | **Post** /deepfence/scan/stop/malware | Stop Malware Scan *SecretScanApi* | [**IngestSecretScanStatus**](docs/SecretScanApi.md#ingestsecretscanstatus) | **Post** /deepfence/ingest/secret-scan-logs | Ingest Secrets Scan Status *SecretScanApi* | [**IngestSecrets**](docs/SecretScanApi.md#ingestsecrets) | **Post** /deepfence/ingest/secrets | Ingest Secrets -*SecretScanApi* | [**ListSecretScan**](docs/SecretScanApi.md#listsecretscan) | **Get** /deepfence/scan/list/secret | Get Secret Scans List -*SecretScanApi* | [**ResultsSecretScan**](docs/SecretScanApi.md#resultssecretscan) | **Get** /deepfence/scan/results/secret | Get Secret Scans Results +*SecretScanApi* | [**ListSecretScan**](docs/SecretScanApi.md#listsecretscan) | **Post** /deepfence/scan/list/secret | Get Secret Scans List +*SecretScanApi* | [**ResultsSecretScan**](docs/SecretScanApi.md#resultssecretscan) | **Post** /deepfence/scan/results/secret | Get Secret Scans Results *SecretScanApi* | [**StartSecretScan**](docs/SecretScanApi.md#startsecretscan) | **Post** /deepfence/scan/start/secret | Start Secret Scan *SecretScanApi* | [**StatusSecretScan**](docs/SecretScanApi.md#statussecretscan) | **Get** /deepfence/scan/status/secret | Get Secret Scan Status *SecretScanApi* | [**StopSecretScan**](docs/SecretScanApi.md#stopsecretscan) | **Post** /deepfence/scan/stop/secret | Stop Secret Scan @@ -119,8 +119,8 @@ Class | Method | HTTP request | Description *UserApi* | [**RegisterUser**](docs/UserApi.md#registeruser) | **Post** /deepfence/user/register | Register User *UserApi* | [**UpdateCurrentUser**](docs/UserApi.md#updatecurrentuser) | **Put** /deepfence/user | Update Current User *VulnerabilityApi* | [**IngestVulnerabilities**](docs/VulnerabilityApi.md#ingestvulnerabilities) | **Post** /deepfence/ingest/vulnerabilities | Ingest Vulnerabilities -*VulnerabilityApi* | [**ListVulnerabilityScans**](docs/VulnerabilityApi.md#listvulnerabilityscans) | **Get** /deepfence/scan/list/vulnerability | Get Vulnerability Scans List -*VulnerabilityApi* | [**ResultsVulnerabilityScans**](docs/VulnerabilityApi.md#resultsvulnerabilityscans) | **Get** /deepfence/scan/results/vulnerability | Get Vulnerability Scans Results +*VulnerabilityApi* | [**ListVulnerabilityScans**](docs/VulnerabilityApi.md#listvulnerabilityscans) | **Post** /deepfence/scan/list/vulnerability | Get Vulnerability Scans List +*VulnerabilityApi* | [**ResultsVulnerabilityScans**](docs/VulnerabilityApi.md#resultsvulnerabilityscans) | **Post** /deepfence/scan/results/vulnerability | Get Vulnerability Scans Results *VulnerabilityApi* | [**StartVulnerabilityScan**](docs/VulnerabilityApi.md#startvulnerabilityscan) | **Post** /deepfence/scan/start/vulnerability | Start Vulnerability Scan *VulnerabilityApi* | [**StatusVulnerabilityScan**](docs/VulnerabilityApi.md#statusvulnerabilityscan) | **Get** /deepfence/scan/status/vulnerability | Get Vulnerability Scan Status *VulnerabilityApi* | [**StopVulnerabilityScan**](docs/VulnerabilityApi.md#stopvulnerabilityscan) | **Post** /deepfence/scan/stop/vulnerability | Stop Vulnerability Scan @@ -150,7 +150,9 @@ Class | Method | HTTP request | Description - [ModelResponse](docs/ModelResponse.md) - [ModelResponseAccessToken](docs/ModelResponseAccessToken.md) - [ModelScanInfo](docs/ModelScanInfo.md) + - [ModelScanListReq](docs/ModelScanListReq.md) - [ModelScanListResp](docs/ModelScanListResp.md) + - [ModelScanResultsReq](docs/ModelScanResultsReq.md) - [ModelScanResultsResp](docs/ModelScanResultsResp.md) - [ModelScanStatusResp](docs/ModelScanStatusResp.md) - [ModelScanTriggerReq](docs/ModelScanTriggerReq.md) diff --git a/deepfence_server_client/api/openapi.yaml b/deepfence_server_client/api/openapi.yaml index 7a67fcc678..ded75cf000 100644 --- a/deepfence_server_client/api/openapi.yaml +++ b/deepfence_server_client/api/openapi.yaml @@ -787,24 +787,14 @@ paths: tags: - Vulnerability /deepfence/scan/list/compliance: - get: + post: description: Get Compliance Scans list on agent or registry operationId: listComplianceScan - parameters: - - explode: true - in: query - name: node_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanListReq' responses: "200": content: @@ -840,24 +830,14 @@ paths: tags: - Compliance /deepfence/scan/list/malware: - get: + post: description: Get Malware Scans list on agent or registry operationId: listMalwareScan - parameters: - - explode: true - in: query - name: node_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanListReq' responses: "200": content: @@ -893,24 +873,14 @@ paths: tags: - Malware Scan /deepfence/scan/list/secret: - get: + post: description: Get Secret Scans list on agent or registry operationId: listSecretScan - parameters: - - explode: true - in: query - name: node_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanListReq' responses: "200": content: @@ -946,24 +916,14 @@ paths: tags: - Secret Scan /deepfence/scan/list/vulnerability: - get: + post: description: Get Vulnerability Scan list on agent or registry operationId: listVulnerabilityScans - parameters: - - explode: true - in: query - name: node_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanListReq' responses: "200": content: @@ -999,24 +959,14 @@ paths: tags: - Vulnerability /deepfence/scan/results/compliance: - get: + post: description: Get Compliance Scans results on agent or registry operationId: resultsComplianceScan - parameters: - - explode: true - in: query - name: scan_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanResultsReq' responses: "200": content: @@ -1052,24 +1002,14 @@ paths: tags: - Compliance /deepfence/scan/results/malware: - get: + post: description: Get Malware Scans results on agent or registry operationId: resultsMalwareScan - parameters: - - explode: true - in: query - name: scan_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanResultsReq' responses: "200": content: @@ -1105,24 +1045,14 @@ paths: tags: - Malware Scan /deepfence/scan/results/secret: - get: + post: description: Get Secret Scans results on agent or registry operationId: resultsSecretScan - parameters: - - explode: true - in: query - name: scan_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanResultsReq' responses: "200": content: @@ -1158,24 +1088,14 @@ paths: tags: - Secret Scan /deepfence/scan/results/vulnerability: - get: + post: description: Get Vulnerability Scan results on agent or registry operationId: resultsVulnerabilityScans - parameters: - - explode: true - in: query - name: scan_id - required: true - schema: - type: string - style: form - - content: + requestBody: + content: application/json: schema: - $ref: '#/components/schemas/ModelFetchWindow' - in: query - name: window - required: true + $ref: '#/components/schemas/ModelScanResultsReq' responses: "200": content: @@ -2462,6 +2382,9 @@ components: type: string type: object ModelFetchWindow: + example: + offset: 0 + size: 6 properties: offset: type: integer @@ -2533,12 +2456,28 @@ components: status: type: string updated_at: + format: int64 type: integer required: - scan_id - status - updated_at type: object + ModelScanListReq: + example: + window: + offset: 0 + size: 6 + node_id: node_id + properties: + node_id: + type: string + window: + $ref: '#/components/schemas/ModelFetchWindow' + required: + - node_id + - window + type: object ModelScanListResp: example: scans_info: @@ -2557,6 +2496,21 @@ components: required: - scans_info type: object + ModelScanResultsReq: + example: + scan_id: scan_id + window: + offset: 0 + size: 6 + properties: + scan_id: + type: string + window: + $ref: '#/components/schemas/ModelFetchWindow' + required: + - scan_id + - window + type: object ModelScanResultsResp: example: results: diff --git a/deepfence_server_client/api_compliance.go b/deepfence_server_client/api_compliance.go index 119b56e119..f26ed0efc2 100644 --- a/deepfence_server_client/api_compliance.go +++ b/deepfence_server_client/api_compliance.go @@ -154,17 +154,11 @@ func (a *ComplianceApiService) IngestCompliancesExecute(r ApiIngestCompliancesRe type ApiListComplianceScanRequest struct { ctx context.Context ApiService *ComplianceApiService - nodeId *string - window *ModelFetchWindow + modelScanListReq *ModelScanListReq } -func (r ApiListComplianceScanRequest) NodeId(nodeId string) ApiListComplianceScanRequest { - r.nodeId = &nodeId - return r -} - -func (r ApiListComplianceScanRequest) Window(window ModelFetchWindow) ApiListComplianceScanRequest { - r.window = &window +func (r ApiListComplianceScanRequest) ModelScanListReq(modelScanListReq ModelScanListReq) ApiListComplianceScanRequest { + r.modelScanListReq = &modelScanListReq return r } @@ -191,7 +185,7 @@ func (a *ComplianceApiService) ListComplianceScan(ctx context.Context) ApiListCo // @return ModelScanListResp func (a *ComplianceApiService) ListComplianceScanExecute(r ApiListComplianceScanRequest) (*ModelScanListResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanListResp @@ -207,17 +201,9 @@ func (a *ComplianceApiService) ListComplianceScanExecute(r ApiListComplianceScan localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.nodeId == nil { - return localVarReturnValue, nil, reportError("nodeId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "node_id", r.nodeId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -233,6 +219,8 @@ func (a *ComplianceApiService) ListComplianceScanExecute(r ApiListComplianceScan if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanListReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -305,17 +293,11 @@ func (a *ComplianceApiService) ListComplianceScanExecute(r ApiListComplianceScan type ApiResultsComplianceScanRequest struct { ctx context.Context ApiService *ComplianceApiService - scanId *string - window *ModelFetchWindow + modelScanResultsReq *ModelScanResultsReq } -func (r ApiResultsComplianceScanRequest) ScanId(scanId string) ApiResultsComplianceScanRequest { - r.scanId = &scanId - return r -} - -func (r ApiResultsComplianceScanRequest) Window(window ModelFetchWindow) ApiResultsComplianceScanRequest { - r.window = &window +func (r ApiResultsComplianceScanRequest) ModelScanResultsReq(modelScanResultsReq ModelScanResultsReq) ApiResultsComplianceScanRequest { + r.modelScanResultsReq = &modelScanResultsReq return r } @@ -342,7 +324,7 @@ func (a *ComplianceApiService) ResultsComplianceScan(ctx context.Context) ApiRes // @return ModelScanResultsResp func (a *ComplianceApiService) ResultsComplianceScanExecute(r ApiResultsComplianceScanRequest) (*ModelScanResultsResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanResultsResp @@ -358,17 +340,9 @@ func (a *ComplianceApiService) ResultsComplianceScanExecute(r ApiResultsComplian localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.scanId == nil { - return localVarReturnValue, nil, reportError("scanId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "scan_id", r.scanId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -384,6 +358,8 @@ func (a *ComplianceApiService) ResultsComplianceScanExecute(r ApiResultsComplian if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanResultsReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err diff --git a/deepfence_server_client/api_malware_scan.go b/deepfence_server_client/api_malware_scan.go index d5a6312571..0f3ee71049 100644 --- a/deepfence_server_client/api_malware_scan.go +++ b/deepfence_server_client/api_malware_scan.go @@ -26,17 +26,11 @@ type MalwareScanApiService service type ApiListMalwareScanRequest struct { ctx context.Context ApiService *MalwareScanApiService - nodeId *string - window *ModelFetchWindow + modelScanListReq *ModelScanListReq } -func (r ApiListMalwareScanRequest) NodeId(nodeId string) ApiListMalwareScanRequest { - r.nodeId = &nodeId - return r -} - -func (r ApiListMalwareScanRequest) Window(window ModelFetchWindow) ApiListMalwareScanRequest { - r.window = &window +func (r ApiListMalwareScanRequest) ModelScanListReq(modelScanListReq ModelScanListReq) ApiListMalwareScanRequest { + r.modelScanListReq = &modelScanListReq return r } @@ -63,7 +57,7 @@ func (a *MalwareScanApiService) ListMalwareScan(ctx context.Context) ApiListMalw // @return ModelScanListResp func (a *MalwareScanApiService) ListMalwareScanExecute(r ApiListMalwareScanRequest) (*ModelScanListResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanListResp @@ -79,17 +73,9 @@ func (a *MalwareScanApiService) ListMalwareScanExecute(r ApiListMalwareScanReque localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.nodeId == nil { - return localVarReturnValue, nil, reportError("nodeId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "node_id", r.nodeId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -105,6 +91,8 @@ func (a *MalwareScanApiService) ListMalwareScanExecute(r ApiListMalwareScanReque if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanListReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -177,17 +165,11 @@ func (a *MalwareScanApiService) ListMalwareScanExecute(r ApiListMalwareScanReque type ApiResultsMalwareScanRequest struct { ctx context.Context ApiService *MalwareScanApiService - scanId *string - window *ModelFetchWindow + modelScanResultsReq *ModelScanResultsReq } -func (r ApiResultsMalwareScanRequest) ScanId(scanId string) ApiResultsMalwareScanRequest { - r.scanId = &scanId - return r -} - -func (r ApiResultsMalwareScanRequest) Window(window ModelFetchWindow) ApiResultsMalwareScanRequest { - r.window = &window +func (r ApiResultsMalwareScanRequest) ModelScanResultsReq(modelScanResultsReq ModelScanResultsReq) ApiResultsMalwareScanRequest { + r.modelScanResultsReq = &modelScanResultsReq return r } @@ -214,7 +196,7 @@ func (a *MalwareScanApiService) ResultsMalwareScan(ctx context.Context) ApiResul // @return ModelScanResultsResp func (a *MalwareScanApiService) ResultsMalwareScanExecute(r ApiResultsMalwareScanRequest) (*ModelScanResultsResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanResultsResp @@ -230,17 +212,9 @@ func (a *MalwareScanApiService) ResultsMalwareScanExecute(r ApiResultsMalwareSca localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.scanId == nil { - return localVarReturnValue, nil, reportError("scanId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "scan_id", r.scanId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -256,6 +230,8 @@ func (a *MalwareScanApiService) ResultsMalwareScanExecute(r ApiResultsMalwareSca if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanResultsReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err diff --git a/deepfence_server_client/api_secret_scan.go b/deepfence_server_client/api_secret_scan.go index 08abcdf72c..3ca8d19625 100644 --- a/deepfence_server_client/api_secret_scan.go +++ b/deepfence_server_client/api_secret_scan.go @@ -282,17 +282,11 @@ func (a *SecretScanApiService) IngestSecretsExecute(r ApiIngestSecretsRequest) ( type ApiListSecretScanRequest struct { ctx context.Context ApiService *SecretScanApiService - nodeId *string - window *ModelFetchWindow + modelScanListReq *ModelScanListReq } -func (r ApiListSecretScanRequest) NodeId(nodeId string) ApiListSecretScanRequest { - r.nodeId = &nodeId - return r -} - -func (r ApiListSecretScanRequest) Window(window ModelFetchWindow) ApiListSecretScanRequest { - r.window = &window +func (r ApiListSecretScanRequest) ModelScanListReq(modelScanListReq ModelScanListReq) ApiListSecretScanRequest { + r.modelScanListReq = &modelScanListReq return r } @@ -319,7 +313,7 @@ func (a *SecretScanApiService) ListSecretScan(ctx context.Context) ApiListSecret // @return ModelScanListResp func (a *SecretScanApiService) ListSecretScanExecute(r ApiListSecretScanRequest) (*ModelScanListResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanListResp @@ -335,17 +329,9 @@ func (a *SecretScanApiService) ListSecretScanExecute(r ApiListSecretScanRequest) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.nodeId == nil { - return localVarReturnValue, nil, reportError("nodeId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "node_id", r.nodeId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -361,6 +347,8 @@ func (a *SecretScanApiService) ListSecretScanExecute(r ApiListSecretScanRequest) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanListReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -433,17 +421,11 @@ func (a *SecretScanApiService) ListSecretScanExecute(r ApiListSecretScanRequest) type ApiResultsSecretScanRequest struct { ctx context.Context ApiService *SecretScanApiService - scanId *string - window *ModelFetchWindow + modelScanResultsReq *ModelScanResultsReq } -func (r ApiResultsSecretScanRequest) ScanId(scanId string) ApiResultsSecretScanRequest { - r.scanId = &scanId - return r -} - -func (r ApiResultsSecretScanRequest) Window(window ModelFetchWindow) ApiResultsSecretScanRequest { - r.window = &window +func (r ApiResultsSecretScanRequest) ModelScanResultsReq(modelScanResultsReq ModelScanResultsReq) ApiResultsSecretScanRequest { + r.modelScanResultsReq = &modelScanResultsReq return r } @@ -470,7 +452,7 @@ func (a *SecretScanApiService) ResultsSecretScan(ctx context.Context) ApiResults // @return ModelScanResultsResp func (a *SecretScanApiService) ResultsSecretScanExecute(r ApiResultsSecretScanRequest) (*ModelScanResultsResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanResultsResp @@ -486,17 +468,9 @@ func (a *SecretScanApiService) ResultsSecretScanExecute(r ApiResultsSecretScanRe localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.scanId == nil { - return localVarReturnValue, nil, reportError("scanId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "scan_id", r.scanId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -512,6 +486,8 @@ func (a *SecretScanApiService) ResultsSecretScanExecute(r ApiResultsSecretScanRe if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanResultsReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err diff --git a/deepfence_server_client/api_vulnerability.go b/deepfence_server_client/api_vulnerability.go index 55162e535e..e7f0fb43c7 100644 --- a/deepfence_server_client/api_vulnerability.go +++ b/deepfence_server_client/api_vulnerability.go @@ -154,17 +154,11 @@ func (a *VulnerabilityApiService) IngestVulnerabilitiesExecute(r ApiIngestVulner type ApiListVulnerabilityScansRequest struct { ctx context.Context ApiService *VulnerabilityApiService - nodeId *string - window *ModelFetchWindow + modelScanListReq *ModelScanListReq } -func (r ApiListVulnerabilityScansRequest) NodeId(nodeId string) ApiListVulnerabilityScansRequest { - r.nodeId = &nodeId - return r -} - -func (r ApiListVulnerabilityScansRequest) Window(window ModelFetchWindow) ApiListVulnerabilityScansRequest { - r.window = &window +func (r ApiListVulnerabilityScansRequest) ModelScanListReq(modelScanListReq ModelScanListReq) ApiListVulnerabilityScansRequest { + r.modelScanListReq = &modelScanListReq return r } @@ -191,7 +185,7 @@ func (a *VulnerabilityApiService) ListVulnerabilityScans(ctx context.Context) Ap // @return ModelScanListResp func (a *VulnerabilityApiService) ListVulnerabilityScansExecute(r ApiListVulnerabilityScansRequest) (*ModelScanListResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanListResp @@ -207,17 +201,9 @@ func (a *VulnerabilityApiService) ListVulnerabilityScansExecute(r ApiListVulnera localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.nodeId == nil { - return localVarReturnValue, nil, reportError("nodeId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "node_id", r.nodeId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -233,6 +219,8 @@ func (a *VulnerabilityApiService) ListVulnerabilityScansExecute(r ApiListVulnera if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanListReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -305,17 +293,11 @@ func (a *VulnerabilityApiService) ListVulnerabilityScansExecute(r ApiListVulnera type ApiResultsVulnerabilityScansRequest struct { ctx context.Context ApiService *VulnerabilityApiService - scanId *string - window *ModelFetchWindow + modelScanResultsReq *ModelScanResultsReq } -func (r ApiResultsVulnerabilityScansRequest) ScanId(scanId string) ApiResultsVulnerabilityScansRequest { - r.scanId = &scanId - return r -} - -func (r ApiResultsVulnerabilityScansRequest) Window(window ModelFetchWindow) ApiResultsVulnerabilityScansRequest { - r.window = &window +func (r ApiResultsVulnerabilityScansRequest) ModelScanResultsReq(modelScanResultsReq ModelScanResultsReq) ApiResultsVulnerabilityScansRequest { + r.modelScanResultsReq = &modelScanResultsReq return r } @@ -342,7 +324,7 @@ func (a *VulnerabilityApiService) ResultsVulnerabilityScans(ctx context.Context) // @return ModelScanResultsResp func (a *VulnerabilityApiService) ResultsVulnerabilityScansExecute(r ApiResultsVulnerabilityScansRequest) (*ModelScanResultsResp, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile localVarReturnValue *ModelScanResultsResp @@ -358,17 +340,9 @@ func (a *VulnerabilityApiService) ResultsVulnerabilityScansExecute(r ApiResultsV localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.scanId == nil { - return localVarReturnValue, nil, reportError("scanId is required and must be specified") - } - if r.window == nil { - return localVarReturnValue, nil, reportError("window is required and must be specified") - } - parameterAddToQuery(localVarQueryParams, "scan_id", r.scanId, "") - parameterAddToQuery(localVarQueryParams, "window", r.window, "") // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -384,6 +358,8 @@ func (a *VulnerabilityApiService) ResultsVulnerabilityScansExecute(r ApiResultsV if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.modelScanResultsReq req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err diff --git a/deepfence_server_client/docs/ComplianceApi.md b/deepfence_server_client/docs/ComplianceApi.md index c1df57816f..189aa8331e 100644 --- a/deepfence_server_client/docs/ComplianceApi.md +++ b/deepfence_server_client/docs/ComplianceApi.md @@ -5,8 +5,8 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- [**IngestCompliances**](ComplianceApi.md#IngestCompliances) | **Post** /deepfence/ingest/compliance | Ingest Compliances -[**ListComplianceScan**](ComplianceApi.md#ListComplianceScan) | **Get** /deepfence/scan/list/compliance | Get Compliance Scans List -[**ResultsComplianceScan**](ComplianceApi.md#ResultsComplianceScan) | **Get** /deepfence/scan/results/compliance | Get Compliance Scans Results +[**ListComplianceScan**](ComplianceApi.md#ListComplianceScan) | **Post** /deepfence/scan/list/compliance | Get Compliance Scans List +[**ResultsComplianceScan**](ComplianceApi.md#ResultsComplianceScan) | **Post** /deepfence/scan/results/compliance | Get Compliance Scans Results [**StartComplianceScan**](ComplianceApi.md#StartComplianceScan) | **Post** /deepfence/scan/start/compliance | Start Compliance Scan [**StatusComplianceScan**](ComplianceApi.md#StatusComplianceScan) | **Get** /deepfence/scan/status/compliance | Get Compliance Scan Status [**StopComplianceScan**](ComplianceApi.md#StopComplianceScan) | **Post** /deepfence/scan/stop/compliance | Stop Compliance Scan @@ -79,7 +79,7 @@ Name | Type | Description | Notes ## ListComplianceScan -> ModelScanListResp ListComplianceScan(ctx).NodeId(nodeId).Window(window).Execute() +> ModelScanListResp ListComplianceScan(ctx).ModelScanListReq(modelScanListReq).Execute() Get Compliance Scans List @@ -98,12 +98,11 @@ import ( ) func main() { - nodeId := "nodeId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanListReq := *openapiclient.NewModelScanListReq("NodeId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanListReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ComplianceApi.ListComplianceScan(context.Background()).NodeId(nodeId).Window(window).Execute() + resp, r, err := apiClient.ComplianceApi.ListComplianceScan(context.Background()).ModelScanListReq(modelScanListReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ComplianceApi.ListComplianceScan``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -124,8 +123,7 @@ Other parameters are passed through a pointer to a apiListComplianceScanRequest Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **nodeId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanListReq** | [**ModelScanListReq**](ModelScanListReq.md) | | ### Return type @@ -137,7 +135,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -147,7 +145,7 @@ Name | Type | Description | Notes ## ResultsComplianceScan -> ModelScanResultsResp ResultsComplianceScan(ctx).ScanId(scanId).Window(window).Execute() +> ModelScanResultsResp ResultsComplianceScan(ctx).ModelScanResultsReq(modelScanResultsReq).Execute() Get Compliance Scans Results @@ -166,12 +164,11 @@ import ( ) func main() { - scanId := "scanId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanResultsReq := *openapiclient.NewModelScanResultsReq("ScanId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanResultsReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ComplianceApi.ResultsComplianceScan(context.Background()).ScanId(scanId).Window(window).Execute() + resp, r, err := apiClient.ComplianceApi.ResultsComplianceScan(context.Background()).ModelScanResultsReq(modelScanResultsReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ComplianceApi.ResultsComplianceScan``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -192,8 +189,7 @@ Other parameters are passed through a pointer to a apiResultsComplianceScanReque Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **scanId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanResultsReq** | [**ModelScanResultsReq**](ModelScanResultsReq.md) | | ### Return type @@ -205,7 +201,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/deepfence_server_client/docs/MalwareScanApi.md b/deepfence_server_client/docs/MalwareScanApi.md index b55c29ecfb..9a7465f05b 100644 --- a/deepfence_server_client/docs/MalwareScanApi.md +++ b/deepfence_server_client/docs/MalwareScanApi.md @@ -4,8 +4,8 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**ListMalwareScan**](MalwareScanApi.md#ListMalwareScan) | **Get** /deepfence/scan/list/malware | Get Malware Scans List -[**ResultsMalwareScan**](MalwareScanApi.md#ResultsMalwareScan) | **Get** /deepfence/scan/results/malware | Get Malware Scans Results +[**ListMalwareScan**](MalwareScanApi.md#ListMalwareScan) | **Post** /deepfence/scan/list/malware | Get Malware Scans List +[**ResultsMalwareScan**](MalwareScanApi.md#ResultsMalwareScan) | **Post** /deepfence/scan/results/malware | Get Malware Scans Results [**StartMalwareScan**](MalwareScanApi.md#StartMalwareScan) | **Post** /deepfence/scan/start/malware | Start Malware Scan [**StatusMalwareScan**](MalwareScanApi.md#StatusMalwareScan) | **Get** /deepfence/scan/status/malware | Get Malware Scan Status [**StopMalwareScan**](MalwareScanApi.md#StopMalwareScan) | **Post** /deepfence/scan/stop/malware | Stop Malware Scan @@ -14,7 +14,7 @@ Method | HTTP request | Description ## ListMalwareScan -> ModelScanListResp ListMalwareScan(ctx).NodeId(nodeId).Window(window).Execute() +> ModelScanListResp ListMalwareScan(ctx).ModelScanListReq(modelScanListReq).Execute() Get Malware Scans List @@ -33,12 +33,11 @@ import ( ) func main() { - nodeId := "nodeId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanListReq := *openapiclient.NewModelScanListReq("NodeId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanListReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.MalwareScanApi.ListMalwareScan(context.Background()).NodeId(nodeId).Window(window).Execute() + resp, r, err := apiClient.MalwareScanApi.ListMalwareScan(context.Background()).ModelScanListReq(modelScanListReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `MalwareScanApi.ListMalwareScan``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -59,8 +58,7 @@ Other parameters are passed through a pointer to a apiListMalwareScanRequest str Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **nodeId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanListReq** | [**ModelScanListReq**](ModelScanListReq.md) | | ### Return type @@ -72,7 +70,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -82,7 +80,7 @@ Name | Type | Description | Notes ## ResultsMalwareScan -> ModelScanResultsResp ResultsMalwareScan(ctx).ScanId(scanId).Window(window).Execute() +> ModelScanResultsResp ResultsMalwareScan(ctx).ModelScanResultsReq(modelScanResultsReq).Execute() Get Malware Scans Results @@ -101,12 +99,11 @@ import ( ) func main() { - scanId := "scanId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanResultsReq := *openapiclient.NewModelScanResultsReq("ScanId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanResultsReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.MalwareScanApi.ResultsMalwareScan(context.Background()).ScanId(scanId).Window(window).Execute() + resp, r, err := apiClient.MalwareScanApi.ResultsMalwareScan(context.Background()).ModelScanResultsReq(modelScanResultsReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `MalwareScanApi.ResultsMalwareScan``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -127,8 +124,7 @@ Other parameters are passed through a pointer to a apiResultsMalwareScanRequest Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **scanId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanResultsReq** | [**ModelScanResultsReq**](ModelScanResultsReq.md) | | ### Return type @@ -140,7 +136,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/deepfence_server_client/docs/ModelScanInfo.md b/deepfence_server_client/docs/ModelScanInfo.md index 43ed227312..6b1e3e0f37 100644 --- a/deepfence_server_client/docs/ModelScanInfo.md +++ b/deepfence_server_client/docs/ModelScanInfo.md @@ -6,13 +6,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ScanId** | **string** | | **Status** | **string** | | -**UpdatedAt** | **int32** | | +**UpdatedAt** | **int64** | | ## Methods ### NewModelScanInfo -`func NewModelScanInfo(scanId string, status string, updatedAt int32, ) *ModelScanInfo` +`func NewModelScanInfo(scanId string, status string, updatedAt int64, ) *ModelScanInfo` NewModelScanInfo instantiates a new ModelScanInfo object This constructor will assign default values to properties that have it defined, @@ -69,20 +69,20 @@ SetStatus sets Status field to given value. ### GetUpdatedAt -`func (o *ModelScanInfo) GetUpdatedAt() int32` +`func (o *ModelScanInfo) GetUpdatedAt() int64` GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. ### GetUpdatedAtOk -`func (o *ModelScanInfo) GetUpdatedAtOk() (*int32, bool)` +`func (o *ModelScanInfo) GetUpdatedAtOk() (*int64, bool)` GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetUpdatedAt -`func (o *ModelScanInfo) SetUpdatedAt(v int32)` +`func (o *ModelScanInfo) SetUpdatedAt(v int64)` SetUpdatedAt sets UpdatedAt field to given value. diff --git a/deepfence_server_client/docs/ModelScanListReq.md b/deepfence_server_client/docs/ModelScanListReq.md new file mode 100644 index 0000000000..b8e6f2cc74 --- /dev/null +++ b/deepfence_server_client/docs/ModelScanListReq.md @@ -0,0 +1,72 @@ +# ModelScanListReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NodeId** | **string** | | +**Window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + +## Methods + +### NewModelScanListReq + +`func NewModelScanListReq(nodeId string, window ModelFetchWindow, ) *ModelScanListReq` + +NewModelScanListReq instantiates a new ModelScanListReq object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewModelScanListReqWithDefaults + +`func NewModelScanListReqWithDefaults() *ModelScanListReq` + +NewModelScanListReqWithDefaults instantiates a new ModelScanListReq object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNodeId + +`func (o *ModelScanListReq) GetNodeId() string` + +GetNodeId returns the NodeId field if non-nil, zero value otherwise. + +### GetNodeIdOk + +`func (o *ModelScanListReq) GetNodeIdOk() (*string, bool)` + +GetNodeIdOk returns a tuple with the NodeId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNodeId + +`func (o *ModelScanListReq) SetNodeId(v string)` + +SetNodeId sets NodeId field to given value. + + +### GetWindow + +`func (o *ModelScanListReq) GetWindow() ModelFetchWindow` + +GetWindow returns the Window field if non-nil, zero value otherwise. + +### GetWindowOk + +`func (o *ModelScanListReq) GetWindowOk() (*ModelFetchWindow, bool)` + +GetWindowOk returns a tuple with the Window field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWindow + +`func (o *ModelScanListReq) SetWindow(v ModelFetchWindow)` + +SetWindow sets Window field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/deepfence_server_client/docs/ModelScanResultsReq.md b/deepfence_server_client/docs/ModelScanResultsReq.md new file mode 100644 index 0000000000..bebeb289d4 --- /dev/null +++ b/deepfence_server_client/docs/ModelScanResultsReq.md @@ -0,0 +1,72 @@ +# ModelScanResultsReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ScanId** | **string** | | +**Window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + +## Methods + +### NewModelScanResultsReq + +`func NewModelScanResultsReq(scanId string, window ModelFetchWindow, ) *ModelScanResultsReq` + +NewModelScanResultsReq instantiates a new ModelScanResultsReq object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewModelScanResultsReqWithDefaults + +`func NewModelScanResultsReqWithDefaults() *ModelScanResultsReq` + +NewModelScanResultsReqWithDefaults instantiates a new ModelScanResultsReq object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetScanId + +`func (o *ModelScanResultsReq) GetScanId() string` + +GetScanId returns the ScanId field if non-nil, zero value otherwise. + +### GetScanIdOk + +`func (o *ModelScanResultsReq) GetScanIdOk() (*string, bool)` + +GetScanIdOk returns a tuple with the ScanId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScanId + +`func (o *ModelScanResultsReq) SetScanId(v string)` + +SetScanId sets ScanId field to given value. + + +### GetWindow + +`func (o *ModelScanResultsReq) GetWindow() ModelFetchWindow` + +GetWindow returns the Window field if non-nil, zero value otherwise. + +### GetWindowOk + +`func (o *ModelScanResultsReq) GetWindowOk() (*ModelFetchWindow, bool)` + +GetWindowOk returns a tuple with the Window field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWindow + +`func (o *ModelScanResultsReq) SetWindow(v ModelFetchWindow)` + +SetWindow sets Window field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/deepfence_server_client/docs/SecretScanApi.md b/deepfence_server_client/docs/SecretScanApi.md index 4ffcae4022..3ec64198af 100644 --- a/deepfence_server_client/docs/SecretScanApi.md +++ b/deepfence_server_client/docs/SecretScanApi.md @@ -6,8 +6,8 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**IngestSecretScanStatus**](SecretScanApi.md#IngestSecretScanStatus) | **Post** /deepfence/ingest/secret-scan-logs | Ingest Secrets Scan Status [**IngestSecrets**](SecretScanApi.md#IngestSecrets) | **Post** /deepfence/ingest/secrets | Ingest Secrets -[**ListSecretScan**](SecretScanApi.md#ListSecretScan) | **Get** /deepfence/scan/list/secret | Get Secret Scans List -[**ResultsSecretScan**](SecretScanApi.md#ResultsSecretScan) | **Get** /deepfence/scan/results/secret | Get Secret Scans Results +[**ListSecretScan**](SecretScanApi.md#ListSecretScan) | **Post** /deepfence/scan/list/secret | Get Secret Scans List +[**ResultsSecretScan**](SecretScanApi.md#ResultsSecretScan) | **Post** /deepfence/scan/results/secret | Get Secret Scans Results [**StartSecretScan**](SecretScanApi.md#StartSecretScan) | **Post** /deepfence/scan/start/secret | Start Secret Scan [**StatusSecretScan**](SecretScanApi.md#StatusSecretScan) | **Get** /deepfence/scan/status/secret | Get Secret Scan Status [**StopSecretScan**](SecretScanApi.md#StopSecretScan) | **Post** /deepfence/scan/stop/secret | Stop Secret Scan @@ -144,7 +144,7 @@ Name | Type | Description | Notes ## ListSecretScan -> ModelScanListResp ListSecretScan(ctx).NodeId(nodeId).Window(window).Execute() +> ModelScanListResp ListSecretScan(ctx).ModelScanListReq(modelScanListReq).Execute() Get Secret Scans List @@ -163,12 +163,11 @@ import ( ) func main() { - nodeId := "nodeId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanListReq := *openapiclient.NewModelScanListReq("NodeId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanListReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SecretScanApi.ListSecretScan(context.Background()).NodeId(nodeId).Window(window).Execute() + resp, r, err := apiClient.SecretScanApi.ListSecretScan(context.Background()).ModelScanListReq(modelScanListReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `SecretScanApi.ListSecretScan``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -189,8 +188,7 @@ Other parameters are passed through a pointer to a apiListSecretScanRequest stru Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **nodeId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanListReq** | [**ModelScanListReq**](ModelScanListReq.md) | | ### Return type @@ -202,7 +200,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -212,7 +210,7 @@ Name | Type | Description | Notes ## ResultsSecretScan -> ModelScanResultsResp ResultsSecretScan(ctx).ScanId(scanId).Window(window).Execute() +> ModelScanResultsResp ResultsSecretScan(ctx).ModelScanResultsReq(modelScanResultsReq).Execute() Get Secret Scans Results @@ -231,12 +229,11 @@ import ( ) func main() { - scanId := "scanId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanResultsReq := *openapiclient.NewModelScanResultsReq("ScanId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanResultsReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SecretScanApi.ResultsSecretScan(context.Background()).ScanId(scanId).Window(window).Execute() + resp, r, err := apiClient.SecretScanApi.ResultsSecretScan(context.Background()).ModelScanResultsReq(modelScanResultsReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `SecretScanApi.ResultsSecretScan``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -257,8 +254,7 @@ Other parameters are passed through a pointer to a apiResultsSecretScanRequest s Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **scanId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanResultsReq** | [**ModelScanResultsReq**](ModelScanResultsReq.md) | | ### Return type @@ -270,7 +266,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/deepfence_server_client/docs/VulnerabilityApi.md b/deepfence_server_client/docs/VulnerabilityApi.md index 7ff24e6edc..a94f061fe4 100644 --- a/deepfence_server_client/docs/VulnerabilityApi.md +++ b/deepfence_server_client/docs/VulnerabilityApi.md @@ -5,8 +5,8 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- [**IngestVulnerabilities**](VulnerabilityApi.md#IngestVulnerabilities) | **Post** /deepfence/ingest/vulnerabilities | Ingest Vulnerabilities -[**ListVulnerabilityScans**](VulnerabilityApi.md#ListVulnerabilityScans) | **Get** /deepfence/scan/list/vulnerability | Get Vulnerability Scans List -[**ResultsVulnerabilityScans**](VulnerabilityApi.md#ResultsVulnerabilityScans) | **Get** /deepfence/scan/results/vulnerability | Get Vulnerability Scans Results +[**ListVulnerabilityScans**](VulnerabilityApi.md#ListVulnerabilityScans) | **Post** /deepfence/scan/list/vulnerability | Get Vulnerability Scans List +[**ResultsVulnerabilityScans**](VulnerabilityApi.md#ResultsVulnerabilityScans) | **Post** /deepfence/scan/results/vulnerability | Get Vulnerability Scans Results [**StartVulnerabilityScan**](VulnerabilityApi.md#StartVulnerabilityScan) | **Post** /deepfence/scan/start/vulnerability | Start Vulnerability Scan [**StatusVulnerabilityScan**](VulnerabilityApi.md#StatusVulnerabilityScan) | **Get** /deepfence/scan/status/vulnerability | Get Vulnerability Scan Status [**StopVulnerabilityScan**](VulnerabilityApi.md#StopVulnerabilityScan) | **Post** /deepfence/scan/stop/vulnerability | Stop Vulnerability Scan @@ -79,7 +79,7 @@ Name | Type | Description | Notes ## ListVulnerabilityScans -> ModelScanListResp ListVulnerabilityScans(ctx).NodeId(nodeId).Window(window).Execute() +> ModelScanListResp ListVulnerabilityScans(ctx).ModelScanListReq(modelScanListReq).Execute() Get Vulnerability Scans List @@ -98,12 +98,11 @@ import ( ) func main() { - nodeId := "nodeId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanListReq := *openapiclient.NewModelScanListReq("NodeId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanListReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.VulnerabilityApi.ListVulnerabilityScans(context.Background()).NodeId(nodeId).Window(window).Execute() + resp, r, err := apiClient.VulnerabilityApi.ListVulnerabilityScans(context.Background()).ModelScanListReq(modelScanListReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `VulnerabilityApi.ListVulnerabilityScans``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -124,8 +123,7 @@ Other parameters are passed through a pointer to a apiListVulnerabilityScansRequ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **nodeId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanListReq** | [**ModelScanListReq**](ModelScanListReq.md) | | ### Return type @@ -137,7 +135,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -147,7 +145,7 @@ Name | Type | Description | Notes ## ResultsVulnerabilityScans -> ModelScanResultsResp ResultsVulnerabilityScans(ctx).ScanId(scanId).Window(window).Execute() +> ModelScanResultsResp ResultsVulnerabilityScans(ctx).ModelScanResultsReq(modelScanResultsReq).Execute() Get Vulnerability Scans Results @@ -166,12 +164,11 @@ import ( ) func main() { - scanId := "scanId_example" // string | - window := map[string][]openapiclient.ModelFetchWindow{ ... } // ModelFetchWindow | + modelScanResultsReq := *openapiclient.NewModelScanResultsReq("ScanId_example", *openapiclient.NewModelFetchWindow(int32(123), int32(123))) // ModelScanResultsReq | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.VulnerabilityApi.ResultsVulnerabilityScans(context.Background()).ScanId(scanId).Window(window).Execute() + resp, r, err := apiClient.VulnerabilityApi.ResultsVulnerabilityScans(context.Background()).ModelScanResultsReq(modelScanResultsReq).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `VulnerabilityApi.ResultsVulnerabilityScans``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -192,8 +189,7 @@ Other parameters are passed through a pointer to a apiResultsVulnerabilityScansR Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **scanId** | **string** | | - **window** | [**ModelFetchWindow**](ModelFetchWindow.md) | | + **modelScanResultsReq** | [**ModelScanResultsReq**](ModelScanResultsReq.md) | | ### Return type @@ -205,7 +201,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/deepfence_server_client/model_model_scan_info.go b/deepfence_server_client/model_model_scan_info.go index e1bf659813..439f8b84c5 100644 --- a/deepfence_server_client/model_model_scan_info.go +++ b/deepfence_server_client/model_model_scan_info.go @@ -22,14 +22,14 @@ var _ MappedNullable = &ModelScanInfo{} type ModelScanInfo struct { ScanId string `json:"scan_id"` Status string `json:"status"` - UpdatedAt int32 `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` } // NewModelScanInfo instantiates a new ModelScanInfo object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewModelScanInfo(scanId string, status string, updatedAt int32) *ModelScanInfo { +func NewModelScanInfo(scanId string, status string, updatedAt int64) *ModelScanInfo { this := ModelScanInfo{} this.ScanId = scanId this.Status = status @@ -94,9 +94,9 @@ func (o *ModelScanInfo) SetStatus(v string) { } // GetUpdatedAt returns the UpdatedAt field value -func (o *ModelScanInfo) GetUpdatedAt() int32 { +func (o *ModelScanInfo) GetUpdatedAt() int64 { if o == nil { - var ret int32 + var ret int64 return ret } @@ -105,7 +105,7 @@ func (o *ModelScanInfo) GetUpdatedAt() int32 { // GetUpdatedAtOk returns a tuple with the UpdatedAt field value // and a boolean to check if the value has been set. -func (o *ModelScanInfo) GetUpdatedAtOk() (*int32, bool) { +func (o *ModelScanInfo) GetUpdatedAtOk() (*int64, bool) { if o == nil { return nil, false } @@ -113,7 +113,7 @@ func (o *ModelScanInfo) GetUpdatedAtOk() (*int32, bool) { } // SetUpdatedAt sets field value -func (o *ModelScanInfo) SetUpdatedAt(v int32) { +func (o *ModelScanInfo) SetUpdatedAt(v int64) { o.UpdatedAt = v } diff --git a/deepfence_server_client/model_model_scan_list_req.go b/deepfence_server_client/model_model_scan_list_req.go new file mode 100644 index 0000000000..b145584fea --- /dev/null +++ b/deepfence_server_client/model_model_scan_list_req.go @@ -0,0 +1,145 @@ +/* +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. + +API version: 2.0.0 +Contact: community@deepfence.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package deepfence_server_client + +import ( + "encoding/json" +) + +// checks if the ModelScanListReq type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelScanListReq{} + +// ModelScanListReq struct for ModelScanListReq +type ModelScanListReq struct { + NodeId string `json:"node_id"` + Window ModelFetchWindow `json:"window"` +} + +// NewModelScanListReq instantiates a new ModelScanListReq object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelScanListReq(nodeId string, window ModelFetchWindow) *ModelScanListReq { + this := ModelScanListReq{} + this.NodeId = nodeId + this.Window = window + return &this +} + +// NewModelScanListReqWithDefaults instantiates a new ModelScanListReq object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelScanListReqWithDefaults() *ModelScanListReq { + this := ModelScanListReq{} + return &this +} + +// GetNodeId returns the NodeId field value +func (o *ModelScanListReq) GetNodeId() string { + if o == nil { + var ret string + return ret + } + + return o.NodeId +} + +// GetNodeIdOk returns a tuple with the NodeId field value +// and a boolean to check if the value has been set. +func (o *ModelScanListReq) GetNodeIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NodeId, true +} + +// SetNodeId sets field value +func (o *ModelScanListReq) SetNodeId(v string) { + o.NodeId = v +} + +// GetWindow returns the Window field value +func (o *ModelScanListReq) GetWindow() ModelFetchWindow { + if o == nil { + var ret ModelFetchWindow + return ret + } + + return o.Window +} + +// GetWindowOk returns a tuple with the Window field value +// and a boolean to check if the value has been set. +func (o *ModelScanListReq) GetWindowOk() (*ModelFetchWindow, bool) { + if o == nil { + return nil, false + } + return &o.Window, true +} + +// SetWindow sets field value +func (o *ModelScanListReq) SetWindow(v ModelFetchWindow) { + o.Window = v +} + +func (o ModelScanListReq) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelScanListReq) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["node_id"] = o.NodeId + toSerialize["window"] = o.Window + return toSerialize, nil +} + +type NullableModelScanListReq struct { + value *ModelScanListReq + isSet bool +} + +func (v NullableModelScanListReq) Get() *ModelScanListReq { + return v.value +} + +func (v *NullableModelScanListReq) Set(val *ModelScanListReq) { + v.value = val + v.isSet = true +} + +func (v NullableModelScanListReq) IsSet() bool { + return v.isSet +} + +func (v *NullableModelScanListReq) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelScanListReq(val *ModelScanListReq) *NullableModelScanListReq { + return &NullableModelScanListReq{value: val, isSet: true} +} + +func (v NullableModelScanListReq) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelScanListReq) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/deepfence_server_client/model_model_scan_results_req.go b/deepfence_server_client/model_model_scan_results_req.go new file mode 100644 index 0000000000..1a1c2a46f2 --- /dev/null +++ b/deepfence_server_client/model_model_scan_results_req.go @@ -0,0 +1,145 @@ +/* +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. + +API version: 2.0.0 +Contact: community@deepfence.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package deepfence_server_client + +import ( + "encoding/json" +) + +// checks if the ModelScanResultsReq type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelScanResultsReq{} + +// ModelScanResultsReq struct for ModelScanResultsReq +type ModelScanResultsReq struct { + ScanId string `json:"scan_id"` + Window ModelFetchWindow `json:"window"` +} + +// NewModelScanResultsReq instantiates a new ModelScanResultsReq object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelScanResultsReq(scanId string, window ModelFetchWindow) *ModelScanResultsReq { + this := ModelScanResultsReq{} + this.ScanId = scanId + this.Window = window + return &this +} + +// NewModelScanResultsReqWithDefaults instantiates a new ModelScanResultsReq object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelScanResultsReqWithDefaults() *ModelScanResultsReq { + this := ModelScanResultsReq{} + return &this +} + +// GetScanId returns the ScanId field value +func (o *ModelScanResultsReq) GetScanId() string { + if o == nil { + var ret string + return ret + } + + return o.ScanId +} + +// GetScanIdOk returns a tuple with the ScanId field value +// and a boolean to check if the value has been set. +func (o *ModelScanResultsReq) GetScanIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ScanId, true +} + +// SetScanId sets field value +func (o *ModelScanResultsReq) SetScanId(v string) { + o.ScanId = v +} + +// GetWindow returns the Window field value +func (o *ModelScanResultsReq) GetWindow() ModelFetchWindow { + if o == nil { + var ret ModelFetchWindow + return ret + } + + return o.Window +} + +// GetWindowOk returns a tuple with the Window field value +// and a boolean to check if the value has been set. +func (o *ModelScanResultsReq) GetWindowOk() (*ModelFetchWindow, bool) { + if o == nil { + return nil, false + } + return &o.Window, true +} + +// SetWindow sets field value +func (o *ModelScanResultsReq) SetWindow(v ModelFetchWindow) { + o.Window = v +} + +func (o ModelScanResultsReq) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelScanResultsReq) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["scan_id"] = o.ScanId + toSerialize["window"] = o.Window + return toSerialize, nil +} + +type NullableModelScanResultsReq struct { + value *ModelScanResultsReq + isSet bool +} + +func (v NullableModelScanResultsReq) Get() *ModelScanResultsReq { + return v.value +} + +func (v *NullableModelScanResultsReq) Set(val *ModelScanResultsReq) { + v.value = val + v.isSet = true +} + +func (v NullableModelScanResultsReq) IsSet() bool { + return v.isSet +} + +func (v *NullableModelScanResultsReq) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelScanResultsReq(val *ModelScanResultsReq) *NullableModelScanResultsReq { + return &NullableModelScanResultsReq{value: val, isSet: true} +} + +func (v NullableModelScanResultsReq) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelScanResultsReq) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/deepfence_utils/log/log.go b/deepfence_utils/log/log.go index 7370416a9a..45b6185704 100644 --- a/deepfence_utils/log/log.go +++ b/deepfence_utils/log/log.go @@ -56,7 +56,7 @@ func (a AsynqLogger) Fatal(args ...interface{}) { func init() { log.Logger = log.Output( zerolog.ConsoleWriter{ - Out: os.Stdout, + Out: os.Stderr, TimeFormat: time.RFC1123Z, FormatCaller: func(i interface{}) string { return filepath.Join(