Documentation
¶
Index ¶
- Constants
- type Agent
- type AgentList
- type Assessment
- type AssessmentList
- type CustomerAssessments
- type ImageInfra
- type InventoryStats
- type JSONField
- type Key
- type KeySerializer
- type Label
- type Operation
- type OsStats
- type Permission
- type RVToolsJobMetadata
- type Relation
- type RelationSqlModel
- type Relationship
- type RelationshipUpdate
- type Resource
- type ResourceType
- type Snapshot
- type Source
- type SourceList
- type StorageCustomerStats
- type Subject
- type SubjectType
- type VmStats
Constants ¶
const ( SnapshotVersionV1 = 1 + iota SnapshotVersionV2 )
const ( SourceTypeAgent string = "agent" SourceTypeRvtools string = "rvtools" )
const ( JobStatusPending = "pending" JobStatusParsing = "parsing" JobStatusValidating = "validating" JobStatusCompleted = "completed" JobStatusFailed = "failed" JobStatusCancelled = "cancelled" )
Job status constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Assessment ¶
type Assessment struct {
ID uuid.UUID `gorm:"primaryKey;column:id;type:VARCHAR(255);"`
CreatedAt time.Time `gorm:"not null;default:now()"`
UpdatedAt *time.Time
Name string `gorm:"not null;uniqueIndex:org_id_user_name"`
OrgID string `gorm:"not null;uniqueIndex:org_id_user_name;index:assessments_org_id_idx"`
Username string `gorm:"type:VARCHAR(255);uniqueIndex:org_id_user_name"`
OwnerFirstName *string `gorm:"type:VARCHAR(100)"`
OwnerLastName *string `gorm:"type:VARCHAR(100)"`
SourceType string `gorm:"not null;type:VARCHAR(100)"`
SourceID *uuid.UUID `gorm:"type:TEXT"`
Snapshots []Snapshot `gorm:"foreignKey:AssessmentID;references:ID;constraint:OnDelete:CASCADE;"`
}
func (Assessment) String ¶
func (a Assessment) String() string
type AssessmentList ¶
type AssessmentList []Assessment
type CustomerAssessments ¶ added in v0.2.2
type ImageInfra ¶
type InventoryStats ¶
type InventoryStats struct {
Vms VmStats
Os OsStats
TotalCustomers int
TotalAssessmentsByCustomerBySource map[string]CustomerAssessments
TotalInventories int
Storage []StorageCustomerStats
}
func NewInventoryStats ¶
func NewInventoryStats(assessments []Assessment) InventoryStats
type JSONField ¶
type JSONField[T any] struct { Data T }
JSONField wraps an arbitrary struct so that it can be included in a GORM model, for use in a JSON/JSONB field
func MakeJSONField ¶
Return a copy of 'data', wrapped in a JSONField object
func (JSONField[T]) MarshalJSON ¶
func (*JSONField[T]) UnmarshalJSON ¶
type OsStats ¶
type OsStats struct {
// TotalTypes is total of os types. (e.g. how many different os we found)
Total int
}
type Permission ¶ added in v0.10.0
type Permission string
Permission represents a computed permission derived from relations.
const ( ReadPermission Permission = "read" EditPermission Permission = "edit" DeletePermission Permission = "delete" )
func (Permission) In ¶ added in v0.10.0
func (p Permission) In(perms []Permission) bool
In returns true if the permission is present in the given slice.
func (Permission) Relations ¶ added in v0.10.0
func (p Permission) Relations() []string
Relations returns the relation types that grant this permission.
type RVToolsJobMetadata ¶ added in v0.3.0
type RVToolsJobMetadata struct {
Status string `json:"status,omitempty"` // parsing, validating
Error string `json:"error,omitempty"` // error message if failed
AssessmentID *uuid.UUID `json:"assessment_id,omitempty"` // set when completed
}
RVToolsJobMetadata is stored in river_job.metadata to track progress and results.
type Relation ¶ added in v0.10.0
type Relation string
Relation represents a stored relation between a resource and a subject.
func (Relation) Permissions ¶ added in v0.10.0
func (r Relation) Permissions() []Permission
Permissions returns the permissions that this relation grants.
type RelationSqlModel ¶ added in v0.10.0
type RelationSqlModel struct {
ID int64 `gorm:"primaryKey;autoIncrement"`
Resource string `gorm:"not null;uniqueIndex:uq_resource_relation"`
ResourceID string `gorm:"column:resource_id;not null;uniqueIndex:uq_resource_relation"`
Relation string `gorm:"not null;uniqueIndex:uq_resource_relation"`
SubjectNamespace string `gorm:"column:subject_namespace;not null;uniqueIndex:uq_resource_relation"`
SubjectID string `gorm:"column:subject_id;not null;uniqueIndex:uq_resource_relation"`
}
RelationSqlModel is the GORM model for the relations table.
func (RelationSqlModel) TableName ¶ added in v0.10.0
func (RelationSqlModel) TableName() string
func (RelationSqlModel) ToRelationship ¶ added in v0.10.0
func (r RelationSqlModel) ToRelationship() Relationship
type Relationship ¶ added in v0.10.0
type Relationship struct {
ResourceType ResourceType
ResourceID string
Relation Relation
Subject Subject
}
Relationship represents a single tuple: resource_type:resource_id#relation@subject_type:subject_id
func NewRelationship ¶ added in v0.10.0
func NewRelationship(resourceType ResourceType, resourceID string, relation Relation, subject Subject) Relationship
func (Relationship) String ¶ added in v0.10.0
func (r Relationship) String() string
func (Relationship) ToSql ¶ added in v0.10.0
func (rel Relationship) ToSql() RelationSqlModel
type RelationshipUpdate ¶ added in v0.10.0
type RelationshipUpdate struct {
Operation Operation
Relationship Relationship
}
RelationshipUpdate pairs an operation with a relationship for batch writes.
type Resource ¶ added in v0.10.0
type Resource struct {
Type ResourceType
ID string
Permissions []Permission
}
Resource identifies a resource. Permissions is populated by query methods (ListResources, GetPermissions) and nil on input (DeleteRelationships, builder).
func NewAssessmentResource ¶ added in v0.10.0
func NewOrgResource ¶ added in v0.10.0
type ResourceType ¶ added in v0.10.0
type ResourceType string
ResourceType identifies the type of resource in a relationship tuple.
const ( AssessmentResource ResourceType = "assessment" OrgResource ResourceType = "org" )
type Snapshot ¶
type Source ¶
type Source struct {
gorm.Model
ID uuid.UUID `gorm:"primaryKey;"`
Name string `gorm:"uniqueIndex:sources_org_id_user_name;not null"`
VCenterID string
Username string `gorm:"uniqueIndex:sources_org_id_user_name"`
OrgID string `gorm:"uniqueIndex:sources_org_id_user_name;not null"`
Inventory []byte `gorm:"type:jsonb"`
OnPremises bool
Agents []Agent `gorm:"constraint:OnDelete:CASCADE;"`
ImageInfra ImageInfra `gorm:"constraint:OnDelete:CASCADE;"`
Labels []Label `gorm:"foreignKey:SourceID;references:ID;constraint:OnDelete:CASCADE;"`
EmailDomain *string
}
type SourceList ¶
type SourceList []Source
type StorageCustomerStats ¶
type Subject ¶ added in v0.10.0
type Subject struct {
ID string
Kind SubjectType
}
Subject represents the "who" in a relationship.
func NewOrgSubject ¶ added in v0.10.0
func NewUserSubject ¶ added in v0.10.0
type SubjectType ¶ added in v0.10.0
type SubjectType string
SubjectType identifies the type of subject in a relationship tuple.
const ( UserSubject SubjectType = "user" OrgSubject SubjectType = "org" )