Skip to content

markstgodard/routing-api-cli

 
 

Repository files navigation

Build Status

Routing API CLI

The Routing API CLI lets you list, register, and unregister routes with the Cloud Foundry Routing API.

Dependencies

The Routing API uses OAuth tokens to authenticate clients. To obtain a token from UAA an OAuth client must first be created for the API client in UAA. For instructions on registering OAuth clients, see Routing API Server Configuration.

Installation

Download Binaries

See Releases

Compile

  • Go should be installed and in the PATH

  • GOPATH should be set as described in http://golang.org/doc/code.html

  • godep installed and in the PATH

  • Build the binary, and place it in your gopath:

    go get github.com/cloudfoundry-incubator/routing-api-cli
    godep restore
    go build -o $GOPATH/bin/rtr

Usage

Each command has required arguments and route structure.

Required arguments:

--api: the routing API endpoint, e.g. http://routing-api.10.244.0.34.xip.io
--client-id: the id of the client registered with your OAuth provider with the proper authorities, e.g. routing_api_client
--client-secret: your OAuth client secret, e.g. route_secret
--oauth-url: the OAuth provider endpoint with optional port, e.g. http://uaa.10.244.0.34.xip.io

Routes are described as JSON: '[{"route":"foo.com","port":65340,"ip":"1.2.3.4","ttl":60, "route_service_url":"https://route-service.example.cf-app.com"}]'

List Routes

rtr list [args]

Register Route(s)

rtr register [args] [routes]

Unregister Route(s)

rtr unregister [args] [routes]

Subscribe to Events

rtr events [args]

Tracing Requests and Responses

By specifying the environment variable RTR_TRACE=true, rtr will output the HTTP requests and responses that it makes and receives.

export RTR_TRACE=true
rtr list [args]

Notes:

  • Route "ttl" definition is ignored for unregister.
  • CLI will appear successful when unregistering routes that do not exist.
  • The route_service_url is an optional value, and must be a HTTPS url.

###Examples

rtr list --api https://routing-api.example.com --client-id admin --client-secret admin-secret --oauth-url https://uaa.example.com

rtr register --api https://routing-api.example.com --client-id admin --client-secret admin-secret --oauth-url https://uaa.example.com '[{"route":"mynewroute.com","port":12345,"ip":"1.2.3.4","ttl":60}]'

rtr unregister --api https://routing-api.example.com --client-id admin --client-secret admin-secret --oauth-url https://uaa.example.com '[{"route":"undesiredroute.com","port":12345,"ip":"1.2.3.4"}]'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.2%
  • Shell 1.8%