// Bind an instance to a secret.
Bind an instance to a secret.
// Bind an instance to a secret .
func (sdk *SDK) Bind(namespace, bindingName, externalID, instanceName, secretName string,
	params interface{}, secrets map[string]string) (*v1beta1.ServiceBinding, error) {
	if bindingName == "" {
		bindingName = instanceName
	}
	request := &v1beta1.ServiceBinding{
		ObjectMeta: v1.ObjectMeta{
			Name:      bindingName,
			Namespace: namespace,
		},
		Spec: v1beta1.ServiceBindingSpec{
			ExternalID: externalID,
			ServiceInstanceRef: v1beta1.LocalObjectReference{
				Name: instanceName,
			},
			SecretName:     secretName,
			Parameters:     BuildParameters(params),
			ParametersFrom: BuildParametersFrom(secrets),
		},
	}
	result, err := sdk.ServiceCatalog().ServiceBindings(namespace).Create(request)
	if err != nil {
		return nil, errors.Wrap(err, "bind request failed")
	}
	return result, nil
}
func ( sdk * SDK ) Bind ( namespace , bindingName , externalID , instanceName , secretName string , params interface { } , secrets map [ string ] string ) ( * v1beta1 . ServiceBinding , error ) { if bindingName == " " { bindingName = instanceName } request := & v1beta1 . ServiceBinding { ObjectMeta : v1 . ObjectMeta { Name : bindingName , Namespace : namespace , } , Spec : v1beta1 . ServiceBindingSpec { ExternalID : externalID , ServiceInstanceRef : v1beta1 . LocalObjectReference { Name : instanceName , } , SecretName : secretName , Parameters : BuildParameters ( params ) , ParametersFrom : BuildParametersFrom ( secrets ) , } , } result , err := sdk . ServiceCatalog ( ) . ServiceBindings ( namespace ) . Create ( request ) if err != nil { return nil , errors . Wrap ( err , " " ) } return result , nil }
Bind an instance to a secret.
Bind an instance to a secret .
// Manually defaulting the name of the binding // I'm not doing the same for the secret since the API handles defaulting that value.