All Projects → eruvanos → openbrokerapi

eruvanos / openbrokerapi

Licence: MIT license
A python package for the V2 CF Service Broker API

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to openbrokerapi

nfs-volume-release
No description or website provided.
Stars: ✭ 17 (-46.87%)
Mutual labels:  cloudfoundry
go-cfclient
Golang client lib for Cloud Foundry
Stars: ✭ 61 (+90.63%)
Mutual labels:  cloudfoundry
antifreeze
Cloud Foundry CLI plugin to detect if an app doesn't match the manifest
Stars: ✭ 21 (-34.37%)
Mutual labels:  cloudfoundry
multiple-deployment-options
Shows how one service can be deployed to multiple deployment options
Stars: ✭ 20 (-37.5%)
Mutual labels:  cloudfoundry
cf-k8s-networking
building a cloud foundry without gorouter....
Stars: ✭ 33 (+3.13%)
Mutual labels:  cloudfoundry
bbr-pcf-pipeline-tasks
Collection of Concourse tasks for backing up a Tanzu Application Service (TAS) installation using BOSH Backup and Restore (BBR)
Stars: ✭ 39 (+21.88%)
Mutual labels:  cloudfoundry
akka-react-cloudant
A Soccer Dashboard created by scraping EPL website using Akka backend and ReactJS frontend and IBM Cloudant for object storage. IBM Cloud Foundry is used to host both frontend and backend app.
Stars: ✭ 21 (-34.37%)
Mutual labels:  cloudfoundry
cf-sample-app-spring
Introduction to Cloud Foundry app deployment and management concepts.
Stars: ✭ 30 (-6.25%)
Mutual labels:  cloudfoundry
logistics-wizard
The Logistics Wizard is an end-to-end, smart supply chain management solution that showcases how to execute hybrid cloud, microservices, and predictive data analytics in the real world.
Stars: ✭ 99 (+209.38%)
Mutual labels:  cloudfoundry
mssql-server-broker
Cloud Foundry service broker for Microsoft SQL Server
Stars: ✭ 13 (-59.37%)
Mutual labels:  cloudfoundry
go-uaa
UAA API Client Library
Stars: ✭ 14 (-56.25%)
Mutual labels:  cloudfoundry
uaa-cli
CLI for UAA written in Go
Stars: ✭ 22 (-31.25%)
Mutual labels:  cloudfoundry
paas-templates
Bosh, CFAR, CFCR and OSB services templates for use with COA (cf-ops-automation) framework
Stars: ✭ 16 (-50%)
Mutual labels:  cloudfoundry
cf-ops-automation
a collaboration framework for operating cloudfoundry and services at scale
Stars: ✭ 21 (-34.37%)
Mutual labels:  cloudfoundry
loggregator
Archived: Now bundled in https://github.com/cloudfoundry/loggregator-release
Stars: ✭ 61 (+90.63%)
Mutual labels:  cloudfoundry
cf-mysql-plugin
Cloud Foundry CLI MySQL Plugin
Stars: ✭ 35 (+9.38%)
Mutual labels:  cloudfoundry
cf-abacus
CF usage metering and aggregation
Stars: ✭ 100 (+212.5%)
Mutual labels:  cloudfoundry
cf-tools
Useful shell scripts for Cloud Foundry API v2
Stars: ✭ 22 (-31.25%)
Mutual labels:  cloudfoundry
credhub
CredHub centralizes and secures credential generation, storage, lifecycle management, and access
Stars: ✭ 203 (+534.38%)
Mutual labels:  cloudfoundry
cf-python-client
Small cloudfoundry client implemented in python
Stars: ✭ 50 (+56.25%)
Mutual labels:  cloudfoundry

Build Status Coverage Status Known Vulnerabilities PYUP

Open Broker API

A Python package for building Service Brokers supporting API version 2.13+.

Following Open Service Broker API Spec and Open Service Broker API

Check out the documentation.

To find out more about Platform Compatibility for OSBAPI versions, check out Platform Compatibility for OSBAPI

Not all features are supported with this library due to conflicting features.

Installation

This package is available for Python 3.6+.

pip3 install openbrokerapi

# including gevent as server
pip3 install openbrokerapi[gevent]

# recommended production setup
pip3 install openbrokerapi[gunicorn]

Or install the development version from github:

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

Usage

You can start with a skeleton project or just from scratch.

from typing import Union, List

import openbrokerapi
from openbrokerapi import api
from openbrokerapi.api import ServiceBroker
from openbrokerapi.catalog import ServicePlan
from openbrokerapi.service_broker import (
    Service,
    ProvisionDetails,
    ProvisionedServiceSpec,
    DeprovisionDetails,
    DeprovisionServiceSpec
)


class MyServiceBroker(ServiceBroker):
    def catalog(self) -> Union[Service, List[Service]]:
        return Service(
            id='service id',
            name='service name',
            description='service description',
            bindable=False,
            plans=[
                ServicePlan(
                    id='plan id',
                    name='plan name',
                    description='plan description',
                )
            ]
        )

    def provision(self,
                  instance_id: str,
                  details: ProvisionDetails,
                  async_allowed: bool,
                  **kwargs) -> ProvisionedServiceSpec:
        # Create service instance
        # ...

        return ProvisionedServiceSpec()

    def deprovision(self,
                    instance_id: str,
                    details: DeprovisionDetails,
                    async_allowed: bool,
                    **kwargs) -> DeprovisionServiceSpec:
        # Delete service instance
        # ...

        return DeprovisionServiceSpec(is_async=False)

print('Start server on 127.0.0.1:5000')
print('Check the catalog at:')
print('> curl 127.0.0.1:5000/v2/catalog -H "X-Broker-API-Version: 2.14"')
api.serve(MyServiceBroker(), None)

# Simply start the server
# api.serve(ExampleServiceBroker(), api.BrokerCredentials("", ""))

# or start the server without authentication
# api.serve(ExampleServiceBroker(), None)

# or start the server with multiple authentication
# api.serve(ExampleServiceBroker(), [api.BrokerCredentials("", ""), api.BrokerCredentials("", "")])

# or with multiple service brokers and multiple credentials
# api.serve_multiple([ExampleServiceBroker(), ExampleServiceBroker()], [api.BrokerCredentials("", ""), api.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_util
# openbroker_bp = api.get_blueprint(ExampleServiceBroker(), api.BrokerCredentials("", ""), logger)
# app.register_blueprint(openbroker_bp)
# app.run("0.0.0.0")

Deployment

The included api.serve function provides a server setup for local usage only.

For productive deployments use the blueprint from api.get_blueprint to setup a production ready server like Waitress or other mentioned in Flask Deployment Docs

Error Types

Openbrokerapi 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 openbrokerapi will do the "right thing" (™), and give Cloud Foundry an appropriate status code, as per the Service Broker API specification.

Bugs or Issues

Please report bugs, issues or feature requests to Github Issues

How to contribute

You want to contribute, I really appreciate!

So let us check how you can contribute:

  • Create an issue in the Github Issues. Please provide all information that you think are usefull to solve it.

  • Use the Github Issues to create a feature request, so we can discuss and find a good interface for that feature.

  • Create a Pull Request. There are some things that will make it easier to review your Pull Request:

    • Use a new branch for every Pull Request
    • Include just related commits in this branch
    • Less commits are better, one would be the best (You can squash them.)
    • Always add tests for your feature, if you are not familiar with writing tests, ask for help.
    • Hint: To update your fork with the newest changes, follow these instructions.

[ ~ Dependencies scanned by PyUp.io ~ ]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].