本文整理汇总了Golang中github.com/openshift/origin/pkg/client.Interface.BackingServices方法的典型用法代码示例。如果您正苦于以下问题:Golang Interface.BackingServices方法的具体用法?Golang Interface.BackingServices怎么用?Golang Interface.BackingServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/origin/pkg/client.Interface
的用法示例。
在下文中一共展示了Interface.BackingServices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: checkIfPlanidExist
func checkIfPlanidExist(client osclient.Interface, planId string) (bool, *backingserviceapi.BackingService, error) {
items, err := client.BackingServices("openshift").List(kapi.ListOptions{})
if err != nil {
return false, nil, err
}
for _, bs := range items.Items {
for _, plans := range bs.Spec.Plans {
if planId == plans.Id {
glog.Info("we found plan id at plan", bs.Spec.Name)
return true, &bs, nil
}
}
}
return false, nil, fatalError(fmt.Sprintf("Can't find plan id %s", planId))
}
示例2: backingServiceHandler
func backingServiceHandler(client osclient.Interface, backingService *backingserviceapi.BackingService) error {
newBs, err := client.BackingServices(backingserviceapi.BSNS).Get(backingService.Name)
if err != nil {
if errors.IsNotFound(err) {
if _, err := client.BackingServices(backingserviceapi.BSNS).Create(backingService); err != nil {
glog.Errorln("servicebroker create backingservice err ", err)
return err
}
}
} else {
newBs.Status.Phase = backingserviceapi.BackingServicePhaseActive
if _, err := client.BackingServices(backingserviceapi.BSNS).Update(newBs); err != nil {
glog.Errorln("servicebroker update backingservice err ", err)
return err
}
}
return nil
}