Fuck Off As A Service /w vCO and REST API

Consider this a Hello, World exercise for vCenter Orchestrator (vCO) and a REST API plugin.   With vulgarity.  Put the kid to bed, or drop a dollar in the curse word can because it’s about to get ugly.

There’s a web service I came across this summer called Fuck Off As A Service that is a RESTful service that will respond via plain text, JSON, or HTML based on the data you send it.   Let’s explore the most basic use case.

The first one listed is:

Image

If you format it in a web browser with the URL http://foaas.com/off/Congress/The_People   you get back:

Image

Neat huh?   So let’s do something in vCO to prove we can talk to a REST web service.   I’ll leave to to Those Better Than I to describe how to set up vCO and what not.  So I’ll jump in after the REST plugin is installed and vCO is restarted.

First, we need to add the web service as a host.

Image

We want to give it a name, and enter the URL:

Image

Since this is a totally public service we do not need any authentication:

Image

You’ll notice the green check mark indicating a successful add.   Now we need to add the operation.  Think of the operation as a specific action we are calling.

ImageT

This workflow has a few more boxes to fill in.  We need to choose the host the action will always be taken on.   We give it a name.  We form the template – this is key.  This corresponds to the API documentation of the web service we are dealing with.  Use stuff in brackets {blah} to indicate the parameters.  In this case we need to give it two names.  And a HTTP method.

Image

Save it and we should be good to go:

Image

OK now let’s see if it works.   Just to do a simple test we’re provided a pre-built workflow to invoke rest operations.  So right click and start that guy:

Image

Choose the “off” operation we were just adding:

Image

Since this is just a pre-built demo workflow it’s not properly asking for the names but it does know we have two parameters.  So enter the NAME and FROM parameters here:

EDIT: I didn’t realize spaces causes it to puke, not sure if it’s on the vCO side or the FOAAS side but put an underscore in there and you’re golden

Image

Unless we broke something along the way, we should see it run successfully as such:

Image

Now to see the output click on the Logs tab of the workflow we ran.  At the very bottom you should see:

Image

Boom.   Take that, Congress.   So this is a very simple example but shows that we do have the power to interact with a web service from within vCO.   You can do any number of things with this now.  You could make a popup error message in a VMware product contain this kind of vulgarity.    A user tries to deploy more VMs in vCD than they have quota for and you could respond with a customized message with their user name.    Vulgar awesomeness can be done.  Or at least vulgar wastes of time while you learn yourself some vCO.

Tagged , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *