Skip to main content

A python package for the V2 CF Service Broker API and Open Broker API

Project description

Service Broker API

A Python package for building Service Brokers.

Following CF Service Broker API and Open Service Broker API

Installation

This package is available for Python 3.5+.

pip3 install openbrokerapi

Getting started

from openbrokerapi import service_broker
from openbrokerapi.api import *
from flask import Flask

# Implement a service broker by overriding methods of ServiceBroker
class CustomServiceBroker(service_broker.ServiceBroker):
    def catalog(self) -> List[Service]:
        pass

    def provision(self, instance_id: str, service_details: ProvisionDetails, async_allowed: bool) -> ProvisionedServiceSpec:
        pass

    def unbind(self, instance_id: str, binding_id: str, details: UnbindDetails):
        pass

    def update(self, instance_id: str, details: UpdateDetails, async_allowed: bool) -> UpdateServiceSpec:
        pass

    def bind(self, instance_id: str, binding_id: str, details: BindDetails) -> Binding:
        pass

    def deprovision(self, instance_id: str, details: DeprovisionDetails, async_allowed: bool) -> DeprovisionServiceSpec:
        pass

# Simpely start the server
serve(CustomServiceBroker(), BrokerCredentials("", ""))

# or register blueprint to your own FlaskApp instance
app = Flask(__name__)
openbroker_bp = get_blueprint(CustomServiceBroker(), BrokerCredentials("",""))
app.register_blueprint(openbroker_bp)
app.run("0.0.0.0")

Error Types

Brokerapi defines a handful of error types in errors.py for some common error cases that your service broker may encounter. Raise these from your ServiceBroker methods where appropriate, and brokerapi will do the “right thing” (™), and give Cloud Foundry an appropriate status code, as per the Service Broker API specification.

Planned

  • Support async tasks

  • Support VolumeMounts

Not Planned To Support

  • Provisioning

    • Response: 200 - If service already exists, a 409-Conflict will be returned

  • Bind

    • Response: 200 - If binding already exists, a 409-Conflict will be returned

Bugs or Issues

Please report bugs, issues or feature requests to Github Issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openbrokerapi-0.1.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file openbrokerapi-0.1.tar.gz.

File metadata

  • Download URL: openbrokerapi-0.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for openbrokerapi-0.1.tar.gz
Algorithm Hash digest
SHA256 ca7ebcde3fc77f0a4439fae6f4fc3d78c36d071b882aae5ae556e0a36983acb7
MD5 4b46dd00982bbcc9d01a2152fce8bb40
BLAKE2b-256 4f7a8c010c864aa25413500a35bf1713d1e7541bca0219b3308c5d382db92b92

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page