Export & Import tasks in IICS from command line using Asset Management CLI Utility

Spread the love

1. Introduction

How do you export and Import your code from one Informatica Cloud Org to other?

The traditional way of exporting the code from IICS Org involves selecting the IICS code components manually and downloading all the code as a zip file. The exported components from one Org can be imported into another Org by selecting the downloaded zip file from Import Wizard manually.

The entire export and import process involves manual work of logging into different Orgs, selecting the components, downloading and importing the code as a zip file. There is a command line based Utility provided by Informatica which helps in automating all these activities.

You can import and export code out of an IICS Org from command line using the IICS Asset Management CLI V2 Utility. The utility is standalone meaning it can be installed and operated from any machine, not necessarily from the Secure Agent installed server.

2. Downloading the IICS Asset Management CLI V2 Utility

Access the below URL to download the IICS Asset Management CLI V2 utility:
https://github.com/InformaticaCloudApplicationIntegration/Tools/tree/master/IICS%20Asset%20Management%20CLI/v2

IICS Asset Management CLI V2 Utility download page
IICS Asset Management CLI V2 Utility download page

Download the utility based on the operating system that you use. For the demo purpose in the article we will be using the Windows version.

3. Running the IICS Asset Management CLI V2 Utility

Perform the following steps to run the utility:

  • From the command prompt, navigate to the directory where you downloaded the utility.
  • Run the required commands which we will be discussing in the further sections of the article.

4. ICS Asset Management CLI Utility Commands

You can use the following commands with the IICS Asset Management CLI V2 utility:

CommandSynopsis
IICSCommand line interface for the IICS application.
ExportExports artifacts from IICS
Export StatusGets the status of an export from IICS.
ImportImports artifacts into IICS.
Import StatusGets the status of an import into IICS.
ListLists artifacts in IICS
PublishPublishes artifacts in IICS. You can publish connections, service connectors, guides, processes, and taskflows.
Publish StatusGets the status of a publish job.
VersionPrints the application version.

5. IICS Asset Management CLI Utility Command flags

You can use the following flags with the IICS Asset Management CLI V2 utility commands which gives much more flexibility and usability:

OptionDescriptionDataType
-aartifactsstringArray
-fartifactsFilestring
-hhelp 
-mmaxWaitTimeint
-nnamestring
-ppasswordstring
-PpollingIntervalint
-rregionstring
-ssync 
-uusernamestring
-zzipFilePathstring
-vlogLevelstring
-IIDstring

-a artifacts

Defines the list of artifacts to be used. The artifacts are to be represented in a normalized form, see example below. It will be the path of the artifact from the root, followed by a period (.) character and then artifact type. The following are the list of available artifact types:

  • AI_CONNECTION (for application integration connections)
  • AI_SERVICE_CONNECTOR (for service connectors)
  • DTEMPLATE (for mappings)
  • GUIDE (for guides)
  • PROCESS (for processes)
  • PROCESS_OBJECT (for process objects)
  • MAPPLET (for mapplets)
  • MTT (for mapping tasks)
  • DSS (for synchronization tasks)
  • DRS (for replication tasks)
  • DMASK (for masking tasks)
  • FWCONFIG (for fixed width file formats)
  • VISIOTEMPLATE (for visio templates)
  • PCS (for powercenter tasks)
  • CustomSource (for saved query)
  • WORKFLOW (for linear taskflows)
  • TASKFLOW (for taskflows)
  • FOLDER (for folders)
  • PROJECT (for projects)

Examples:
Explore/MyProjectName.Project 
Explore/ProjectName/MyFolderName.Folder
Explore/ProjectName/MyMappingName.Mapping

If you want to specify multiple artifacts, use the flag multiple times (for example, -a artifact1 -a artifact2). If the path values contain spaces, you must enclose them within double quotes.

-f artifactsFile

Instead of passing each individual artifact as an argument, you can pass path and file name of the file that contains a list of artifacts to be used.

-h help

Display help for the command

-n name

Name of the request. This is used as the name of the import/export job in IICS My Import/Export Logs.

-u username

Username to login to IICS. Mandatory.

-p password

Password to login to IICS. Mandatory.

-r region

IICS region to which the org belongs. For example, us, eu, ap. Mandatory.

-z zipFilePath

Location (including name) of the zip file to create. 

-v logLevel

Log level with which the command is run. The value can be error, warn, info, or trace.

  • Trace indicates the maximum log level and all log messages will be displayed.
  • Default log level is “info”.  
  • If set to warn, both warn and error messages will be displayed.

