One of the most common uses of the SoftLayer Activity Library for Citrix Workflow Studio is to obtain information about the instances that you have running on your SoftLayer account. This information may be composed of the public IP address, private IP address, username, password, transaction state, and power state of the machine.

In the last blog, I discussed how you can create a workflow to order a new Cloud Computing Instance (CCI) on SoftLayer, In this blog, we will create a workflow for retrieving information about the instance. To download the SoftLayer activity library and get started, view the setup instructions listed here. To view the full list of blogs within this blog series, refer to the bottom of this article.

First Step – Obtain the Order ID (or Instance ID) for the instance
To get the details about an instance on SoftLayer, we need to know either the Order ID or Instance ID for the instance. The way that the SoftLayer ordering process generally works is that when you order a new instance, SoftLayer returns the Order ID to allow you to keep track of it. You can then use the Order ID to get the Instance ID and other details regarding the instance.

In the previous blog, when we ordered a new instance we outputted the Order ID into a message box for us to use later. We should have written that Order ID down, or better yet, store that Order ID into a database for safe keeping. In the second step below, notice how we are using the Order ID for gathering the instance details, including the Instance ID. Once you have the Instance ID, you can use either the Order ID or Instance ID for gathering instance details from SoftLayer. If you have experience in using the SoftLayer portal, you’ll notice that when they display the list of Cloud Computing Instances (CCIs) for your account on the web page, each link contains the Instance ID for that instance. The Instance ID is required for performing other actions on the instance such as cancelling, so it’s good to keep track of the Instance ID as well.

Second Step – Create the workflow
Open the Workflow Studio Console and create a new workflow called CheckInstanceStatus. Within the Workflow Studio Designer, drag the Connect To SoftLayer, Get Instance Info, Message Box, and Disconnect From SoftLayer activities to the designer surface as shown below. The Message Box activity can be found within the Workflow Control activity library section. The other three activities are all part of the SoftLayer activity library section.

Configure the activities as noted in the table below:

Activity Configuration
Connect To SoftLayer
  • API Key – specify the API Key from your SoftLayer account
  • Username – specify your API Username from your SoftLayer account
Get Instance Info
  • Connection – select the output of the Connect to SoftLayer activity
  • Order ID – input the Order ID for your instance that was given when placing the order
Message Box
  • Message Text – select the outputs of the Get Instance Info activity as shown in the screen shot below
  • Window Title – specify a title for the message box such as Instance Info
Disconnect From SoftLayer
  • Connection – select the output of the Connect to SoftLayer activity

The purpose of inserting the Message Box activity into this sample workflow is to allow us to view the details regarding this instance from SoftLayer. In a true workflow, I would definitely recommend storing this data into a SQL Server database or persisting it to a file. The SQL Server Activity Library can be used for executing commands on a SQL database for storing this data. The key point is that this data should be retained so that it can used for displaying within your applications or performing additional actions on SoftLayer.

Third Step – Run the workflow
Run the workflow within the Designer. Ensure that it succeeds properly. A message box should be displayed containing the instance information. Note – although we are not doing it in this example, we can also obtain and display the username and password for the instance as well.

Next Steps
In the next blog we will create a workflow to cancel an instance on SoftLayer. Stay tuned!

Blogs in this series

Ed York – Architect – Worldwide Technical Readiness
Ask-the-Architect Site: http://community.citrix.com/p/product-automation#home
Follow Me on twitter: http://twitter.com/citrixedy