common

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEvidenceMissing         = errors.New("evidence is missing")
	ErrEvidenceIdInvalidFormat = errors.New("evidence id not in expected format (UUID) or missing")
	ErrTimestampMissing        = errors.New("evidence timestamp is missing")
	ErrTargetServiceMissing    = errors.New("evidence target service is missing")
	ErrEvidenceWithError       = errors.New("evidence includes error")
	ErrValueMissing            = errors.New("evidence value is missing")
	ErrValueNotStruct          = errors.New("evidence value is no struct value")
	ErrValueNotMap             = errors.New("evidence (struct) value is not convertible to map")
)
View Source
var (
	Error_Code_name = map[int32]string{
		0: "ERROR_UNKNOWN",
		1: "ERROR_INVALID_CONFIGURATION",
		2: "ERROR_CONNECTION_FAILURE",
		3: "ERROR_PROTOCOL_VIOLATION",
	}
	Error_Code_value = map[string]int32{
		"ERROR_UNKNOWN":               0,
		"ERROR_INVALID_CONFIGURATION": 1,
		"ERROR_CONNECTION_FAILURE":    2,
		"ERROR_PROTOCOL_VIOLATION":    3,
	}
)

Enum value maps for Error_Code.

View Source
var File_api_common_evidence_proto protoreflect.FileDescriptor
View Source
var File_api_common_metric_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Error

type Error struct {

	// The type of error
	Code Error_Code `protobuf:"varint,1,opt,name=code,proto3,enum=cam.Error_Code" json:"code,omitempty"`
	// Optional. A human-readable description of the error.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// contains filtered or unexported fields
}

An error result

func (*Error) Descriptor deprecated

func (*Error) Descriptor() ([]byte, []int)

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() Error_Code

func (*Error) GetDescription

func (x *Error) GetDescription() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

func (x *Error) ProtoReflect() protoreflect.Message

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type Error_Code

type Error_Code int32

The broad type of error, should not be too collection module specific

const (
	Error_ERROR_UNKNOWN               Error_Code = 0
	Error_ERROR_INVALID_CONFIGURATION Error_Code = 1 // The collection module configuration did not allow for collection
	// (e.g. Port number 1000000)
	Error_ERROR_CONNECTION_FAILURE Error_Code = 2 // The service could not be reached (e.g. Timeout)
	Error_ERROR_PROTOCOL_VIOLATION Error_Code = 3 // The service did not behave as expected
)

func (Error_Code) Descriptor

func (Error_Code) Descriptor() protoreflect.EnumDescriptor

func (Error_Code) Enum

func (x Error_Code) Enum() *Error_Code

func (Error_Code) EnumDescriptor deprecated

func (Error_Code) EnumDescriptor() ([]byte, []int)

Deprecated: Use Error_Code.Descriptor instead.

func (Error_Code) Number

func (x Error_Code) Number() protoreflect.EnumNumber

func (Error_Code) String

func (x Error_Code) String() string

func (Error_Code) Type

type Evidence

type Evidence struct {

	// The ID is a newly generated uuid
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Name equals the ID
	Name          string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	TargetService string `protobuf:"bytes,3,opt,name=target_service,json=targetService,proto3" json:"target_service,omitempty"`
	// Optional. Specific to the service, e.g. resource ID within service
	TargetResource string `protobuf:"bytes,4,opt,name=target_resource,json=targetResource,proto3" json:"target_resource,omitempty"`
	// Reference to Metric (e.g. metric ID)
	GatheredUsing string `protobuf:"bytes,5,opt,name=gathered_using,json=gatheredUsing,proto3" json:"gathered_using,omitempty"`
	// Represents the collection module
	ToolId string `protobuf:"bytes,11,opt,name=tool_id,json=toolId,proto3" json:"tool_id,omitempty"`
	// Time of evidence creation
	GatheredAt *timestamppb.Timestamp `` /* 131-byte string literal not displayed */
	// Conditional, Mutually exclusive with error. The measured value. Depends on
	// the type of evidence
	Value *structpb.Value `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty" gorm:"serializer:json"`
	// Conditional, Mutually exclusive with value. An error
	Error *Error `protobuf:"bytes,8,opt,name=error,proto3" json:"error,omitempty" gorm:"serializer:json"`
	// Optional. E.g. a JSON representation of the raw underlying evidence
	RawEvidence string `protobuf:"bytes,10,opt,name=raw_evidence,json=rawEvidence,proto3" json:"raw_evidence,omitempty"`
	// contains filtered or unexported fields
}

An evidence resource

func (*Evidence) Descriptor deprecated

func (*Evidence) Descriptor() ([]byte, []int)

Deprecated: Use Evidence.ProtoReflect.Descriptor instead.

func (*Evidence) GetError

func (x *Evidence) GetError() *Error

func (*Evidence) GetGatheredAt

func (x *Evidence) GetGatheredAt() *timestamppb.Timestamp

func (*Evidence) GetGatheredUsing

func (x *Evidence) GetGatheredUsing() string

func (*Evidence) GetId

func (x *Evidence) GetId() string

func (*Evidence) GetName

func (x *Evidence) GetName() string

func (*Evidence) GetRawEvidence

func (x *Evidence) GetRawEvidence() string

func (*Evidence) GetTargetResource

func (x *Evidence) GetTargetResource() string

func (*Evidence) GetTargetService

func (x *Evidence) GetTargetService() string

func (*Evidence) GetToolId

func (x *Evidence) GetToolId() string

func (*Evidence) GetValue

func (x *Evidence) GetValue() *structpb.Value

func (*Evidence) ProtoMessage

func (*Evidence) ProtoMessage()

func (*Evidence) ProtoReflect

func (x *Evidence) ProtoReflect() protoreflect.Message

func (*Evidence) Reset

func (x *Evidence) Reset()

func (*Evidence) ResourceTypes

func (evidence *Evidence) ResourceTypes() (types []string, err error)

ResourceTypes parses the embedded resource of this evidence and returns its types according to the ontology.

func (*Evidence) String

func (x *Evidence) String() string

func (*Evidence) Validate

func (e *Evidence) Validate() error

type Metric

type Metric struct {
	Id          string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name        string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	// Reference to the control: It is an ID according to OSCAL model
	Control string `protobuf:"bytes,4,opt,name=control,proto3" json:"control,omitempty"`
	Scale   string `protobuf:"bytes,5,opt,name=scale,proto3" json:"scale,omitempty"`
	// contains filtered or unexported fields
}

A metric resource TODO: Remove, Clouditor metric is used instead

func (*Metric) Descriptor deprecated

func (*Metric) Descriptor() ([]byte, []int)

Deprecated: Use Metric.ProtoReflect.Descriptor instead.

func (*Metric) GetControl

func (x *Metric) GetControl() string

func (*Metric) GetDescription

func (x *Metric) GetDescription() string

func (*Metric) GetId

func (x *Metric) GetId() string

func (*Metric) GetName

func (x *Metric) GetName() string

func (*Metric) GetScale

func (x *Metric) GetScale() string

func (*Metric) ProtoMessage

func (*Metric) ProtoMessage()

func (*Metric) ProtoReflect

func (x *Metric) ProtoReflect() protoreflect.Message

func (*Metric) Reset

func (x *Metric) Reset()

func (*Metric) String

func (x *Metric) String() string

Jump to

Keyboard shortcuts

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