-I ID

ID of the original request. Available only after the original request is submitted.

-s sync

Optional. Controls whether the command is blocking or non-blocking.

  • If set to true, the command will be a blocking call. The command will issue the request and wait for the action to be completed.
  • If set to false, the command will be a non-blocking call. The command will issue the request, but not wait for the action to complete. It will return the request id.
  • You can use the request id in subsequent operations such as checking the status of the request. (default true)

-P pollingInterval

Optional. Indicates how often to poll for status (in seconds). Applicable only with –sync. (default 10)

-m maxWaitTime

Optional. Indicates the maximum time (in seconds) to wait for the request to complete. Applicable only with –sync. (default 120)

6. Automate Exports from Informatica Cloud using CLI Utility

Use IICS Export command to export artifacts from Informatica Cloud.

Method-1: Passing Individual Artifacts

The syntax to export individual artifacts from IICS is as mentioned below

iics export -n <request name> -u <username> -p <password> -r <region> -a <artifact1> -a <artifact2> -z <zip file name with path>

In the example below, two mappings “m_Test_Mapping_1” and “m_Test_Mapping_2” are exported from “Default” project into a zip file as “C:\IICS_Artifacts\IICS_CLI_EXPORT.zip”. The name of the export job is mentioned as “IICS_CLI_EXPORT

The Id of the export request generated is “0JU6pDESBi6gvq3kLIm7Sn

Exporting artifacts from IICS using -a
Exporting artifacts from IICS using -a

Method-2: Passing Artifacts List in a File

The syntax to export list of artifacts by reading them from a file is as mentioned below

iics export -n <request name> -u <username> -p <password> -r <region> -f <filename with path holding artifcats list> -z <zip file name with path>

In the example below, artifacts from the file “C:\IICS_Artifacts\IICS_ArtifactsList.txt” are exported into a zip file is as “C:\IICS_Artifacts\IICS_CLI_EXPORT_LIST.zip”. The name of the export job is mentioned as “IICS_CLI_EXPORT_LIST

Exporting artifacts from IICS using -f
Exporting artifacts from IICS using -f

The artifacts details in the IICS_ArtifactsList.txt file are as below. The same can be seen from the standard output of iics export command.

Contents of Artifacts file
Contents of Artifacts file

7. Automate Imports into Informatica Cloud using CLI Utility

Use IICS Import command to import artifacts into Informatica Cloud.

The syntax to import artifacts into IICS is as mentioned below

iics import -n <request name> -u <username> -p <password> -r <region> -z <zip filename with path>

In the example below, the zip file “C:\IICS_Artifacts\IICS_CLI_EXPORT.zip” is imported into IICS org. The name of the export job is mentioned as “IICS_CLI_IMPORT

The Id of the import request generated is “5gvyjtf0s0dfJ89ESrVNg7

Importing artifacts into IICS
Importing artifacts into IICS

8. Verify Export and Import Status

The status of import and export jobs triggered from CLI utility can be verified in two different ways.

Method-1: Using CLI Utility Status commands

The output from CLI utility Export and Import commands gives the status of the request in the standard output as shown in above examples. We can also verify the Import and Export status after the job is executed using the ID of the original request.

The syntax to find the export status of a job using IICS Export command is as mentioned below

iics export status -u <username> -p <password> -r <region> -I <ID of original request>

The example below shows the export status as SUCCESSFUL for the export job with ID = 0JU6pDESBi6gvq3kLIm7Sn

Get Export Job Status
Get Export Job Status

The syntax to find the import status of a job using IICS Import command is as mentioned below

iics export status -u <username> -p <password> -r <region> -I <ID of original request>

The example below shows the import status as SUCCESSFUL for the import job with ID = 5gvyjtf0s0dfJ89ESrVNg7

Get Import Job Status
Get Import Job Status

Method-2: From IICS Web Interface

The status of the import and export jobs can also be verified by logging into Informatica Cloud Data Integration and navigating to ‘My Import/Export Logs’ from home page.

The Instance Name available in the ‘My Import/Export Logs’ is same as the name passed in the command line request using –n option.

The Start Method shows API indicating that the job is triggered using IICS REST API. (The CLI V2 Utility in turn uses the IICS REST API to perform the import and export activities)

Import Job Status in IICS
Import Job Status in IICS
Export Job Status in IICS
Export Job Status in IICS

9. List Artifacts in Informatica Cloud using CLI Utility

