Package: diadmin
`diadmin - SAP Data Intelligence Admin ToolsCommandline tool with Python packages that helps me to run my operation tasks for the SAP Data Intelligence Cloud instances. Most of the commands use vctl and some official RestAPIs (SAP API Data Hub) and unoffical RestAPIs.Attention: This is a private and unsupported solution. Of course I am happy to get hints on bugs and try to solve them.Pre-requisteSystem Management Command-line of SAP Data Intelligence (vctl)Download:SAP Download Center.Installationpip diadminSummaryCommandlineAll commands use a configuration yaml-file (option: --config) that at least needs the URL and the credentials of the SAP Data Intelligence system:TENANT: default
URL: https://vsystem.ingress.xxx.shoot.live.k8s-hana.ondemand.com
USER: user
PWD: pwd123Some commands need more configuration parameters. Each command comes with a help option (--help)CommandDescriptionConfig ParameterAPI typedibackupDownloads some DI artificats (operators, pipelines, dockerfiles, solutions) to local folders.-vctldidownloadDownloads the specified artifacts (operators,graphs,dockerfiles,general) to local folder. Wildcards supported.-vctldiuploadUploads the specified artifacts in the local folder to DI.-vctldiconnectionsDownloads the connections (Uploaded option open).-metadata apidimockCreates a script.py template out of operator.json and configSchema.json including a local test-script for offline development. Uses dimockapi package.--dipolicyDownloads, uploads and analyses DI policies.RESOURCE_CLASSES, COLOR_MAP, POLICY_FILTER,CLASS_THRESHOLDvctldiuserDownloads user, creates new user, deletes user, assignes policies to user ..USERLISTS, USER_ROLEvctldicatalogDownloads and uploads catalog hierarchies and dataset tags. Additionally downloads connections and container (=data source path)-metadata apidipmonitorDownloads the runtime pipeline information of user-runtime apididockerbuildStarts docker build of Dockerfile for user-private apidipipelinesbatchStarts pipelines from batch with maximum number of running pipelines.-runtime apiPackagesdimockapiCreating script templates based on operator.json and configSchema.json and a test-script for offline testing. In addtion it contains a mock_api package.metadata_apiUsing the metadata RestAPIs of SAP API Business HubutilsCollection of helper functionsvctl_cmdsPython wrapper around vctl-commandsanalysisFor analysing the policy dataDetailsdipolicyCommand line script that supports admin tasks regarding policy managment, likediupload: uploading development artifacts (operators, graphs, dockerfiles, menus, solutions)didownload: downloading development artifacts (operators, graphs, dockerfiles, menus, solutions)analyses policy dependency and producing acsv-file of policy resourcesvisualizes  policy networkexport and import policiesbuild docker images in user workspacescreating user in Data Intelligence system with defined roles/policiesmonitors pipelinescreates a custom operator script framework using config.json and operatorSchema.jsonReads policy data from SAP Data Intelligence and provides a policy network, chart and a resources.csv file for further analysis.usage: dipolicy [-h] [-c CONFIG] [-g] [-d DOWNLOAD] [-u UPLOAD] [-f FILE] [-a]

"Policy utility script for SAP Data Intelligence. Pre-requiste: vctl. "

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Specifies yaml-config file
  -g, --generate        Generates config.yaml file
  -d DOWNLOAD, --download DOWNLOAD
                        Downloads specified policy. If 'all' then all policies are download
  -u UPLOAD, --upload UPLOAD
                        Uploads new policy.
  -f FILE, --file FILE  File to analyse policy structure. If not given all policies are newly downloaded.
  -a, --analyse         Analyses the policy structure. Resource list is saved as 'resources.csv'.dipmonitorList of pipelines user has started recently. Needs a config.yaml with SAP Data Intelligence credentials:URL : 'https://vsystem.ingress.myinstance.ondemand.com'
TENANT: 'default'
USER : 'user'
PWD : 'pwd123'didownload - part of diadminDownloads SAP Data Intelligence artifactsoperatorspipelinesDockerfilesto local files systems in order to be offline modified or tested (operators) or using a local git implementation for a version control. The script as to started from the root folder of the project that has the following structure:project/operators/package/(optional) subpackage/operator/operator-files...pipelinespackage/pipeline/pipeline-file with sub-foldersdockerfilesname of dockerfileDockerfileTags.jsonIn the root folder a config.yaml file is needed. With the option--configyou can specify which config-file should be used in case e.g. you work with different user or SAP Data Intelligence instances. The basic parameters of config.yaml areURL : 'https://vsystem.ingress.myinstance.ondemand.com'
TENANT: 'default'
USER : 'user'
PWD : 'pwd123'The--helpoption describes the additional optionsddidownload --help
usage: didownload [-h] [-c CONFIG] [-i] [-n SOLUTION] [-v VERSION] [-u USER] [-g] {operators,graphs,dockerfiles,all,*,solution} artifact

Downloads operators, pipelines or solution to local from SAP Data Intelligence to local file system. Pre-requiste: vctl.

positional arguments:
  {operators,graphs,dockerfiles,all,*,solution}
                        Type of artifacts.
  artifact              Artifact name of package, graph or dockerfile or wildcard '*'. For 'all' wildcard is required.

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Specifies yaml-config file
  -i, --init            Creates a config.yaml and the necessary folders. Additionally you need to add '* *' as dummy positional arguments
  -n SOLUTION, --solution SOLUTION
                        Solution imported to vrep before artifacts downloaded.
  -v VERSION, --version VERSION
                        Version of solution. Required for option --solution
  -u USER, --user USER  SAP Data Intelligence user if different from login-user. Not applicable for solutions-download
  -g, --gitcommit       Git commit for the downloaded filesdiupload - part of diadminUploads locally stored SAP Data Intelligence artifactsoperatorspipelinesDockerfilesto an SAP Data Intelligence instance. The usage is similar todidownloadthat uses the same project structure andconfig.yamlfile.The--helpoption describes the additional optionsdiupload --help 
usage: diupload [-h] [-i] [-c CONFIG] [-r CONFLICT] [-n SOLUTION] [-s DESCRIPTION] [-v VERSION] [-u USER] [-g] {operators,graphs,dockerfiles,all,*} artifact

Uploads operators, graphs, dockerfiles and bundle to SAP Data Intelligence. Pre-requiste: vctl.

positional arguments:
  {operators,graphs,dockerfiles,all,*}
                        Type of artifacts. 'bundle'- only supports .tgz-files with differnt artifact types.
  artifact              Artifact file(tgz) or directory

optional arguments:
  -h, --help            show this help message and exit
  -i, --init            Creates a config.yaml and the necessary folders. Additionally you need to add '* *' as dummy positional arguments
  -c CONFIG, --config CONFIG
                        Specifies yaml-config file
  -r CONFLICT, --conflict CONFLICT
                        Conflict handling flag of 'vctl vrep import'
  -n SOLUTION, --solution SOLUTION
                        Solution name if uploaded artificats should be exported to solution repository as well.
  -s DESCRIPTION, --description DESCRIPTION
                        Description string for solution.
  -v VERSION, --version VERSION
                        Version of solution. Necessary if exported to solution repository.
  -u USER, --user USER  SAP Data Intelligence user if different from login-user. Not applicable for solutions-upload
  -g, --gitcommit       Git commit for the uploaded filesdimock - part of diadminBuilds a framework of a new python script for a custom operator.dimock --help
usage: dimock [-h] [-w] operatorPrepare script for offline developmentpositional arguments:
operator         Operator folderoptional arguments:
-h, --help       show this help message and exit
-w, --overwrite  Forcefully overwrite existing scriptAdditional Modules in diadmin PackagegenpwdsgenpwdGenerate password with a given length with ascii excluding ambigiuos characters
:param len_pwd: Passeword length (default 8)
:return: passwordgen_user_pwd_listGenerates a generic user-password list with a given user prefix. Used for workshops
:param num_user: Number of users (default 10)
:param len_pwd: Lenght of password (default 8)
:param prefix: User prefix (default user_
:return: dictionary (dict[user]=pwduseradminContains functions forcreating user listssychronizing local user list with SAP Data Intelligence user,Assigning and deassigning policies for user`