Connection Profiles

AutomationAPI Documentation

Connection profiles are used to define access methods and security credentials for a specific application. They can be referenced by multiple jobs. To do this, you must deploy the connection profile definition before running the relevant jobs.

Note: For most types of connection profiles (except for File Transfer connection profiles), the name of the connection profile can contain only the following types of characters: uppercase letters, numbers, hyphens, and underscores. The connection profile name can contain up to 30 characters.

Arguments:

  • target_ctm : (Only when centralized is False) The Control-M/Server to which to deploy the connection profile. If there is only one Control-M/Server, that is the default

  • target_agent : (Only when centralized is False) The Control-M/Agent to which to deploy the connection profile

  • description : Description of the connection profile

  • centralized : (Available with Automation API >= 9.0.20.000) Whether to create the connection profile as a centralized connection profile that is stored in the Control-M database and is available to all Control-M/Agents

[21]:
from aapi import *

ConnectionProfileHadoop

[ ]:
# For Apache spark

cp_spark = ConnectionProfileHadoop(
    'SPARK_CONNECTION_PROFILE',
    target_agent='docker-hadoop',
    spark=ConnectionProfileHadoop.Spark(
        custom_path='/home'
    )
)


# For Apache Oozie

cp_ooze = ConnectionProfileHadoop(
    'OOZIE_CONNECTION_PROFILE',
    target_agent='docker-hadoop',
    oozie=ConnectionProfileHadoop.Oozie(
        ssl_enabled=True,
        host='hdp-centos',
        port='11000',
        extraction_rules=[
            ExtractRule(rule_name='rule1', work_flow_name='wf1',
                        work_flow_user_name='user1', folder_name='fname1', job_name='jname1'),
            ExtractRule(rule_name='rule2', work_flow_name='wf2',
                        work_flow_user_name='user2', folder_name='fname2', job_name='jname2')
        ]
    )
)


# For Apache Sqoop

cp_sqoop = ConnectionProfileHadoop(
    'SQOOP_CONNECTION_PROFILE',
    centralized=True,
    sqoop=ConnectionProfileHadoop.Sqoop(
        user='user1',
        password='mypass',
        connection_string='jdbc:mysql://mysql.server/database',
        driver_class='com.mysql.jdbc.Driver'
    )
)

# For Apache Tajo

cp_tajo = ConnectionProfileHadoop(
    'TAJO_CP',
    centralized=True,
    tajo=ConnectionProfileHadoop.Tajo(binary_path='$TAJO_HOME/bin/', database_name='myjob',
                                      master_server_name='myTajoServer', master_server_port='26001')
)


# For Apache Hive

cp_hive = ConnectionProfileHadoop('HIVE_CONNECTION_PROFILE',
                                  centralized=True,
                                  hive=ConnectionProfileHadoop.Hive(
                                      host='hivehost',
                                      port='10000',
                                      database_name='db'
                                  )
                                  )

ConnectionProfileFileTransfer

ConnectionProfileFileTransferFTP

[ ]:
ftcon = ConnectionProfileFileTransferFTP('FTPConn',
                                         target_agent='agent',
                                         target_ctm='ctmserver',
                                         host_name='FTPServer',
                                         user='FTPUser',
                                         password='ftp_pass',
                                         additional_parameters=[
                                             PackageParams('param1', '1'),
                                             PackageParams('param2', '2'),
                                         ],
                                         home_directory='/home',
                                         os_type='Unix'
                                         )

ConnectionProfileFileTransferSFTP

[ ]:
ftcon = ConnectionProfileFileTransferSFTP('SFTPConn',
                                         target_agent='agent',
                                         target_ctm='ctmserver',
                                         host_name='SFTPServer',
                                         user='SFTPUser',
                                         private_key_name='/home/key',
                                         passphrase='passphrase',
                                         ssh_compression=True,
                                         additional_parameters=[
                                             PackageParams('param1', '1'),
                                             PackageParams('param2', '2'),
                                         ],
                                         home_directory='/home',
                                         os_type='Unix'
                                         )

ConnectionProfileFileTransferFTPS

[ ]:
ftcon = ConnectionProfileFileTransferFTPS('FTPSConn',
                                         target_agent='agent',
                                         target_ctm='ctmserver',
                                         host_name='FTPServer',
                                         user='FTPUser',
                                         password='ftp_pass',
                                         ssl_implicit=True,
                                         clear_command_channel=True,
                                         clear_data_channel=True,
                                         ssl_level=ConnectionProfileFileTransferFTPS.SslLevel.ClientServerAuthentication,
                                         additional_parameters=[
                                             PackageParams('param1', '1'),
                                             PackageParams('param2', '2'),
                                         ],
                                         home_directory='/home',
                                         os_type='Unix'
                                         )

ConnectionProfileFileTransferLocal

[ ]:
ftcon = ConnectionProfileFileTransferLocal('LocalConn',
                                         target_agent='agent',
                                         target_ctm='ctmserver',
                                         password='pass',
                                         additional_parameters=[
                                             PackageParams('param1', '1'),
                                             PackageParams('param2', '2'),
                                         ],
                                         home_directory='/home',
                                         os_type='Unix'
                                         )

ConnectionProfileFileTransferS3Amazon

[ ]:
ftcon = ConnectionProfileFileTransferS3Amazon('testAmazon',
                                              centralized=True,
                                              access_key='access',
                                              secret_access_key='secretAccess',
                                              verify_destination=True,
                                              additional_parameters=[
                                                  PackageParams('param1', '1'),
                                                  PackageParams('param2', '2'),
                                              ]
                                              )