IICS List command lists the artifcats in IICS.

In the earlier discussed export command, the file which contains the list of all artifacts to be exported can also be created using the CLI utility using IICS List command.

Below are other flags available which can be used with IICS List command

-o outputFile

Location (including name) of the artifacts list file to create. The location can be a relative path or absolute path. If you do not specify this argument, the command prints the list of IICS artifacts to the standard output.

-q query

Specifies the queries to filter the IICS artifacts that you want to include in the artifacts list.

  • You can define multiple query parameters separated with a space character.
  • The command performs an AND operation when you define multiple query parameters.
  • You can use the following parameters to construct the query
    location: Defines where the artifact is stored in IICS. Include the project and folder name in the location.
    tag: Defines the tag associated with the asset.
    type: Defines the artifact type.
    updateTime: Defines a filter condition based on the last updated time for the artifact. 
    updated By: Defines the user name of the user account that last updated the artifact.

If your query parameters includes spaces in name of Project and/or Folder you need to enclose the parameter value in encoded double quotes, replace spaces with + and replace / with %2F. Similarly operators such as  <, <=, >, >=, and = must be replaced with URL-encoded values.

For example:

  • Query parameter “location==Project with space/Folder with space” must be replaced with “location==%22Project+with+space%2FFolder+with+space%22″ where Project with space is the Project name and Folder with space is the Folder name
  • Query parameter “updateTime>=2021-01-28T13:26:12Z” must be replaced with “updateTime%3E%3D2021-01-28T13:26:12Z”

Note: You must use two == operators between the parameter name and value. If any value contains space characters, you must enclose the parameter-value pair within double quotes.

The syntax to create a file with artifacts list using IICS List command is as mentioned below

iics list -u <username> -p <password> -r <region> -o <artifacts filename with path> -q <query> 

For example, consider below assets are present in the Default project in Data Integration.

Artifacts in IICS Default folder
Artifacts in IICS Default folder

To list all the artifacts present in the Default project, execute the below command line request.

List Artifacts passing Location parameter
List Artifacts passing Location parameter

The “Length=5” in standard output indicates that 5 components are added in the artifacts list.

The contents of the C:\IICS_Artifacts\IICS_CLI_ArtifactsList.txt file are as below

Explore/Default.Project
Explore/Default/TF_Test.TASKFLOW
Explore/Default/m_Test_Mapping_1.DTEMPLATE
Explore/Default/m_Test_Mapping_2.DTEMPLATE
Explore/Default/mct_Test.MTT

To list only mappings from Default project, execute the below command line request by adding additional query parameter.

List Artifacts passing Location and Type parameter
List Artifacts passing Location and Type parameter

The contents of the C:\IICS_Artifacts\IICS_CLI_ArtifactsList.txt file are as below

Explore/Default/m_Test_Mapping_1.DTEMPLATE
Explore/Default/m_Test_Mapping_2.DTEMPLATE


10. Bulk Publish Artifacts in Informatica Cloud using CLI Utility

The IICS Publish command publishes artifacts in IICS. You can publish connections, service connectors, guides, processes, and taskflows. After the command runs successfully, the status of the artifact changes to Published in IICS.

The Taskflows imported using the CLI utility are not auto published. Hence IICS Publish command helps in bulk publishing the taskflows from command line.

The syntax to publish taskflows by passing taskflows names in the command line request is as mentioned below

iics publish -u <username> -p <password> -r <region> -a <taskflow with path>

Example:
iics publish -u infauser_005 -p Informatica123 -r us -a Explore/Default/TF_Test.TASKFLOW

The syntax to publish taskflows by passing a filename which contains the artifacts list to be published is as mentioned below

iics publish -u <username> -p <password> -r <region> -f <artifacts filename with path>

Example:
iics publish -u infauser_005 -p Informatica123 -r us -f C:\IICS_Artifacts\IICS_CLI_ArtifactsList.txt

11. Conclusion

The entire process of collecting the list of artifacts, exporting them as a zip file, importing them into another Org and publishing them can be packaged into a script in a language of your choice depending on the platform on which you are working.

This way you need not run each of these commands individually and also you will be able to mask the Username and Password of the IICS Org used in the request.

The script might require few arguments as an input like the folder from which artifacts needs to be exported, the name of the zip file to be created, import and export job names, artifacts filename with path etc., depending on how you build it.

4 thoughts on “Export & Import tasks in IICS from command line using Asset Management CLI Utility”

Leave a Comment

Related Posts