Metadata-Version: 2.1
Name: duplocloud-client
Version: 0.2.31
Summary: Command line Client for interacting with Duplocloud portals.
Author-email: Kelly <kelly@duplocloud.net>
Maintainer-email: Kelly <kelly@duplocloud.net>
Project-URL: Homepage, https://duplocloud.com/
Project-URL: Documentation, https://cli.duplocloud.com/
Project-URL: Repository, https://github.com/duplocloud/duploctl
Project-URL: Issues, https://github.com/duplocloud/duploctl/issues
Project-URL: Changelog, https://cli.duplocloud.com/Changelog
Project-URL: LatestRelease, https://github.com/duplocloud/duploctl/releases
Keywords: duplocloud,duplo,duploctl,duplo-client
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10.0
Description-Content-Type: text/markdown
Requires-Dist: requests >=2.22.0
Requires-Dist: cachetools >=5.2.0
Requires-Dist: jmespath >=1.0.1
Requires-Dist: pyyaml >=6.0.1
Requires-Dist: jsonpatch >=1.33
Requires-Dist: pyjwt >=2.8.0
Requires-Dist: jsonpointer >=2.4
Provides-Extra: aws
Requires-Dist: boto3 >=1.34.83 ; extra == 'aws'
Provides-Extra: build
Requires-Dist: invoke ; extra == 'build'
Requires-Dist: setuptools-scm ; extra == 'build'
Requires-Dist: build ; extra == 'build'
Requires-Dist: twine ; extra == 'build'
Requires-Dist: pyinstaller ; extra == 'build'
Requires-Dist: toml ; extra == 'build'
Requires-Dist: semver ; extra == 'build'
Requires-Dist: GitPython ; extra == 'build'
Provides-Extra: docs
Requires-Dist: mkdocs ; extra == 'docs'
Requires-Dist: mkdocs-material ; extra == 'docs'
Requires-Dist: mkdocstrings[python] ; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: ruff ; extra == 'test'
Requires-Dist: pytest-black ; extra == 'test'
Requires-Dist: pytest-isort ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: pytest-dependency ; extra == 'test'
Requires-Dist: pytest-order ; extra == 'test'

# Duplocloud Py Client  

[![Unit Tests](https://github.com/duplocloud/duploctl/actions/workflows/test_unit.yml/badge.svg)](https://github.com/duplocloud/duploctl/actions/workflows/test_unit.yml) [![PyPI - Version](https://img.shields.io/pypi/v/duplocloud-client?logo=pypi)](https://pypi.org/project/duplocloud-client/) [![Docker Image Version](https://img.shields.io/docker/v/duplocloud/duploctl?sort=semver&logo=Docker&label=docker&color=blue&link=https%3A%2F%2Fhub.docker.com%2Fr%2Fduplocloud%2Fduploctl)](https://hub.docker.com/r/duplocloud/duploctl) [![GitHub Release](https://img.shields.io/github/v/release/duplocloud/duploctl?logo=github&label=Github&color=purple)
](https://github.com/duplocloud/duploctl) [![Static Badge](https://img.shields.io/badge/Docs-lightblue?logo=github)
](https://cli.duplocloud.com/)

```duploctl``` is a cli and package to work with a Duplocloud portal. It is a CLI for interacting with Duplocloud resources, such as Tenants, and is designed to work seamlessly within CLI-based CI/CD pipelines. It is a fully extensible package and can be used as both a Python module and a CLI. 

## Installation  

From PyPi:
```
pip install duplocloud-client
```

From Homebrew:  
```sh
brew install duplocloud/tap/duploctl
```

## Usage 

Use ```duploctl``` as a CLI or as a standalone Python module called by your custom script. 

### Configuration  

Use the following syntax for these global arguments:  
| Arg | Env Var | Description | Default | Required |  
| --- | --- | --- | --- | --- |  
| --host, -H | DUPLO_HOST | The host to connect to |  | Yes |  
| --token, -T | DUPLO_TOKEN | The token to use for auth |  | Yes |  
| --tenant, -t | DUPLO_TENANT | The tenant to use for auth | default | No |  

### CLI  

CLI command syntax for invoking ```duploctl``` 

```sh
duploctl <resource> <command> <args...>
```

### Example Usages

Full documentation is in the Wiki section.

Configure `duploctl` access with environment variables:
```sh
export DUPLO_HOST=https://example.duplocloud.net
export DUPLO_TOKEN=AQAAA...
export DUPLO_TENANT=dev01
```

List the services in a tenant:
```sh
duploctl service list
```

Register Profile for AWS:
```sh
duploctl jit update_aws_config myportal
```

Open AWS Web Console:
```sh
duploctl jit web
```

Get Kubernetes config:
```sh
duploctl jit update_kubeconfig myinfra
```

### Python Module

Spawn your client from a Python script using the ```DuploClient.from_env()``` method and arguments. The second return value are the unparsed arguments from the command line. This example uses the client as a callable using command like syntax.

```python
duplo, args = DuploClient.from_env()
t = duplo("tenant", "find", "mytenant")
print(t)
```

Spawn a client with a custom host and token from a Python script. This example loads a resource and runs a method manually. 

```python
duplo = DuploClient.from_creds(host="https://example.duplocloud.net", token="mytoken")
tenants = duplo.load("tenant")
t = tenants.find("mytenant")
print(t)
```

