Пример #1
0
func servicebroker_load(c osclient.Interface, name string) (*ServiceBroker, error) {
	servicebroker := &ServiceBroker{}
	if sb, err := c.ServiceBrokers().Get(name); err != nil {
		return nil, err
	} else {
		servicebroker.Url = sb.Spec.Url
		servicebroker.UserName = sb.Spec.UserName
		servicebroker.Password = sb.Spec.Password
		return servicebroker, nil
	}
}
Пример #2
0
func unloadServiceBrokerLabel(client osclient.Interface, application *api.Application, labelSelector labels.Selector) error {
	resourceList, _ := client.ServiceBrokers().List(kapi.ListOptions{LabelSelector: labelSelector, FieldSelector: fields.Everything()})
	errs := []error{}
	for _, resource := range resourceList.Items {
		if !hasItem(application.Spec.Items, api.Item{Kind: "ServiceBroker", Name: resource.Name}) {
			delete(resource.Labels, fmt.Sprintf("%s.application.%s", application.Namespace, application.Name))
			if _, err := client.ServiceBrokers().Update(&resource); err != nil {
				errs = append(errs, err)
			}
		}
	}

	return nil
}