dt-cli


Namedt-cli JSON
Version 1.6.18 PyPI version JSON
download
home_pagehttps://github.com/dynatrace-oss/dt-cli
SummaryDynatrace CLI
upload_time2024-04-30 09:46:42
maintainerVagiz Duseev
docs_urlNone
authorVagiz Duseev
requires_python<4.0,>=3.8
licenseApache-2.0
keywords dynatrace cli extensions
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # dt-cli — Dynatrace developer's toolbox

Dynatrace CLI is a command line utility that assists in signing, building and uploading
extensions for Dynatrace Extension Framework 2.0.

<p>
  <a href="https://pypi.org/project/dt-cli/"><img alt="PyPI" src="https://img.shields.io/pypi/v/dt-cli?color=blue&logo=python&logoColor=white"></a>
  <a href="https://pypi.org/project/dt-cli/"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/dt-cli?logo=python&logoColor=white"></a>
  <a href="https://github.com/dynatrace-oss/dt-cli/actions/workflows/built-test-release.yml"><img alt="GitHub Workflow Status (main branch)" src="https://img.shields.io/github/actions/workflow/status/dynatrace-oss/dt-cli/test.yml?branch=main&logo=github"></a>
</p>

## Features

* Work with Extensions 2.0
  * Build and sign extensions from source
  * Generate CA certificates for development
  * Generate development certificates for extension signing
  * Validate and upload extension to Dynatrace
* *(planned) Perform various API requests from command line*

## FAQ

**What's the difference between monaco and dt-cli?**

