mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
* Interfaces are unchanged
* Deprecated: low-level API funcs marked for deprecation:
HttpPost, HttpGetter, HttpDelete (an augmented version of the KS Cloud
client will expose the post report API, which is currently the sole
use-case of low-level API)
* Doc: the package is now godoc-friendly
* Style & code layout:
* listed all exposed types via aliases, for clarity/less confusing
imports
* unexported private types
* factorized query param logic
* factorized type <-> JSON using generic func & io.Reader
* "utils" are now limited to a few common utility functions
* centralized hard-coded strings as (unexported) constants
* concision: use higher-level http definitions such as constants,
cookie methods, etc
* included type-safety guards to verify that interfaces are
actually implemented by the exported types
* Tests: existing test assertions are unchanged
* tests are beefed-up to assert proper authentication flow (token & cookie).
* added unit tests for utility methods
* Perf:
* unmarshalling API responses is now flowing without extraneous memory allocation via string representation
* request headers are now passed withot extraneous map allocation
* JSON operations are now fully supported by jsoniter (no longer use encoding/json)
* Changes in functionality:
* the client is now fully extensible with KSCloudOption
* use the option functor idiom to keep constructors short
* methods that used to mute errors (i.e. return nil, nil) now bubble up errors
* the captured cookie is now captured in full, not just its value
(other cookie parameters returned are stored)
* added a request/response dump option, for debugging
* added support for SubmitReport and retrieval of UI url's
* backported utm changes (reports use case)
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
62 lines
1.9 KiB
Go
62 lines
1.9 KiB
Go
package getter
|
|
|
|
import (
|
|
"github.com/armosec/armoapi-go/armotypes"
|
|
"github.com/kubescape/opa-utils/reporthandling"
|
|
"github.com/kubescape/opa-utils/reporthandling/attacktrack/v1alpha1"
|
|
reporthandlingv2 "github.com/kubescape/opa-utils/reporthandling/v2"
|
|
)
|
|
|
|
// NativeFrameworks identifies all pre-built, native frameworks.
|
|
var NativeFrameworks = []string{"allcontrols", "nsa", "mitre"}
|
|
|
|
type (
|
|
// TenantResponse holds the credentials for a tenant.
|
|
TenantResponse struct {
|
|
TenantID string `json:"tenantId"`
|
|
Token string `json:"token"`
|
|
Expires string `json:"expires"`
|
|
AdminMail string `json:"adminMail,omitempty"`
|
|
}
|
|
|
|
// AttackTrack is an alias to the API type definition for attack tracks.
|
|
AttackTrack = v1alpha1.AttackTrack
|
|
|
|
// Framework is an alias to the API type definition for a framework.
|
|
Framework = reporthandling.Framework
|
|
|
|
// Control is an alias to the API type definition for a control.
|
|
Control = reporthandling.Control
|
|
|
|
// PostureExceptionPolicy is an alias to the API type definition for posture exception policy.
|
|
PostureExceptionPolicy = armotypes.PostureExceptionPolicy
|
|
|
|
// CustomerConfig is an alias to the API type definition for a customer configuration.
|
|
CustomerConfig = armotypes.CustomerConfig
|
|
|
|
// PostureReport is an alias to the API type definition for a posture report.
|
|
PostureReport = reporthandlingv2.PostureReport
|
|
)
|
|
|
|
type (
|
|
// internal data descriptors
|
|
|
|
// feLoginData describes the input to a login challenge.
|
|
feLoginData struct {
|
|
Secret string `json:"secret"`
|
|
ClientId string `json:"clientId"`
|
|
}
|
|
|
|
// feLoginResponse describes the response to a login challenge.
|
|
feLoginResponse struct {
|
|
Token string `json:"accessToken"`
|
|
RefreshToken string `json:"refreshToken"`
|
|
Expires string `json:"expires"`
|
|
ExpiresIn int32 `json:"expiresIn"`
|
|
}
|
|
|
|
ksCloudSelectCustomer struct {
|
|
SelectedCustomerGuid string `json:"selectedCustomer"`
|
|
}
|
|
)
|