cloudflare/Cloudflare-Pivotal-Cloud-Foundry
Publicmirrored fromhttps://github.com/cloudflare/Cloudflare-Pivotal-Cloud-Foundry
README.md
107lines · modecode
unknown
| 1 | # CloudFlare-Pivotal-Cloud-Foundry |
| 2 | |
| 3 | ## Usage |
| 4 | |
| 5 | Be sure you have `$GOPATH` setup. |
| 6 | |
| 7 | Set environment variables |
| 8 | ``` |
| 9 | export SECURITY_USER_NAME=username |
| 10 | export SECURITY_USER_PASSWORD=password |
| 11 | export PORT=3000 |
| 12 | ``` |
| 13 | |
| 14 | `go run main.go` runs the service on localhost. |
| 15 | `go test ./...` runs tests. |
| 16 | |
| 17 | ## Documentation |
| 18 | |
| 19 | - CF Command Line Interface Documentation https://docs.cloudfoundry.org/cf-cli/ |
| 20 | - Service Broker API Documentation https://docs.cloudfoundry.org/services/api.html |
| 21 | |
| 22 | ## Example cURL calls |
| 23 | |
| 24 | In the example the following attributes are replaced with the corresponding value. |
| 25 | |
| 26 | * username is `username` |
| 27 | * password is `password` |
| 28 | * broker-url is `localhost` |
| 29 | * port is `9000` |
| 30 | * instance_id is `1`. |
| 31 | |
| 32 | ### Service |
| 33 | ``` |
| 34 | curl -H "X-Broker-API-Version: 2.10" http://username:password@localhost:9000/v2/catalog |
| 35 | ``` |
| 36 | |
| 37 | ### Provision |
| 38 | |
| 39 | ``` |
| 40 | curl http://username:password@localhost:9000/v2/service_instances/1 -d '{ |
| 41 | "organization_guid": "org-guid-here", |
| 42 | "plan_id": "plan-guid-here", |
| 43 | "service_id": "service-guid-here", |
| 44 | "space_guid": "space-guid-here", |
| 45 | "parameters": { |
| 46 | "x-auth-key": "mykey", |
| 47 | "x-auth-email": "email@email.com" |
| 48 | } |
| 49 | }' -X PUT -H "X-Broker-API-Version: 2.10" -H "Content-Type: application/json" |
| 50 | ``` |
| 51 | |
| 52 | ### Deprovision |
| 53 | |
| 54 | ``` |
| 55 | curl 'http://username:password@localhost:9000/v2/service_instances/1?service_id=service-id-here&plan_id=plan-id-here' -X DELETE -H "X-Broker-API-Version: 2.10" |
| 56 | ``` |
| 57 | |
| 58 | ### Bind |
| 59 | |
| 60 | * Assumed binding_id as `2` |
| 61 | |
| 62 | ``` |
| 63 | curl http://username:password@localhost:9000/v2/service_instances/1/service_bindings/2 -d '{ |
| 64 | "plan_id": "plan-guid-here", |
| 65 | "service_id": "service-guid-here", |
| 66 | "app_guid": "app-guid-here", |
| 67 | "bind_resource": { |
| 68 | "app_guid": "app-guid-here" |
| 69 | }, |
| 70 | "parameters": { |
| 71 | "domain": "domain.com" |
| 72 | } |
| 73 | }' -X PUT |
| 74 | ``` |
| 75 | |
| 76 | ### Unbind |
| 77 | |
| 78 | * Assumed binding_id as `2` |
| 79 | |
| 80 | ``` |
| 81 | curl 'http://username:password@localhost:9000/v2/service_instances/1/service_bindings/2?service_id=service-id-here&plan_id=plan-id-here' -X DELETE -H "X-Broker-API-Version: 2.10" |
| 82 | ``` |
| 83 | |
| 84 | ### Last Operation (Not supported) |
| 85 | ``` |
| 86 | curl http://username:password@localhost:9000/v2/service_instances/1/last_operation |
| 87 | ``` |
| 88 | |
| 89 | |
| 90 | ### Update (Not supported) |
| 91 | |
| 92 | ``` |
| 93 | curl http://username:password@localhost:9000/v2/service_instances/1 -d '{ |
| 94 | "service_id": "service-guid-here", |
| 95 | "plan_id": "plan-guid-here", |
| 96 | "parameters": { |
| 97 | "parameter1": 1, |
| 98 | "parameter2": "value" |
| 99 | }, |
| 100 | "previous_values": { |
| 101 | "plan_id": "old-plan-guid-here", |
| 102 | "service_id": "service-guid-here", |
| 103 | "organization_id": "org-guid-here", |
| 104 | "space_id": "space-guid-here" |
| 105 | } |
| 106 | }' -X PATCH -H "X-Broker-API-Version: 2.10" -H "Content-Type: application/json" |
| 107 | ``` |