# 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:
```sh
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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "duplocloud-client",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10.0",
"maintainer_email": "Kelly <kelly@duplocloud.net>",
"keywords": "duplocloud, duplo, duploctl, duplo-client",
"author": null,
"author_email": "Kelly <kelly@duplocloud.net>",
"download_url": "https://files.pythonhosted.org/packages/50/66/606e341226af580b197a2a8efd9393ce5703d0dd77067c5e0dba8cde0f84/duplocloud_client-0.2.44.tar.gz",
"platform": null,
"description": "# Duplocloud Py Client\n\n[![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)\n](https://github.com/duplocloud/duploctl) [![Static Badge](https://img.shields.io/badge/Docs-lightblue?logo=github)\n](https://cli.duplocloud.com/)\n\n```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.\n\n## Installation\n\nFrom PyPi:\n\n```sh\npip install duplocloud-client\n```\n\nFrom Homebrew:\n\n```sh\nbrew install duplocloud/tap/duploctl\n```\n\n## Usage\n\nUse ```duploctl``` as a CLI or as a standalone Python module called by your custom script.\n\n### Configuration\n\nUse the following syntax for these global arguments:\n\n| Arg | Env Var | Description | Default | Required |\n| --- | ------- | ----------- | ------- | -------- |\n| --host, -H | DUPLO_HOST | The host to connect to | | Yes |\n| --token, -T | DUPLO_TOKEN | The token to use for auth | | Yes |\n| --tenant, -t | DUPLO_TENANT | The tenant to use for auth | default | No |\n\n### CLI\n\nCLI command syntax for invoking ```duploctl```\n\n```sh\nduploctl <resource> <command> <args...>\n```\n\n### Example Usages\n\nFull documentation is in the Wiki section.\n\nConfigure `duploctl` access with environment variables:\n\n```sh\nexport DUPLO_HOST=https://example.duplocloud.net\nexport DUPLO_TOKEN=AQAAA...\nexport DUPLO_TENANT=dev01\n```\n\nList the services in a tenant:\n\n```sh\nduploctl service list\n```\n\nRegister Profile for AWS:\n\n```sh\nduploctl jit update_aws_config myportal\n```\n\nOpen AWS Web Console:\n\n```sh\nduploctl jit web\n```\n\nGet Kubernetes config:\n\n```sh\nduploctl jit update_kubeconfig myinfra\n```\n\n### Python Module\n\nSpawn 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.\n\n```python\nduplo, args = DuploClient.from_env()\nt = duplo(\"tenant\", \"find\", \"mytenant\")\nprint(t)\n```\n\nSpawn a client with a custom host and token from a Python script. This example loads a resource and runs a method manually.\n\n```python\nduplo = DuploClient.from_creds(host=\"https://example.duplocloud.net\", token=\"mytoken\")\ntenants = duplo.load(\"tenant\")\nt = tenants.find(\"mytenant\")\nprint(t)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Command line Client for interacting with Duplocloud portals.",
"version": "0.2.44",
"project_urls": {
"Changelog": "https://cli.duplocloud.com/Changelog",
"Documentation": "https://cli.duplocloud.com/",
"Homepage": "https://duplocloud.com/",
"Issues": "https://github.com/duplocloud/duploctl/issues",
"LatestRelease": "https://github.com/duplocloud/duploctl/releases",
"Repository": "https://github.com/duplocloud/duploctl"
},
"split_keywords": [
"duplocloud",
" duplo",
" duploctl",
" duplo-client"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6385855fddca59402f31e0c034865439ca369ae5aac95811049e96d964d31eaf",
"md5": "9e283386e42a8ccfd2e32b2d4ad9739d",
"sha256": "c0a02516d567d051d1f7ebcbbea81c7b983b1b3cbf9f314fdd1cd984130c083f"
},
"downloads": -1,
"filename": "duplocloud_client-0.2.44-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9e283386e42a8ccfd2e32b2d4ad9739d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10.0",
"size": 61757,
"upload_time": "2025-01-22T22:12:59",
"upload_time_iso_8601": "2025-01-22T22:12:59.016021Z",
"url": "https://files.pythonhosted.org/packages/63/85/855fddca59402f31e0c034865439ca369ae5aac95811049e96d964d31eaf/duplocloud_client-0.2.44-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5066606e341226af580b197a2a8efd9393ce5703d0dd77067c5e0dba8cde0f84",
"md5": "271a31daaabc672b16eb7aab99b6658a",
"sha256": "b97e306f9010944b386f81bf70526fd14a90769e2335f58f88cf76b5082baec2"
},
"downloads": -1,
"filename": "duplocloud_client-0.2.44.tar.gz",
"has_sig": false,
"md5_digest": "271a31daaabc672b16eb7aab99b6658a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10.0",
"size": 87886,
"upload_time": "2025-01-22T22:13:00",
"upload_time_iso_8601": "2025-01-22T22:13:00.955146Z",
"url": "https://files.pythonhosted.org/packages/50/66/606e341226af580b197a2a8efd9393ce5703d0dd77067c5e0dba8cde0f84/duplocloud_client-0.2.44.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-22 22:13:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "duplocloud",
"github_project": "duploctl",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "duplocloud-client"
}