Documentation
¶
Index ¶
- func DeleteTestDB(ctx context.Context, log *logrus.Logger, cfg *config.Config, store Store, ...)
- func ImageBuildAPIVersion() string
- func ImageBuildsToApiResource(imageBuilds []ImageBuild, cont *string, numRemaining *int64) (api.ImageBuildList, error)
- func ImageBuildsToApiResourceWithOptions(imageBuilds []ImageBuild, cont *string, numRemaining *int64, ...) (api.ImageBuildList, error)
- func ImageExportAPIVersion() string
- func ImageExportsToApiResource(imageExports []ImageExport, cont *string, numRemaining *int64) (api.ImageExportList, error)
- func TxFromContext(ctx context.Context) *gorm.DB
- func WithTx(ctx context.Context, tx *gorm.DB) context.Context
- type GetOption
- type GetOptions
- type ImageBuild
- func (i *ImageBuild) GetKind() string
- func (i *ImageBuild) GetStatusAsJson() ([]byte, error)
- func (i *ImageBuild) HasNilSpec() bool
- func (i *ImageBuild) HasSameSpecAs(otherResource any) bool
- func (i *ImageBuild) ListSelectors() selector.SelectorNameSet
- func (i *ImageBuild) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (i ImageBuild) String() string
- func (i *ImageBuild) ToApiResource(opts ...ImageBuildAPIResourceOption) (*api.ImageBuild, error)
- type ImageBuildAPIResourceOption
- type ImageBuildStore
- type ImageExport
- func (i *ImageExport) GetKind() string
- func (i *ImageExport) GetStatusAsJson() ([]byte, error)
- func (i *ImageExport) HasNilSpec() bool
- func (i *ImageExport) HasSameSpecAs(otherResource any) bool
- func (i *ImageExport) ListSelectors() selector.SelectorNameSet
- func (i *ImageExport) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
- func (i ImageExport) String() string
- func (i *ImageExport) ToApiResource() (*api.ImageExport, error)
- type ImageExportStore
- type ListOption
- type ListOptions
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteTestDB ¶
func DeleteTestDB(ctx context.Context, log *logrus.Logger, cfg *config.Config, store Store, dbName string)
DeleteTestDB drops the test database
func ImageBuildAPIVersion ¶
func ImageBuildAPIVersion() string
func ImageBuildsToApiResource ¶
func ImageBuildsToApiResource(imageBuilds []ImageBuild, cont *string, numRemaining *int64) (api.ImageBuildList, error)
func ImageBuildsToApiResourceWithOptions ¶
func ImageBuildsToApiResourceWithOptions(imageBuilds []ImageBuild, cont *string, numRemaining *int64, imageExportsMap map[string][]api.ImageExport) (api.ImageBuildList, error)
func ImageExportAPIVersion ¶
func ImageExportAPIVersion() string
func ImageExportsToApiResource ¶
func ImageExportsToApiResource(imageExports []ImageExport, cont *string, numRemaining *int64) (api.ImageExportList, error)
func TxFromContext ¶
TxFromContext retrieves a transaction from context, or nil if none exists
Types ¶
type GetOptions ¶
type GetOptions struct {
WithExports bool
}
type ImageBuild ¶
type ImageBuild struct {
model.Resource
// The desired state, stored as opaque JSON object.
Spec *model.JSONField[api.ImageBuildSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *model.JSONField[api.ImageBuildStatus] `gorm:"type:jsonb"`
// Logs contains the last 500 lines of build logs for completed builds.
// This is separate from Status to keep the ImageBuild resource lightweight.
// Logs are only accessible via the /log endpoint.
Logs *string `gorm:"type:text"`
}
func NewImageBuildFromApiResource ¶
func NewImageBuildFromApiResource(resource *api.ImageBuild) (*ImageBuild, error)
func (*ImageBuild) GetKind ¶
func (i *ImageBuild) GetKind() string
func (*ImageBuild) GetStatusAsJson ¶
func (i *ImageBuild) GetStatusAsJson() ([]byte, error)
func (*ImageBuild) HasNilSpec ¶
func (i *ImageBuild) HasNilSpec() bool
func (*ImageBuild) HasSameSpecAs ¶
func (i *ImageBuild) HasSameSpecAs(otherResource any) bool
func (*ImageBuild) ListSelectors ¶
func (i *ImageBuild) ListSelectors() selector.SelectorNameSet
ListSelectors returns all available field selectors for ImageBuild
func (*ImageBuild) ResolveSelector ¶
func (i *ImageBuild) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
ResolveSelector resolves a field selector name to a SelectorField for ImageBuild
func (ImageBuild) String ¶
func (i ImageBuild) String() string
func (*ImageBuild) ToApiResource ¶
func (i *ImageBuild) ToApiResource(opts ...ImageBuildAPIResourceOption) (*api.ImageBuild, error)
type ImageBuildAPIResourceOption ¶
type ImageBuildAPIResourceOption func(*imageBuildAPIResourceOptions)
func WithImageExports ¶
func WithImageExports(imageExports []api.ImageExport) ImageBuildAPIResourceOption
type ImageBuildStore ¶
type ImageBuildStore interface {
Create(ctx context.Context, orgId uuid.UUID, imageBuild *api.ImageBuild) (*api.ImageBuild, error)
Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*api.ImageBuild, error)
List(ctx context.Context, orgId uuid.UUID, listParams flightctlstore.ListParams, opts ...ListOption) (*api.ImageBuildList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string) (*api.ImageBuild, error)
UpdateStatus(ctx context.Context, orgId uuid.UUID, imageBuild *api.ImageBuild) (*api.ImageBuild, error)
UpdateLastSeen(ctx context.Context, orgId uuid.UUID, name string, timestamp time.Time) error
UpdateLogs(ctx context.Context, orgId uuid.UUID, name string, logs string) error
GetLogs(ctx context.Context, orgId uuid.UUID, name string) (string, error)
InitialMigration(ctx context.Context) error
}
ImageBuildStore is the store interface for ImageBuild resources
func NewImageBuildStore ¶
func NewImageBuildStore(db *gorm.DB, log logrus.FieldLogger) ImageBuildStore
NewImageBuildStore creates a new ImageBuild store
type ImageExport ¶
type ImageExport struct {
model.Resource
// The desired state, stored as opaque JSON object.
Spec *model.JSONField[api.ImageExportSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *model.JSONField[api.ImageExportStatus] `gorm:"type:jsonb"`
// Logs contains the last 500 lines of export logs for completed exports.
// This is separate from Status to keep the ImageExport resource lightweight.
// Logs are only accessible via the /log endpoint.
Logs *string `gorm:"type:text"`
}
ImageExport model
func NewImageExportFromApiResource ¶
func NewImageExportFromApiResource(resource *api.ImageExport) (*ImageExport, error)
func (*ImageExport) GetKind ¶
func (i *ImageExport) GetKind() string
func (*ImageExport) GetStatusAsJson ¶
func (i *ImageExport) GetStatusAsJson() ([]byte, error)
func (*ImageExport) HasNilSpec ¶
func (i *ImageExport) HasNilSpec() bool
func (*ImageExport) HasSameSpecAs ¶
func (i *ImageExport) HasSameSpecAs(otherResource any) bool
func (*ImageExport) ListSelectors ¶
func (i *ImageExport) ListSelectors() selector.SelectorNameSet
ListSelectors returns all available field selectors for ImageExport
func (*ImageExport) ResolveSelector ¶
func (i *ImageExport) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)
ResolveSelector resolves a field selector name to a SelectorField for ImageExport
func (ImageExport) String ¶
func (i ImageExport) String() string
func (*ImageExport) ToApiResource ¶
func (i *ImageExport) ToApiResource() (*api.ImageExport, error)
type ImageExportStore ¶
type ImageExportStore interface {
Create(ctx context.Context, orgId uuid.UUID, imageExport *api.ImageExport) (*api.ImageExport, error)
Get(ctx context.Context, orgId uuid.UUID, name string) (*api.ImageExport, error)
List(ctx context.Context, orgId uuid.UUID, listParams flightctlstore.ListParams) (*api.ImageExportList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string) (*api.ImageExport, error)
UpdateStatus(ctx context.Context, orgId uuid.UUID, imageExport *api.ImageExport) (*api.ImageExport, error)
UpdateLastSeen(ctx context.Context, orgId uuid.UUID, name string, timestamp time.Time) error
UpdateLogs(ctx context.Context, orgId uuid.UUID, name string, logs string) error
GetLogs(ctx context.Context, orgId uuid.UUID, name string) (string, error)
InitialMigration(ctx context.Context) error
}
ImageExportStore is the store interface for ImageExport resources
func NewImageExportStore ¶
func NewImageExportStore(db *gorm.DB, log logrus.FieldLogger) ImageExportStore
NewImageExportStore creates a new ImageExport store
type ListOption ¶
type ListOption func(*ListOptions)
func ListWithExports ¶
func ListWithExports(val bool) ListOption
type ListOptions ¶
type ListOptions struct {
WithExports bool
}
type Store ¶
type Store interface {
ImageBuild() ImageBuildStore
ImageExport() ImageExportStore
RunMigrations(ctx context.Context) error
Ping() error
Close() error
}
Store is the imagebuilder-specific store interface