aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cli/internal/util/status.go
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-28 01:36:55 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-28 01:36:55 +0800
commitfc8c5fdce62fb229202659408798a7b6c98f6e8b (patch)
tree7554f80e50de4af6fd255afa7c21bcdd58a7af34 /cli/internal/util/status.go
parentdd84b9d64fb98746a230cd24233ff50a562c39c9 (diff)
downloadHydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.tar.gz
HydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.zip
Diffstat (limited to 'cli/internal/util/status.go')
-rw-r--r--cli/internal/util/status.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/cli/internal/util/status.go b/cli/internal/util/status.go
deleted file mode 100644
index 23ae165..0000000
--- a/cli/internal/util/status.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package util
-
-import "fmt"
-
-// CachingStatus represents the api server's perspective
-// on whether remote caching should be allowed
-type CachingStatus int
-
-const (
- // CachingStatusDisabled indicates that the server will not accept or serve artifacts
- CachingStatusDisabled CachingStatus = iota
- // CachingStatusEnabled indicates that the server will accept and serve artifacts
- CachingStatusEnabled
- // CachingStatusOverLimit indicates that a usage limit has been hit and the
- // server will temporarily not accept or serve artifacts
- CachingStatusOverLimit
- // CachingStatusPaused indicates that a customer's spending has been paused and the
- // server will temporarily not accept or serve artifacts
- CachingStatusPaused
-)
-
-// CachingStatusFromString parses a raw string to a caching status enum value
-func CachingStatusFromString(raw string) (CachingStatus, error) {
- switch raw {
- case "disabled":
- return CachingStatusDisabled, nil
- case "enabled":
- return CachingStatusEnabled, nil
- case "over_limit":
- return CachingStatusOverLimit, nil
- case "paused":
- return CachingStatusPaused, nil
- default:
- return CachingStatusDisabled, fmt.Errorf("unknown caching status: %v", raw)
- }
-}
-
-// CacheDisabledError is an error used to indicate that remote caching
-// is not available.
-type CacheDisabledError struct {
- Status CachingStatus
- Message string
-}
-
-func (cd *CacheDisabledError) Error() string {
- return cd.Message
-}