getter

package
v0.0.0-...-cb424ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLocalStore = getCacheDir()

======================================================================================================================= ============================================== LoadPolicy ============================================================= =======================================================================================================================

View Source
var NativeFrameworks = []string{"nsa", "mitre", "armobest", "devopsbest"}

Functions

func GetDefaultPath

func GetDefaultPath(name string) string

func HttpDelete

func HttpDelete(httpClient *http.Client, fullURL string, headers map[string]string) (string, error)

func HttpGetter

func HttpGetter(httpClient *http.Client, fullURL string, headers map[string]string) (string, error)

func HttpPost

func HttpPost(httpClient *http.Client, fullURL string, headers map[string]string, body []byte) (string, error)

func JSONDecoder

func JSONDecoder(origin string) *json.Decoder

JSONDecoder returns JSON decoder for given string

func SaveInFile

func SaveInFile(policy interface{}, pathStr string) error

func SetARMOAPIConnector

func SetARMOAPIConnector(armoAPI *ArmoAPI)

Types

type ArmoAPI

type ArmoAPI struct {
	// contains filtered or unexported fields
}

Armo API for downloading policies

func GetArmoAPIConnector

func GetArmoAPIConnector() *ArmoAPI

func NewARMOAPICustomized

func NewARMOAPICustomized(armoERURL, armoBEURL, armoFEURL, armoAUTHURL string) *ArmoAPI

func NewARMOAPIDev

func NewARMOAPIDev() *ArmoAPI

func NewARMOAPIProd

func NewARMOAPIProd() *ArmoAPI

func NewARMOAPIStaging

func NewARMOAPIStaging() *ArmoAPI

func (*ArmoAPI) Delete

func (armoAPI *ArmoAPI) Delete(fullURL string, headers map[string]string) (string, error)

func (*ArmoAPI) DeleteException

func (armoAPI *ArmoAPI) DeleteException(exceptionName string) error

func (*ArmoAPI) Get

func (armoAPI *ArmoAPI) Get(fullURL string, headers map[string]string) (string, error)

func (*ArmoAPI) GetAPIURL

func (armoAPI *ArmoAPI) GetAPIURL() string

func (*ArmoAPI) GetAccountConfig

func (armoAPI *ArmoAPI) GetAccountConfig(clusterName string) (*armotypes.CustomerConfig, error)

ControlsInputs // map[<control name>][<input arguments>]

func (*ArmoAPI) GetAccountID

func (armoAPI *ArmoAPI) GetAccountID() string

func (*ArmoAPI) GetClientID

func (armoAPI *ArmoAPI) GetClientID() string

func (*ArmoAPI) GetControl

func (armoAPI *ArmoAPI) GetControl(policyName string) (*reporthandling.Control, error)

func (*ArmoAPI) GetControlsInputs

func (armoAPI *ArmoAPI) GetControlsInputs(clusterName string) (map[string][]string, error)

ControlsInputs // map[<control name>][<input arguments>]

func (*ArmoAPI) GetExceptions

func (armoAPI *ArmoAPI) GetExceptions(clusterName string) ([]armotypes.PostureExceptionPolicy, error)

func (*ArmoAPI) GetFramework

func (armoAPI *ArmoAPI) GetFramework(name string) (*reporthandling.Framework, error)

func (*ArmoAPI) GetFrameworks

func (armoAPI *ArmoAPI) GetFrameworks() ([]reporthandling.Framework, error)

func (*ArmoAPI) GetFrontendURL

func (armoAPI *ArmoAPI) GetFrontendURL() string

func (*ArmoAPI) GetReportReceiverURL

func (armoAPI *ArmoAPI) GetReportReceiverURL() string

func (*ArmoAPI) GetSecretKey

func (armoAPI *ArmoAPI) GetSecretKey() string

func (*ArmoAPI) GetTenant

func (armoAPI *ArmoAPI) GetTenant() (*TenantResponse, error)

func (*ArmoAPI) IsLoggedIn

func (armoAPI *ArmoAPI) IsLoggedIn() bool

func (*ArmoAPI) ListControls

func (armoAPI *ArmoAPI) ListControls(l ListType) ([]string, error)

func (*ArmoAPI) ListCustomFrameworks

func (armoAPI *ArmoAPI) ListCustomFrameworks() ([]string, error)

func (*ArmoAPI) ListFrameworks

func (armoAPI *ArmoAPI) ListFrameworks() ([]string, error)

func (*ArmoAPI) Login

func (armoAPI *ArmoAPI) Login() error

func (*ArmoAPI) Post

func (armoAPI *ArmoAPI) Post(fullURL string, headers map[string]string, body []byte) (string, error)

func (*ArmoAPI) PostExceptions

