In my last post What’s In It For Me I provided a step by step example that showed how I could gain peace of mind by backup an important SaaS application to GitHub on a scheduled basis.
Then I had a little fun and showed how easily you could quickly change the simple single application workflow to backup all applications for all spaces. Way to easy for Choreographers or Makers.
With one exception, that I needed to write a disclaimer about:
Heads up as you read the following Bonus and Gold Star items … you have to keep Security in mind.
So what in the world is the Security issue?
Well my friends while I am the tenant administrator for many of the tenants I have access to, even a Qlik Dork like myself isn’t the admin for all of the tenants I have access to. On those systems I’m just a normal user with mixed sets of permissions. So when I saved my magic Qlik Application Workflow as a Template and uploaded it to my other tenants to test, I was greeted with the following error message because I don’t have permissions to export all of the applications on those tenants.
Checking for Permissions
Qlik Application Automation provides all that is needed to handle this situation, but the big question is who can do it? While the first post targeted Choreographers and Makers this post is really directed towards helping Makers grow, and for Architects. Because those people on staff who won’t just be worrying all about creating workflows for themselves but will thinking about their departments and the organizations. You know … THEM.
In the list of things available under Qlik Cloud Services you will find a block called “Get App Information.” Simply place it in the loop for “List Apps.” It will ask you for the App Id you wish to use which you can simply pull from the List Apps.
The metadata for the application will contain a lot of great deal information included a list of security privileges. If you do have permissions to Download an application you will have the term “export” as one of the things in that list. Knowing that, we simply need to check for that value. So simply drag/drop a Condition block from the Basic blocks section and set the condition. Heads up: There are many conditions like equals and contains. Be sure that you choose the “list contains” from the drop down because privileges is a list.
Now you can simply move your Export App to Base 64 Encoded File and Create or Update File Content to the YES part of the flow. So that you will only attempt to export and backup the file if you have the permissions to do so.
I started by mentioning that I discovered the security problem after exporting my workflow as a template and tried it in a different template. Kind of cool 😎. Right?
Well since that’s possible I should probably be a nice guy and simply hand you the template I wrote.
I do that by right clicking anywhere in the white space of my workflow and choose “Download Workspace.”
The download is in the form of a .JSON file, that I have uploaded to a Shared repository in GitHub. https://github.com/DaltonRuer/Qlik-Application-Automations
Once you download that repository you can simply create a new automation in your tenant. Once in the workflow simply right click somewhere in the white space and choose “Upload workspace” and choose the .JSON file from wherever you placed it.
When you upload you will quickly notice that my template is different in many respects than the step by step I took you through in the first post. I’ve done that intentionally since I was building this post for OTHERS. While I have shown you how to handle the security issue, all that does is Not export and Not backup the applications you don’t have security permissions to. So I have created 2 variables that are lists so that I can keep track of those applications that are backed up, and those that are not backed up for you to use anyway you would like following the loop. In addition I have created a GitHubVariables, variable, that is an object and allows you to input all of the values you need at the top of the loop so you, others, don’t have to worry about which of many blocks in the entire workflow will need your attention.
Within my GitHub block I simply pull all of the information that is needed so you won’t need to do anything, other than, establish your connection. I didn’t really need to do this, however, it was a great way to suggest to you that if you are building a template you should consider isolating how many other things in the workflow will need attention, and to help you learn something else. In the left image you will see how I refer to different key/value pairs in my Git Hub Variables object. While they look pretty the fact is that I needed to toggle how I viewed the formulas and use JSON to directly enter the key names.
I’ve been coding for over 40 years now. One of the philosophies I’ve always held is that you can never have to many comments. Comments are what enable understandability and maintainability. So I’ve tried to demonstrate in this template how you can add comments to each and every block so that when anyone uses it, they are clear what can be removed/changed if they want to.
While you may start out in Qlik Application Automation asking yourself what’s in it for you, I hope your knowledge continues to grow and you end up asking how you can help others. Be sure to follow my YouTube channel and especially keep watching my Qlik Application Automation playlist content where I walk through in detail how to do the things I’ve discussed here in these 2 posts: https://www.youtube.com/playlist?list=PLbsWj_vdptAdAK9uL5BaZEp80ywaFehey
I also hope my template helps adds peace to your life by automating your SaaS backups. If there are other DevOps related tasks you would like to have me cover don’t hesitate to reach out to me directly with your suggestions, or via comments here: [email protected]