ConnectionProfileFileTransferS3Compatible

[ ]:
ftcon = ConnectionProfileFileTransferS3Compatible('testCompatible',
                                              centralized=True,
                                              access_key='access',
                                              rest_end_point='api.com',
                                              secret_access_key='secretAccess',
                                              verify_destination=True,
                                              additional_parameters=[
                                                  PackageParams('param1', '1'),
                                                  PackageParams('param2', '2'),
                                              ]
                                              )

ConnectionProfileFileTransferAS2

[ ]:
ftcon = ConnectionProfileFileTransferAS2('AS2_Conn_1',
                                         centralized=True,
                                         workload_automation_groups=['noAI'],
                                         partner_as2_id='partner',
                                         partner_destination_url='dest.com',
                                         partner_certificate_alias='alias'
                                         )

ConnectionProfileDatabase

ConnectionProfileDatabaseDB2

[ ]:
cpdb = ConnectionProfileDatabaseDB2(
    'DB2_CONNECTION_PROFILE',
    centralized=True,
    host='DB2Host',
    port='50000',
    user='user',
    password='pass',
    database_name='db2'
)

ConnectionProfileDatabaseJDBC

[ ]:
cpdb = ConnectionProfileDatabaseJDBC(
    'JDBC_CONNECTION_PROFILE',
    centralized=True,
    host='DB2Host',
    port='50000',
    user='user',
    password='pass',
    database_name='db2',
    driver='PGDRV'
)

ConnectionProfileDatabaseMSSql

[ ]:
cpdb = ConnectionProfileDatabaseMSSql(
    'MSSQL_CONNECTION_PROFILE',
    centralized=True,
    host='DB2Host',
    port='50000',
    user='user',
    password='pass',
    database_name='db2',
    database_version='2005',
    max_concurrent_connections='9',
    connection_retry_time_out='34',
    connection_idle_time='45'
)

ConnectionProfileDatabaseOracleSID

[ ]:
cpdb = ConnectionProfileDatabaseOracleSID(
    'ORACLE_CONNECTION_PROFILE',
    centralized=True,
    sid='ORCL',
    user='username',
    password='pass'
)

ConnectionProfileDatabaseOracleServiceName

[ ]:
cpdb = ConnectionProfileDatabaseOracleServiceName(
    'ORACLE_CONNECTION_PROFILE',
    centralized=True,
    service_name='ORCL',
    user='username',
    password='pass'
)

ConnectionProfileDatabaseOracleConnectionString

[ ]:
cpdb = ConnectionProfileDatabaseOracleConnectionString(
    'ORACLE_CONNECTION_PROFILE',
    centralized=True,
    connection_string='host:1521:ORCL',
    user='username',
    password='pass'
)

ConnectionProfileDatabasePostgreSql

[ ]:
cpdb = ConnectionProfileDatabasePostgreSql(
    'POSTGRESQL_CONNECTION_PROFILE',
    centralized=True,
    database_name='postgres',
    user='username',
    password='pass'
)

ConnectionProfileDatabaseSybase

[ ]:
cpdb = ConnectionProfileDatabaseSybase(
    'SYBASE_CONNECTION_PROFILE',
    centralized=True,
    database_name='postgres',
    user='username',
    password='pass'
)

ConnectionProfileSAP

[ ]:
cpsap = ConnectionProfileSAP(
    'SAPCON',
    centralized=True,
    sap_client='100',
    language='',
    xbp_version='XBP3.0',
    app_version='R3',
    application_server_logon=ConnectionProfileSAP.ApplicationServerLogon(
        host='localhost',
        system_number='12'
    ),
    secured_network_connection=ConnectionProfileSAP.SecuredNetworkConnection(
        snc_lib='',
        snc_partner_name='',
        quality_of_protection='2',
        snc_my_name=''
    ),
    sap_response_time_out='180',
    use_extended=True,
    solution_manager_connection_profile='IP4-GROUP',
    is_solution_manager_connection_profile=True

)

print(cpsap.dumps_aapi(indent=2))

ConnectionProfileInformatica

[ ]:
cpinf = ConnectionProfileInformatica('INFORMATICA_CONNECTION',
                                     centralized=True,
                                     host='INF',
                                     port='50000',
                                     user='user',
                                     password='pass',
                                     power_center_domain='domain',
                                     repository='rep',
                                     integration_service='servicename',
                                     security_domain='Native',
                                     connection_type=ConnectionProfileInformatica.ConnectionType.HTTP
                                     )

ConnectionProfileAWS

[ ]:
cpaws = ConnectionProfileAWS('AWS_CONNECTION_IAMROLE',
                             centralized=True,
                             iam_role='myrole',
                             region='ap-northeast-1',
                             proxy_settings=ConnectionProfileAWS.ProxySettings(
                                 host='host',
                                 port='12345',
                                 username='user',
                                 password='pass'
                             )
                             )

ConnectionProfileAzure

[ ]:
cpazure = ConnectionProfileAzure('AZURE_CONNECTION',
                                 centralized=True,
                                 active_directory_domain_name='domain',
                                 subscription_id='id',
                                 application_id='id',
                                 user='myuser',
                                 password='pass',
                                 batch=ConnectionProfileAzure.Batch(
                                     batch_account_name='mybatch',
                                     batch_account_key='key',
                                     location='centralus'
                                 )
                                 )