environmentssvc

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEnvironmentNotFound        = environments.ErrNotFound
	ErrSlugTaken                  = environments.ErrSlugTaken
	ErrInvalidEnvironmentSlug     = xerror.InvalidInput(xerror.Environment)
	ErrProjectEnvironmentNotFound = environments.ErrProjectEnvironmentNotFound
	ErrRuntimeVariableNotFound    = environments.ErrRuntimeVariableNotFound
	ErrInvalidRuntimeVariable     = xerror.InvalidInput(xerror.RuntimeVariable)
	ErrEnvironmentSecretNotFound  = environments.ErrEnvironmentSecretNotFound
	ErrInvalidEnvironmentSecret   = xerror.InvalidInput(xerror.EnvironmentSecret)
)

Functions

This section is empty.

Types

type Option

type Option func(*service)

func WithCredentialService

func WithCredentialService(credentials credentialssvc.Service) Option

WithCredentialService attaches the shared credential lifecycle used by environment secrets.

type Service

type Service interface {
	CreateDefaultEnvironments(ctx context.Context, orgSlug slug.Slug) error
	CreateEnvironment(
		ctx context.Context,
		orgSlug slug.Slug,
		newEnvironment model.NewEnvironment,
		actor model.EventActor,
	) (*model.Environment, error)
	GetEnvironment(ctx context.Context, orgSlug, environmentSlug slug.Slug) (*model.Environment, error)
	ListEnvironments(
		ctx context.Context,
		orgSlug slug.Slug,
		req model.ListEnvironmentsRequest,
	) (model.ListResponse[model.Environment], error)
	UpdateEnvironment(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		update model.UpdateEnvironment,
		actor model.EventActor,
	) (*model.Environment, error)
	DeleteEnvironment(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		deleted model.DeleteEnvironment,
		actor model.EventActor,
	) error
	EnableProjectEnvironment(
		ctx context.Context,
		orgSlug, projectSlug, environmentSlug slug.Slug,
		params model.EnableProjectEnvironment,
		actor model.EventActor,
	) (*model.ProjectEnvironment, error)
	ListProjectEnvironments(
		ctx context.Context,
		orgSlug, projectSlug slug.Slug,
		req model.ListRequest,
	) (model.ListResponse[model.ProjectEnvironment], error)
	DisableProjectEnvironment(
		ctx context.Context,
		orgSlug, projectSlug, environmentSlug slug.Slug,
		confirmation *slug.Slug,
		actor model.EventActor,
	) error
	UpsertRuntimeVariable(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		params model.UpsertRuntimeVariable,
		actor model.EventActor,
	) (*model.RuntimeVariable, error)
	GetRuntimeVariable(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		key string,
	) (*model.RuntimeVariable, error)
	ListRuntimeVariables(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		req model.ListRequest,
	) (model.ListResponse[model.RuntimeVariable], error)
	DeleteRuntimeVariable(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		key string,
		confirmation *slug.Slug,
		actor model.EventActor,
	) error
	UpsertEnvironmentSecret(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		params model.UpsertEnvironmentSecret,
		actor model.EventActor,
	) (*model.EnvironmentSecret, error)
	GetEnvironmentSecret(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		key string,
	) (*model.EnvironmentSecret, error)
	ListEnvironmentSecrets(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		req model.ListRequest,
	) (model.ListResponse[model.EnvironmentSecret], error)
	DeleteEnvironmentSecret(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
		key string,
		confirmation *slug.Slug,
		actor model.EventActor,
	) error
	ResolveRuntimeSecrets(
		ctx context.Context,
		orgSlug, environmentSlug slug.Slug,
	) ([]model.RuntimeSecretValue, error)
}

func New

func New(
	txm postgres.TransactionManager,
	environmentsRepo environments.Repository,
	eventProducer workerproducer.EventProducer,
	options ...Option,
) Service

func NewServiceWithLogging

func NewServiceWithLogging(base Service, logger *slog.Logger) Service

NewServiceWithLogging wraps base with method completion logging.

type ServiceWithLogging

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

ServiceWithLogging implements Service with method completion logging.

func (ServiceWithLogging) CreateDefaultEnvironments

func (_d ServiceWithLogging) CreateDefaultEnvironments(ctx context.Context, orgSlug slug.Slug) (err error)

CreateDefaultEnvironments implements Service.

func (ServiceWithLogging) CreateEnvironment

