mondooclient

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RunAdmissionReviewEndpoint = "/Scan/RunAdmissionReview"
	// A valid result would come back as a '2'
	ValidScanResult = uint32(2)
)
View Source
const ExchangeRegistrationTokenEndpoint = "/AgentManager/ExchangeRegistrationToken"
View Source
const GarbageCollectAssetsEndpoint = "/Scan/GarbageCollectAssets"
View Source
const HealthCheckEndpoint = "/Health/Check"
View Source
const IntegrationCheckInEndpoint = "/IntegrationsManager/CheckIn"
View Source
const IntegrationRegisterEndpoint = "/IntegrationsManager/Register"
View Source
const IntegrationReportStatusEndpoint = "/IntegrationsManager/ReportStatus"
View Source
const ScanKubernetesResourcesEndpoint = "/Scan/Run"
View Source
const ScheduleKubernetesResourceScanEndpoint = "/Scan/Schedule"

Variables

This section is empty.

Functions

func DefaultHttpClient

func DefaultHttpClient() *http.Client

Types

type AdmissionReviewJob added in v1.6.0

type AdmissionReviewJob struct {
	Data *structpb.Struct `json:"data,omitempty"`
	// Map of string keys and values that can be used to organize and categorize the assets
	Labels     map[string]string `json:"labels,omitempty"`
	ReportType ReportType        `json:"report_type,omitempty"`
	// Additional options for the manifest job
	Options map[string]string `json:"options,omitempty"`
	// Additional discovery settings for the manifest job
	Discovery *inventory.Discovery `json:"discovery,omitempty"`
}

type Client

type Client interface {
	ExchangeRegistrationToken(context.Context, *ExchangeRegistrationTokenInput) (*ExchangeRegistrationTokenOutput, error)

	HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
	RunAdmissionReview(context.Context, *AdmissionReviewJob) (*ScanResult, error)
	ScanKubernetesResources(ctx context.Context, scanOpts *ScanKubernetesResourcesOpts) (*ScanResult, error)
	ScheduleKubernetesResourceScan(ctx context.Context, integrationMrn, resourceKey, managedBy string) (*Empty, error)
	GarbageCollectAssets(context.Context, *garbagecollection.GarbageCollectOptions) error

	IntegrationRegister(context.Context, *IntegrationRegisterInput) (*IntegrationRegisterOutput, error)
	IntegrationCheckIn(context.Context, *IntegrationCheckInInput) (*IntegrationCheckInOutput, error)
	IntegrationReportStatus(context.Context, *ReportStatusRequest) error
}

func NewClient

func NewClient(opts ClientOptions) Client

type ClientOptions

type ClientOptions struct {
	ApiEndpoint string
	Token       string
}

type Empty added in v1.5.0

type Empty struct{}

type ExchangeRegistrationTokenInput

type ExchangeRegistrationTokenInput struct {
	// JWT token, only available during creation
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
}

ExchangeRegistrationTokenInput is used for converting a JWT to a Mondoo serivce account

type ExchangeRegistrationTokenOutput

type ExchangeRegistrationTokenOutput struct {
	ServiceAccount string `json:"serviceAccount,omitempty"`
}

type File

type File struct {
	Data []byte `json:"data,omitempty"`
}

type HealthCheckRequest

type HealthCheckRequest struct{}

type HealthCheckResponse

type HealthCheckResponse struct {
	Status string `json:"status,omitempty"`
	// returns rfc 3339 timestamp
	Time string `json:"time,omitempty"`
	// returns the major api version
	ApiVersion string `json:"apiVersion,omitempty"`
	// returns the git commit checksum
	Build string `json:"build,omitempty"`
}

type IntegrationCheckInInput added in v0.2.10

type IntegrationCheckInInput struct {
	// Mrn should hold the MRN of the integration that is having the CheckIn() called for
	Mrn string `protobuf:"bytes,1,opt,name=mrn,proto3" json:"mrn,omitempty"`
	// optional, ensure the client has the exact same configuration options
	// as the ones saved to the integration/db
	ConfigurationHash string `protobuf:"bytes,2,opt,name=configuration_hash,json=configurationHash,proto3" json:"configuration_hash,omitempty"`
	// source identifier for the integration, e.g. AWS account id
	Identifier string `protobuf:"bytes,3,opt,name=identifier,proto3" json:"identifier,omitempty"`
}

type IntegrationCheckInOutput added in v0.2.10

type IntegrationCheckInOutput struct {
	Mrn string `protobuf:"bytes,1,opt,name=mrn,proto3" json:"mrn,omitempty"`
	// true if the configuration hash sent in matches the hash of the stored configuration
	ConfigurationMatch bool `protobuf:"varint,2,opt,name=configuration_match,json=configurationMatch,proto3" json:"configuration_match,omitempty"`
}

type IntegrationMessage added in v0.6.0

