cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export plugin zip using API

Export plugin zip using API

IdentityIQ plugins are persisted to the database which are accessed by sailpoint.object.PersistedFile. Chunk of a file is written to the database and accessed by sailpoint.object.FileBucket. For larger files, break them up into FileBuckets so that they can be read into and out of the database efficiently.

Sometimes it's needed to export the installed plugins from the IdentityIQ but IdentityIQ doesn't provides a user interface to export the installed plugin. However, IdentityIQ provides APIs which can be leveraged to export the installed plugin and save plugin zip file on physical drive on the server where IdentityIQ is running.


Below sample code for exporting the plugin zip:

import sailpoint.object.Plugin;
import sailpoint.object.QueryOptions;
import sailpoint.object.PersistedFile;
import sailpoint.object.Filter;
import sailpoint.object.FileBucket;
import java.nio.file.Files;
import java.io.ByteArrayOutputStream;
String byteString = "";
String pluginName = "Provide Plugin Name";
String pathToSavePluginZip = "D:/";
try{
Plugin plugin = context.getObjectByName(Plugin.class,pluginName);
if(plugin !=null){
PersistedFile persistedFile = plugin.getFile();
if(persistedFile !=null){
QueryOptions qo = new QueryOptions();
Filter filter = Filter.eq("parent", persistedFile);
qo.addFilter(filter);
qo.addOrdering("fileIndex", true);
List fileBucketList = context.getObjects(FileBucket.class, qo);
if(fileBucketList !=null && !fileBucketList.isEmpty()){
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
for (FileBucket fileBucket : fileBucketList) {
outputStream.write(fileBucket.getData() );
}
Files.write(new File(pathToSavePluginZip+pluginName+".zip").toPath(), outputStream.toByteArray());
log.debug("Plugin exported successfully.");
}else{
log.debug("FileBucket is null or empty.");
}
}else{
log.debug("PersistedFile not found.");
}
}else{
log.debug("Plugin not found.");
}
}catch(Exception e){
log.error("Error while exporting plugin : "+e.toString());
}

Labels (2)
Comments

Plugin can be exported using IIQ plugin CLI command: plugin export <pluginname>

Thanks @kalyankumar_saha. good to know.

Version history
Revision #:
6 of 6
Last update:
‎Jul 24, 2023 04:44 PM
Updated by: