Appendix B: Advanced Features

Base64 Encoding

Using the GUI, FAST has the ability to encode template parameters as base64, which becomes part of the template output (AS3 declaration).
iRules are a common use case, however AS3 supports base64 for a wide range of objects.

In the following example, base64var will display as editable plain text but render as base64-encoded text:

contentType: application/json
definitions:
    base64var:
        type: string
        format: text
        contentEncoding: base64
        default: ZmRhZWVhZWZl # will display as plain text in the GUI
template: |
  {
    "data": {{base64var}}
  }

See also

AS3 Schema Reference for a full list of f5base64 fields.

Enumerated Type

An Enumerated Type (enum) is a list of constant values. In order for the property to be valid, it must match an item in the list of values. As it relates to BIG-IP, it is a mechanism to pull data from the BIG-IP (enumFromBigip) presenting it as an enum.

An example usage would be to create drop-down lists. The path on BIG-IP: /mgmt/tm/${enumFromBigip}?$select=fullPath

See also

BIG-IP Appendix D: Endpoint List for a list of BIG-IP endpoints.

Multiple Choice Lists

While authoring a template, it is possible to specify multiple choice list boxes for use in cases such as iRules.

../_images/iRuleList.png

Some requirements must be met, which are:

  • type must be array

  • uniqueItems must be true

  • items must have an enum

An example for generating a multi-select list box for iRules would be:

contentType: application/json
definitions:
    irules:
        type: array
        uniqueItems: true
        items:
            type: string
            enumFromBigip: ltm/rule
 template: |
   {
    "irules": {{irules::array}}
   }

Schema-driven GUI

Generating a GUI is done by passing data to a libary called JSON Editor. JSON supports formats for schema of type string.

Example of a password object.

{
  "type": "object",
  "properties": {
    "password": {
      "type": "string",
      "format": "password"
    }
  }
}

Note

If property enum is specified, type format is ignored.

Using type format: info allows for adding titles and descriptions. For example:

help_stuff:
  title: This template configures BIG-IP devices.
  description: A BIG-IP is an application proxy.
  format: info

See also

JSON Editor: format for additional information and input types.

HTTP Calls to External Resources

Some template parameters may be sourced from other places, such as external APIs or databases.

A Template.fetchHttp() method does an HTTP request for each parameter definition that has a url property returning a parameter object with the response results. The value used from a response can be altered by specifying a JSONPath query in an optional pathQuery property of the parameter definition. url can also be an object matching Node’s http.request() options object.

type: object
properties:
  url:
    description: HTTP resource to call to fetch data.
      oneOf:
        - type: string
        - type: object # looks like Node request options
  pathQuery:
    type: string
    description: JSONPath of data to be fetched, must match schema