Skip to main content

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

Project description

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

Or install the development version from github:

pip3 install git+https://github.com/eruvanos/openbrokerapi.git

Getting started

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

# 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

    def last_operation(self, instance_id: str, operation_data: str) -> LastOperation:
        pass

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

# or register blueprint to your own FlaskApp instance
app = Flask(__name__)
logger = basic_config() #  Use root logger with a basic configuration provided by openbrokerapi.log_utils
openbroker_bp = get_blueprint(CustomServiceBroker(), BrokerCredentials("",""), logger)
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 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

Release Notes

v0.2

  • improve testing

  • fix: Bind and update getting dict instead of expected objects

  • support async for provision, update and deprovision

  • Handle unexpected exception with global error_handler (responding with 500)

  • get_blueprint() now expects a logger

  • add log_utils with basic_config()

v0.1

  • initial version

  • supported operations

  • provision

  • update

  • bind

  • unbind

  • deprovision

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.2.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

openbrokerapi-0.2.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for openbrokerapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fa98832b4f1e5b896392514bef4968190b8e44e3a4e62618fd5701ac9d9f5165
MD5 ff2acdb18fa8aa9815ba5acc6c63016e
BLAKE2b-256 7f9b4ed694301f3c5f11881b74c7205c27ff1f7befbc004cc143d86ab3e58a70

See more details on using hashes here.

File details

Details for the file openbrokerapi-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openbrokerapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebeb0d5526ee87de5895f86e3c149c5e88a3badf83bcd38eb7418567ab976e08
MD5 5d9c5ef3cddba4d3fc3aeca9b41eef6c
BLAKE2b-256 5c0d92ef0d43171f6f13df51ce251d491a44b91199163fdcf65fb219a91f58c6

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