schema

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssetHost     = "host"
	AssetStorage  = "storage"
	AssetUser     = "user"
	AssetDatabase = "database"
	AssetDomain   = "domain"
	AssetLog      = "log"
)

Asset type constants. Providers and payloads should reference these rather than raw strings to keep the grouping key canonical.

Variables

This section is empty.

Functions

func AppendAssets added in v0.2.0

func AppendAssets[T Asset](r *Resources, items []T)

AppendAssets copies a typed slice into r.Assets as Asset values. Provider implementations use this to flow a []Host / []Storage / ... into the open asset list without writing the boxing loop inline.

Types

type Asset added in v0.2.0

type Asset interface {
	AssetType() string
}

Asset is any cloud resource that can be enumerated and rendered. New asset types (FaaS, K8s clusters, container registries, etc.) only need to implement AssetType() to flow through the existing asset-inventory pipeline.

type BucketManager added in v0.2.0

type BucketManager interface {
	Provider
	BucketDump(ctx context.Context, action, bucketName string) ([]BucketResult, error)
}

BucketManager powers the bucket-check payload.

type BucketObject added in v0.3.0

type BucketObject struct {
	BucketName   string
	Key          string
	Size         int64
	LastModified string
	StorageClass string
}

type BucketResult added in v0.3.0

type BucketResult struct {
	Action      string
	BucketName  string
	ObjectCount int64
	Objects     []BucketObject
	Message     string
}

func AggregateBucketResults added in v0.3.0

func AggregateBucketResults(action, bucketName string, results []BucketResult) BucketResult

type DBManager added in v0.2.0

type DBManager interface {
	Provider
	DBManagement(action, instanceID string)
}

DBManager powers the rds-account-check payload.

type Database

type Database struct {
	InstanceId    string `table:"ID"`
	Engine        string `table:"Engine"`
	EngineVersion string `table:"Version"`
	Region        string `table:"Region"`
	Address       string `table:"Address"`
	NetworkType   string `table:"NetworkType"`
	DBNames       string `table:"DBName"`
}

func (Database) AssetType added in v0.2.0

func (Database) AssetType() string

type Domain added in v0.0.9

type Domain struct {
	DomainName string
	Records    []Record
}

func (Domain) AssetType added in v0.2.0

func (Domain) AssetType() string

type Enumerator added in v0.2.0

type Enumerator interface {
	Provider
	Resources(ctx context.Context) (Resources, error)
}

Enumerator powers the asset-inventory (`cloudlist`) payload.

type ErrNoSuchKey

type ErrNoSuchKey struct {
	Name string
}

ErrNoSuchKey means no such key exists in metadata.

func (*ErrNoSuchKey) Error

func (e *ErrNoSuchKey) Error() string

Error returns the value of the metadata key

type Event added in v0.0.9

type Event struct {
	Id        string
	Name      string
	Affected  string
	API       string
	Status    string
	SourceIp  string `table:"Source IP"`
	AccessKey string
	Time      string
}

type EventReader added in v0.2.0

type EventReader interface {
	Provider
	EventDump(action, args string)
}

EventReader powers the event-check payload.

type Host

type Host struct {
	HostName    string `table:"HostName"`
	ID          string `table:"Instance ID"`
	State       string `table:"State"`
	PublicIPv4  string `table:"Public IP"`
	PrivateIpv4 string `table:"Private IP"`
	OSType      string `table:"OS Type"`
	DNSName     string `table:"DNS Name"`
	Public      bool   `table:"Public"`
	Region      string `table:"Region"`
}

func (Host) AssetType added in v0.2.0

func (Host) AssetType() string

type IAMManager added in v0.2.0

type IAMManager interface {
	Provider
	UserManagement(action, username, password string) (IAMResult, error)
}

IAMManager powers the iam-user-check payload.

type IAMResult added in v0.3.0

type IAMResult struct {
	Action    string
	Username  string
	Password  string
	LoginURL  string
	AccountID string
	Message   string
}

type Log added in v0.1.2

type Log struct {
	ProjectName    string `table:"Project Name"`
	Region         string
	Description    string
	LastModifyTime string
}

func (Log) AssetType added in v0.2.0

func (Log) AssetType() string

type Options

type Options map[string]string

Options contains configuration options for a provider

func (Options) GetMetadata added in v0.0.6

func (o Options) GetMetadata(key string) (string, bool)

GetMetadata returns the value for a key if it exists.

type Provider

type Provider interface {
	Name() string
}

Provider is the minimum contract every cloud must satisfy. Capability interfaces below (Enumerator, IAMManager, etc.) extend it optionally; a payload type-asserts for the capability it needs and fails gracefully when the current provider does not implement it.

type Record added in v0.0.9

type Record struct {
	RR     string
	Type   string
	Value  string
	Status string
}

type ResourceError added in v0.2.0

type ResourceError struct {
	Scope   string
	Message string
}

type Resources

type Resources struct {
	Provider string
	Assets   []Asset
	Sms      Sms
	Errors   []ResourceError
}

func NewResources

func NewResources() Resources

NewResources creates a new resources structure

func (*Resources) AddError added in v0.2.0

func (r *Resources) AddError(scope string, err error)

func (Resources) Err added in v0.2.0

func (r Resources) Err() error

func (*Resources) Grouped added in v0.2.0

func (r *Resources) Grouped() map[string][]Asset

Grouped returns assets partitioned by AssetType() while preserving insertion order within each bucket. Used by the asset-inventory printer so each asset type renders as its own table.

type Sms added in v0.0.6

type Sms struct {
	Signs     []SmsSign
	Templates []SmsTemplate
	DailySize int64
}

type SmsSign added in v0.0.6

type SmsSign struct {
	Name   string `table:"Name"`
	Type   string `table:"Type"`
	Status string `table:"Status"`
}

type SmsTemplate added in v0.0.6

type SmsTemplate struct {
	Name    string `table:"Name"`
	Status  string `table:"Status"`
	Content string `table:"Content"`
}

type Storage

type Storage struct {
	BucketName  string `table:"Bucket"`
	AccountName string `table:"Storage Account"`
	Region      string `table:"Region"`
}

func (Storage) AssetType added in v0.2.0

func (Storage) AssetType() string

type User

type User struct {
	UserName    string `table:"User"`
	UserId      string `table:"ID"`
	Policies    string `table:"Policies"`
	EnableLogin bool   `table:"EnableLogin"`
	LastLogin   string `table:"LastLogin"`
	CreateTime  string `table:"CreateTime"`
}

func (User) AssetType added in v0.2.0

func (User) AssetType() string

type VMExecutor added in v0.2.0

type VMExecutor interface {
	Provider
	ExecuteCloudVMCommand(instanceID, cmd string)
}

VMExecutor powers the instance-cmd-check / shell payloads.

Jump to

Keyboard shortcuts

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