Chapter 14. More Advanced Schema Features

Our Automate examples so far have used relatively simple class schema features. We have used the attribute and method field types, and we’ve seen how to store attributes as strings or encrypted passwords. We’ve called our instances using simple URI pathnames such as /General/Methods/HelloWorld, and our instances have run single methods. This simple type of schema allows us to create many different and useful instances, but there are times when we need additional flexibility. For example, it is sometimes useful to be able to select which of several methods in our schema to run, based on criteria established at runtime.

There are three more class schema features that we can use to extend the usefulness of our instances: messages, assertions, and collections.

Messages

Each schema field has a Message column/value that we can optionally use to identify a particular field to execute or evaluate when we call the instance. We can think of this as a filter to determine which schema values to process.

The default message is create, and if we look at the schema that we created for our /ACME/General/Methods class, we see that the default message value of create was automatically set for us for all fields (see Figure 14-1).

mcla 1401
Figure 14-1. The schema of the /ACME/General/Methods class, showing the message

We specify the message when we create a relationship ...

Get Mastering CloudForms Automation now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.