Bootstrap FreeKB - Broadcom API Gateway - List Policy using the Gateway Migration Utility
Broadcom API Gateway - List Policy using the Gateway Migration Utility

Updated:   |  Broadcom API Gateway articles

This assumes you are familiar with the basic usage of the Gateway Migration Utility. Following is an example of how to list every policy in an API Gateway.

/path/to/GatewayMigrationUtility.sh restman
-host apig.example.com
-port 8443
-username john.doe
-password f5VPX0yUJPg.m4BrjdgMv84UgktddJD3xA
-method GET
-path '1.0/policies'

 

Or the -argFile option can be used, to reduce the number of options that are used on the command line.

/path/to/GatewayMigrationUtility.sh restman
-argFile example.properties
-method GET
-path '1.0/policies'

 

Or, a single policy can be returned by including the policy ID.

/path/to/GatewayMigrationUtility.sh restman
-argFile example.properties
-method GET
-path '1.0/policies/ed470defe8384b2fdfcb701c3623de7a'

 

Or, you can use the -query option to return a single policy by including the name of the policy.

/path/to/GatewayMigrationUtility.sh restman
-argFile example.properties
-method GET
-path '1.0/policies'
-query 'name=myPolicy'

 

versions can be included to return each version of the policy.

/path/to/GatewayMigrationUtility.sh restman
-argFile example.properties
-method GET
-path '1.0/policies/ed470defe8384b2fdfcb701c3623de7a/versions'

 

Each version will have a unique ordinal number, such as 1 for version 1, 2 for version 2, et cetera.

<l7:ordinal>1</l7:ordinal>

 

The ordinal number can be used to return a specific version of the policy.

/path/to/GatewayMigrationUtility.sh restman
-argFile example.properties
-method GET
-path '1.0/policies/ed470defe8384b2fdfcb701c3623de7a/versions/2'

 

The -response option can be used to output the XML to a file.

/path/to/GatewayMigrationUtility.sh restman
-argFile example.properties
-method GET
-path '1.0/policies'
-response /path/to/myPolicies.xml

 

Something like this should be returned.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<l7:List xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
    <l7:Name>myPolicy</l7:Name>
    <l7:Type>POLICY</l7:Type>
    <l7:TimeStamp>2020-08-29T21:13:52.094-05:00</l7:TimeStamp>
    <l7:Link rel="self" uri="https://api.example.com:8443/restman/1.0/policies?name=myPolicy"/>
    <l7:Link rel="template" uri="https://api.example.com:8443/restman/1.0/policies/template"/>
    <l7:Item>
        <l7:Name>myPolicy</l7:Name>
        <l7:Id>ed470defe8384b2fdfcb701c3623de7a</l7:Id>
        <l7:Type>POLICY</l7:Type>
        <l7:TimeStamp>2020-08-29T21:13:52.094-05:00</l7:TimeStamp>
        <l7:Link rel="self" uri="https://api.example.com:8443/restman/1.0/policies/ed470defe8384b2fdfcb701c3623de7a"/>
        <l7:Resource>
            <l7:Policy guid="ed470defe8384b2fdfcb701c3623de7a" version="2">
                <l7:PolicyDetail folderId="0000000000000000ffffffffffffec76" guid="227afbfd-768c-4a41-a0d9-c40924be0d4c" id="ed470defe8384b2fdfcb701c3623de7a" version="2">
                    <l7:Name>myPolciy</l7:Name>
          </l7:Policy>
        </l7:Resource>
    </l7:Item>
</l7:List>

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 8f72b4 in the box below so that we can be sure you are a human.