(resource operator.DeployedResource, supportedKind userconfig.Kind, supportedKinds ...userconfig.Kind)
| 48 | ) |
| 49 | |
| 50 | func 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 | |
| 64 | func ErrorAPINotDeployed(apiName string) error { |
| 65 | return errors.WithStack(&errors.Error{ |
no test coverage detected