Metadata-Version: 2.4
Name: xldeploy-py
Version: 0.0.21
Summary: The Python SDK for Digital.ai Deploy
Home-page: https://github.com/xebialabs/xldeploy-py
Author: Xebialabs
Author-email: opensource@xebialabs.com
License: MIT
Keywords: Digital.ai Deploy xldeploy sdk python xebialabs
License-File: LICENSE.txt
Requires-Dist: requests==2.31.0
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

****************
xldeploy-py
****************
Python SDK for `Digital.ai Deploy`_.

.. _Digital.ai Deploy: https://digital.ai/products/deploy/


Usage
=======

.. code:: python

    import xldeploy

    config = xldeploy.Config(protocol="http", host="localhost", port="4516", context_path="deployit", username="admin", password="admin")

    # If you are using url
    config = xldeploy.Config.initialize(url="http://localhost:4516/deployit", username="admin", password="admin")

    # If you are using proxies
    config = xldeploy.Config(protocol="http", host="localhost", port="4516", context_path="deployit", username="admin", password="admin",  proxy_host="localhost", proxy_port=8080, proxy_username="proxyUsername", proxy_password="proxyPassword")

    # If you are using PAT (Personal Access Token) authentication
    config = xldeploy.Config(protocol="http", host="localhost", port="4516", context_path="deployit", token="dpa_xxxxx", authentication_method="pat")

    # or
    config = xldeploy.Config()
    client = xldeploy.Client(config)

    # repository
    repository = client.repository
    print(repository.exists("Applications/EC2/1.0/ec2"))
    print(repository.exists("Applications/EC2/1.0/wrong"))
    ci = repository.read("Applications/EC2/1.0/ec2")
    print(ci.amiId)

    # deployment
    deployment = client.deployment
    deploymentRef = deployment.prepare_initial("Applications/NIApp/1.0", "Environments/awsEnv")
    depl = deployment.prepare_auto_deployeds(deploymentRef)
    task = deployment.create_task(depl)
    task.start()
    print(task.task_id)

    # Deployfile

    ## Apply Deployfile script.

    import re
    from os import path

    deployfile = client.deployfile
    deploy_file = open('deploy_file_path', 'rb').read()
    file_names = re.findall('upload\([\'|"](.*)[\'|"]\)', deploy_file.decode("utf-8"))
    files_to_upload = [path.abspath(path.join(path.abspath(path.join(file_path, "..")), name)) for name in file_names]

    deployfile.apply('deploy_file_path',files_to_upload)

    ## POST of multiple multipart-encoded binary files  

    Based on Python [requests](https://pypi.python.org/pypi/requests) module, see [docs](http://docs.python-requests.org/en/master/user/advanced/#advanced) 

    ## Generate Deployfile script.

    deployfile = client.deployfile
    deployfile.generate([Environments/directory1,Environments/directory1])

Installing from the PyPi repository
===================================
::

    $ pip install xldeploy-py

Installing package directly from source
=======================================
::

    $ cd xldeploy-py
    $ pip install --editable .
