本文整理匯總了Golang中github.com/deis/deis/client/controller/api.Config類的典型用法代碼示例。如果您正苦於以下問題:Golang Config類的具體用法?Golang Config怎麽用?Golang Config使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Config類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: LimitsSet
// LimitsSet sets an app's limits.
func LimitsSet(appID string, limits []string, limitType string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
limitsMap := parseLimits(limits)
fmt.Print("Applying limits... ")
quit := progress()
configObj := api.Config{}
if limitType == "cpu" {
configObj.CPU = limitsMap
} else {
configObj.Memory = limitsMap
}
_, err = config.Set(c, appID, configObj)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Print("done\n\n")
return LimitsList(appID)
}
示例2: TagsSet
// TagsSet sets an app's tags.
func TagsSet(appID string, tags []string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
tagsMap := parseTags(tags)
fmt.Print("Applying tags... ")
quit := progress()
configObj := api.Config{}
configObj.Tags = tagsMap
_, err = config.Set(c, appID, configObj)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Print("done\n\n")
return TagsList(appID)
}
示例3: TagsUnset
// TagsUnset removes an app's tags.
func TagsUnset(appID string, tags []string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
fmt.Print("Applying tags... ")
quit := progress()
configObj := api.Config{}
tagsMap := make(map[string]interface{})
for _, tag := range tags {
tagsMap[tag] = nil
}
configObj.Tags = tagsMap
_, err = config.Set(c, appID, configObj)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Print("done\n\n")
return TagsList(appID)
}
示例4: ConfigUnset
// ConfigUnset removes a config variable from an app.
func ConfigUnset(appID string, configVars []string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
fmt.Print("Removing config... ")
quit := progress()
configObj := api.Config{}
valuesMap := make(map[string]interface{})
for _, configVar := range configVars {
valuesMap[configVar] = nil
}
configObj.Values = valuesMap
_, err = config.Set(c, appID, configObj)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Print("done\n\n")
return ConfigList(appID, false)
}
示例5: LimitsUnset
// LimitsUnset removes an app's limits.
func LimitsUnset(appID string, limits []string, limitType string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
fmt.Print("Applying limits... ")
quit := progress()
configObj := api.Config{}
valuesMap := make(map[string]interface{})
for _, limit := range limits {
valuesMap[limit] = nil
}
if limitType == "cpu" {
configObj.CPU = valuesMap
} else {
configObj.Memory = valuesMap
}
_, err = config.Set(c, appID, configObj)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Print("done\n\n")
return LimitsList(appID)
}