environment

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorCodeEnvironmentNotPaused = "ENVIRONMENT_NOT_PAUSED"
	ErrorCodeNoBuildFound         = "NO_BUILD_FOUND"
	ErrorCodeEnvironmentNotFound  = "ENVIRONMENT_NOT_FOUND"
	ErrorCodeInvalidToken         = "INVALID_TOKEN"
	ErrorCodeOrgNotFound          = "ORG_NOT_FOUND"
	ErrorCodeUnknown              = "UNKNOWN_ERROR"
)

Error codes for common business logic scenarios

Variables

This section is empty.

Functions

func GetErrorCode

func GetErrorCode(err error) string

GetErrorCode extracts the error code from a BusinessError, or returns UNKNOWN for other errors

func GetErrorContext

func GetErrorContext(err error) map[string]interface{}

GetErrorContext extracts the context from a BusinessError

func IsBusinessError

func IsBusinessError(err error) bool

IsBusinessError checks if an error is a BusinessError

func ParseAPIError

func ParseAPIError(err error, context map[string]interface{}) error

ParseAPIError analyzes an API error and converts it to a BusinessError if possible

Types

type BusinessError

type BusinessError struct {
	Code    string                 `json:"code"`
	Message string                 `json:"message"`
	Context map[string]interface{} `json:"context,omitempty"`
}

BusinessError represents a structured business logic error

func (*BusinessError) Error

func (e *BusinessError) Error() string

type EnvironmentManager

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

EnvironmentManager handles environment business operations

func NewEnvironmentManager

func NewEnvironmentManager(client client.Client) *EnvironmentManager

NewEnvironmentManager creates a new environment manager

func (*EnvironmentManager) Cancel

func (s *EnvironmentManager) Cancel(id string) error

Cancel cancels an environment's latest build

func (*EnvironmentManager) GetByID

func (s *EnvironmentManager) GetByID(id string) (*types.Environment, error)

GetByID retrieves a single environment by its ID

func (*EnvironmentManager) List

List retrieves environments based on the provided filters

func (*EnvironmentManager) Rebuild

func (s *EnvironmentManager) Rebuild(id string) error

Rebuild rebuilds an environment

func (*EnvironmentManager) Restart

func (s *EnvironmentManager) Restart(id string) error

Restart restarts a stopped environment

func (*EnvironmentManager) Revive

func (s *EnvironmentManager) Revive(id string) error

Revive revives a deleted environment

func (*EnvironmentManager) Stop

func (s *EnvironmentManager) Stop(id string) error

Stop stops a running environment

type ListRequest

type ListRequest struct {
	Branch            string
	RepoName          string
	Deleted           bool
	Page              int
	PageSize          int
	Name              string
	OrgName           string
	PullRequestNumber string
}

ListRequest contains parameters for listing environments

type ListResponse

type ListResponse struct {
	Environments []types.Environment
	HasNext      bool
	NextPage     int
	Links        types.Links
}

ListResponse contains the result of listing environments

Jump to

Keyboard shortcuts

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