mirror of
https://github.com/docker/compose.git
synced 2026-11-18 22:27:03 +00:00
chore(api): deprecate the API surface that nothing produces or reads
Several exported symbols describe a contract Compose never honors, and a reader of the package cannot tell: the stack status constants (Stack.Status is never one of them), ConfigOptions and ServiceStatus (no operation takes or returns them), the error sentinels ErrAlreadyExists, ErrForbidden, ErrUnknown and ErrUnsupportedFlag (never returned, with their Is helpers), and the ExitCodeLoginRequired exit code of the cloud login Compose no longer has. Mark them Deprecated, with no change of behavior, so that they can be removed with the next breaking release. Nothing in the repository uses them. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
f5efe67ea3
commit
c11d43424d
2 changed files with 34 additions and 0 deletions
|
|
@ -487,6 +487,8 @@ type DownOptions struct {
|
|||
}
|
||||
|
||||
// ConfigOptions group options of the Config API
|
||||
//
|
||||
// Deprecated: no operation of Compose takes these options, they will be removed.
|
||||
type ConfigOptions struct {
|
||||
// Format define the output format used to dump converted application model (json|yaml)
|
||||
Format string
|
||||
|
|
@ -765,6 +767,8 @@ type ImageSummary struct {
|
|||
}
|
||||
|
||||
// ServiceStatus hold status about a service
|
||||
//
|
||||
// Deprecated: no operation of Compose returns it, it will be removed.
|
||||
type ServiceStatus struct {
|
||||
ID string
|
||||
Name string
|
||||
|
|
@ -823,16 +827,28 @@ type GenerateOptions struct {
|
|||
|
||||
const (
|
||||
// STARTING indicates that stack is being deployed
|
||||
//
|
||||
// Deprecated: Stack.Status never takes this value, it will be removed.
|
||||
STARTING string = "Starting"
|
||||
// RUNNING indicates that stack is deployed and services are running
|
||||
//
|
||||
// Deprecated: Stack.Status never takes this value, it will be removed.
|
||||
RUNNING string = "Running"
|
||||
// UPDATING indicates that some stack resources are being recreated
|
||||
//
|
||||
// Deprecated: Stack.Status never takes this value, it will be removed.
|
||||
UPDATING string = "Updating"
|
||||
// REMOVING indicates that stack is being deleted
|
||||
//
|
||||
// Deprecated: Stack.Status never takes this value, it will be removed.
|
||||
REMOVING string = "Removing"
|
||||
// UNKNOWN indicates unknown stack state
|
||||
//
|
||||
// Deprecated: Stack.Status never takes this value, it will be removed.
|
||||
UNKNOWN string = "Unknown"
|
||||
// FAILED indicates that stack deployment failed
|
||||
//
|
||||
// Deprecated: Stack.Status never takes this value, it will be removed.
|
||||
FAILED string = "Failed"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import (
|
|||
const (
|
||||
// ExitCodeLoginRequired exit code when command cannot execute because it requires cloud login
|
||||
// This will be used by VSCode to detect when creating context if the user needs to login first
|
||||
//
|
||||
// Deprecated: Compose has no cloud login anymore and never exits with this code, it will be removed.
|
||||
ExitCodeLoginRequired = 5
|
||||
)
|
||||
|
||||
|
|
@ -31,14 +33,22 @@ var (
|
|||
// ErrNotFound is returned when an object is not found
|
||||
ErrNotFound = errors.New("not found")
|
||||
// ErrAlreadyExists is returned when an object already exists
|
||||
//
|
||||
// Deprecated: Compose never returns it, it will be removed.
|
||||
ErrAlreadyExists = errors.New("already exists")
|
||||
// ErrForbidden is returned when an operation is not permitted
|
||||
//
|
||||
// Deprecated: Compose never returns it, it will be removed.
|
||||
ErrForbidden = errors.New("forbidden")
|
||||
// ErrUnknown is returned when the error type is unmapped
|
||||
//
|
||||
// Deprecated: Compose never returns it, it will be removed.
|
||||
ErrUnknown = errors.New("unknown")
|
||||
// ErrNotImplemented is returned when a backend doesn't implement an action
|
||||
ErrNotImplemented = errors.New("not implemented")
|
||||
// ErrUnsupportedFlag is returned when a backend doesn't support a flag
|
||||
//
|
||||
// Deprecated: Compose never returns it, it will be removed.
|
||||
ErrUnsupportedFlag = errors.New("unsupported flag")
|
||||
// ErrCanceled is returned when the command was canceled by user
|
||||
ErrCanceled = errors.New("canceled")
|
||||
|
|
@ -63,21 +73,29 @@ func IsNotFoundError(err error) bool {
|
|||
}
|
||||
|
||||
// IsAlreadyExistsError returns true if the unwrapped error is ErrAlreadyExists
|
||||
//
|
||||
// Deprecated: ErrAlreadyExists is never returned, it will be removed.
|
||||
func IsAlreadyExistsError(err error) bool {
|
||||
return errors.Is(err, ErrAlreadyExists)
|
||||
}
|
||||
|
||||
// IsForbiddenError returns true if the unwrapped error is ErrForbidden
|
||||
//
|
||||
// Deprecated: ErrForbidden is never returned, it will be removed.
|
||||
func IsForbiddenError(err error) bool {
|
||||
return errors.Is(err, ErrForbidden)
|
||||
}
|
||||
|
||||
// IsUnknownError returns true if the unwrapped error is ErrUnknown
|
||||
//
|
||||
// Deprecated: ErrUnknown is never returned, it will be removed.
|
||||
func IsUnknownError(err error) bool {
|
||||
return errors.Is(err, ErrUnknown)
|
||||
}
|
||||
|
||||
// IsErrUnsupportedFlag returns true if the unwrapped error is ErrUnsupportedFlag
|
||||
//
|
||||
// Deprecated: ErrUnsupportedFlag is never returned, it will be removed.
|
||||
func IsErrUnsupportedFlag(err error) bool {
|
||||
return errors.Is(err, ErrUnsupportedFlag)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue