Created
May 14, 2016 15:12
-
-
Save jhunt/e4377245e6b1710f5f5ff665103a7dfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"fmt" | |
"net/http" | |
"github.com/pivotal-cf/brokerapi" | |
"github.com/pivotal-golang/lager" | |
) | |
type VaultBroker struct{} | |
func (*VaultBroker) Services() []brokerapi.Service { | |
// Return a []brokerapi.Service here, describing your service(s) and plan(s) | |
return []brokerapi.Service{} | |
} | |
func (*VaultBroker) Provision( | |
instanceID string, | |
details brokerapi.ProvisionDetails, | |
asyncAllowed bool, | |
) (brokerapi.ProvisionedServiceSpec, error) { | |
// Provision a new instance here. If async is allowed, the broker can still | |
// chose to provision the instance synchronously. | |
return brokerapi.ProvisionedServiceSpec{}, fmt.Errorf("not implemented"); | |
} | |
func (*VaultBroker) LastOperation(instanceID string) (brokerapi.LastOperation, error) { | |
// If the broker provisions asynchronously, the Cloud Controller will poll this endpoint | |
// for the status of the provisioning operation. | |
// This also applies to deprovisioning (work in progress). | |
return brokerapi.LastOperation{}, fmt.Errorf("not implemented"); | |
} | |
func (*VaultBroker) Deprovision(instanceID string, details brokerapi.DeprovisionDetails, asyncAllowed bool) (brokerapi.IsAsync, error) { | |
// Deprovision a new instance here. If async is allowed, the broker can still | |
// chose to deprovision the instance synchronously, hence the first return value. | |
return false, fmt.Errorf("not implemented"); | |
} | |
func (*VaultBroker) Bind(instanceID, bindingID string, details brokerapi.BindDetails) (brokerapi.Binding, error) { | |
// Bind to instances here | |
// Return a binding which contains a credentials object that can be marshalled to JSON, | |
// and (optionally) a syslog drain URL. | |
return brokerapi.Binding{}, fmt.Errorf("not implemented"); | |
} | |
func (*VaultBroker) Unbind(instanceID, bindingID string, details brokerapi.UnbindDetails) error { | |
// Unbind from instances here | |
return fmt.Errorf("not implemented"); | |
} | |
func (*VaultBroker) Update(instanceID string, details brokerapi.UpdateDetails, asyncAllowed bool) (brokerapi.IsAsync, error) { | |
// Update instance here | |
return false, fmt.Errorf("not implemented"); | |
} | |
func main() { | |
http.Handle("/", brokerapi.New( | |
&VaultBroker{}, | |
lager.NewLogger("vault-broker"), | |
brokerapi.BrokerCredentials{ | |
Username: os.Getenv("BROKER_CF_USERNAME"), | |
Password: os.Getenv("BROKER_CF_PASSWORD"), | |
})) | |
http.ListenAndServe(":3000", nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment