Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1863)

Unified Diff: deploytool/api/deploy/util.go

Issue 2584893004: luci_deploy: Enable loading "index.yaml" directly. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « deploytool/api/deploy/component.pb.go ('k') | deploytool/cmd/luci_deploy/appengine.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: deploytool/api/deploy/util.go
diff --git a/deploytool/api/deploy/util.go b/deploytool/api/deploy/util.go
index 66e1cfa3049e4c33fecb75d57c3ec6ba68dbf177..9adbe2508d1a70ee6d33623022d544669e965848 100644
--- a/deploytool/api/deploy/util.go
+++ b/deploytool/api/deploy/util.go
@@ -6,6 +6,8 @@ package deploy
import (
"fmt"
+
+ "github.com/luci/luci-go/common/errors"
)
// AppYAMLString returns the "app.yaml" string for this option.
@@ -36,7 +38,7 @@ func (v AppEngineModule_Handler_SecureOption) AppYAMLString() string {
}
}
-// AppYAMLString returns the "app.yaml" string for this option.
+// AppYAMLString returns the "index.yaml" string for this option.
func (v AppEngineResources_Index_Direction) AppYAMLString() string {
switch v {
case AppEngineResources_Index_ASCENDING:
@@ -48,6 +50,26 @@ func (v AppEngineResources_Index_Direction) AppYAMLString() string {
}
}
+// IndexDirectionFromAppYAMLString returns the
+// AppEngineResources_Index_Direction value associated with the given
+// "index.yaml" strnig value.
+//
+// This is a reverse of the AppEngineResources_Index_Direction's AppYAMLString.
+//
+// If the direction value is not recognized, an error will be returned.
+func IndexDirectionFromAppYAMLString(v string) (AppEngineResources_Index_Direction, error) {
+ switch v {
+ case "asc", "":
+ return AppEngineResources_Index_ASCENDING, nil
+
+ case "desc":
+ return AppEngineResources_Index_DESCENDING, nil
+
+ default:
+ return 0, errors.Reason("invalid index direction %(value)q").D("value", v).Err()
+ }
+}
+
// KubeString returns the Kubernetes "restartPolicy" field string for the
// enumeration value.
func (v KubernetesPod_RestartPolicy) KubeString() string {
« no previous file with comments | « deploytool/api/deploy/component.pb.go ('k') | deploytool/cmd/luci_deploy/appengine.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698