
This assumes you are familiar with the basic usage of the Gateway Migration Utility and that you are using an arguments file with an encoded password to connect to your API Gateway. This also assumes you have migrated out an entity (service, policy, folder) into an XML file named foo.xml.
When you export an entity using migrateOut, the defaultAction can be NewOrExisting, NewOrUpdate, or Ignore, like this.
/path/to/GatewayMigrationUtility.sh migrateOut
-defaultAction NewOrExisting|NewOrUpdate|Ignore
. . .
The action you use will be in the XML file that is migrated out, like this.
<l7:Mapping action="NewOrExisting">
If one of these three actions does not quite fit into your needs, then you can utilize manageMappings. With manageMappings, the following actions can be used.
New | Create new entity. Fail if entity exists. |
Update | Update existing entity. Fail if entity does not exist. |
Existing | Use existing entity. Fail if entity does not exist. |
ForceNew | Create new entity, using a new ID if necessary. |
Delete | Delete an entity. Fail if entity does not exist. |
Ignore | Ignore an entity regardless if entity exists or not. The entity will not be created or updated in the target environment as part of the migrate in. |
NewOrUpdate | Create a new entity or Update an existing entity. |
NewOrExisting | Use an existing entity. Create one if entity does not exist. |
DeleteOrIgnore | Delete an entity. Ignore if it does not exist. |
For example, you could use ForceNew to create a new entity in the target.
/path/to/GatewayMigrationUtility.sh manageMappings
–bundle foo.xml
-type "SERVICE"
-action "ForceNew"
-outputFile mappings.xml
In this example, mappings.xml is updated with the new mapping action.
<l7:Mapping action="ForceNew">
Or Delete the entity in the target.
/path/to/GatewayMigrationUtility.sh manageMappings
–bundle foo.xml
-type "SERVICE"
-action "Delete"
-outputFile mappings.xml
In this example, mappings.xml is not changed. Instead, a new file (bar.xml) is created, and bar.xml contains the new mapping action.
<l7:Mapping action="Delete">
If you only want to update the action for a specific service, policy, or folder, the -srcID or -targetID option can be used.
/path/to/GatewayMigrationUtility.sh manageMappings
–bundle foo.xml
-type "SERVICE"
-action "ForceNew"
-srcID "69a0077896bf3ccf38deeab48ba4ac82"
-outputFile mappings.xml
In this example, only the lines that match the srcID in the mapping file will be updated to use the new mapping action.
<l7:Mapping action="ForceNew" srcId="69a0077896bf3ccf38deeab48ba4ac82" srcUri="https://apig.example.com:8443/restman/1.0/services/69a0077896bf3ccf38deeab48ba4ac82" type="SERVICE"/>
After updating the mapping action, you are ready to migrate in.
Did you find this article helpful?
If so, consider buying me a coffee over at