本文整理汇总了Golang中github.com/litl/galaxy/config.Store.PoolExists方法的典型用法代码示例。如果您正苦于以下问题:Golang Store.PoolExists方法的具体用法?Golang Store.PoolExists怎么用?Golang Store.PoolExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/litl/galaxy/config.Store
的用法示例。
在下文中一共展示了Store.PoolExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AppAssign
func AppAssign(configStore *config.Store, app, env, pool string) error {
// Don't allow deleting runtime hosts entries
if app == "hosts" || app == "pools" {
return fmt.Errorf("invalid app name: %s", app)
}
exists, err := configStore.PoolExists(env, pool)
if err != nil {
return err
}
if !exists {
log.Warnf("WARN: Pool %s does not exist.", pool)
}
created, err := configStore.AssignApp(app, env, pool)
if err != nil {
return err
}
if created {
log.Printf("Assigned %s in env %s to pool %s.\n", app, env, pool)
} else {
log.Printf("%s already assigned to pool %s in env %s.\n", app, pool, env)
}
return nil
}
示例2: PoolCreate
// Create a pool for an environment
func PoolCreate(configStore *config.Store, env, pool string) error {
exists, err := configStore.PoolExists(env, pool)
if err != nil {
return err
} else if exists {
return fmt.Errorf("pool '%s' exists", pool)
}
_, err = configStore.CreatePool(pool, env)
if err != nil {
return err
}
return nil
}
示例3: PoolDelete
func PoolDelete(configStore *config.Store, env, pool string) error {
exists, err := configStore.PoolExists(env, pool)
if err != nil {
return err
} else if !exists {
return fmt.Errorf("pool '%s' does not exist", pool)
}
empty, err := configStore.DeletePool(pool, env)
if err != nil {
return err
}
if !empty {
return fmt.Errorf("pool '%s' is not epmty", pool)
}
return nil
}