vRealize Orchestrator REST Hosts and Operations for Rubrik

vRealize Orchestrator REST Hosts and Operations for Rubrik

In part one of this series, we went over some basics about what REST is and the methods involved in it. In this post, we’ll add a REST host and show you how to add some REST Operations. To begin, we need to add a REST host. In plain terms, this is simply a host that will be accepting an API call. In this case, we’re adding the Rubrik Hybrid Cloud Appliance as our REST host.

Add a REST Host

We open vRealize Orchestrator and go to the design view. From there we navigate to Library –> HTTP-REST –> Configuration –> Add a REST Host. Right click to run the workflow.

AddaRESThost

 

The workflow dialog opens and we need to enter some information about our REST host. We’ll give it a descriptive name so that we can differentiate it from all of the other REST hosts we’ll be adding with our newly acquired skills!

Next, we need to add the URL of the REST host. This is easy for rubrik since it’s just the hostname on port 443. In other cases this may be something like https://hostname/api:443 or some other resource. We are also able to change the timeout settings and whether or not to accept the certificate.

RESTHost1

 

If you’re paying close attention to the screens, you’ll notice I skipped the proxy settings because I don’t need a proxy. If you are using a proxy server, enter those settings. Next, we need to add information about the authentication. Rubrik is using Basic Authentication, but depending on the host you’re connecting to you may have a different type such as OAuth.

RESTHost2

Since we selected Basic for the authentication type, we will enter the username and a password to connect to the host. Also, notice the “Session Mode” which is set to shared session. This means that these credentials will be used for all connections regardless of who runs the workflows.

RESTHost3

Lastly, we choose whether we’re going to check to see if the SSL certificate matches the hostname. For a production server we should say “Yes” but this is a lab and we can get away with a slightly less secure connection.

RESTHost4

 

Thats the basics of adding a REST host. The REST host will have several operations tied to it which we’ll handle in the next section.

REST Operations

The REST operations listed below, map to methods that are available on the Rubrik appliance. Remember the: GET,PUT,DELETE,PATCH methods we talked about in the previous post? To add a REST operation run the “Add a REST operation” workflow.RESTOperation

The first operation that we add is a POST method to get a login token from the appliance. We’ll get to more of this in the next blog post, but for now we just add the operation. We select the “Parent host” which is the REST host that we added earlier. Next we give the Operation a descriptive name so that we’ll know what commands we’re running. Next is the Template URL which is the REST Resource. The resource that you’ll need to use can be found in the API documentation or in my case, I found it in the Swagger-UI provided by Rubrik. The Template URL for getting a login token from Rubrik is “/login”. The HTTP Method is a POST and our content type is “application/json”. Again, I found the method and content type from the Swagger-UI provided by Rubrik, buty ou may need to check the API documentation for other vendors.

RESTOp-LoginWe can run the workflow again and add any other REST operations that we might want to use. The next operation I added was a GET command on the “/vm” resource. Guess what it does? Yep, it lists the VMs.

RESTOP-GetVM

I’ve also added a PATCH method on the “/vm/{id}”  Lets take a second to look at this one. PATCH is used to modify an entry so we can safely assume I’m going to make a modification to a virtual machine. The {id} means that it requires a VM ID as part of the input. Since we only want to modify a single VM we need to ensure that we only return a single entry in the resource. A resource with “/VM” might return all the VMs whereas the “/VM/{id}” resource would only return a specific VM.

RestOP-PatchVM

 

And the last operation that we added was a GET on the /slaDomain resource. Rubrik calls their backup policies an slaDomain.

RestOP-GetSLADomain

 

Summary

We’re still doing some of the setup here and haven’t run any workflows against the Rubrik appliance yet, but we’ll be getting to that in the next post. By now though, you should know how to setup a new REST host and setup the REST operations. Remember, that you really won’t know how to use the API unless you have proper documentation or swagger or something to view the API schema. Don’t feel bad if you didn’t know that there was an “slaDomain” or other resource. You just have to look some of this up.

If you want more information about using the REST hosts, check out Nick Colyer’s blog over at SystemsGame.com for more information on how we built the Rubrik plugins. OH, and if you haven’t downloaded the plugin from Github yet, what are you waiting for? Here’s a link.

 

Leave a reply