Packages
ucmdb_rest.packages.Packages(server)
Initialize the service with a reference to the main level UCMDB server
Source code in ucmdb_rest\packages.py
deletePackage(package)
Delete a package from the UCMDB server.
This function makes a DELETE request to the UCMDB server to undeploy a specified package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package
|
str
|
Package to undeploy. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
A dictionary of the result of the deletePackage call: { "failedResources": [], "successResources": [ { "errorCode": { "description": "", "code": 0, "errorParametersValues": null, "parametrizedError": false }, "resourceInfo": { "subSystem": "discoveryPatterns", "subSystemDisplayName": "", "name": "KWPDisk", "extension": "xml", "path": "", "packageName": "", "packageDisplayName": "KWP", "cmdbVersion": "", "updateTime": 0, "isFactory": false, "data": null, "recalculateName": true, "absoluteName": "discoveryPatterns/KWPDisk.xml", "qualifiedName": "", "currentVersion": false, "subSystemName": "discoveryPatterns", "noVersionSet": true }, "deploySuccessful": true } ] } |
Source code in ucmdb_rest\packages.py
deployPackage(filestoupload, package_name)
Deploy a package to the UCMDB server.
This function makes a POST request to the UCMDB server to upload and deploy a specified package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filestoupload
|
bytes
|
Binary read of the file to upload. |
required |
package_name
|
str
|
Name of the package to associate with these files. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
A dictionary of the result of the deployPackage call: { "failedResources": [], "successResources": [ { "errorCode": { "description": "", "code": 0, "errorParametersValues": null, "parametrizedError": false }, "resourceInfo": { "subSystem": "discoveryPatterns", "subSystemDisplayName": "", "name": "KWPDisk", "extension": "xml", "path": "", "packageName": "", "packageDisplayName": "KWP", "cmdbVersion": "", "updateTime": 0, "isFactory": false, "data": null, "recalculateName": true, "absoluteName": "discoveryPatterns/KWPDisk.xml", "qualifiedName": "", "currentVersion": false, "subSystemName": "discoveryPatterns", "noVersionSet": true }, "deploySuccessful": true }, ... ] } |
Source code in ucmdb_rest\packages.py
exportPackage(package_name)
Export a package from the UCMDB server.
This function makes a GET request to the UCMDB server to export a specified package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_name
|
str
|
Package name to sync (zip file name). |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
Binary file to be written. |
Source code in ucmdb_rest\packages.py
filterPackage(package)
Filter a package from the UCMDB server.
This function makes a GET request to the UCMDB server to list the specified package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package
|
str
|
Package name to list (should be the displayName of the package). |
required |
Returns:
| Type | Description |
|---|---|
Response
|
A dictionary containing all information about the package name: { "collection": [ { "name": "KWP.zip", "displayName": "KWP", "lastModifiedTime": 1718134976552, "dependencies": [], "version": "2019.05", "category": "UCMDB", "description": "This package contains the information needed to discover disks and their size.", "updatedBy": "admin", "updatedVersion": 3, "buildNumber": "", "minVersion": "", "maxVersion": "", "operationErrorCode": 0, "readme": "", "undeployResources": null, "subSystems": [ "discoveryJobs", "discoveryScripts", "discoveryPatterns" ], "errorCode": 0, "hidden": false, "allResources": [ { "subSystem":"discoveryJobs", ... } ] } ] } |
Source code in ucmdb_rest\packages.py
getContentPacks()
Get the content packs from the UCMDB server.
This function makes a GET request to the UCMDB server to retrieve information about the deployed content packs.
Returns:
| Type | Description |
|---|---|
Response
|
List of content pack information: [ { "version": "23.4.198", "cpStatus": "DEPLOYED", "incompliantClasses": null, "cpDeploymentProgress": "", "cpDeploymentPercentage": "" }, { "version": "24.1.109", "cpStatus": "UPLOADED", "incompliantClasses": null, "cpDeploymentProgress": "", "cpDeploymentPercentage": "" }, { "version": "24.2.67", "cpStatus": "UPLOADED", "incompliantClasses": null, "cpDeploymentProgress": "", "cpDeploymentPercentage": "" } ] |
Source code in ucmdb_rest\packages.py
getDiffReport(cpversion)
Retrieve the difference report for a content pack version.
This function makes a GET request to the UCMDB server to retrieve the difference report for a specified content pack version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cpversion
|
str
|
Content Pack Version. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
JSON output with Difference Report if error, otherwise binary file with report. |
Source code in ucmdb_rest\packages.py
getPackage(pkg_name='A10_vthunder.zip')
Retrieves details of a specific package from the UCMDB server.
This method makes a GET request to the UCMDB server to retrieve details of the specified package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg_name
|
str
|
Name of the package to retrieve. Defaults to 'A10_vthunder.zip'. |
'A10_vthunder.zip'
|
Returns:
| Type | Description |
|---|---|
Response
|
Response object containing a JSON listing of the package details, including name, display name, version, and a list of resources it contains. |
Source code in ucmdb_rest\packages.py
getPackages()
Retrieves a list of packages from the UCMDB server.
This method makes a GET request to the UCMDB server to retrieve a list of packages.
Returns:
| Type | Description |
|---|---|
Response
|
A list containing dictionaries with details of each package: - name: str - displayName: str - lastModifiedTime: int - dependencies: list of str - version: str - category: str - description: str - updatedBy: str - updatedVersion: int - buildNumber: str - minVersion: str - maxVersion: str - operationErrorCode: int - readme: str - undeployResources: None - factory: bool - hidden: bool - errorCode: int - allResources: list of dict, each containing details of a resource: - subSystem: str - subSystemDisplayName: str - name: str - extension: str - path: str - packageName: str - packageDisplayName: str - cmdbVersion: str - updateTime: int - isFactory: bool - data: str - recalculateName: bool - absoluteName: str - qualifiedName: str - currentVersion: bool - noVersionSet: bool - subSystemName: str |
Source code in ucmdb_rest\packages.py
getProgress(package)
Retrieves the deployment or undeployment progress for a specific package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package
|
str
|
Name of the package to check. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
A JSON response indicating status (e.g., 'FINISHED', 'IN_PROGRESS') and any failed resource names. |
Source code in ucmdb_rest\packages.py
getSpecificContentPack(cpversion)
Retrieves the status and deployment percentage of a specific Content Pack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cpversion
|
str
|
The version string of the Content Pack (e.g., '24.1.109'). |
required |
Returns:
| Type | Description |
|---|---|
Response
|
JSON containing deployment status and completion percentage. { "version": "24.1.109", "cpStatus": "SIMULATED_INSTALLATION_FINISHED", "incompliantClasses": null, "cpDeploymentProgress": "FINISHED", "cpDeploymentPercentage": "100%" } |
Source code in ucmdb_rest\packages.py
uploadContentPack(filestoupload, cp_name)
Uploads a new Content Pack version to the UCMDB server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filestoupload
|
bytes
|
Binary content of the Content Pack file. |
required |
cp_name
|
str
|
The name/version to associate with the upload. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
Status of the upload process. { "name" : null, "errorCode" : { "description" : "CP was uploaded successfully", "code" : 0, "parametrizedError" : false, "errorParametersValues" : null }, "successResources" : [ ], "failedResources" : [ ], "deploySuccessful" : true, "resourcesStatus" : [ ] } |