Filter Extensibility Subscriptions in CAS
For the last couple of days, I have been playing quite a lot with Cloud Automation Services.
That means deploying a lot of VM’s, just to destroy them again.
Some time ago, I got help, from some good colleagues, to setup a Python Slack notification, using the extensibility on AWS Faas. The subscription to this, was on a single project, and on all Post Compute Provisions events.
This ment, that I have gotten A LOT of notifications, the last couple of days. And since I like notifications, when I do customer demo’s, turning them off, was not an option.
So I wanted to be able to select, when to get the notification, in a more clever way.
Disclamer : There are probably more than one way to do this, and i’m still learning, but this is how I did it :-)
One way to also do it, is described in this blog.
First I created an input parameter on the blueprint, where i ask for Notification.
notify:
_ type: string_
_ title: Notify_
_ description: Notify when deployment is finished_
_ enum:_
_ - ‘yes’_
_ - ’no’_
_ default: ‘yes’_
Under my VM’s properties (still in the blueprint), I then created the following :
notify: ‘${input.notify}’
This means, that I get a property, called notify under customProperties.
If you want to see the full blueprint, use this link to my Github repo : https://github.com/rhjensen79/cas/blob/master/blueprints/ubuntu_demo.yaml
Under Extensibility -> Subscriptions, I then edited my subscription, and selected “Filter events in topic”
There I could enter
event.data.customProperties.notify ==‘yes’
to make sure the subscription only runs, when i select yes during deployment.
The deployment now looks like this, and it works perfectly, meaning I select when I get notification :-)