Virtual application pattern (deprecated)
Use the command-line interface to administer virtual application patterns.
The Application and Applications objects are deprecated. To work with virtual application patterns on the Cloud Pak System Software command-line interface, use the VirtualApplicationInstance and VirtualApplicationInstances objects. For more information, see Virtual application patterns.
Application object
An Application object represents a particular virtual application pattern that is defined in Cloud Pak System Software. Use the Application object to query and manipulate the virtual application pattern definition. Attributes of the virtual application pattern and relationships between the virtual application pattern and other resources in Cloud Pak System Software are represented as Jython attributes on the Application object. Manipulate these Jython attributes by using standard Jython mechanisms to change the corresponding data on Cloud Pak System Software. To get help for the Application object, pass it as an argument to the help() function, as shown in the following example:
>>> help(deployer.application)
Applications object
An Applications object represents the collection of virtual application patterns that are defined in Cloud Pak System Software. Objects of this type are used to create, delete, iterate over, list and search for virtual application patterns in Cloud Pak System Software. To get help for the Applications object, pass it as an argument to the help() function, as shown in the following example:
>>> help(deployer.applications)
Application attributes
- acl
- The access control list for this application pattern.
- app_id
- The identifier for the application pattern. The application pattern identifier must be unique. This value is automatically generated and cannot be changed.
- app_name
- The name of the application pattern. The name of the application pattern does not have to be unique.
- app_type
- Type of the application pattern.
- artifacts
- Artifacts of the application pattern.
- create_time
- The creation time of the application pattern.
- creator
- Creator of the application pattern.
- description
- The description of the application pattern.
- last_modified
- Time the application pattern was updated.
- last_modifier
- The last user who updated the application pattern.
Application methods
- List all applications patterns
deployer.applications
For example,
>>> deployer.applications
- Get a single application pattern by index:
deployer.applications[<index>]
For example,
>>> deployer.applications[0]
- Search for a single application with app_id
Format: deployer.applications[<app_id>][0]
Example: deployer.applications["a-f4979c44-5a4f-42c0-bbbe-26a91a5a13cc"][0]
Sample output:>>> deployer.applications.list({'name':'try1'})[0] { "access_rights": (nested object), "app_id": "a-f4979c44-5a4f-42c0-bbbe-26a91a5a13cc", "app_name": "try1", "app_type": "application", "artifacts": (nested object), "content_md5": "D3DAE053B982C86DEC80A4FFEA492812", "content_type": "application/json", "create_time": "2011-03-17T07:45:30Z", "creator": "vivien", "last_modified": "2011-03-17T07:45:32Z", "last_modifier": "vivien" }
- Search for applications with a filter(dict format)
Format: deployer.applications.list(<filter in dict format>)
Example: deployer.applications.list({'app_name':'testapp'})
Sample output:>>> deployer.applications.list({'app_name':'application'}) [{ "access_rights": (nested object), "app_id": "a-9121a3b3-bc9f-46c1-a1b4-53ce52fe087a", "app_name": "Secured JEE web application", "app_type": "application", "artifacts": (nested object), "content_md5": "9990B7128E0CC488081B092647DF1FEE", "content_type": "application/json", "create_time": "2011-03-11T18:50:39Z", "creator": "cbadmin", "last_modified": "2011-03-11T18:50:40Z", "last_modifier": "cbadmin" }, ... , { "access_rights": (nested object), "app_id": "a-f0049cf6-8f58-4da0-a4d9-f00000a08490", "app_name": "Sample JEE web application", "app_type": "application", "artifacts": (nested object), "content_md5": "024DFB5FC8679B2EDF0F21A5CB20A3F4", "content_type": "application/json", "create_time": "2011-03-11T18:50:36Z", "creator": "cbadmin", "last_modified": "2011-03-11T18:50:37Z", "last_modifier": "cbadmin" }]
- Share an application with another user
Format: deployer.applications.get(<app_id>).shareuser(<user name>,<access rights>)
Example: deployer.applications.get("a-f4979c44-5a4f-42c0-bbbe-26a91a5a13cc").shareuser("tester","F")
- Share an application with another group
Format: deployer.applications.get(<app_id>).sharegroup(<group name>,<access rights>)
Example: deployer.applications.get("a-f4979c44-5a4f-42c0-bbbe-26a91a5a13cc").sharegroup("users","F")
- Create a virtual application pattern
Format: deployer.applications.create(<a dict or a file path>, name=None)
Create an application pattern with a JSON file, a compressed file (.zip), or a dictionary (dict) object. The file type is determined by using the file extension.
If the first argument is a file path, then the second argument can be used to specify the name for the pattern. The second argument is optional.
Examples:- Use specific attributes:
>>> deployer.applications.create({'name':'demoApp'})
- Use a compressed file package or a JSON file:
>>> deployer.applications.create("C:\\sample.json")
>>> deployer.applications.create("C:\\sample.zip")
- Use specific attributes:
- Delete an application pattern
deployer.applications.delete(<app_ID>)
For example,
>>> deployer.applications.delete("a-6aa5bf17-0c1e-457c-b135-7c8d19401109")
- Update an application pattern
deployer.application.get(<app_ID>).update(<local file path>)
For example,
>>> deployer.applications.get("a-514a4175-a771-4b3f-8761-0227663d9181").update("C:\\sample.zip")
Note: Updating the application model (appmodel.json) manually is not recommended. Use the user interface instead.- Clone an application pattern from an existing application pattern
deployer.application.get(<app_ID>).clone(<app_name>, <app_type>)
app_type is an optional parameter. The default value is application.
For example,
>>> deployer.applications.get("a-7dd50b00-c74c-4c63-ab70-abd7dff7fcdf").clone("clonedTest")
- Deploy an application pattern
deployer.applications.get(<app_ID>).deploy(<depl_name>, <cloud object or env dict>, <certFile>(optional), <params>(optional))
For the second parameter, you can use a cloud object or a dictionary to describe the environment profile. The environment profile dictionary format is:{ 'environment_profile': <env_profile_obj> or <env_profile_id> 'cloud_group': <cloud_group_obj> or <cloud_group_id> 'ip_group': <ip_group_obj> or <ip_group_id> 'ip_version': 'IPv4' or 'IPv6' }
You can use ssh-keygen to generate SSH keys and save the public key in a file.
The format for <params> is:{ "node_link_id.attributeId": attributeValue, "groups":{"node_link_id.groupId": True/False} (optional) }.
You must specify "groups" if there is group definition in the plug-in metadata.
Example:deployer.applications.get(<app_id>).deploy(<depl_name>, <cloud object or env dict>, <certFile>(optional), <params>(optional))
Example:sample= deployer.applications.get('a-b62aeddb-6b43-4421-a0b6-df41b44c5407') env=deployer.environmentprofiles[0] cloud = env.clouds.keys()[0] ipgroup=env.clouds[cloud].ipgroups.keys()[0] deployOptions = {"environment_profile" : env, "cloud_group": cloud, 'ip_group': ipgroup, 'ip_version': 'IPv4' } vapp = sample.deploy('env_test', deployOptions)
- Export the virtual application pattern as a single compressed file in the local directory
The file contains the application model and archive files such as EAR or WAR files for the web application component and SQL files for the DB2® component.
Format: deployer.applications[0].download("file path")
Example:deployer.applications[3].download("C:\\temp\\sample.zip")
- List all attributes and groups
Format: deployer.applications.listConfig()
Sample output:{ "Additional archive file.external_archive": "artifacts/page.zip", "Additional archive file.extract_path": "/webapp", "Log Policy.ErrLogMaxNum": None, "Log Policy.ErrLogMaxSize": None, "Log Policy.ErrLogName": None, "Log Policy.OutLogMaxNum": None, "Log Policy.OutLogMaxSize": None, "Log Policy.OutLogName": None, "Log Policy.extraLogDirectories": "/var/log/clientlogs/", "Log Policy.logLevel": "*=info", "WASFILE_1.sharedLibraryName": None, "Web Application.archive": "artifacts/webappSampleWeb.war", "Web Application.ctx_root": "webapp", "Web Application.ifixes": None, "Web Application.ignoreFailedIfix": True, "Web Application.maxSessionCount": None, "groups": { "WASFILE_1.ShareLibrary": False } }
- List all artifacts
Format: deployer.applications.get(<app_id>).artifacts
Example: deployer.applications["a-1881c73e-cac4-4af4-ba16-639ae47befff"][0].artifacts.list()
Sample output:>>> deployer.applications.get("a-1881c73e-cac4-4af4-ba16-639ae47befff").artifacts [ { "content_type": "application/octet-stream", "last_modifier": "tester", "create_time": 1074528964, "last_modified": 1074528964, "access_rights": { "tester": "F" }, "content_md5": "64C79B6A807A13B028E5E43E950E09BD", "name": "CounterDB.sql", "creator": "tester" }, ... ]
- Get a single artifact by index
Format: deployer.applications.get(<app_id>).artifacts[<index>]
Example: deployer.applications.get("a-4f581e31-b1d1-416d-8395-1d0692515eed").artifacts[0]
Sample output:>>>deployer.applications.get("a-4f581e31-b1d1-416d-8395-1d0692515eed").artifacts[0] { "content_type": "application/octet-stream", "last_modifier": "tester", "create_time": 1074528964, "last_modified": 1074528964, "access_rights": { "tester": "F" }
- Upload an artifact file for an application
Format: deployer.applications.get(<app_id>).artifacts.upload(<local file path>)
Example: deployer.applications.get("a-4f581e31-b1d1-416d-8395-1d0692515eed").artifacts.upload("C:\\artifacts\\hello.war")
Sample output:>>> deployer.applications.get("a-4f581e31-b1d1-416d-8395-1d0692515eed").artifacts.upload("C:\\artifacts\\hello.war") >>>
- Download an artifact file of an application
Format: deployer.applications[<app_id>][0].artifacts.download(<artifact file name>, <local file path>)
Example: deployer.applications["a-4f581e31-b1d1-416d-8395-1d0692515eed"][0].artifacts.download("hello.war","D:\\hello.war")
Sample output:>>> deployer.applications["a-4f581e31-b1d1-416d-8395-1d0692515eed"][0].artifacts.download("hello.war","D:\\hello.war") >>>