environments

package
v0.0.0-...-5106b98 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound                   = xerror.NotFound(xerror.Environment)
	ErrSlugTaken                  = xerror.AlreadyExists(xerror.Environment)
	ErrProjectEnvironmentNotFound = xerror.NotFound(xerror.ProjectEnvironment)
	ErrProjectEnvironmentTaken    = xerror.AlreadyExists(xerror.ProjectEnvironment)
	ErrRuntimeVariableNotFound    = xerror.NotFound(xerror.RuntimeVariable)
	ErrEnvironmentSecretNotFound  = xerror.NotFound(xerror.EnvironmentSecret)
)

Functions

This section is empty.

Types

type CreateParams

type CreateParams struct {
	Slug        slug.Slug
	Name        string
	Description *string
	Color       model.EnvironmentColor
	Protected   bool
}

type DeleteParams

type DeleteParams struct {
	Reason *string
}

type EnableProjectParams

type EnableProjectParams struct {
	IsDefault bool
}

type Environment

type Environment struct {
	Slug         slug.Slug
	Name         string
	Description  *string
	Color        model.EnvironmentColor
	Protected    bool
	DeletedAt    *time.Time
	DeleteReason *string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type ProjectEnvironment

type ProjectEnvironment struct {
	Environment Environment
	IsDefault   bool
	EnabledAt   time.Time
	UpdatedAt   time.Time
}

type Repository

type Repository interface {
	Create(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		params *CreateParams,
	) (*Environment, error)
	FindBySlug(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
	) (*Environment, error)
	FindAnyBySlug(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
	) (*Environment, error)
	ListByOrg(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		req model.ListEnvironmentsRequest,
	) ([]*Environment, error)
	Update(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		params *UpdateParams,
	) (*Environment, error)
	Delete(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		params *DeleteParams,
	) error
	EnableProjectEnvironment(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, projectSlug, environmentSlug slug.Slug,
		params *EnableProjectParams,
	) (*ProjectEnvironment, error)
	ListProjectEnvironments(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, projectSlug slug.Slug,
		req model.ListRequest,
	) ([]*ProjectEnvironment, error)
	FindProjectEnvironmentProtection(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, projectSlug, environmentSlug slug.Slug,
	) (*model.ProjectEnvironmentProtection, error)
	FindProjectEnvironmentCatalogProtection(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, projectSlug, environmentSlug slug.Slug,
	) (*model.ProjectEnvironmentProtection, error)
	DisableProjectEnvironment(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, projectSlug, environmentSlug slug.Slug,
	) error
	UpsertRuntimeVariable(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		params model.UpsertRuntimeVariable,
	) (*model.RuntimeVariable, error)
	FindRuntimeVariable(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		key string,
	) (*model.RuntimeVariable, error)
	ListRuntimeVariables(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		req model.ListRequest,
	) ([]*model.RuntimeVariable, error)
	DeleteRuntimeVariable(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		key string,
	) error
	UpsertEnvironmentSecret(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		params model.UpsertEnvironmentSecret,
		credentialSlug slug.Slug,
	) (*model.EnvironmentSecret, error)
	FindEnvironmentSecret(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		key string,
	) (*model.EnvironmentSecret, error)
	ListEnvironmentSecrets(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		req model.ListRequest,
	) ([]*model.EnvironmentSecret, error)
	ListAllEnvironmentSecrets(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
	) ([]*model.EnvironmentSecret, error)
	DeleteEnvironmentSecretsForEnvironment(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
	) error
	DeleteEnvironmentSecret(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, environmentSlug slug.Slug,
		key string,
	) error
}

func NewRepository

func NewRepository() Repository

func NewRepositoryWithLogging

func NewRepositoryWithLogging(base Repository, logger *slog.Logger) Repository

NewRepositoryWithLogging wraps base with method completion logging.

type RepositoryWithLogging

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

RepositoryWithLogging implements Repository with method completion logging.

func (RepositoryWithLogging) Create

func (_d RepositoryWithLogging) Create(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, params *CreateParams) (ep1 *Environment, err error)

Create implements Repository.

func (RepositoryWithLogging) Delete

func (_d RepositoryWithLogging) Delete(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, params *DeleteParams) (err error)

Delete implements Repository.

func (RepositoryWithLogging) DeleteEnvironmentSecret

func (_d RepositoryWithLogging) DeleteEnvironmentSecret(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, key string) (err error)

DeleteEnvironmentSecret implements Repository.

func (RepositoryWithLogging) DeleteEnvironmentSecretsForEnvironment

func (_d RepositoryWithLogging) DeleteEnvironmentSecretsForEnvironment(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug) (err error)

DeleteEnvironmentSecretsForEnvironment implements Repository.

func (RepositoryWithLogging) DeleteRuntimeVariable

func (_d RepositoryWithLogging) DeleteRuntimeVariable(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, key string) (err error)

DeleteRuntimeVariable implements Repository.

func (RepositoryWithLogging) DisableProjectEnvironment

func (_d RepositoryWithLogging) DisableProjectEnvironment(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, projectSlug slug.Slug, environmentSlug slug.Slug) (err error)

DisableProjectEnvironment implements Repository.

func (RepositoryWithLogging) EnableProjectEnvironment

func (_d RepositoryWithLogging) EnableProjectEnvironment(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, projectSlug slug.Slug, environmentSlug slug.Slug, params *EnableProjectParams) (pp1 *ProjectEnvironment, err error)

EnableProjectEnvironment implements Repository.

func (RepositoryWithLogging) FindAnyBySlug

func (_d RepositoryWithLogging) FindAnyBySlug(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug) (ep1 *Environment, err error)

FindAnyBySlug implements Repository.

func (RepositoryWithLogging) FindBySlug

func (_d RepositoryWithLogging) FindBySlug(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug) (ep1 *Environment, err error)

FindBySlug implements Repository.

func (RepositoryWithLogging) FindEnvironmentSecret

func (_d RepositoryWithLogging) FindEnvironmentSecret(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, key string) (ep1 *model.EnvironmentSecret, err error)

FindEnvironmentSecret implements Repository.

func (RepositoryWithLogging) FindProjectEnvironmentCatalogProtection

func (_d RepositoryWithLogging) FindProjectEnvironmentCatalogProtection(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, projectSlug slug.Slug, environmentSlug slug.Slug) (pp1 *model.ProjectEnvironmentProtection, err error)

FindProjectEnvironmentCatalogProtection implements Repository.

func (RepositoryWithLogging) FindProjectEnvironmentProtection

func (_d RepositoryWithLogging) FindProjectEnvironmentProtection(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, projectSlug slug.Slug, environmentSlug slug.Slug) (pp1 *model.ProjectEnvironmentProtection, err error)

FindProjectEnvironmentProtection implements Repository.

func (RepositoryWithLogging) FindRuntimeVariable

func (_d RepositoryWithLogging) FindRuntimeVariable(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, key string) (rp1 *model.RuntimeVariable, err error)

FindRuntimeVariable implements Repository.

func (RepositoryWithLogging) ListAllEnvironmentSecrets

func (_d RepositoryWithLogging) ListAllEnvironmentSecrets(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug) (epa1 []*model.EnvironmentSecret, err error)

ListAllEnvironmentSecrets implements Repository.

func (RepositoryWithLogging) ListByOrg

func (_d RepositoryWithLogging) ListByOrg(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, req model.ListEnvironmentsRequest) (epa1 []*Environment, err error)

ListByOrg implements Repository.

func (RepositoryWithLogging) ListEnvironmentSecrets

func (_d RepositoryWithLogging) ListEnvironmentSecrets(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, req model.ListRequest) (epa1 []*model.EnvironmentSecret, err error)

ListEnvironmentSecrets implements Repository.

func (RepositoryWithLogging) ListProjectEnvironments

func (_d RepositoryWithLogging) ListProjectEnvironments(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, projectSlug slug.Slug, req model.ListRequest) (ppa1 []*ProjectEnvironment, err error)

ListProjectEnvironments implements Repository.

func (RepositoryWithLogging) ListRuntimeVariables

func (_d RepositoryWithLogging) ListRuntimeVariables(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, req model.ListRequest) (rpa1 []*model.RuntimeVariable, err error)

ListRuntimeVariables implements Repository.

func (RepositoryWithLogging) Update

func (_d RepositoryWithLogging) Update(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, params *UpdateParams) (ep1 *Environment, err error)

Update implements Repository.

func (RepositoryWithLogging) UpsertEnvironmentSecret

func (_d RepositoryWithLogging) UpsertEnvironmentSecret(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, params model.UpsertEnvironmentSecret, credentialSlug slug.Slug) (ep1 *model.EnvironmentSecret, err error)

UpsertEnvironmentSecret implements Repository.

func (RepositoryWithLogging) UpsertRuntimeVariable

func (_d RepositoryWithLogging) UpsertRuntimeVariable(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, environmentSlug slug.Slug, params model.UpsertRuntimeVariable) (rp1 *model.RuntimeVariable, err error)

UpsertRuntimeVariable implements Repository.

type UpdateParams

type UpdateParams struct {
	Name        string
	Description *string
	Color       model.EnvironmentColor
	Protected   bool
}

Jump to

Keyboard shortcuts

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