type IntegrationMessage struct {
	Message         string        `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Timestamp       string        `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Status          MessageStatus `protobuf:"varint,3,opt,name=status,proto3,enum=mondoo.integrations.v1.MessageStatus" json:"status,omitempty"`
	ReportedByAgent bool          `protobuf:"varint,4,opt,name=reported_by_agent,json=reportedByAgent,proto3" json:"reported_by_agent,omitempty"`
	Identifier      string        `protobuf:"bytes,5,opt,name=identifier,proto3" json:"identifier,omitempty"`
	// Anything extra that the message might contain.
	Extra interface{} `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"`
}

type IntegrationRegisterInput added in v0.2.10

type IntegrationRegisterInput struct {
	// Mrn is the MRN of the integration. It should be provided in the JWT under the "owner" claim
	Mrn   string `protobuf:"bytes,1,opt,name=mrn,proto3" json:"mrn,omitempty"`
	Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
}

type IntegrationRegisterOutput added in v0.2.10

type IntegrationRegisterOutput struct {
	// Mrn is the integration MRN
	Mrn string `protobuf:"bytes,1,opt,name=mrn,proto3" json:"mrn,omitempty"`
	// Creds holds all the Mondoo serivce account data
	Creds *ServiceAccountCredentials `protobuf:"bytes,2,opt,name=creds,proto3" json:"creds,omitempty"`
}

type MessageStatus added in v0.6.0

type MessageStatus int32
const (
	MessageStatus_MESSAGE_UNKNOWN MessageStatus = 0
	MessageStatus_MESSAGE_WARNING MessageStatus = 1
	MessageStatus_MESSAGE_ERROR   MessageStatus = 2
	MessageStatus_MESSAGE_INFO    MessageStatus = 3
)

type Messages added in v0.7.0

type Messages struct {
	Messages []IntegrationMessage `protobuf:"bytes,1,opt,name=messages,proto3" json:"messages,omitempty"`
}

type ReportStatusRequest added in v0.6.0

type ReportStatusRequest struct {
	Mrn string `protobuf:"bytes,1,opt,name=mrn,proto3" json:"mrn,omitempty"`
	// this is the status of the integration itself (is it active/checking in, errored, etc)
	Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=mondoo.integrations.v1.Status" json:"status,omitempty"`
	// this can be any information about the current state of the integration. it will be displayed to the user as-is where supported
	LastState interface{} `protobuf:"bytes,4,opt,name=last_state,json=lastState,proto3" json:"last_state,omitempty"`
	// Allows the agent to report its current version
	Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"`
	// messages that convey extra information about the integration - these messages can be informational, warnings or errors. Can be used
	// to report non-critical errors/warnings without neccesarily changing the whole integration status.
	Messages Messages `protobuf:"bytes,7,opt,name=messages,proto3" json:"messages,omitempty"`
}

type ReportType added in v0.8.2

type ReportType int
const (
	ReportType_NONE  ReportType = 0
	ReportType_ERROR ReportType = 1
	ReportType_FULL  ReportType = 2
)

type ScanJob added in v0.4.0

type ScanJob struct {
	Inventory  inventory.MondooInventory `json:"inventory"`
	ReportType ReportType                `` /* 128-byte string literal not displayed */
}

type ScanKubernetesResourcesOpts added in v1.7.0

type ScanKubernetesResourcesOpts struct {
	IntegrationMrn      string
	ScanContainerImages bool
	ManagedBy           string
	IncludeNamespaces   []string
	ExcludeNamespaces   []string
}

type ScanResult

type ScanResult struct {
	WorstScore *Score `json:"worstScore,omitempty"`
	Ok         bool   `json:"ok,omitempty"`
}

type Score

type Score struct {
	QrId            string `json:"qr_id,omitempty"`
	Type            uint32 `json:"type,omitempty"`
	Value           uint32 `json:"value,omitempty"`
	Weight          uint32 `json:"weight,omitempty"`
	ScoreCompletion uint32 `json:"score_completion,omitempty"`
	DataTotal       uint32 `json:"data_total,omitempty"`
	DataCompletion  uint32 `json:"data_completion,omitempty"`
	Message         string `json:"message,omitempty"`
}

type ServiceAccountCredentials added in v0.2.10

type ServiceAccountCredentials struct {
	Mrn         string `protobuf:"bytes,1,opt,name=mrn,proto3" json:"mrn,omitempty"`
	SpaceMrn    string `protobuf:"bytes,2,opt,name=space_mrn,json=spaceMrn,proto3" json:"space_mrn,omitempty"`
	PrivateKey  string `protobuf:"bytes,3,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
	Certificate string `protobuf:"bytes,4,opt,name=certificate,proto3" json:"certificate,omitempty"`
	ApiEndpoint string `protobuf:"bytes,5,opt,name=api_endpoint,json=apiEndpoint,proto3" json:"api_endpoint,omitempty"`
}

type Status added in v0.6.0

type Status int32
const (
	Status_NOT_READY         Status = 0
	Status_WAITING_FOR_SETUP Status = 1
	Status_ACTIVE            Status = 2
	Status_ERROR             Status = 3
	Status_DELETED           Status = 4
	Status_MISSING           Status = 5
	Status_WARNING           Status = 6
)

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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