Skip to main content

A Python library for the Demisto SDK

Project description

Demisto SDK

PyPI version CircleCI Language grade: Python Coverage Status

The Demisto SDK library can be used to manage your Cortex XSOAR content with ease and efficiency. The library uses python 3.8+.

Usage

Installation

  1. Install - pip3 install demisto-sdk

  2. Upgrade - pip3 install --upgrade demisto-sdk

  3. Connect demisto-sdk with Cortex XSOAR server - In order that demisto-sdk and Cortex XSOAR server communicate, perfrom the following steps:

    1. Get an API key for XSOAR-server - Settings -> Integrations -> API keys -> Get your Key (copy it)

    2. Add the following parameters to your environment. You can also use a .env file, the demisto-sdk will automatically load that file.:

      export DEMISTO_BASE_URL=<http or https>://<demisto-server url or ip>:<port>
      export DEMISTO_API_KEY=<API key>
      

      for example:

      export DEMISTO_BASE_URL=http://127.0.0.1:8080
      export DEMISTO_API_KEY=XXXXXXXXXXXXXXXXXXXXXX
      

      For more configurations, check the demisto-py repository (which is used by the demisto-sdk to communicate with Cortex XSOAR).

    3. Reload your terminal before continue.


CLI usage

You can use the SDK in the CLI as follows:

demisto-sdk <command> <args>

For more information, run demisto-sdk -h. For more information on a specific command execute demisto-sdk <command> -h.

Version Check

demisto-sdk will check against the GitHub repository releases for a new version every time it runs and will issue a warning if you are not using the latest and greatest. If you wish to skip this check you can set the environment variable: DEMISTO_SDK_SKIP_VERSION_CHECK. For example:

export DEMISTO_SDK_SKIP_VERSION_CHECK=yes

Commands

Supported commands:

  1. init
  2. Validate
  3. Lint
  4. Secrets
  5. Unify
  6. Split
  7. Format
  8. Run
  9. Run-playbook
  10. Upload
  11. Download
  12. Generate-docs
  13. Generate-test-playbook
  14. Generate-outputs
  15. Update-release-notes
  16. Zip-packs
  17. openapi-codegen
  18. postman-codegen
  19. generate-integration

Customizable command configuration

You can create your own configuration for the demisto-sdk commands by creating a file named .demisto-sdk-conf within the directory from which you run the commands. This file will enable you to set a default value to the existing command flags that will take effect whenever the command is run. This can be done by entering the following structure into the file:

[command_name]
flag_name=flag_default_value

Note: Make sure to use the flag's full name and input _ instead of a - if it exists in the flag name (e.g. instead of no-docker-checks use no_docker_checks).

Here are a few examples:

  • As a user, I would like to not use the mypy linter in my environment when using the lint command. In the .demisto-sdk-conf file I'll enter:
[lint]
no_mypy=true
  • As a user, I would like to include untracked git files in my validation when running the validate command. In the .demisto-sdk-conf file I'll enter:
[validate]
include_untracked=true
  • As a user, I would like to automatically use minor version changes when running the update-release-notes command. In the .demisto-sdk-conf file I'll enter:
[update-release-notes]
update_type=minor

How to setup development environment?

Follow the guide found here to setup your demisto-sdk-dev virtual environment. The development environment is connected to the branch you are currently using in the SDK repository.

Simply activate it by running workon demisto-sdk-dev. The virtual environment can be deactivated at all times by running deactivate.


Autocomplete

Our CLI supports autocomplete for Linux/MacOS machines, you can turn this feature on by running one of the following: for zsh users run in the terminal

eval "$(_DEMISTO_SDK_COMPLETE=source_zsh demisto-sdk)"

for regular bashrc users run in the terminal

eval "$(_DEMISTO_SDK_COMPLETE=source demisto-sdk)"

License

MIT - See LICENSE for more information.


Contributions

Contributions are welcome and appreciated. For information regarding contributing, press here. For release guide, press here

Project details


Release history Release notifications | RSS feed

This version

1.6.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

demisto-sdk-1.6.3.tar.gz (4.5 MB view details)

Uploaded Source

File details

Details for the file demisto-sdk-1.6.3.tar.gz.

File metadata

  • Download URL: demisto-sdk-1.6.3.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for demisto-sdk-1.6.3.tar.gz
Algorithm Hash digest
SHA256 13ac871966fdf16b65a7c3c5cb3c720be315037f5f5e852d5519dfd6a9e566fe
MD5 57ffc58a62f6f52a9e0301fc863d2816
BLAKE2b-256 6547eff7d37288614b3f49b82da1c2662af41e6b9108278c193010a84bec695d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page