func (_d ServiceWithLogging) CreateEnvironment(ctx context.Context, orgSlug slug.Slug, newEnvironment model.NewEnvironment, actor model.EventActor) (ep1 *model.Environment, err error)

CreateEnvironment implements Service.

func (ServiceWithLogging) DeleteEnvironment

func (_d ServiceWithLogging) DeleteEnvironment(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, deleted model.DeleteEnvironment, actor model.EventActor) (err error)

DeleteEnvironment implements Service.

func (ServiceWithLogging) DeleteEnvironmentSecret

func (_d ServiceWithLogging) DeleteEnvironmentSecret(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, key string, confirmation *slug.Slug, actor model.EventActor) (err error)

DeleteEnvironmentSecret implements Service.

func (ServiceWithLogging) DeleteRuntimeVariable

func (_d ServiceWithLogging) DeleteRuntimeVariable(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, key string, confirmation *slug.Slug, actor model.EventActor) (err error)

DeleteRuntimeVariable implements Service.

func (ServiceWithLogging) DisableProjectEnvironment

func (_d ServiceWithLogging) DisableProjectEnvironment(ctx context.Context, orgSlug slug.Slug, projectSlug slug.Slug, environmentSlug slug.Slug, confirmation *slug.Slug, actor model.EventActor) (err error)

DisableProjectEnvironment implements Service.

func (ServiceWithLogging) EnableProjectEnvironment

func (_d ServiceWithLogging) EnableProjectEnvironment(ctx context.Context, orgSlug slug.Slug, projectSlug slug.Slug, environmentSlug slug.Slug, params model.EnableProjectEnvironment, actor model.EventActor) (pp1 *model.ProjectEnvironment, err error)

EnableProjectEnvironment implements Service.

func (ServiceWithLogging) GetEnvironment

func (_d ServiceWithLogging) GetEnvironment(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug) (ep1 *model.Environment, err error)

GetEnvironment implements Service.

func (ServiceWithLogging) GetEnvironmentSecret

func (_d ServiceWithLogging) GetEnvironmentSecret(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, key string) (ep1 *model.EnvironmentSecret, err error)

GetEnvironmentSecret implements Service.

func (ServiceWithLogging) GetRuntimeVariable

func (_d ServiceWithLogging) GetRuntimeVariable(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, key string) (rp1 *model.RuntimeVariable, err error)

GetRuntimeVariable implements Service.

func (ServiceWithLogging) ListEnvironmentSecrets

func (_d ServiceWithLogging) ListEnvironmentSecrets(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, req model.ListRequest) (p1 model.ListResponse[model.EnvironmentSecret], err error)

ListEnvironmentSecrets implements Service.

func (ServiceWithLogging) ListEnvironments

ListEnvironments implements Service.

func (ServiceWithLogging) ListProjectEnvironments

func (_d ServiceWithLogging) ListProjectEnvironments(ctx context.Context, orgSlug slug.Slug, projectSlug slug.Slug, req model.ListRequest) (p1 model.ListResponse[model.ProjectEnvironment], err error)

ListProjectEnvironments implements Service.

func (ServiceWithLogging) ListRuntimeVariables

func (_d ServiceWithLogging) ListRuntimeVariables(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, req model.ListRequest) (p1 model.ListResponse[model.RuntimeVariable], err error)

ListRuntimeVariables implements Service.

func (ServiceWithLogging) ResolveRuntimeSecrets

func (_d ServiceWithLogging) ResolveRuntimeSecrets(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug) (ra1 []model.RuntimeSecretValue, err error)

ResolveRuntimeSecrets implements Service.

func (ServiceWithLogging) UpdateEnvironment

func (_d ServiceWithLogging) UpdateEnvironment(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, update model.UpdateEnvironment, actor model.EventActor) (ep1 *model.Environment, err error)

UpdateEnvironment implements Service.

func (ServiceWithLogging) UpsertEnvironmentSecret

func (_d ServiceWithLogging) UpsertEnvironmentSecret(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, params model.UpsertEnvironmentSecret, actor model.EventActor) (ep1 *model.EnvironmentSecret, err error)

UpsertEnvironmentSecret implements Service.

func (ServiceWithLogging) UpsertRuntimeVariable

func (_d ServiceWithLogging) UpsertRuntimeVariable(ctx context.Context, orgSlug slug.Slug, environmentSlug slug.Slug, params model.UpsertRuntimeVariable, actor model.EventActor) (rp1 *model.RuntimeVariable, err error)

UpsertRuntimeVariable implements Service.

Jump to

Keyboard shortcuts

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