* [Monaco](https://github.com/Dynatrace/dynatrace-configuration-as-code) is a **mon**itoring configuration **a**s **co**de solution that allows you to configure Dynatrace environment using GitOps approach. It follows a declarative approach: define what you need and the tool will ensure the correct configuration.
* `dt` command line, on the other hand, is a tool for performing imperative step-by-step configuration. You explicitly invoke commands to modify the state.

## Installation

```shell
pip install dt-cli
```

## Usage

1. *(optional) If you don't already have a developer certificate*
           
   1. Generate CA key and certificate

      ```shell
      $ dt ext genca
      CA private key passphrase []: 
      Repeat for confirmation: 
      Generating CA...

      Wrote CA private key: ./ca.key
      Wrote CA certificate: ./ca.pem
      ```

   1. Generate developer key and certificate from the CA

      ```shell
      $ dt ext generate-developer-pem --ca-crt ca.pem --ca-key ca.key -o dev.pem
      Name: Ext
      Loading CA private key ca.key
      Loading CA certificate ca.pem
      Generating developer certificate...
      Wrote developer certificate: dev.pem
      Wrote developer private key: dev.pem
      ```

1. Upload your CA certificate to the Dynatrace credential vault

   See: [Add your root certificate to the Dynatrace credential vault](https://www.dynatrace.com/support/help/extend-dynatrace/extensions20/sign-extension/#add-your-root-certificate-to-the-dynatrace-credential-vault)

1. Upload your CA certificate to OneAgent or ActiveGate hosts that will run your extension

   See: [Uplaod your root certificate to OneAgent or ActiveGate](https://docs.dynatrace.com/docs/extend-dynatrace/extensions20/sign-extension#upload)

1. Build and sign the extension

   ```shell
   $ dt ext assemble
   Building extension.zip from extension/
   Adding file: extension/dashboards/overview_dashboard.json as dashboards/overview_dashboard.json
   Adding file: extension/extension.yaml as extension.yaml
   Adding file: extension/activationSchema.json as activationSchema.json

   $ dt ext sign --key dev.pem
   Successfully signed the extension bundle at bundle.zip
   ```

1. *(optional) Validate the assembled and signed bundle with your Dynatrace tenant*

   ```shell
   $ dt ext validate bundle.zip --tenant-url https://<tenantid>.live.dynatrace.com --api-token <token>
   Extension validation successful!
   ```

1. Upload the extension to your Dynatrace tenant

   ```shell
   $ dt ext upload bundle.zip --tenant-url https://<tenantid>.live.dynatrace.com --api-token <token>
   Extension upload successful!
   ```

## Using dt-cli from your Python code

You may want to use some commands implemented by `dt-cli` directly in your Python code, e.g. to automatically sign your extension in a CI environment.
Here's an example of building an extension programatically, it assumes `dtcli` package is already installed and available in your working environment.


```python
from dtcli import building


building.build_extension(
    extension_dir_path = './extension',
    extension_zip_path = './extension.zip',
    extension_zip_sig_path = './extension.zip.sig',
    target_dir_path = './dist',
    certificate_file_path = './developer.crt',
    private_key_file_path = './developer.key',
    dev_passphrase=None,
    keep_intermediate_files=False,
)
```

## Development

See our [CONTRIBUTING](CONTRIBUTING.md) guidelines and instructions.

## Contributions

You are welcome to contribute using Pull Requests to the respective
repository. Before contributing, please read our
[Code of Conduct](https://github.com/dynatrace-oss/dt-cli/blob/main/CODE_OF_CONDUCT.md).

## License

`dt-cli` is an Open Source Project. Please see
[LICENSE](https://github.com/dynatrace-oss/dt-cli/blob/main/LICENSE) for more information.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dynatrace-oss/dt-cli",
    "name": "dt-cli",
    "maintainer": "Vagiz Duseev",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "vagiz.duseev@dynatrace.com",
    "keywords": "dynatrace, cli, extensions",
    "author": "Vagiz Duseev",
    "author_email": "vagiz.duseev@dynatrace.com",
    "download_url": "https://files.pythonhosted.org/packages/cf/c8/7ce3eeeb94787191fe1dfad7f43a4b07b0d99cb1ab8a7d0cada5bec73e3e/dt_cli-1.6.18.tar.gz",
    "platform": null,
    "description": "# dt-cli \u2014 Dynatrace developer's toolbox\n\nDynatrace CLI is a command line utility that assists in signing, building and uploading\nextensions for Dynatrace Extension Framework 2.0.\n\n<p>\n  <a href=\"https://pypi.org/project/dt-cli/\"><img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/dt-cli?color=blue&logo=python&logoColor=white\"></a>\n  <a href=\"https://pypi.org/project/dt-cli/\"><img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/dt-cli?logo=python&logoColor=white\"></a>\n  <a href=\"https://github.com/dynatrace-oss/dt-cli/actions/workflows/built-test-release.yml\"><img alt=\"GitHub Workflow Status (main branch)\" src=\"https://img.shields.io/github/actions/workflow/status/dynatrace-oss/dt-cli/test.yml?branch=main&logo=github\"></a>\n</p>\n\n## Features\n\n* Work with Extensions 2.0\n  * Build and sign extensions from source\n  * Generate CA certificates for development\n  * Generate development certificates for extension signing\n  * Validate and upload extension to Dynatrace\n* *(planned) Perform various API requests from command line*\n\n## FAQ\n\n**What's the difference between monaco and dt-cli?**\n\n* [Monaco](https://github.com/Dynatrace/dynatrace-configuration-as-code) is a **mon**itoring configuration **a**s **co**de solution that allows you to configure Dynatrace environment using GitOps approach. It follows a declarative approach: define what you need and the tool will ensure the correct configuration.\n* `dt` command line, on the other hand, is a tool for performing imperative step-by-step configuration. You explicitly invoke commands to modify the state.\n\n## Installation\n\n```shell\npip install dt-cli\n```\n\n## Usage\n\n1. *(optional) If you don't already have a developer certificate*\n           \n   1. Generate CA key and certificate\n\n      ```shell\n      $ dt ext genca\n      CA private key passphrase []: \n      Repeat for confirmation: \n      Generating CA...\n\n      Wrote CA private key: ./ca.key\n      Wrote CA certificate: ./ca.pem\n      ```\n\n   1. Generate developer key and certificate from the CA\n\n      ```shell\n      $ dt ext generate-developer-pem --ca-crt ca.pem --ca-key ca.key -o dev.pem\n      Name: Ext\n      Loading CA private key ca.key\n      Loading CA certificate ca.pem\n      Generating developer certificate...\n      Wrote developer certificate: dev.pem\n      Wrote developer private key: dev.pem\n      ```\n\n1. Upload your CA certificate to the Dynatrace credential vault\n\n   See: [Add your root certificate to the Dynatrace credential vault](https://www.dynatrace.com/support/help/extend-dynatrace/extensions20/sign-extension/#add-your-root-certificate-to-the-dynatrace-credential-vault)\n\n1. Upload your CA certificate to OneAgent or ActiveGate hosts that will run your extension\n\n   See: [Uplaod your root certificate to OneAgent or ActiveGate](https://docs.dynatrace.com/docs/extend-dynatrace/extensions20/sign-extension#upload)\n\n1. Build and sign the extension\n\n   ```shell\n   $ dt ext assemble\n   Building extension.zip from extension/\n   Adding file: extension/dashboards/overview_dashboard.json as dashboards/overview_dashboard.json\n   Adding file: extension/extension.yaml as extension.yaml\n   Adding file: extension/activationSchema.json as activationSchema.json\n\n   $ dt ext sign --key dev.pem\n   Successfully signed the extension bundle at bundle.zip\n   ```\n\n1. *(optional) Validate the assembled and signed bundle with your Dynatrace tenant*\n\n   ```shell\n   $ dt ext validate bundle.zip --tenant-url https://<tenantid>.live.dynatrace.com --api-token <token>\n   Extension validation successful!\n   ```\n\n1. Upload the extension to your Dynatrace tenant\n\n   ```shell\n   $ dt ext upload bundle.zip --tenant-url https://<tenantid>.live.dynatrace.com --api-token <token>\n   Extension upload successful!\n   ```\n\n## Using dt-cli from your Python code\n\nYou may want to use some commands implemented by `dt-cli` directly in your Python code, e.g. to automatically sign your extension in a CI environment.\nHere's an example of building an extension programatically, it assumes `dtcli` package is already installed and available in your working environment.\n\n\n```python\nfrom dtcli import building\n\n\nbuilding.build_extension(\n    extension_dir_path = './extension',\n    extension_zip_path = './extension.zip',\n    extension_zip_sig_path = './extension.zip.sig',\n    target_dir_path = './dist',\n    certificate_file_path = './developer.crt',\n    private_key_file_path = './developer.key',\n    dev_passphrase=None,\n    keep_intermediate_files=False,\n)\n```\n\n## Development\n\nSee our [CONTRIBUTING](CONTRIBUTING.md) guidelines and instructions.\n\n## Contributions\n\nYou are welcome to contribute using Pull Requests to the respective\nrepository. Before contributing, please read our\n[Code of Conduct](https://github.com/dynatrace-oss/dt-cli/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\n`dt-cli` is an Open Source Project. Please see\n[LICENSE](https://github.com/dynatrace-oss/dt-cli/blob/main/LICENSE) for more information.",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Dynatrace CLI",
    "version": "1.6.18",
    "project_urls": {
        "Documentation": "https://dt-cli.readthedocs.io",
        "Homepage": "https://github.com/dynatrace-oss/dt-cli",
        "Repository": "https://github.com/dynatrace-oss/dt-cli"
    },
    "split_keywords": [
        "dynatrace",
        " cli",
        " extensions"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d09d228f4e2e0fc3e75829faeaed3e59ef1b9d5f6a7ce4054ecb2ef05e6ce2b",
                "md5": "f14d9f77adf3098f3c9395189d7d144b",
                "sha256": "75d1175980b88c0416ec1ecec108cf0916e6244d52d7d1fd37062464457e5f3a"
            },
            "downloads": -1,
            "filename": "dt_cli-1.6.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f14d9f77adf3098f3c9395189d7d144b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 32706,
            "upload_time": "2024-04-30T09:46:41",
            "upload_time_iso_8601": "2024-04-30T09:46:41.488801Z",
            "url": "https://files.pythonhosted.org/packages/2d/09/d228f4e2e0fc3e75829faeaed3e59ef1b9d5f6a7ce4054ecb2ef05e6ce2b/dt_cli-1.6.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cfc87ce3eeeb94787191fe1dfad7f43a4b07b0d99cb1ab8a7d0cada5bec73e3e",
                "md5": "450957b007168ba50f0e461cabe8c7c8",
                "sha256": "c44788cc638a10e0925196cfe1009468a5e8f36d93fbdb53645c4ba7c12b6380"
            },
            "downloads": -1,
            "filename": "dt_cli-1.6.18.tar.gz",
            "has_sig": false,
            "md5_digest": "450957b007168ba50f0e461cabe8c7c8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 26701,
            "upload_time": "2024-04-30T09:46:42",
            "upload_time_iso_8601": "2024-04-30T09:46:42.880084Z",
            "url": "https://files.pythonhosted.org/packages/cf/c8/7ce3eeeb94787191fe1dfad7f43a4b07b0d99cb1ab8a7d0cada5bec73e3e/dt_cli-1.6.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 09:46:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dynatrace-oss",
    "github_project": "dt-cli",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "dt-cli"
}
        
Elapsed time: 0.22601s