Skip to content

pmorie/osb-broker-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

osb-broker-lib

Build Status Go Report Card Godoc documentation

A go library for developing an Open Service Broker, using the pmorie/go-open-service-broker-client OSB client library types. This project was originally created as part of the OSB Starter Pack project.

Who should use this library?

This library is most useful if you want to build your own broker from scratch and use it in a project just the way you want. If you're looking for an opinionated quickstart to easily start iterating on a new broker you should instead check out the OSB Starter Pack.

Example: serving broker catalog

import (
    osb "github.com/pmorie/go-open-service-broker-client/v2"
    broker "github.com/pmorie/osb-broker-lib/pkg/"

    "gopkg.in/yaml.v2"
)

type MyBroker struct {
    // internal state goes here
}

func (b *MyBroker) GetCatalog(ctx *broker.RequestContext) (*osb.CatalogResponse, error) {
    response := &osb.CatalogResponse{}

    data := `
---
services:
- name: example-service
  id: 4f6e6cf6-ffdd-425f-a2c7-3c9258ad246e
  description: The example service!
  bindable: true
  metadata:
    displayName: "Example service"
    imageUrl: https://avatars2.githubusercontent.com/u/19862012?s=200&v=4
  plans:
  - name: default
    id: 86064792-7ea2-467b-af93-ac9694d96d5c
    description: The default plan for the service
    free: true
`

    err := yaml.Unmarshal([]byte(data), &response)
    if err != nil {
        return nil, err
    }

    return response, nil
}

Goals

  • Provide a simple, composable way to implement the OSB API

Current Status

Currently this library is used on the OSB Starter Pack project.