MCPcopy
hub / github.com/cortexlabs/cortex / ErrorOperationIsOnlySupportedForKind

Function ErrorOperationIsOnlySupportedForKind

pkg/operator/resources/errors.go:50–62  ·  view source on GitHub ↗
(resource operator.DeployedResource, supportedKind userconfig.Kind, supportedKinds ...userconfig.Kind)

Source from the content-addressed store, hash-verified

48)
49
50func ErrorOperationIsOnlySupportedForKind(resource operator.DeployedResource, supportedKind userconfig.Kind, supportedKinds ...userconfig.Kind) error {
51 supportedKindsSlice := append(make([]string, 0, 1+len(supportedKinds)), supportedKind.String())
52 for _, kind := range supportedKinds {
53 supportedKindsSlice = append(supportedKindsSlice, kind.String())
54 }
55
56 msg := fmt.Sprintf("%s %s", s.StrsOr(supportedKindsSlice), s.PluralS(userconfig.KindKey, len(supportedKindsSlice)))
57
58 return errors.WithStack(&errors.Error{
59 Kind: ErrOperationIsOnlySupportedForKind,
60 Message: fmt.Sprintf("this operation is only allowed for %s and is not supported for %s of kind %s", msg, resource.Name, resource.Kind),
61 })
62}
63
64func ErrorAPINotDeployed(apiName string) error {
65 return errors.WithStack(&errors.Error{

Callers 13

ReadLogsFunction · 0.92
GetLogURLFunction · 0.92
GetTaskJobFunction · 0.92
ReadJobLogsFunction · 0.92
GetJobLogURLFunction · 0.92
SubmitTaskJobFunction · 0.92
SubmitBatchJobFunction · 0.92
GetBatchJobFunction · 0.92
UpdateAPIFunction · 0.85
RefreshAPIFunction · 0.85
DeleteAPIFunction · 0.85
GetAPIFunction · 0.85

Calls 2

WithStackFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected