resource

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromModelToResource

func FromModelToResource(r *Resource) (*resource.Resource, error)

Types

type Backup

type Backup struct {
	ID uuid.UUID

	Store         string
	ProjectName   string
	NamespaceName string

	Description   string
	ResourceNames pq.StringArray

	Config map[string]string

	CreatedAt time.Time
	UpdatedAt time.Time
}

func NewBackup

func NewBackup(b *resource.Backup) Backup

func (Backup) ToResourceBackup

func (b Backup) ToResourceBackup() (*resource.Backup, error)

type BackupRepository

type BackupRepository struct {
	// contains filtered or unexported fields
}

func NewBackupRepository

func NewBackupRepository(pool *pgxpool.Pool) *BackupRepository

func (BackupRepository) Create

func (repo BackupRepository) Create(ctx context.Context, resourceBackup *resource.Backup) error

func (BackupRepository) GetAll

func (repo BackupRepository) GetAll(ctx context.Context, tnnt tenant.Tenant, store resource.Store) ([]*resource.Backup, error)

func (BackupRepository) GetByID

type Change added in v0.15.0

type Change struct {
	Property string `json:"attribute_name"`
	Diff     string `json:"diff"`
}

type ChangeLog added in v0.15.0

type ChangeLog struct {
	Change []Change
	Type   string
	Time   time.Time
}

func FromChangelogRow added in v0.15.0

func FromChangelogRow(row pgx.Row) (*ChangeLog, error)

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(pool *pgxpool.Pool) *Repository

func (Repository) ChangeNamespace added in v0.8.0

func (r Repository) ChangeNamespace(ctx context.Context, res *resource.Resource, newTenant tenant.Tenant) error

func (Repository) Create

func (r Repository) Create(ctx context.Context, resourceModel *resource.Resource) error

func (Repository) Delete added in v0.12.0

func (r Repository) Delete(ctx context.Context, resourceModel *resource.Resource) error

func (Repository) GetChangelogs added in v0.15.0

func (r Repository) GetChangelogs(ctx context.Context, projectName tenant.ProjectName, resourceName resource.Name) ([]*resource.ChangeLog, error)

func (Repository) GetResources

func (r Repository) GetResources(ctx context.Context, tnnt tenant.Tenant, store resource.Store, names []string) ([]*resource.Resource, error)

func (Repository) ReadAll

func (r Repository) ReadAll(ctx context.Context, tnnt tenant.Tenant, store resource.Store, onlyActive bool) ([]*resource.Resource, error)

func (Repository) ReadByFullName

func (r Repository) ReadByFullName(ctx context.Context, tnnt tenant.Tenant, store resource.Store, fullName string, onlyActive bool) (*resource.Resource, error)

func (Repository) ReadByURN added in v0.17.0

func (r Repository) ReadByURN(ctx context.Context, tnnt tenant.Tenant, urn resource.URN) (*resource.Resource, error)

func (Repository) Update

func (r Repository) Update(ctx context.Context, resourceModel *resource.Resource) error

func (Repository) UpdateStatus

func (r Repository) UpdateStatus(ctx context.Context, resources ...*resource.Resource) error

type Resource

type Resource struct {
	ID uuid.UUID

	FullName string
	Kind     string
	Store    string

	ProjectName   string
	NamespaceName string

	Metadata json.RawMessage
	Spec     map[string]any

	URN string

	Status string

	CreatedAt time.Time
	UpdatedAt time.Time
}

func FromResourceToModel

func FromResourceToModel(r *resource.Resource) *Resource

Jump to

Keyboard shortcuts

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