Macro API

Macro API allows the user to create an object hierarchy, which consists of a top level object and a set of objects it refers to in a recursive fashion. An example usage would be to create a VirtualService, Pool, and a set of custom profiles such as ApplicationProfile, NetworkProfile for every tenant. Instead of using multiple APIs to create the profiles, pool and the virtualservice, the user can just use one API to create the entire hierarchy of objects. This API is transactional in nature in that if there is an error in the creation of any of the objects, the entire transaction will be rolled back. User has the flexibility to refer to an existing object (eg. system profiles), or create a new object as a part of this object hierarchy. Additionally, the same API can be used to modify any of the objects.

In the following example, the MACRO API is used to create a VirtualService, Pool and associated HealthMonitor object. The VirtualService refers to existing ApplicationProfile and NetworkProfile objects.


POST /api/macro
{
    "model_name": "VirtualService",
    "data": {
        "name": "vs_orange",
        "services": [
            {
                "port": 80
            }
        ],
        "vsvip_ref_data": {
            "name": "vsvip_orange",
            "vip": [
                {
                    "ip_address": {
                        "type": "V4",
                        "addr": "1.1.1.1"
                    }
                }
            ]
        },
        "application_profile_ref": "/api/applicationprofile?name=System-Secure-HTTP",
        "pool_group_ref_data": {
            "name": "poolgroup_orange",
            "members": [
            {
                "priority_label": "20",
                "pool_ref_data": {
                    "name": "pool1_orange",
                    "servers": [
                        {
                            "ip": {
                                "type": "V4",
                                "addr": "2.2.2.2"
                            }
                        }
                    ],
                    "health_monitor_refs_data": [
                        {
                            "type": "HEALTH_MONITOR_HTTP",
                            "name": "healthmonitor_pool1_orange",
                            "http_monitor": {
                                "http_response_code": [
                                    "HTTP_2XX"
                                ]
                            }
                        }
                    ]
                }
            },
            {
                "priority_label": "10",
                "pool_ref_data": {
                    "name": "pool2_orange",
                    "servers": [
                        {
                            "ip": {
                                "type": "V4",
                                "addr": "3.3.3.3"
                            }
                        }
                    ],
                    "health_monitor_refs_data": [
                        {
                            "type": "HEALTH_MONITOR_HTTP",
                            "name": "healthmonitor_pool2_orange",
                            "http_monitor": {
                                "http_response_code": [
                                    "HTTP_2XX"
                                ]
                            }
                        }
                    ]
                }
            }
          ]
        }
    }
}

Macro API

Join Query

Join Query is useful when a full application stack is being created or modified. In this approach all related objects are created and updated in a single API.

Join Query is used to return the referred object instead of returning reference to another object. For example, instead of pool_group_ref it returns pool_group_ref_data, where data contains the top-level pool group object that this virtual service was referring to.

Example 1


GET https://{{ CONTROLLER }}/api/virtualservice?join=tenant_ref,vsvip_ref,network_profile_ref,application_profile_ref,analytics_profile_ref,pool_group_ref

Example 2:


GET https://{{ CONTROLLER }}/api/virtualservice?name.contains=appcluster&join=tenant_ref,vsvip_ref,network_profile_ref,application_profile_ref,analytics_profile_ref,pool_group_ref,pool_group_ref_data.members.pool_ref,pool_group_ref_data.members.pool_ref_data.health_monitor_refs,pool_group_ref_data.members.pool_ref_data.application_persistence_profile_ref
MACRO API

Macro API

DELETE

Macro API allows the user to create or delete an object hierarchy, which consists of a top level object and a set of objects it refers to in a recursive fashion. An example usage would be to create or delete a VirtualService, Pool, and a set of custom profiles such as ApplicationProfile, NetworkProfile for every tenant. Instead of using multiple APIs to create/delete the profiles, pool and the virtualservice, the user can just use one API to operate on the entire hierarchy of objects. This API is transactional in nature in that if there is an error for any of the objects, the entire transaction will be rolled back. During deletion, default profiles and profiles that are in use by other objects will not be deleted. Macro delete will not delete Tenant, Cloud, ServiceEngine, Network, NetworkRuntime, or VIMgr objects. During creation, user has the flexibility to refer to an existing object (eg. system profiles), or create a new object as a part of this object hierarchy. Additionally, the same API can be used to modify any of the objects using PUT.

In the following example, the MACRO API is used to create a VirtualService, Pool and associated HealthMonitor object. The VirtualService refers to existing ApplicationProfile and NetworkProfile objects.


POST /api/macro
{
    "model_name": "VirtualService",
    "data": {
        "name": "n_vs",
        "services": [
            {
                "port": 80
            }
        ],
        "vip":[
            "ip_address": {
                "type": "V4",
                "addr": "2.2.2.2"
            }
        ],
        "application_profile_ref": "/api/applicationprofile?name=n_app_http",
        "pool_ref_data": { "name": "n_pool", "servers": [ { "ip": { "type": "V4", "addr": "1.1.1.1" } } ], "health_monitor_refs_data": [ { "type": "HEALTH_MONITOR_HTTP", "name": "n_http", "http_monitor": { "http_response_code": [ { "code": "HTTP_2XX" } ] } } ] } 
    }
}

In the following example, the MACRO API is used to delete the VirtualService from the POST example above. The Pool and associated HealthMonitor object will also be deleted. The existing ApplicationProfile and NetworkProfile objects will not be deleted as they are in use by another VirtualService. The MACRO API will automatically calculate which objects to delete from the uuid of the top level object.


DELETE /api/macro
{
    "model_name": "VirtualService",
    "data": {
        "uuid": "n_vs_uuid"
    }
}