GithubHelp home page GithubHelp logo

osb-actions-poc's Introduction

Open Service Broker API Actions PoC

Overview

This project contains the artifacts related to the OSB Actions Proof of Concept. The goals of this poc are: *Implement an OSB server that returns a discovery_url on service instance creation. *Implement a discovery_url that returns a json of an actions swagger. *Implement a gui that utilizes the server and the actions swagger to dynamically execute said actions.

Server

The demo server is autogenerated (using go-swagger) from a swagger specification that combines the OSB spec with some sample backup & restore actions.

Pre-requisites

  • goswagger swagger code generation tool has been installed. This will enable automatic generation of files from swagger.yml file.
  • Within your workspace you have setup the standard folders expected for a GO workspace, and the GOPATH variable pointing to it.

How to build

  • cd to your go workspace's src folder.
  • git clone <crb git repo path> osb_api.

Note: You must name the destination folder osb_api as go uses folder names as package names.

  • cd to the project folder.
  • Generate required classes from swagger spec file for building.
  • swagger generate server -f combined-swagger.yaml -A osbapi.

Note: You must name the application 'osbapi' as goswagger uses it to name the packages and files, some of which cannot be modified.

  • Download and install dependencies using one of the following methods:
    • Using godeps tool:
      • Run "godep save ./..." to compile the "Godeps/Godeps.json" and generate the lists of required packages in "vendor/".
    • Using native go get command:
      • Run go get -u -f ./...
  • cd cmd/osbapi-server/
  • Run go build or go install.

How to run

  • Start the server as local standalone app ./osbapi-server --host=localhost --port=8080

Example rest calls

$ curl -X POST "http://localhost:8080/v2/service_instances/test_instance/backups" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"backup_type\": \"incremental\", \"expires\": \"12/31/2020\", \"backup_location\": \"http://s3.amazonaws.com/bucket/backup1.tar\", \"backup_location_protocol\": \"s3\", \"backup_location_credentials\": \"admin/password\", \"note\": \"Changing expiration date of this backup.\", \"compression\": \"tar\", \"encryption\": \"AES128\"}"
$ curl -X POST "http://localhost:8080/v2/service_instances/test_instance/restores" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"backup_location\": \"http://s3.amazonaws.com/bucket/backup1.tar\", \"note\": \"Had to restore from an error at 12pm EST.\"}"
$ curl -X PUT "http://localhost:8080/v2/service_instances/test_instance" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"service_id\": \"string\", \"plan_id\": \"string\", \"context\": {}, \"organization_guid\": \"string\", \"space_guid\": \"string\", \"parameters\": {}}"
$ curl -X GET "http://localhost:8080/v2/service_instances/test_instance/backups" -H "accept: application/json"
$ curl -X GET "http://localhost:8080/v2/service_instances/test_instance/backups/test_backup" -H "accept: application/json"
$ curl -X GET "http://localhost:8080/v2/service_instances/test_instance/restores" -H "accept: application/json"
$ curl -X GET "http://localhost:8080/v2/actions/swagger" -H "accept: application/json"
$ curl -X GET "http://localhost:8080/v2/actions/swagger2" -H "accept: application/json"
$ curl -X PUT "http://localhost:8080/v2/service_instances/test_instance/backups/backup_instance" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"expires\": \"12/31/2020\", \"backup_location\": \"http://s3.amazonaws.com/bucket/backup1.tar\", \"backup_location_protocol\": \"s3\", \"backup_location_credentials\": \"admin/password\", \"note\": \"Changing expiration date of this backup.\", \"compression\": \"tar\", \"encryption\": \"AES128\"}"
$ curl -X DELETE "http://localhost:8080/v2/service_instances/test_instance/backups/test_backup" -H "accept: application/json"
$ curl -X PUT "http://localhost:8080/v2/service_instances/test/pause" -H "accept: application/json"
$ curl -X PUT "http://localhost:8080/v2/service_instances/test/restart" -H "accept: application/json"
$ curl -X PUT "http://localhost:8080/v2/service_instances/test/stop" -H "accept: application/json"
$ curl -X PUT "http://localhost:8080/v2/service_instances/test/start" -H "accept: application/json"

GUI

This UI calls the demo server and mocs up some example backup & restore actions on provisioned service instances.

Pre-requisites

OSB Actions demo server up and running

How to use the UI

Open ui/index.html in your browser Enter in any "Service", "Plan", "Instance" names.

  • E.g "service1", "plan1", "instance1".

Enter in a discovery URL from the OSB server

Create some backups

  • click "createBackup" and fill in the details.

View your backups

  • click "getBackups" to get a list of backups you've created

Create some restores

  • click on "createRestore" and fill in the details

I think you get the rest...

osb-actions-poc's People

Watchers

 avatar

Forkers

nilebox

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.