Documentation
¶
Index ¶
- Constants
- func GetErrorCode(err error) string
- func GetErrorContext(err error) map[string]interface{}
- func IsBusinessError(err error) bool
- func ParseAPIError(err error, context map[string]interface{}) error
- type BusinessError
- type EnvironmentManager
- func (s *EnvironmentManager) Cancel(id string) error
- func (s *EnvironmentManager) GetByID(id string) (*types.Environment, error)
- func (s *EnvironmentManager) List(req ListRequest) (*ListResponse, error)
- func (s *EnvironmentManager) Rebuild(id string) error
- func (s *EnvironmentManager) Restart(id string) error
- func (s *EnvironmentManager) Revive(id string) error
- func (s *EnvironmentManager) Stop(id string) error
- type ListRequest
- type ListResponse
Constants ¶
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 ¶
GetErrorCode extracts the error code from a BusinessError, or returns UNKNOWN for other errors
func GetErrorContext ¶
GetErrorContext extracts the context from a BusinessError
func IsBusinessError ¶
IsBusinessError checks if an error is a BusinessError
func ParseAPIError ¶
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 ¶
func (s *EnvironmentManager) List(req ListRequest) (*ListResponse, error)
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