func (armoAPI *ArmoAPI) PostExceptions(exceptions []armotypes.PostureExceptionPolicy) error

func (*ArmoAPI) SetAccountID

func (armoAPI *ArmoAPI) SetAccountID(accountID string)

func (*ArmoAPI) SetClientID

func (armoAPI *ArmoAPI) SetClientID(clientID string)

func (*ArmoAPI) SetSecretKey

func (armoAPI *ArmoAPI) SetSecretKey(secretKey string)

type ArmoSelectCustomer

type ArmoSelectCustomer struct {
	SelectedCustomerGuid string `json:"selectedCustomer"`
}

type DownloadReleasedPolicy

type DownloadReleasedPolicy struct {
	// contains filtered or unexported fields
}

Use gitregostore to get policies from github release

func NewDownloadReleasedPolicy

func NewDownloadReleasedPolicy() *DownloadReleasedPolicy

func (*DownloadReleasedPolicy) GetControl

func (drp *DownloadReleasedPolicy) GetControl(policyName string) (*reporthandling.Control, error)

func (*DownloadReleasedPolicy) GetControlsInputs

func (drp *DownloadReleasedPolicy) GetControlsInputs(clusterName string) (map[string][]string, error)

func (*DownloadReleasedPolicy) GetFramework

func (drp *DownloadReleasedPolicy) GetFramework(name string) (*reporthandling.Framework, error)

func (*DownloadReleasedPolicy) GetFrameworks

func (drp *DownloadReleasedPolicy) GetFrameworks() ([]reporthandling.Framework, error)

func (*DownloadReleasedPolicy) ListControls

func (drp *DownloadReleasedPolicy) ListControls(listType ListType) ([]string, error)

func (*DownloadReleasedPolicy) ListFrameworks

func (drp *DownloadReleasedPolicy) ListFrameworks() ([]string, error)

func (*DownloadReleasedPolicy) SetRegoObjects

func (drp *DownloadReleasedPolicy) SetRegoObjects() error

type FeLoginData

type FeLoginData struct {
	Secret   string `json:"secret"`
	ClientId string `json:"clientId"`
}

type FeLoginResponse

type FeLoginResponse struct {
	Token        string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
	ExpiresIn    int32  `json:"expiresIn"`
	Expires      string `json:"expires"`
}

type IBackend

type IBackend interface {
	GetAccountID() string
	GetClientID() string
	GetSecretKey() string

	SetAccountID(accountID string)
	SetClientID(clientID string)
	SetSecretKey(secretKey string)

	GetTenant() (*TenantResponse, error)
}

type IControlsInputsGetter

type IControlsInputsGetter interface {
	GetControlsInputs(clusterName string) (map[string][]string, error)
}

type IExceptionsGetter

type IExceptionsGetter interface {
	GetExceptions(clusterName string) ([]armotypes.PostureExceptionPolicy, error)
}

type IPolicyGetter

type IPolicyGetter interface {
	GetFramework(name string) (*reporthandling.Framework, error)
	GetFrameworks() ([]reporthandling.Framework, error)
	GetControl(name string) (*reporthandling.Control, error)

	ListFrameworks() ([]string, error)
	ListControls(ListType) ([]string, error)
}

type ListType

type ListType string

supported listing

const ListID ListType = "id"
const ListName ListType = "name"

type LoadPolicy

type LoadPolicy struct {
	// contains filtered or unexported fields
}

Load policies from a local repository

func NewLoadPolicy

func NewLoadPolicy(filePaths []string) *LoadPolicy

func (*LoadPolicy) GetControl

func (lp *LoadPolicy) GetControl(controlName string) (*reporthandling.Control, error)

Return control from file

func (*LoadPolicy) GetControlsInputs

func (lp *LoadPolicy) GetControlsInputs(clusterName string) (map[string][]string, error)

func (*LoadPolicy) GetExceptions

func (lp *LoadPolicy) GetExceptions(clusterName string) ([]armotypes.PostureExceptionPolicy, error)

func (*LoadPolicy) GetFramework

func (lp *LoadPolicy) GetFramework(frameworkName string) (*reporthandling.Framework, error)

func (*LoadPolicy) GetFrameworks

func (lp *LoadPolicy) GetFrameworks() ([]reporthandling.Framework, error)

func (*LoadPolicy) ListControls

func (lp *LoadPolicy) ListControls(listType ListType) ([]string, error)

func (*LoadPolicy) ListFrameworks

func (lp *LoadPolicy) ListFrameworks() ([]string, error)

type TenantResponse

type TenantResponse struct {
	TenantID  string `json:"tenantId"`
	Token     string `json:"token"`
	Expires   string `json:"expires"`
	AdminMail string `json:"adminMail,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL