Adding Your Own Cloud Connector Add-On in GoAnywhere
What is a Cloud Connector in GoAnywhere?
Cloud-Connectors are used in GA when it is required to connect to a cloud service that is currently not officially supported in GoAnywhere. Any cloud service can be accessed by GA as long as it has a documented REST API.
How to create a Cloud-Connector
To create a Cloud-Connector in GA you must first, login to the admin WUI and go to the System -> Add-ons tab:
Once on the add-ons page, you will see a list of all the custom 'Add-Ons' in the product. They can either be from the GA Marketplace or created manually in the WUI:
It is worth checking if the add-on you want to create already exists in the list shown or in the marketplace.
To create our own Add-on press the 'Create Add-on' button at the top of the page:
A pop-up will appear, fill in the form providing a name and description. Also, make sure to select 'Cloud Connector' as the type:
Once filled in, click Save.
After a modified Workflow editor will appear with two actions configured:
An Action is essentially a step in a typical project Workflow. For example, it would be common to have: upload, list and download actions when integrating with a cloud service.
We can now start by adding some variables that will need to be filled in when the connector is being used in the project workflow. Variables can be set at a global level, so they will apply to all actions configured and also at an action level as well. In this example, we are going to define two global variables, URL and SAS. To create a variable go to the service tab and drag in the 'Text Field Input Variable' task:
As you can see the variable is placed above the actions, allowing it to be used in multiple places:
This task then needs to be configured, providing a name, description and some other values:
These parameters can be configured with as much granularity as desired.
We will do the same for the SAS variable:
We will now start to configure our first Action, this will be an Upload Action.
First, let's update the name of the action to be something for meaning full:
We can now start to configure our action, first by adding any required variables that are specific to the Upload action:
Now we are ready to call the REST API that will upload the file. So drag in the "Rest Put" task from the "Web Service" tab and configure it accordingly based on the REST API documentation:
Please note that it may be required to set 'Use Chunk Encoding' to false in the connection configuration:
To add headers to your API call, right-click on the PUT API task and select the 'Add a Request Header' button. Please add as many headers as required (according to the API documentation):
Also, it is possible to pass the source file name to be used as the target file name. This saves the user in the Project Workflow from always having to hardcode the file name. As you can see in the 'Destination File Name' variable it is set to optional:
It can be used to set a different file name other than the source.
So we can get the source file name by using a set Variable brick like so:
Then we can perform an if statement to check if the destination file name is empty:
If the variable is empty then we will use the source file name in the target:
If the "destinationFileName" variable is not empty then we will use that in the target instead:
We can then set in our API call that we want to use the variable 'targetFileName' to set the name of the file:
So our Cloud-Connector is now ready to be used in a Project Workflow, make sure to click save before exiting.
Using a Cloud-Connector in a Project Workflow
Now that our Cloud-Connector has been configured let's open up a new Workflow and try to use it. You will find your new cloud-connector in the Cloud-Connector drop-down:
Drag it in like you would any other task and start to configure it. As you can see the variables we defined earlier are now configurable:
We can now use this task like we would any other task in GoAnywhere: