Skip to main content

A CLI way to generate and upload cloudshell orchestration scripts

Project description

Python 3.9 Lint and Test PyPI version

Cloudshell Scriptfoundry

A CLI tool to generate, package and upload cloudshell orchestration scripts. This tool is an optional add-on to the shellfoundry shell development cli tool. "Scriptfoundry" has shellfoundry as a dependency, and re-uses the same cli configuration.

Installation

pip install cloudshell-scriptfoundry

Basic Usage

Configure "Shellfoundry" Credentials (shared by "Scriptfoundry")

shellfoundry config host localhost
shellfoundry config username admin
shellfoundry config password admin

To check configured values:

shellfoundry config

See Shellfoundry Reference for more info.

Generate new project:

scriptfoundry new setup_config_firewall --template setup

Zip and upload to cloudshell:

cd setup_config_firewall
scriptfoundry update setup_config_firewall

Commands Overview

Usage: scriptfoundry [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  new      Create new script from template
  pack     Create script zip archive
  update   Create zip archive and update on CloudShell
  version  Display scriptfoundry version

Template Generation

"New" command generates script template. The templates map to the orchestration script "types" in cloudshell (setup, teardown, default, save, restore, resource).

Usage: scriptfoundry new [OPTIONS] NAME

  Create new script from template

Options:
  --template [setup|teardown|save|restore|blueprint|resource]
                                  Specify script template 'type'. Defaults to
                                  'blueprint'.  [required]

  --output TEXT                   (Optional) - Specify path to output
                                  directory. Defaults to current directory.

  --help                          Show this message and exit.

Offline Mode

Online mode will pull cookiecutter templates from github repo

To Setup up Offline mode:

  1. download templates from github release page
  2. Unzip templates and copy to designated location on client dev machine
  3. Set Shellfoundry config "online_mode" to False
  4. Add custom config key to shellfoundry config, with the templates path as value

Sample Configuration:

shellfoundry config online_mode False
shellfoundry config script_template_location "C:\cloudshell_dev_files\cloudshell-script-templates-0.1.0"

Dev Helper

It can be useful to use the api generator helper to get api session without having to add credentials to debug file. With this helper, no need to erase credentials and no accidentally commiting secrets to source control.

from scriptfoundry.utilities.api_generator import AutomationApiGenerator

SANDBOX_ID = "<DEBUG_SANDBOX_ID>"
api = AutomationApiGenerator().create_client()
sb_details = api.GetReservationDetails(SANDBOX_ID, disableCache=True).ReservationDescription

Dependencies

Scriptfoundry is built on top of shellfoundry, and its underlying open-source dependencies

License

Free Software: MIT License

Project details


Download files

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

Source Distribution

cloudshell-scriptfoundry-0.1.2.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

cloudshell_scriptfoundry-0.1.2-py3-none-any.whl (11.8 kB view hashes)

Uploaded Python 3

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