Forum Discussion

Bas_0_145548's avatar
Bas_0_145548
Icon for Nimbostratus rankNimbostratus
Dec 16, 2014

custom metadata and icontrol REST

Hi all,   We've developed an application that is able to create a load balancer using iControl REST based on "profiles". A profiles basically is a number of settings specifically designed for an a...
  • John_Gruber_432's avatar
    Dec 17, 2014

    Bas,

    Since TMOS version 11.2, metadata in the form of name/value pairs can be associated with specific objects in TMOS. One of the objects which supports metadata are LTM virtual server objects. Assuming when you say a 'Load Balancer' you are referencing a specific LTM virtual server, you can simply add a list as a 'metadata' attribute to the virtual server object in your REST calls.

    As an example, let's say we have virtual server named 'lbaas_12345' in folder 'Common' (which by-the-way, if this is multi-tenant you should be building folders per tenant for isolation). When you make the POST request to create the virtual server, include in the request body a JSON attribute that looks like this.

    "metadata": [
        {
            "name": "name1",
            "persist": "true",
            "value": "value1"
        },
        {
            "name": "name2",
            "persist": "true",
            "value": "value2"
        },
        {
            "name": "name3",
            "persist": "true",
            "value": "value3"
        }
      ]
    

    If you want to update the metadata for that virtual server, you would issue a PUT request as follows:

    PUT https://[yourbigip]/mgmt/tm/ltm/virtual/~Common~lbaas_12345

        {
        "metadata": [
            {
                "name": "name1",
                "persist": "true",
                "value": "value1"
            },
            {
                "name": "name2",
                "persist": "true",
                "value": "value2"
            },
            {
                "name": "name3",
                "persist": "true",
                "value": "value3"
            },
            {
                "name": "name4",
                "persist": "true",
                "value": "value4"
            }
        ]
      }
    

    Let me know if that's enough to get you where you need to go..

    John