A Rust crate for building faster V2.16 Open Service Brokers.

Installation

Add the dependency to Cargo.toml

toml [dependencies] brokerapi = "0.1.0"

Usage:

See in /examples/osb.rs for an example of how to use the crate.

```rust use actixweb::middleware::Logger; use actixweb::{guard, web, App, HttpResponse, HttpServer}; use brokerapi::{binding, catalog, polling, service};

[actix_web::main]

async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .wrap(Logger::new(LOGDEFAULT)) .data(catalog::CatalogProvider::new(catalog::buildcatalog())) .service( web::scope("/v2") .route("/catalog", web::get().to(catalog::getcatalog)) .service( web::resource("/serviceinstances/{instanceid}") .route(web::put().to(service::putserviceinstance)) .route(web::get().to(service::getserviceinstance)) .route(web::patch().to(service::patchserviceinstance)) .route(web::delete().to(service::deleteserviceinstance)) ) .service( web::resource("/serviceinstances/{instanceid}/servicebindings/{bindingid}") .route(web::put().to(binding::putbinding)) .route(web::get().to(binding::getbinding)) .route(web::delete().to(binding::deletebinding)) ) .route( "/serviceinstances/{instanceid}/lastoperation", web::get().to(polling::getserviceinstancelastoperation), ) .route( "/serviceinstances/{instanceid}/servicebindings/{bindingid}/lastoperation", web::get().to(polling::getservicebindingstate), ), ) .defaultservice(web::route().to(|| HttpResponse::NotFound())) }) .bind("0.0.0.0:8080")? .run() .await } ```